function chanceStyles(){
	if (screen.height>=850)
	{
		document.getElementById('switchStyle').href ="css/styles.css";
	}else{
		window.menubar.visible = false;
	}
}
function openContacto(){
	window.open("contacto.html","contacto","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=337, height=504");
}
function alterForm(caller){
	contenido = caller.id;
	document.getElementById('city').value = contenido;
	title = document.getElementById('titleVariable')
	
	switch (contenido){
		case "mty":
				title.src="images/btns_03.png";
			break;
		case "glj":
				title.src="images/btns_06.png";
			break;
		case "mx":
				title.src="images/btns_08.png";
			break;
	}
	document.getElementById('formaAparece').style.display="block";
	document.getElementById('formPre').style.display="none";
}

function validateText(texto,msj){
	if(texto.value==null || texto.value==""){
		alert(msj);
		return false;
	}else{
		return true;
	}
}
function validateNumber(texto,msj){
	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	
	if(texto.value==null || texto.value=="" || parseFloat(texto.value)==0 || !anum.test(texto.value) || parseFloat(texto.value)>=100){
		alert(msj);
		return false;
	}else{
		return true;
	}
}
function validateTel(texto,msj){
	telefono = texto.value.replace(/[^0-9]+/g,'');
	
	if(texto.value==null || texto.value=="" || parseFloat(telefono)<100000 || telefono==""){
		alert(msj);
		return false;
	}else{
		return true;
	}
}
function validateMail(field,alerttxt){
  apos=field.value.indexOf("@");
  dotpos=field.value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
}
function formValidation(forma){
	with(forma){
		if(validateText(name,"Favor de ingresar su nombre")==false){
			name.focus();
			return false;}
			
		if(validateMail(mail,"El correo no es valido")==false){
			mail.focus();
			return false;}
			
		if(validateTel(tel,"Favor de ingresar un telefono valido")==false){
			tel.focus();
			return false;}
			
		if(validateText(msj,"Favor de ingresar un comentario")==false){
			msj.focus();
			return false;}
	}
}