var timeOut;

var eighteen_or_older = false;
var crime_conviction = false;
var highest_grade_school = false;
var highest_grade_college = false;
var highest_grade_graduate = false;
var applied_before = false;
var work_for_triangle = false;
var work_any_shift = false;
var work_any_day = false;
var first_can_contact = false;
var affidavit_app = false;

function verifyApplication() {
	try {
	    if (document.getElementById('employment[last_name]').value == "") {
            alert("The Last Name field is required.");
	        document.getElementById('employment[last_name]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[first_name]').value == "") {
            alert("The First Name field is required.");
	        document.getElementById('employment[first_name]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[street]').value == "") {
            alert("The Street Address field is required.");
	        document.getElementById('employment[street]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[city]').value == "") {
            alert("The City field is required.");
	        document.getElementById('employment[city]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[state]').value == "") {
            alert("The State field is required.");
	        document.getElementById('employment[state]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[zip]').value == "") {
            alert("The Zip field is required.");
	        document.getElementById('employment[zip]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[phone]').value == "") {
            alert("The Phone field is required.");
	        document.getElementById('employment[phone]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[ssn]').value == "") {
            alert("The Social Security Number field is required.");
	        document.getElementById('employment[ssn]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[drivers_license_number]').value == "") {
            alert("The Drivers License Number field is required.");
	        document.getElementById('employment[drivers_license_number]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[drivers_license_state]').value == "") {
            alert("The Drivers License Issuing State field is required.");
	        document.getElementById('employment[drivers_license_state]').focus();
	        return false;
	    }
		if (!eighteen_or_older) {
			alert("Are you eighteen or older?");
			window.location.hash="#eighteen_or_older";
			return false;
		}
		if (!crime_conviction) {
			alert("Have you ever been convicted of a crime other than a minor traffic violation?");
			window.location.hash="#crime_conviction";
			return false;
		}
		if (!highest_grade_school) {
			alert("Select Highest Grade Completed in Grade, Jr High or Sr High");
			window.location.hash="#highest_grade_school";
			return false;
		}
		if (!highest_grade_college) {
			alert("Select Highest Grade Completed in Undergraduate School");
			window.location.hash="#highest_grade_college";
			return false;
		}
		if (!highest_grade_graduate) {
			alert("Select Highest Grade Completed in Graduate School");
			window.location.hash="#highest_grade_graduate";
			return false;
		}
		if (document.getElementById('employment[job_applied]').value == "") {
			alert("To which job are you applying?");
			document.getElementById('employment[job_applied]').focus();
			return false;
		}
		if (document.getElementById('employment[salary_desired]').value == "") {
			alert("What is your desired salary?");
			document.getElementById('employment[salary_desired]').focus();
			return false;
		}
		if (!applied_before) {
			alert("Have you ever applied here before?");
			window.location.hash="#applied_before";
			return false;
		}
		if (!work_for_triangle) {
			alert("Have you ever worked for Triangle before?");
			window.location.hash="#work_for_triangle";
			return false;
		}
		if (!work_any_shift) {
			alert("Are you available to work any shift?");
			window.location.hash="#work_any_shift";
			return false;
		}
		if (!work_any_day) {
			alert("Any day of the week?");
			window.location.hash="#work_any_day";
			return false;
		}
	    if (document.getElementById('employment[report_when]').value == "") {
            alert("When are you able to start?");
	        document.getElementById('employment[report_when]').focus();
	        return false;
	    }
	    if (document.getElementById('employment[first_company]').value == "") {
	    	alert("The Company Name field is required.");
	    	document.getElementById('employment[first_company]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_from_month]').value == "") {
	    	alert("The From Month field is required.");
	    	document.getElementById('employment[first_from_month]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_from_year]').value == "") {
	    	alert("The From Year field is required.");
	    	document.getElementById('employment[first_from_year]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_to_month]').value == "") {
	    	alert("The To Month field is required.");
	    	document.getElementById('employment[first_to_month]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_to_year]').value == "") {
	    	alert("The To Year field is required.");
	    	document.getElementById('employment[first_to_year]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_phone]').value == "") {
	    	alert("The Phone field is required.");
	    	document.getElementById('employment[first_phone]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_street]').value == "") {
	    	alert("The Street field is required.");
	    	document.getElementById('employment[first_street]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_city]').value == "") {
	    	alert("The City field is required.");
	    	document.getElementById('employment[first_city]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_state]').value == "") {
	    	alert("The State field is required.");
	    	document.getElementById('employment[first_state]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_zip]').value == "") {
	    	alert("The Zip field is required.");
	    	document.getElementById('employment[first_zip]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_start_salary]').value == "") {
	    	alert("The Starting Salary field is required.");
	    	document.getElementById('employment[first_start_salary]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_start_salary_period]').value == "") {
	    	alert("The Starting Salary Period field is required.");
	    	document.getElementById('employment[first_start_salary_period]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_end_salary]').value == "") {
	    	alert("The Ending Salary field is required.");
	    	document.getElementById('employment[first_end_salary]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_end_salary_period]').value == "") {
	    	alert("The Ending Salary Period field is required.");
	    	document.getElementById('employment[first_end_salary_period]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_supervisor_name]').value == "") {
	    	alert("The Supervisor field is required.");
	    	document.getElementById('employment[first_supervisor_name]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_type_of_business]').value == "") {
	    	alert("The Type of Business field is required.");
	    	document.getElementById('employment[first_type_of_business]').focus();
	    	return false;
	    }
		if (!first_can_contact) {
			alert("If this is your current employer, may we contact?");
			window.location.hash="#first_can_contact";
			return false;
		}
	    if (document.getElementById('employment[first_position]').value == "") {
	    	alert("The Position field is required.");
	    	document.getElementById('employment[first_position]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_responsiblities]').value == "") {
	    	alert("The Responsibilities field is required.");
	    	document.getElementById('employment[first_responsiblities]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_reason_for_leaving]').value == "") {
	    	alert("The Specific Reason for Leaving field is required.");
	    	document.getElementById('employment[first_reason_for_leaving]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_reference_name]').value == "") {
	    	alert("The Reference Name field is required.");
	    	document.getElementById('employment[first_reference_name]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_reference_occupation]').value == "") {
	    	alert("The Reference Occupation field is required.");
	    	document.getElementById('employment[first_reference_occupation]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_reference_years_known]').value == "") {
	    	alert("The Reference Years Known field is required.");
	    	document.getElementById('employment[first_reference_years_known]').focus();
	    	return false;
	    }
	    if (document.getElementById('employment[first_reference_phone]').value == "") {
	    	alert("The Reference Phone field is required.");
	    	document.getElementById('employment[first_reference_phone]').focus();
	    	return false;
	    }
	    if (!affidavit_app) {
			alert("I authorize, without liability, investigation of all statements in this application. I authorize all schools which I attended and all previous employers to furnish to Triangle Rent A Car my record, reason for leaving and all information they may have concerning me, and hereby release them and Triangle Rent A Car from all liability for any damage whatsoever arising therefrom. I authorize my neighbors, friends or others with whom I am acquainted or who are acquainted with me to furnish Triangle Rent A Car with information used in connection with the evaluation of my qualifications as a prospective employee.  I release such persons and organizations from any legal liability in making such statements. I understand that in event of my employment by Triangle Rent A Car, it shall be sufficient cause for dismissal if any of the information I have given in this application is false or if I have failed to give any information herein requested.  I understand that proof of identity and work authorization will be required upon employment in accordance with federal regulations.  In the vent of my employment by Triangle Rent A Car, I agree to abide by all present and subsequently issued rules of Triangle Rent A Car.  I agree to be responsible for property and equipment issued to me by Triangle Rent A Car until returned by me, and to pay for property and equipment not returned.  I agree to submit to a physical examination, including drug and alcohol testing, if required.  I understand that my employment is for no definite period of time and may be terminated at any time by Triangle Rent A Car.");
			window.location.hash="#affidavit_app";
			return false;
	    }
		return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}
var reservation_process_promptness_of_service = false;
var reservation_process_attitude_of_reservation_agent = false;
var reservation_process_timeliness_of_reservation_process_promptness_of_service = false;
var reservation_process_knowledge_of_rental_agent = false;
var reservation_process_selection_of_vehicles = false;
var reservation_process_availability_of_vehicles = false;
var reservation_process_pricing_of_vehicles = false;
var rental_process_promptness_of_service = false;
var rental_process_courtesy_of_rental_agent = false;
var rental_process_appearance_of_rental_agent = false;
var rental_process_knowledge_of_rental_agent = false;
var vehicle_performance_performance_of_vehicle = false;
var vehicle_performance_cleanliness_of_vehicle_interior = false;
var vehicle_performance_cleanliness_of_vehicle_exterior = false;
var return_process_promptness_of_service = false;
var return_process_courtesy_of_rental_agent = false;
var rental_car_location_appearance_of_location = false;
var rental_car_location_accessibility_of_location = false;
var experience_staff = false;
var experience_vehicle_selection = false;
var experience_location = false;
var experience_pricing = false;
var experience_overall = false;

function verifySurvey() {
    try {
	    if (document.getElementById('survey[first_name]').value == "") {
            alert("The First Name field is required.");
	        document.getElementById('survey[first_name]').focus();
	        return false;
	    }
        if (document.getElementById('survey[last_name]').value == "") {
		    alert("The Last Name field is required.");
		    document.getElementById('survey[last_name]').focus();
		    return false;
		}
  		if (document.getElementById('survey[email_address]').value == "") {
		    alert("The Email field is required.");
		    document.getElementById('survey[email_address]').focus();
		    return false;
  		}
  		if (document.getElementById('survey[rental_agreement_number]').value == "") {
		    alert("The Rental Agreement Number field is required.");
		    document.getElementById('survey[rental_agreement_number]').focus();
		    return false;
		}
		if (!reservation_process_promptness_of_service) {
			alert("How would you rate the reservation process? Promptness of service");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_attitude_of_reservation_agent) {
			alert("How would you rate the reservation process? Attitude of reservation agent");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_timeliness_of_reservation_process_promptness_of_service) {
			alert("How would you rate the reservation process? Timeliness of reservation process");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_knowledge_of_rental_agent) {
			alert("How would you rate the reservation process? Knowledge of rental agent");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_selection_of_vehicles) {
			alert("How would you rate the reservation process? Selection of vehicles");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_availability_of_vehicles) {
			alert("How would you rate the reservation process? Availability of vehicles");
			window.location.hash="#Q7";
			return false;
		}
		if (!reservation_process_pricing_of_vehicles) {
			alert("How would you rate the reservation process? Pricing of vehicles");
			window.location.hash="#Q7";
			return false;
		}
		if (!rental_process_promptness_of_service) {
			alert("How would you rate the rental process? Promptness of service");
			window.location.hash="#Q8";
			return false;
		}
		if (!rental_process_courtesy_of_rental_agent) {
			alert("How would you rate the rental process? Courtesy of rental agent");
			window.location.hash="#Q8";
			return false;
		}
		if (!rental_process_appearance_of_rental_agent) {
			alert("How would you rate the rental process? Appearance of rental agent");
			window.location.hash="#Q8";
			return false;
		}
		if (!rental_process_knowledge_of_rental_agent) {
			alert("How would you rate the rental process? Knowledge of rental agent");
			window.location.hash="#Q8";
			return false;
		}
		if (!vehicle_performance_performance_of_vehicle) {
			alert("How would you rate the vehicle's performance? Performance of vehicle");
			window.location.hash="#Q9";
			return false;
		}
		if (!vehicle_performance_cleanliness_of_vehicle_interior) {
			alert("How would you rate the vehicle's performance? Cleanliness of vehicle interior");
			window.location.hash="#Q9";
			return false;
		}
		if (!vehicle_performance_cleanliness_of_vehicle_exterior) {
			alert("How would you rate the vehicle's performance? Cleanliness of vehicle exterior");
			window.location.hash="#Q9";
			return false;
		}
		if (!return_process_promptness_of_service) {
			alert("How would you rate the return process? Promptness of service");
			window.location.hash="#Q10";
			return false;
		}
		if (!return_process_courtesy_of_rental_agent) {
			alert("How would you rate the return process? Courtesy of rental agent");
			window.location.hash="#Q10";
			return false;
		}
		if (!rental_car_location_appearance_of_location) {
			alert("How would you rate the rental car location? Appearance of location");
			window.location.hash="#Q11";
			return false;
		}
		if (!rental_car_location_accessibility_of_location) {
			alert("How would you rate the rental car location? Accessibility of location");
			window.location.hash="#Q11";
			return false;
		}
		if (!experience_staff) {
			alert("How would you rate your Triangle Rent A Car experience? Staff");
			window.location.hash="#Q12";
			return false;
		}
		if (!experience_vehicle_selection) {
			alert("How would you rate your Triangle Rent A Car experience? Vehicle selection");
			window.location.hash="#Q12";
			return false;
		}
		if (!experience_location) {
			alert("How would you rate your Triangle Rent A Car experience? Location");
			window.location.hash="#Q12";
			return false;
		}
		if (!experience_pricing) {
			alert("How would you rate your Triangle Rent A Car experience? Pricing");
			window.location.hash="#Q12";
			return false;
		}
		if (!experience_overall) {
			alert("How would you rate your Triangle Rent A Car experience? Overall opinion");
			window.location.hash="#Q12";
			return false;
		}
		return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}

function verifyComments() {
    try {
	    if (document.getElementById('comments[name]').value == "") {
            alert("The Name field is required.");
	        document.getElementById('comments[name]').focus();
	        return false;
	    }
        if (document.getElementById('comments[email]').value == "") {
		    alert("The Email field is required.");
		    document.getElementById('comments[email]').focus();
		    return false;
		}
  		if (document.getElementById('comments[comments]').value == "") {
		    alert("The Comments field is required.");
		    document.getElementById('comments[comments]').focus();
		    return false;
		}
	    return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}
var interview_type = false;
var applied_for = false;
var status_type = false;
var customer_service = false;
var job_experience = false;
var knowledge_and_understanding = false;
var eye_contact = false;
var energy_level = false;
var motivation = false;
var appearance = false;
var attitude = false;
var clear_speech = false;
var phone_interview = false;
var overall_rating = false;
var recommendation = false;

function verifyInterview() {
    try {
    	if (document.getElementById('interview[applicant_name]').value == "") {
            alert("The Employee Name field is required.");
	        document.getElementById('interview[applicant_name]').focus();
	        return false;
	    }
        if (document.getElementById('interview[date]').value == "") {
		    alert("The Date field is required.");
		    document.getElementById('interview[date]').focus();
		    return false;
		}
  		if (document.getElementById('interview[interviewer_name]').value == "") {
		    alert("The Interviewer Name field is required.");
		    document.getElementById('interview[interviewer_name]').focus();
		    return false;
		}
  		if (document.getElementById('interview[title]').value == "") {
		    alert("The Title field is required.");
		    document.getElementById('interview[title]').focus();
		    return false;
		}
		if (!interview_type) {
			alert("What type of interview?");
			window.location.hash="#interview_type";
			return false;
		}
		if (!applied_for) {
			alert("What is applicant applying for?");
			window.location.hash="#interview_type";
			return false;
		}
		if (!status_type) {
			alert("What is the applicant's status?");
			window.location.hash="#interview_type";
			return false;
		}
		if (!customer_service) {
			alert("Rate applicant's understanding of customer service.");
			window.location.hash="#rate";
			return false;
		}
		if (!job_experience) {
			alert("Rate applicant's job experience.");
			window.location.hash="#rate";
			return false;
		}
		if (!knowledge_and_understanding) {
			alert("Rate applicant's understanding of the field.");
			window.location.hash="#rate";
			return false;
		}
		if (!eye_contact) {
			alert("Rate applicant's eye contact.");
			window.location.hash="#rate";
			return false;
		}
		if (!energy_level) {
			alert("Rate applicant's energy level.");
			window.location.hash="#rate";
			return false;
		}
		if (!motivation) {
			alert("Rate applicant's motivation.");
			window.location.hash="#rate";
			return false;
		}
		if (!appearance) {
			alert("Rate applicant's appearance.");
			window.location.hash="#rate";
			return false;
		}
		if (!attitude) {
			alert("Rate applicant's attitude.");
			window.location.hash="#rate";
			return false;
		}
		if (!clear_speech) {
			alert("Rate applicant's word usage.");
			window.location.hash="#rate";
			return false;
		}
		if (!phone_interview) {
			alert("Rate applicant's phone interview.");
			window.location.hash="#rate";
			return false;
		}
		if (!overall_rating) {
			alert("Rate applicant overall.");
			window.location.hash="#rate";
			return false;
		}
  		if (document.getElementById('interview[first_company_name]').value == "") {
		    alert("The Company Name field is required.");
		    document.getElementById('interview[first_company_name]').focus();
		    return false;
		}
  		if (document.getElementById('interview[first_contact_name]').value == "") {
		    alert("The Contact Name field is required.");
		    document.getElementById('interview[first_contact_name]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_title]').value == "") {
		    alert("The Title field is required.");
		    document.getElementById('interview[first_title]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_phone_number]').value == "") {
		    alert("The Phone Number field is required.");
		    document.getElementById('interview[first_phone_number]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_date]').value == "") {
		    alert("The Date field is required.");
		    document.getElementById('interview[first_date]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_time]').value == "") {
		    alert("The Time field is required.");
		    document.getElementById('interview[first_time]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_verify_employment]').value == "") {
		    alert("The Verify Dates of Employment field is required.");
		    document.getElementById('interview[first_verify_employment]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_verify_title]').value == "") {
		    alert("The Verify Title/Position field is required.");
		    document.getElementById('interview[first_verify_title]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_rehirable_status]').value == "") {
		    alert("The Re-hirable Status field is required.");
		    document.getElementById('interview[first_rehirable_status]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_company_name]').value == "") {
		    alert("The Company Name field is required.");
		    document.getElementById('interview[second_company_name]').focus();
		    return false;
		}
  		if (document.getElementById('interview[second_contact_name]').value == "") {
		    alert("The Contact Name field is required.");
		    document.getElementById('interview[second_contact_name]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_title]').value == "") {
		    alert("The Title field is required.");
		    document.getElementById('interview[second_title]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_phone_number]').value == "") {
		    alert("The Phone Number field is required.");
		    document.getElementById('interview[second_phone_number]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_date]').value == "") {
		    alert("The Date field is required.");
		    document.getElementById('interview[second_date]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_time]').value == "") {
		    alert("The Time field is required.");
		    document.getElementById('interview[second_time]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_verify_employment]').value == "") {
		    alert("The Verify Dates of Employment field is required.");
		    document.getElementById('interview[second_verify_employment]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_verify_title]').value == "") {
		    alert("The Verify Title/Position field is required.");
		    document.getElementById('interview[second_verify_title]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_rehirable_status]').value == "") {
		    alert("The Re-hirable Status field is required.");
		    document.getElementById('interview[second_rehirable_status]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_personal_name]').value == "") {
		    alert("The Contact Name field is required.");
		    document.getElementById('interview[first_personal_name]').focus();
		    return false;
		}
		if (document.getElementById('interview[first_personal_date]').value == "") {
		    alert("The Date field is required.");
		    document.getElementById('interview[first_personal_date]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_personal_name]').value == "") {
		    alert("The Contact Name field is required.");
		    document.getElementById('interview[second_personal_name]').focus();
		    return false;
		}
		if (document.getElementById('interview[second_personal_date]').value == "") {
		    alert("The Date field is required.");
		    document.getElementById('interview[second_personal_date]').focus();
		    return false;
		}
		if (!recommendation) {
			alert("Is the applicant recommended?");
			window.location.hash="#recommend";
			return false;
		}
	    return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}
var marital_status = false;
var veteran_status = false;

function verifyInfochange() {
    try {
    	if (document.getElementById('infochange[effective_date]').value == "") {
            alert("The Effective Date field is required.");
	        document.getElementById('infochange[effective_date]').focus();
	        return false;
	    }
		if (document.getElementById('infochange[employee_number]').value == "") {
            alert("The Employee Number field is required.");
	        document.getElementById('infochange[employee_number]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[employee_last]').value == "") {
            alert("The Employee Last Name field is required.");
	        document.getElementById('infochange[employee_last]').focus();
	        return false;
	    }
		if (document.getElementById('infochange[employee_first]').value == "") {
            alert("The Employee First Name field is required.");
	        document.getElementById('infochange[employee_first]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[old_street]').value == "") {
            alert("The Old Street field is required.");
	        document.getElementById('infochange[old_street]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[old_city]').value == "") {
            alert("The Old City field is required.");
	        document.getElementById('infochange[old_city]').focus();
	        return false;
	    }
		if (document.getElementById('infochange[old_state]').value == "") {
            alert("The Old State field is required.");
	        document.getElementById('infochange[old_state]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[old_zip]').value == "") {
            alert("The Old Zip field is required.");
	        document.getElementById('infochange[old_zip]').focus();
	        return false;
	    }
		if (document.getElementById('infochange[new_street]').value == "") {
            alert("The New Street field is required.");
	        document.getElementById('infochange[new_street]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[new_city]').value == "") {
            alert("The New City field is required.");
	        document.getElementById('infochange[new_city]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[new_state]').value == "") {
            alert("The New State field is required.");
	        document.getElementById('infochange[new_state]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[new_zip]').value == "") {
            alert("The New Zip field is required.");
	        document.getElementById('infochange[new_zip]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[home_phone]').value == "") {
            alert("The Home Phone field is required.");
	        document.getElementById('infochange[home_phone]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[drivers_license]').value == "") {
            alert("The Driver's License Number field is required.");
	        document.getElementById('infochange[drivers_license]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[state_issued]').value == "") {
            alert("The State Issued field is required.");
	        document.getElementById('infochange[state_issued]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[expiration]').value == "") {
            alert("The Expiration field is required.");
	        document.getElementById('infochange[expiration]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[dependants]').value == "") {
            alert("The Dependants field is required.");
	        document.getElementById('infochange[dependants]').focus();
	        return false;
	    }
	    if (!marital_status) {
			alert("What is your Marital status?");
			window.location.hash="#marital_status";
			return false;
		}
		if (!veteran_status) {
			alert("What is your Veteran status?");
			window.location.hash="#veteran_status";
			return false;
		}
	    if (document.getElementById('infochange[emergency_name]').value == "") {
            alert("The Emergency Name field is required.");
	        document.getElementById('infochange[emergency_name]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[emergency_relation]').value == "") {
            alert("The Emergency Relation field is required.");
	        document.getElementById('infochange[emergency_relation]').focus();
	        return false;
	    }
	    if (document.getElementById('infochange[emergency_phone]').value == "") {
            alert("The Emergency Phone field is required.");
	        document.getElementById('infochange[emergency_phone]').focus();
	        return false;
	    }
	     return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}	    
var sex = false;

function verifyAuthorize() {
    try {
    	if (document.getElementById('authorize[last_name]').value == "") {
            alert("The Last Name field is required.");
	        document.getElementById('authorize[last_name]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[first_name]').value == "") {
            alert("The First Name field is required.");
	        document.getElementById('authorize[first_name]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[birth_date]').value == "") {
            alert("The Date of Birth field is required.");
	        document.getElementById('authorize[birth_date]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[social_security]').value == "") {
            alert("The Social Security Number field is required.");
	        document.getElementById('authorize[social_security]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[drviers_license]').value == "") {
            alert("The Driver's License Number field is required.");
	        document.getElementById('authorize[drviers_license]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[state]').value == "") {
            alert("The State field is required.");
	        document.getElementById('authorize[state]').focus();
	        return false;
	    }
	    if (!sex) {
			alert("Please indicate gender.");
			window.location.hash="#sex";
			return false;
		}
	    if (document.getElementById('authorize[street_first]').value == "") {
            alert("The Street field is required.");
	        document.getElementById('authorize[street_first]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[citystreetzip_first]').value == "") {
            alert("The City, State, and Zip field is required.");
	        document.getElementById('authorize[citystreetzip_first]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[from_first]').value == "") {
            alert("The Date From field is required.");
	        document.getElementById('authorize[from_first]').focus();
	        return false;
	    }
	    if (document.getElementById('authorize[to_first]').value == "") {
            alert("The Date To field is required.");
	        document.getElementById('authorize[to_first]').focus();
	        return false;
	    }
	    return true;
	}
	catch(e) {
		alert(e.message);
		return false;
	}
}

function check_data()
{
  if (document.getElementById('pickuploc').selectedIndex == 0)
  {
    alert('Please choose a pickup location.');
    document.getElementById('pickuploc').focus();
    return(false);
  }
  if (document.getElementById('returnloc').selectedIndex == 0)
  {
    alert('Please choose a drop off location.');
    document.getElementById('returnloc').focus();
    return(false);
  }
  if (document.getElementById('reservation_info_vehicles_id').selectedIndex == 0)
  {
    alert('Please choose vehicle preference.');
    document.getElementById('reservation_info_vehicles_id').focus();
    return(false);
  }
  
  var divStatusHolder = document.getElementById("status_holder");
  divStatusHolder.style.display = 'none';
  sendRequest();
  return(false);
}

function sendRequest()
{
  var oForm = document.forms[0];
  var sBody = getRequestBody(oForm);
  var oXmlHttp = zXmlHttp.createRequest();
  
  oXmlHttp.open("post", 'check_form_data.php', true);
  oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  oXmlHttp.onreadystatechange = 
function ()
  {
    if (oXmlHttp.readyState == 4)
    {
      if (oXmlHttp.status == 200)
      {
        saveResult(oXmlHttp.responseText);
      }
      else
      {
        saveResult("An error occurred: " + oXmlHttp.statusText);
      }
    }
  };
  oXmlHttp.send(sBody);
  return(false);
}

function getRequestBody(oForm)
{
  var aParams = new Array();
  for (var i=0 ; i < oForm.elements.length; i++)
  {
    var sParam = encodeURIComponent(oForm.elements[i].name);
    sParam += "=";
    sParam += encodeURIComponent(oForm.elements[i].value);
    aParams.push(sParam);
  }
  return aParams.join("&");
}

function saveResult(sMessage) {
    if (sMessage == 'data_good')
    {
      pageTracker._trackPageview('sent to erez');
      launch_voice();
    }
    else
    {
      var divStatusHolder = document.getElementById("status_holder");
      divStatusHolder.style.display = 'block';
      var divStatus = document.getElementById("divStatus");
      divStatus.innerHTML = sMessage;
      // alert(sMessage);
    }
}

function launch_voice()
{
  timeOut = setTimeout("send_to_erez()",8000);
  var divStatusHolder = document.getElementById("myvideo");
  divStatusHolder.style.display = 'block';
}

function show_video()
{
  var divStatusHolder = document.getElementById("myvideo");
  divStatusHolder.style.display = 'block';
}

function send_to_erez()
{
  clearTimeout(timeOut);
  var oForm = document.forms[0];
  oForm.submit();
}

function check_content()
{
  // Get natural heights
  var cHeight = xHeight("content");
  var minHeight = 400;
  // Find the maximum height
  var maxHeight = Math.max(cHeight, minHeight);
  // alert(lHeight);
  // Assign maximum height to all columns
  xHeight("content", maxHeight);
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function getMouseXY(e) {
  if (document.all) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
  // catch possible negative values in NS4
  return [tempX,tempY];
}

function put_slogan()
{
  mouse_position_array = getMouseXY();
  obj_position_array = findPos(document.getElementById('slogan_img'));
  lowerX = eval(obj_position_array[0] + 15);
  lowerY = eval(obj_position_array[1] + 15) ;
  // alert(lowerX + ' ' + lowerY );
  document.getElementById('slogan').style.left = lowerX + 'px';
  document.getElementById('slogan').style.top = lowerY + 'px';
  document.getElementById('slogan').style.display = 'inline';
}

function verifyRequired() {
  if (document.icpsignup["fields_email"].value == "") {
    alert("The Email field is required.");
    return false;
  }
  if (document.icpsignup["fields_fname"].value == "") {
    alert("The First Name field is required.");
    return false;
  }
  if (document.icpsignup["fields_lname"].value == "") {
    alert("The Last Name field is required.");
    return false;
  }
return true;
}
/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 */
/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */

function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}

function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}

function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}

function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }

function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }

function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
/*
 * Perform a simple self-test to see if the VM is working
 */

function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
/*
 * Calculate the MD5 of an array of little-endian words, and a bit length
 */

function core_md5(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;
    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);
}

function do_form()
{
  var testdata = hex_md5("aw34567uj");
  document.write('<input type="hidden" name="checkval" value="' + testdata + '" />');
  // alert(testdata);
}
/*
 * These functions implement the four basic operations the algorithm uses.
 */

function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}

function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}

function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}

function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}

function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
/*
 * Calculate the HMAC-MD5, of a key and some data
 */

function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }
  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}
/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */

function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}
/*
 * Bitwise rotate a 32-bit number to the left.
 */

function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}
/*
 * Convert a string to an array of little-endian words
 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
 */

function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}
/*
 * Convert an array of little-endian words to a string
 */

function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}
/*
 * Convert an array of little-endian words to a hex string.
 */

function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}
/*
 * Convert an array of little-endian words to a base-64 string
 */

function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

function show_disclaimer()
{
  document.getElementById('disclaimer_iframe').src = 'disclaimer.php'
  document.getElementById('disclaimer_div').style.display='block';
  return false;
}

function hide_disclaimer()
{
  document.getElementById('disclaimer_div').style.display='none';  
  return false;
}
