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 Format")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address Format")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address Format")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address Format")
		    return false
		 }

 		 return true
	}


function pass_form ( )
{
    valid = true;
    if ( document.myform.customer.value == "" )
    {
        alert ( "Please fill in your Name." );
        document.myform.customer.focus();
        return false;
    }
    if ( document.myform.email.value == "" )
    {
        alert ( "Please fill in your Email Address." );
        document.myform.email.focus();
        return false;
    }
    if ( document.myform.comments.value == "" )
    {
        alert ( "Please fill in the Comments field." );
        document.myform.comments.focus();
        return false;
    }
    if ( document.myform.cap.value == "" )
    {
        alert ( "Please fill in the SPAM Guard." );
        document.myform.cap.focus();
        return false;
    }

}



function validate(chk){
  if (chk.checked == 1)
    return True;
  else
    alert("You did not check the check box agreeing to our reservation policies.")
    return false;
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=450,left = 187,top = 59');");
}


function validate_wedding ( )
{
    valid = true;
    if ( document.WedForm.group_name.value == "" )
    {
        alert ( "Please fill in your Wedding Party's Name" );
        document.WedForm.group_name.focus();
        return false;
    }
    if ( document.WedForm.group_leader.value == "" )
    {
        alert ( "Your Primary Contact's is required." );
        document.WedForm.group_leader.focus();
        return false;
    }
    if ( document.WedForm.group_address.value == "" )
    {
        alert ( "Your Group's Address is required." );
        document.WedForm.group_address.focus();
        return false;
    }
    if ( document.WedForm.city_state_zip.value == "" )
    {
        alert ( "Your Group's City, State and Zip code is required." );
        document.WedForm.city_state_zip.focus();
        return false;
    }
    if ( document.WedForm.leaders_phone.value == "" )
    {
        alert ( "Your Contact Phone Number is required." );
        document.WedForm.leaders_phone.focus();
        return false;
    }
    if ( document.WedForm.leaders_email.value == "" )
    {
        alert ( "Your Email is required." );
        document.WedForm.leaders_email.focus();
        return false;
    }
    if ( document.WedForm.number_of_passengers.value == "" )
    {
        alert ( "Please fill in the Number of Passengers." );
        document.WedForm.number_of_passengers.focus();
        return false;
    }
    if ( document.WedForm.travel_day.value == "" )
    {
        alert ( "Please fill in your Wedding's Date." );
        document.WedForm.travel_day.focus();
        return false;
    }
    if ( document.WedForm.day_of_week.value == "" )
    {
        alert ( "Please fill in the Day of the Week your Wedding is on." );
        document.WedForm.day_of_week.focus();
        return false;
    }
   if ( document.WedForm.origination_location.value == "" )
    {
        alert ( "Please fill in your Origination Location." );
        document.WedForm.origination_location.focus();
        return false;
    }
    if ( document.WedForm.origination_pickup_time.value == "" )
    {
        alert ( "Please fill in your Origination Pickup Time." );
        document.WedForm.origination_pickup_time.focus();
        return false;
    }
    if ( document.WedForm.bride_location.value == "" )
    {
        alert ( "Please fill in the Bride's Location." );
        document.WedForm.bride_location.focus();
        return false;
    }
    if ( document.WedForm.bride_depart_time.value == "" )
    {
        alert ( "Please fill in your Bride's Departure Time." );
        document.WedForm.bride_depart_time.focus();
        return false;
    }
    if ( document.WedForm.groom_location.value == "" )
    {
        alert ( "Please fill in the Groom's Location." );
        document.WedForm.groom_location.focus();
        return false;
    }
    if ( document.WedForm.groom_depart_time.value == "" )
    {
        alert ( "Please fill in your Groom's Departure Time." );
        document.WedForm.groom_depart_time.focus();
        return false;
    }
    if ( document.WedForm.wedding_location.value == "" )
    {
        alert ( "Please fill in your Wedding's Location." );
        document.WedForm.wedding_location.focus();
        return false;
    }
    if ( document.WedForm.wedding_arrival_time.value == "" )
    {
        alert ( "Please fill in the Wedding Arrival Time." );
        document.WedForm.wedding_arrival_time.focus();
        return false;
    }
    if ( document.WedForm.wedding_length.value == "" )
    {
        alert ( "Please fill in the length of the Wedding service." );
        document.WedForm.wedding_length.focus();
        return false;
    }
    if ( document.WedForm.recept_location.value == "" )
    {
        alert ( "Please fill in your Reception's Location." );
        document.WedForm.recept_location.focus();
        return false;
    }
    if ( document.WedForm.recept_arrival_time.value == "" )
    {
        alert ( "Please fill in the Reception Arrival Time." );
        document.WedForm.recept_arrival_time.focus();
        return false;
    }
    if ( document.WedForm.service_end_time.value == "" )
    {
        alert ( "Please fill in the end time our services will be needed." );
        document.WedForm.service_end_time.focus();
        return false;
    }
    if ( document.WedForm.total_hours.value == "" )
    {
        alert ( "Please fill in the estimate of the total number of hours you will need us from start to end." );
        document.WedForm.total_hours.focus();
        return false;
    }
    if ( document.WedForm.cap.value == "" )
    {
        alert ( "Please fill in the SPAM Guard." );
        document.WedForm.cap.focus();
        return false;
    }
}




function validate_rate ( )
{
    valid = true;
    if ( document.RateForm.group_name.value == "" )
    {
        alert ( "Please fill in your Group's Name" );
        document.RateForm.group_name.focus();
        return false;
    }
    if ( document.RateForm.group_leader.value == "" )
    {
        alert ( "Your Group Leader Name is required." );
        document.RateForm.group_leader.focus();
        return false;
    }
    if ( document.RateForm.group_address.value == "" )
    {
        alert ( "Your Group's Address is required." );
        document.RateForm.group_address.focus();
        return false;
    }
    if ( document.RateForm.city_state_zip.value == "" )
    {
        alert ( "Your Group's City, State and Zip code is required." );
        document.RateForm.city_state_zip.focus();
        return false;
    }
    if ( document.RateForm.leaders_phone.value == "" )
    {
        alert ( "Your Contact Phone Number is required." );
        document.RateForm.leaders_phone.focus();
        return false;
    }
    if ( document.RateForm.leaders_email.value == "" )
    {
        alert ( "Your Email is required." );
        document.RateForm.leaders_email.focus();
        return false;
    }
    if ( document.RateForm.number_of_passengers.value == "" )
    {
        alert ( "Please fill in the Number of Passengers." );
        document.RateForm.number_of_passengers.focus();
        return false;
    }
    if ( document.RateForm.travel_day.value == "" )
    {
        alert ( "Please fill in your Anticipated travel date." );
        document.RateForm.travel_day.focus();
        return false;
    }
    if ( document.RateForm.pickup_time.value == "" )
    {
        alert ( "Please fill in your Pickup Time." );
        document.RateForm.pickup_time.focus();
        return false;
    }
    if ( document.RateForm.pickup_location.value == "" )
    {
        alert ( "Please fill in your Pickup Location." );
        document.RateForm.pickup_location.focus();
        return false;
    }
    if ( document.RateForm.destination.value == "" )
    {
        alert ( "Please fill in your trip's Destination." );
        document.RateForm.destination.focus();
        return false;
    }
    if ( document.RateForm.arrival_time.value == "" )
    {
        alert ( "Please fill in your Anticipated Arrival Time." );
        document.RateForm.arrival_time.focus();
        return false;
    }
    if ( document.RateForm.return_time.value == "" )
    {
        alert ( "Please fill in your Anticipated Return Time." );
        document.RateForm.return_time.focus();
        return false;
    }
    if ( document.RateForm.return_location.value == "" )
    {
        alert ( "Please fill in your Return Location." );
        document.RateForm.return_location.focus();
        return false;
    }
    if ( document.RateForm.trip_description.value == "" )
    {
        alert ( "Please fill in your Trip Description." );
        document.RateForm.trip_description.focus();
        return false;
    }
    if ( document.RateForm.cap.value == "" )
    {
        alert ( "Please fill in the SPAM Guard." );
        document.RateForm.cap.focus();
        return false;
    }
}

function mailpage()
{
  mail_str = "mailto:?subject= Quality Coach Lines News Article";
  mail_str += "&body= I saw this news article on the Quality Coach Lines website and thought I would email it to you. ";
  mail_str += "Check out the story at this link: " + location.href;
 location.href = mail_str;
}


