// JavaScript Document// JavaScript Document

function chex()
{

		
	if (document.form1.Name.value=='')
	{
	alert('You must fill out name field to proceed');
	document.form1.Name.focus();
	document.form1.Name.style.backgroundColor="#FF9900";
	return false;
	
	}
	
if (document.form1.email.value=='')
		
		
	
	{
	alert('You must fill out the email field to proceed');
	document.form1.email.focus();
	document.form1.email.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (echeck(document.form1.email.value)==false){
		document.form1.email.value=""
		document.form1.email.focus()
  		document.form1.email.style.backgroundColor="#FF9900";
		return false
	}
if (document.form1.HomePhone.value=='')
	{
	alert('You must fill out phone field to proceed');
	document.form1.HomePhone.focus();
	document.form1.HomePhone.style.backgroundColor="#FF9900";
	return false;
	
	}
	if(document.form1.HomePhone.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.");
      return false;
   }		
}
	

// JavaScript Document// JavaScript Document

function chexfund()
{

		
	if (document.form1.Name.value=='')
	{
	alert('You must fill out name field to proceed');
	document.form1.Name.focus();
	document.form1.Name.style.backgroundColor="#FF9900";
	return false;
	}
	if (document.form1.Organization.value=='')
	{
	alert('You must fill out Organization field to proceed');
	document.form1.Organization.focus();
	document.form1.Organization.style.backgroundColor="#FF9900";
	return false;
	
	}	
if (document.form1.email.value=='')
		
		
	
	{
	alert('You must fill out the email field to proceed');
	document.form1.email.focus();
	document.form1.email.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (echeck(document.form1.email.value)==false){
		document.form1.email.value=""
		document.form1.email.focus()
  		document.form1.email.style.backgroundColor="#FF9900";
		return false
	}
if (document.form1.HomePhone.value=='')
	{
	alert('You must fill out phone field to proceed');
	document.form1.HomePhone.focus();
	document.form1.HomePhone.style.backgroundColor="#FF9900";
	return false;
	
	}
	if(document.form1.HomePhone.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.");
      return false;
   }
if (document.form1.Address.value=='')
	{
	alert('You must fill out address field to proceed');
	document.form1.Address.focus();
	document.form1.Address.style.backgroundColor="#FF9900";
	return false;
	
	}
if (document.form1.City.value=='')
	{
	alert('You must fill out the City field to proceed');
	document.form1.City.focus();
	document.form1.City.style.backgroundColor="#FF9900";
	return false;
	
	}
if (document.form1.State.value=='')
	{
	alert('You must fill out state field to proceed');
	document.form1.State.focus();
	document.form1.State.style.backgroundColor="#FF9900";
	return false;
	
	}
if (document.form1.Zip.value=='')
	{
	alert('You must fill out zip field to proceed');
	document.form1.Zip.focus();
	document.form1.Zip.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.NumberCabins.value=='')
	{
	alert('You must fill out Number of Cabins Requested  field to proceed');
	document.form1.NumberCabins.focus();
	document.form1.NumberCabins.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.NumberInsideCabins.value=='')
	{
	alert('You must fill out Inside field to proceed');
	document.form1.NumberInsideCabins.focus();
	document.form1.NumberInsideCabins.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.NumberOutsideCabins.value=='')
	{
	alert('You must fill out Outside field to proceed');
	document.form1.NumberOutsideCabins.focus();
	document.form1.NumberOutsideCabins.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.NumberTripleQuadCabins.value=='')
	{
	alert('You must fill out Triples or Quads  field to proceed');
	document.form1.NumberTripleQuadCabins.focus();
	document.form1.NumberTripleQuadCabins.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.Required.value=='')
	{
	alert('You must fill out Revenues required  field to proceed');
	document.form1.Required.focus();
	document.form1.Required.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.MinParticipants.value=='')
	{
	alert('You must fill out Minimum Number of Participants  field to proceed');
	document.form1.MinParticipants.focus();
	document.form1.MinParticipants.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.MaxParticipants.value=='')
	{
	alert('You must fill out Maximum Number of Participants field to proceed');
	document.form1.MaxParticipants.focus();
	document.form1.MaxParticipants.style.backgroundColor="#FF9900";
	return false;
	
	}
	if (document.form1.BudgetLimits.value=='')
	{
	alert('You must fill out  Budget Limitations field to proceed');
	document.form1.BudgetLimits.focus();
	document.form1.BudgetLimits.style.backgroundColor="#FF9900";
	return false;
	
	}

	if (document.form1.SailingDate.value=='' || document.form1.SailingDate.value=='MM/DD/YYYY')
	{
	alert('You must fill out Sailing Date field to proceed');
	document.form1.SailingDate.focus();
	document.form1.SailingDate.style.backgroundColor="#FF9900";
	return false;
	
	}if (document.form1.CruiseLength.value=='')
	{
	alert('You must select from Cruise Length field to proceed');
	document.form1.CruiseLength.focus();
	document.form1.CruiseLength.style.backgroundColor="#FF9900";
	return false;
	
	}if (document.form1.Intinerary.value=='')
	{
	alert('You must select from Intinerary field to proceed');
	document.form1.Intinerary.focus();
	document.form1.Intinerary.style.backgroundColor="#FF9900";
	return false;
	
	}if (document.form1.Cabin.value=='')
	{
	alert('You must select from Cabin Accommodations field to proceed');
	document.form1.Cabin.focus();
	document.form1.Cabin.style.backgroundColor="#FF9900";
	return false;
	
	}if (document.form1.CabinType.value=='')
	{
	alert('You must select from Cabin Type field to proceed');
	document.form1.CabinType.focus();
	document.form1.CabinType.style.backgroundColor="#FF9900";
	return false;
	
	}if (document.form1.GuestPerCabin.value=='')
	{
	alert('You must select from Guest Per Cabin field to proceed');
	document.form1.GuestPerCabin.focus();
	document.form1.GuestPerCabin.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					
	}


	
	

