function validateEmail(sEmail)
{
	var splitted = sEmail.match("^(.+)@(.+)$");
	if(splitted == null) return false;
	if(splitted[1] != null )
	{
	  var regexp_user=/^\"?[\w-_\.]*\"?$/;
	  if(splitted[1].match(regexp_user) == null) return false;
	}
	if(splitted[2] != null)
	{
	  var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
	  if(splitted[2].match(regexp_domain) == null) 
	  {
		var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
		if(splitted[2].match(regexp_ip) == null) return false;
	  }
	  return true;
	}
return false;
}
function ValidarTexto()
{
	if (window.event.keyCode == 13)
	{
		 ValidarOportunidad()
	}
	if (window.event.keyCode==34 || window.event.keyCode==39 || window.event.keyCode==38 || window.event.keyCode==44 || window.event.keyCode==59)
	{
		event.returnValue = false;
	}
}
function ValidarOportunidad()
{
	if (document.forma.sNombre.value.length == 0)
	{
		alert("Favor de ingresar tu nombre.");
		document.forma.sNombre.focus();
		return;
	}
	if (document.forma.sEmpresa.value.length == 0)
	{
		alert("Favor de especificar tu empresa.");
		document.forma.sEmpresa.focus();
		return;
	}
	if (validateEmail(document.forma.sEmail.value)==false)
	{
		alert("Favor de ingresar una cuenta de e-mail válida.");
		document.forma.sEmail.focus();
		return;
	}
	if (document.forma.sCiudad.value.length == 0)
	{
		alert("Favor de especificar tu ciudad.");
		document.forma.sCiudad.focus();
		return;
	}
	
		if (document.forma.iEstado.value == 0)
	{
		alert("Favor de seleccionar el Estado.");
		document.forma.iEstado.focus();
		return;
	}
		if (document.forma.iEstado.value == 33 & document.forma.iPais.value==0)
	{
		alert("Favor de seleccionar el País.");
		document.forma.iPais.focus();
		return;
	}
		if (document.forma.iPais.value == 153 & document.forma.iEstado.value==0)
	{
		alert("Favor de seleccionar el Estado.");
		document.forma.iEstado.focus();
		return;
	}
	if (document.forma.iServicio.value == 0)
	{
		alert("Por favor selecciona el servicio que te interesa.");
		document.forma.iServicio.focus();
		return;
	}
	if (document.forma.iFormaContacto.value == 5)
	{
		if (validateEmail(document.forma.sMsn.value)==false)
		{
			alert("Favor de ingresar una cuenta de MSN válida.");
			document.forma.sMsn.focus();
			return;
		}
	}

	if (document.forma.iComo.value == 0)
	{
		alert("Por favor indícanos cómo te enteraste de Manatí.");
		document.forma.iComo.focus();
		return;
	}
		if (document.forma.iComo.value == 4 & document.forma.sQuien.value=="")
	{
		alert("Por favor dinos quién te recomendó.");
		document.forma.sQuien.focus();
		return;
	}
	if (document.forma.iComo.value == 4 & document.forma.sQuien.value=="")
	{
		alert("Por favor dinos quién te recomendó.");
		document.forma.sQuien.focus();
		return;
	}

	document.forma.submit();
}
function LimpiarForma()
{	
	if (confirm("¿Estás seguro de querer borrar la información del formulario?"))
	{
	/*document.forma.sNombre.value = "";
	document.forma.sEmpresa.value = "";
	document.forma.sEmail.value = "";
	document.forma.sTelefono.value = "";
	document.forma.iServicio.selectedIndex = 0;
	document.forma.iComo.selectedIndex = 0;
	document.forma.sComentario.value = "";*/
		document.forma.reset();
		return;
	}
}
function ValidarNumeros()
{
	if(event.keyCode < 48  || event.keyCode > 57 )
	{
		event.returnValue = false
	}
	if (window.event.keyCode==13)
	{
		Validar();
	}
}
function MostrarRecomendacion()
	{
		if (document.forma.iComo.selectedIndex==4)
		{
			Quien.style.display= 'block';
		}	
		else
		{
			Quien.style.display= 'none'
		}
		if (document.forma.iComo.selectedIndex==11)
		{
			Otro.style.display= 'block';
		}	
		else
		{
			Otro.style.display= 'none'
		}
	}
function OcultarFechaCita()
	{
		if (document.forma.iFormaContacto.selectedIndex==1| document.forma.iFormaContacto.selectedIndex==2)
			{
				FechaCita.style.display= 'block';
			}	
			else
			{
				FechaCita.style.display= 'none'
			}
		if (document.forma.iFormaContacto.selectedIndex==1)
			{
				Leyenda.style.display= 'block';
			}	
			else
			{
				Leyenda.style.display= 'none'
			}
		if  (document.forma.iFormaContacto.selectedIndex==5)
			{
				Msn.style.display= 'block';
			}	
			else
			{
				Msn.style.display= 'none'
			}
	}	
function cambiar_estado()
	{
		if (document.forma.iPais.value!=153)
			{
				
				document.forma.iEstado.value=33
				return;				
			}
		if (document.forma.iPais.value==153)
			{
				
				document.forma.iEstado.value=0
				return;				
			}
	}	
function cambiar_pais()
	{
		  if  (document.forma.iEstado.value==33)
		{
			Pais.style.display= 'block';
		}	
		else
		{
			Pais.style.display= 'none'
		}
		 if (document.forma.iEstado.value==33)
		 {
			
			document.forma.iPais.value=0
			return;
			
		 }
		
		if (document.forma.iEstado.value>0 & document.forma.iEstado.value!=33  )
		{	
			
			document.forma.iPais.value=153
			return;
		} 
	}
