// JavaScript Document// JavaScript Document

function chex()
{

		
	if (document.form1.name_Of_Insured.value=='')
	{
	alert('You must fill out name field to proceed');
	document.form1.name_Of_Insured.focus();
	document.form1.name_Of_Insured.style.backgroundColor="#FF9900";
	return false;
	
	}
	
	if (document.form1.telephone_Number_Contact_Person.value=='')
	{
	alert('You must fill out phone field to proceed');
	document.form1.telephone_Number_Contact_Person.focus();
	document.form1.telephone_Number_Contact_Person.style.backgroundColor="#FF9900";
	return false;
	
	}
	if(document.form1.telephone_Number_Contact_Person.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
      	document.form1.telephone_Number_Contact_Person.focus();
	document.form1.telephone_Number_Contact_Person.style.backgroundColor="#FF9900";

	  return false;
   }

	if (document.form1.security_code.value=='')
	{
	alert('You must enter security code to proceed');
	document.form1.security_code.focus();
	document.form1.security_code.style.backgroundColor="#FF9900";
	return false;
	
	}

		
}
	
function chex1()
{

		
	if (document.form1.nombreAsegurado.value=='')
	{
	alert('Debe rellenar el campo del nombre para continuar');
	document.form1.nombreAsegurado.focus();
	document.form1.nombreAsegurado.style.backgroundColor="#FF9900";
	return false;
	
	}
	
	if (document.form1.numberoTelefonoNombeContacto.value=='')
	{
	alert('Debe rellenar el campo telefónico para continuar');
	document.form1.numberoTelefonoNombeContacto.focus();
	document.form1.numberoTelefonoNombeContacto.style.backgroundColor="#FF9900";
	return false;
	
	}
	if(document.form1.numberoTelefonoNombeContacto.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
   {
      alert("El número de teléfono que ingresó es inválido,\r\nPor favor ingrese un número telefónico con el siguiente formato xxx-xxx-xxxx");
      	document.form1.numberoTelefonoNombeContacto.focus();
	document.form1.numberoTelefonoNombeContacto.style.backgroundColor="#FF9900";

	  return false;
   }

	if (document.form1.security_code.value=='')
	{
	alert('Debe ingresar un código de seguridad para continuar');
	document.form1.security_code.focus();
	document.form1.security_code.style.backgroundColor="#FF9900";
	return false;
	
	}

		
}




function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}


	
	

