function validoFormuCompra(){
	var errores = false;
	var txtError = "";
	var nombre, mailP, telefonoP, rut, comuna, direccion, telefonoF, giro, razon;
	nombre = document.getElementById( 'nombre' ).value.replace( /\s/g, '' );
	mailP = document.getElementById( 'mailP' ).value.replace( /\s/g, '' );
	telefonoP = document.getElementById( 'telefonoP' ).value.replace( /\s/g, '' );
	rut = document.getElementById( 'rut' ).value.replace( /\s/g, '' );
	comuna = document.getElementById( 'comuna' ).value.replace( /\s/g, '' );
	direccion = document.getElementById( 'direccion' ).value.replace( /\s/g, '' );
	giro = document.getElementById( 'giro' ).value.replace( /\s/g, '' );
	razon = document.getElementById( 'razon' ).value.replace( /\s/g, '' );
	
	if( !nombre ){
		errores = true;
		txtError += "\n- Debe escribir un Nombre de Contacto";
	}
	if( !telefonoP ){
		errores = true;
		txtError += "\n- Debe escribir un Teléfono de Contácto";
	}
	if( !mailP ){
		errores = true;
		txtError += "\n- Debe escribir un e-mail";
	}
	if( mailP != ''){
		if( mailP.indexOf('@') < 1 || 
			mailP.indexOf('.') < 1 || 
			mailP.indexOf('@') > mailP.length - 6 || 
			mailP.indexOf('@') != mailP.lastIndexOf('@') || 
			mailP.lastIndexOf('.') == mailP.length - 1 ||
			mailP.lastIndexOf('.') < mailP.indexOf('@') ){
				errores = true;
				txtError += "\n- Debes ingresar una cuenta de email válida";
		}
	}
	if( !razon ){
		errores = true;
		txtError += "\n- Debe escribir un nombre en Razon Social";
	}
	if( !rut ){
		errores = true;
		txtError += "\n- Debe escribir un Rut";
	}
	if( !comuna ){
		errores = true;
		txtError += "\n- Debe escribir una Comuna";
	}
	if( !direccion ){
		errores = true;
		txtError += "\n- Debe escribir una Dirección";
	}
	if( !giro ){
		errores = true;
		txtError += "\n- Debe escribir un giro";
	}
	if( errores == true ){ 
		alert( txtError ); 
		return false
	}
}
function solonumeros(e) { // 1
    tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
    patron =/[A-Za-z\s]/; // 4
    te = String.fromCharCode(tecla); // 5
    return !patron.test(te); // 6
} 
function sololetras(e) { // 1
    tecla = (document.all) ? e.keyCode : e.which; // 2
    if (tecla==8) return true; // 3
    patron =/\d/; // 4
    te = String.fromCharCode(tecla); // 5
    return !patron.test(te); // 6
}
function validoCotiza(){
	var errores = false;
	var txtError = "";
	var nombre, mailP, telefonoP;
	nombre = document.getElementById( 'nombre' ).value.replace( /\s/g, '' );
	mailP = document.getElementById( 'mailP' ).value.replace( /\s/g, '' );
	telefonoP = document.getElementById( 'telefonoP' ).value.replace( /\s/g, '' );
	
	if( !nombre ){
		errores = true;
		txtError += "\n- Debe escribir un Nombre de Contacto";
	}
	if( !telefonoP ){
		errores = true;
		txtError += "\n- Debe escribir un Teléfono de Contácto";
	}
	if( !mailP ){
		errores = true;
		txtError += "\n- Debe escribir un e-mail";
	}
	if( mailP != ''){
		if( mailP.indexOf('@') < 1 || 
			mailP.indexOf('.') < 1 || 
			mailP.indexOf('@') > mailP.length - 6 || 
			mailP.indexOf('@') != mailP.lastIndexOf('@') || 
			mailP.lastIndexOf('.') == mailP.length - 1 ||
			mailP.lastIndexOf('.') < mailP.indexOf('@') ){
				errores = true;
				txtError += "\n- Debes ingresar una cuenta de email válida";
		}
	}
	if( errores == true ){ 
		alert( txtError ); 
		return false
	}
}
function validoDemoSoporte(){
	var errores = false;
	var txtError = "";
	var nombre, mailP, telefonoP;
	nombre = document.getElementById( 'nombre' ).value.replace( /\s/g, '' );
	mailP = document.getElementById( 'email' ).value.replace( /\s/g, '' );
	telefonoP = document.getElementById( 'telefono' ).value.replace( /\s/g, '' );
	
	if( !nombre ){
		errores = true;
		txtError += "\n- Debe escribir un Nombre de Contacto";
	}
	if( !telefonoP ){
		errores = true;
		txtError += "\n- Debe escribir un Teléfono de Contácto";
	}
	if( !mailP ){
		errores = true;
		txtError += "\n- Debe escribir un e-mail";
	}
	if( mailP != ''){
		if( mailP.indexOf('@') < 1 || 
			mailP.indexOf('.') < 1 || 
			mailP.indexOf('@') > mailP.length - 6 || 
			mailP.indexOf('@') != mailP.lastIndexOf('@') || 
			mailP.lastIndexOf('.') == mailP.length - 1 ||
			mailP.lastIndexOf('.') < mailP.indexOf('@') ){
				errores = true;
				txtError += "\n- Debes ingresar una cuenta de email válida";
		}
	}
	if( errores == true ){ 
		alert( txtError ); 
		return false
	}
}
