// JavaScript Document
function zoomText(Accion,Elemento){	
	obj=document.getElementById(Elemento);
	if(obj.style.fontSize==""){obj.style.fontSize="100%";}
	actual=parseInt(obj.style.fontSize); //valor actual del tamaño del texto 
	incremento=10; // el valor del incremento o decremento en el tamaño 
	//accion sobre el texto 
	//limites
	if(actual > 140){actual=150;}
	if(actual < 85){actual=85;}	
	if(Accion=="reestablecer"){obj.style.fontSize="100%"}
	if(Accion=="aumentar"){valor=actual+incremento; obj.style.fontSize=valor+"%"}
	if(Accion=="disminuir"){valor=actual-incremento;obj.style.fontSize=valor+"%"}
} 
function validarForm(){
	var f1=document.forms[0];
	var wm = "Atención :\n\r\n";
	var noerror = 1;
	var vacios = false;
	
	var t1=f1.txt_nombre; var t2=f1.txt_email_1; var t3=f1.txt_email_2; var t4=f1.txt_fono; var t5=f1.txt_localidad;  var t6=f1.txt_mensaje; 
	
	for(i=1; i < 6; i++){
		if(eval("t"+i).value==""){
			vacios=true;
			break;
		}
	}
	if(vacios){
		wm+= "Debe completar todos los campos."; noerror=0;
	}else{
		//controlar email
		if(validar_email(t2.value)){
			//comparar que ambos estén iguales
			if(t2.value != t3.value){
				wm+= "Debe escribir la misma dirección de e-mail."; noerror=0;
			}
		}else{
			wm+= "Dirección de correo inválida."; noerror=0;
		}
	}
	
	if (noerror == 0) {
	alert(wm);
	return false;
	}
	else return true;
}
function validarFormGuia(){
	var f1=document.forms[0];
	var wm = "Atención :\n\r\n";
	var noerror = 1;
	var t1=f1.txt_nombre.value; 
	var t2=f1.txt_email1.value; 
	var t3=f1.txt_email2.value; 
	var t4=f1.txt_fono.value;
	
	if(t1=="" || t1==" "){wm+= "Por favor indique su nombre.\n"; noerror=0;}
	if(t2=="" || t2==" " || t3=="" || t3==" "){wm+= "Por favor indique una dirección de e-mail.\n"; noerror=0;}
	if(t4=="" || t4==" "){wm+= "Por favor indique un teléfono."; noerror=0;}
	
	//controlar email
	if(validar_email(t2)){
		//comparar que ambos estén iguales
		if(t2 != t3){
			wm+= "Debe escribir la misma dirección de e-mail."; noerror=0;
		}
	}else{
		wm+= "Dirección de correo inválida."; noerror=0;
	}

	
	if (noerror == 0) {
	alert(wm);
	return false;
	}
	else return true;
}

function validar_email(email){
	var result=false;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) result= true;
	return result;
}