// JavaScript Document
function popUpWin(page,popup)
{
	var newWin=0;
	var Opt;
	var win = "";
	
	if (popup == '1') {
			Opt = 'personalbar=no,toolbar=no,location=no,directories=no,statusbar=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=350,height=350,left=100,top=100,screenX=100,screenY=100';
	} else {
		if (popup == '2') {
			Opt ='personalbar=no,toolbar=no,location=no,directories=no,statusbar=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=500,height=300,left=100,top=100,screenX=100,screenY=100';
		} else {
			if (popup == '3') {
				win = "newWin";
				Opt ='personalbar=no,toolbar=no,location=no,directories=no,statusbar=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=400,height=200,left=100,top=100,screenX=100,screenY=100';
			}
		}
	}
	if (page == "") {page = "about:blank"};
	
  	if(newWin)
  	{
    	if(!newWin.closed) newWin.close();
  	}
	
	newWin = window.open(page,win,Opt);
	
// write document content	
	if (popup == '3')
	{
		newWin.document.writeln("<div style='text-align:center; font-size:20px; color:#3360A4; font-family:Tahoma; font-weight:bold;'><br /><br />Processing Information...<br /><br />Please Wait...</div>");
	}
}

function download_manual(state) {
	var loc;
	switch (state) {
		case 'Alabama':
			loc = "http://www.dps.state.al.us/public/driverlicense/manual/cdlmanual.pdf"; 
			break;
		case 'Arizona':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Arkansas':
			loc = "http://www.dmv.org/dmv-practice-test.php?thestate=ARKANSAS%20&testtype=COMMERCIAL%20LICENSE&testname=nationwide_cdl";
			break;
		case 'California':
			loc = "http://www.dmv.ca.gov/pubs/comlhdbk/comlhdbk.pdf";
			break;
		case 'Colorado':
			loc = "http://www.revenue.state.co.us/mv_dir/formspdf/2251.pdf";
			break;
		case 'Connecticut':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Florida':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'District of Columbia':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'DE1aware': 
			loc = "http://www.dmv.de.gov/forms/driver_serv_forms/pdfs/dr_frm_cdlmanual.pdf"; 
			break;
		case 'Georgia':
			loc = "http://www.dds.ga.gov/docs/forms/CDLmanual.pdf";
			break;
		case 'Idaho':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Illinois':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Indiana': 
			loc = "http://www.in.gov/dor/mcs/pdf/cdl.pdf";     
			break;
		case 'Iowa':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";   
			break;
		case 'Kansas':
			loc = "http://www.ksrevenue.org/pdf/cdlhb.pdf";       
			break;
		case 'Kentucky':
			loc = "http://www.kentuckystatepolice.org/pdf/CDL%20Driver%20Manual.pdf";    
			break;
		case 'Louisiana':
			loc = "http://www.dps.state.la.us/omv/cdlguide.pdf";  
			break;
		case 'Massachusetts':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Maryland': 
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Michigan': 
			loc = "http://www.michigan.gov/documents/cdlmanul_16090_7.pdf";  
			break;
		case 'Minnesota':
			loc = "http://www.dps.state.mn.us/dvs/Commercial%20Drv/CDL.htm";
			break;
		case 'Missouri':
			loc = "http://www.dor.mo.gov/mvdl/drivers/forms/cdl.pdf"; 
			break;
		case 'Montana':
			loc = "http://www.doj.state.mt.us/driving/forms/25-0300.pdf"; 
			break;
		case 'Nebraska':
			loc = "http://www.dmv.state.ne.us/examining/pdf/cdlmanual.pdf";  
			break;
		case 'Nevada':
			loc = "http://nevadadmv.state.nv.us/pdfforms/dlbookcomm.pdf";  
			break;
		case 'New Jersey': 
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'New Mexico':
			loc = "http://www.state.nm.us/tax/pubs/cdlman.htm";  
			break;
		case 'New York':
			loc = "http://www.nysdmv.com/broch/cdlmanual.htm";
			break;
		case 'North Carolina':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'North Dakota': 
			loc = "http://www.state.nd.us/dot/docs/class_c1.pdf"; 
			break;
		case 'Ohio':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Oklahoma': 
			loc = "http://www.dps.state.ok.us/dls/pub/commanual.pdf";
			break;
		case 'Oregon': 
			loc = "http://www.odot.state.or.us/forms/dmv/36.pdf";
			break;
		case 'Pennsylvania': 
			loc = "http://www.dmv.state.pa.us/drivers_manual/commercial_manual.shtml"; 
			break;
		case 'Rhode Island':   
			loc = "http://www.dmv.state.ri.us/documents/manuals/CDLMANC.pdf";
			break;
		case 'South Carolina': 
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'South Dakota':
			loc = "http://www.state.sd.us/dps/dl/Online_Manuals/2005%20CDL%20MANUAL%20.pdf";
			break;
		case 'Tennessee':
			loc = "http://www.dot.state.ia.us/mvd/ods/cdl/cdlmanual.pdf";
			break;
		case 'Texas': 
			loc = "http://www.txdps.state.tx.us/ftp/forms/CDLhandbook.pdf";
			break;
		case 'Utah':
			loc = "http://driverlicense.utah.gov/pdf/cdl.pdf";
			break;
		case 'Vermont':
			loc = "http://www.aot.state.vt.us/dmv/documents/Manuals/CommercialVehicle/2004VTCommercialDriverLicenseManual.pdf";  
			break;
		case 'Virginia':
			loc = "http://www.dmv.state.va.us/webdoc/pdf/dmv60.pdf";  
			break;
		case 'West Virginia':
			loc = "http://www.wvdot.com/6_motorists/Dmv/downloads/2005-CDL-Manual.pdf";
			break;
		case 'Washington':
			loc = "http://www.dol.wa.gov/ds/cdlguide.pdf";
			break;
		case 'Wisconsin':
			loc = "http://www.dot.wisconsin.gov/drivers/docs/cdl-vol1.pdf";
			break;
		case 'Wyoming':
			loc = "http://www.dot.state.wy.us/Default.jsp?sCode=drvcm";
			break;
	}
	if (loc != null) { 
		popUpWin(loc,'',''); 
	} else {
		alert('No manual for the state of ' + state + ' is available.');
	}
	return false;
}

function validate_contact_data()
{
	var frm = document.forms[0];
	
	if (frm.contact_name.value == "")
	{
		alert("Your name is required!");
		frm.contact_name.style.backgroundColor = '#ffff00';
		frm.contact_name.focus();
	} else {
		if (frm.contact_email.value == "") 
		{
			alert("You must leave a valid email address!");
			frm.contact_email.style.backgroundColor = '#ffff00';
			frm.contact_email.focus();
		} else {
			if (check_email(frm.contact_email.value) == false)
			{
				alert('Email format is invalid!');
				frm.contact_email.style.backgroundColor = '#ffff00';
				frm.contact_email.focus();
			} else {
				if (frm.contact_message.value == "")
			   	{
					alert("You must send a message!");
					frm.contact_message.style.backgroundColor = '#ffff00';
					frm.contact_message.focus();
				} else {
					popUpWin('','3');
					frm.action = "sendinfo.php";
					frm.target = "newWin";
					frm.submit();
					frm.reset();
				}
			}
		}
	}
}

function validate_app_data()
{
	var frm = document.forms[0];

	if (frm.Application_Type[0].checked == false && frm.Application_Type[1].checked == false && frm.Application_Type[2].checked == false && frm.Application_Type[3].checked == false && frm.Application_Type[4].checked == false) {
		alert("Your must choose an application type!");
		frm.Application_Type[0].focus();
		return false;
	}
	if (frm.Application_Type[1].checked == true){
		if (frm.school_name.value == '') {
			alert("The name of the school you graduated from is required!");
			frm.school_name.style.backgroundColor = '#ffff00';
			frm.school_name.focus();
			return false;
		} 
		if (frm.school_phone_area.value == "" && frm.school_phone_prefix.value == "" && frm.school_phone_suffix.value == "") {
			alert("School phone number is required!");
			frm.school_phone_area.style.backgroundColor = '#ffff00';
			frm.school_phone_prefix.style.backgroundColor = '#ffff00';
			frm.school_phone_suffix.style.backgroundColor = '#ffff00';
			frm.school_phone_area.focus();
			return false;
		}
		if (frm.school_phone_area.length < 3 || isNaN(frm.school_phone_area.value)) {
			alert("School phone number is invalid!");
			frm.school_phone_area.style.backgroundColor = '#ffff00';
			frm.school_phone_area.focus();
			return false;
		}
		if (frm.school_phone_prefix.length < 3 || isNaN(frm.school_phone_prefix.value)) {
			alert("School phone number is invalid!");
			frm.school_phone_prefix.style.backgroundColor = '#ffff00';
			frm.school_phone_prefix.focus();
			return false;
		}
		if (frm.school_phone_suffix.length < 4 || isNaN(frm.school_phone_suffix.value)) {
			alert("School phone number is invalid!");
			frm.school_phone_suffix.style.backgroundColor = '#ffff00';
			frm.school_phone_suffix.focus();
			return false;
		}
		if (frm.school_graduation_date.value == '') {
			alert("Graduation date is required!");
			frm.school_graduation_date.style.backgroundColor = '#ffff00';
			frm.school_graduation_date.focus();
			return false;
		}
	} 
	if (frm.Name.value == '') {
		alert("Your first name is required!");
		frm.Name.style.backgroundColor = '#ffff00';
		frm.Name.focus();
		return false;
	}
	if (frm.Lastname.value == '') {
		alert("Your last name is required!");
		frm.Lastname.style.backgroundColor = '#ffff00';
		frm.Lastname.focus();
		return false;
	}
	if (frm.homeaddress.value == '') {
		alert("Your home address is required!");
		frm.homeaddress.style.backgroundColor = '#ffff00';
		frm.homeaddress.focus();
		return false;
	}
	if (frm.City.value == '') {
		alert("Please enter a city of residence!");
		frm.City.style.backgroundColor = '#ffff00';
		frm.City.focus();
		return false;
	}
	if (frm.HomeState.value == "State") {
		alert("Please choose your state of residence!");
		frm.HomeState.style.backgroundColor = '#ffff00';
		frm.HomeState.focus();
		return false;
	}
	if (frm.Zip.value == '') {
		alert("Please enter your zipcode!");
		frm.Zip.style.backgroundColor = '#ffff00';
		frm.Zip.focus();
		return false;
	}
	if (isNaN(frm.Zip.value)) {
		alert("Zipcode must be numeric!");
		frm.Zip.style.backgroundColor = '#ffff00';
		frm.Zip.focus();
		return false;
	}
	if (frm.Zip.value.length < 5) {
		alert("Zipcode must be at least 5 digits!");
		frm.Zip.style.backgroundColor = '#ffff00';
		frm.Zip.focus();
		return false;
	}
	if (frm.Dobmonth.value == 'Month') {
		alert("Please choose the month of your birth!");
		frm.Dobmonth.style.backgroundColor = '#ffff00';
		frm.Dobmonth.focus();
		return false;
	}
	if (frm.DOBday.value == 'Day') {
		alert("Please choose the day of your birth!");
		frm.DOBday.style.backgroundColor = '#ffff00';
		frm.DOBday.focus();
		return false;
	}
	if (frm.DOByear.value == 'Year') {
		alert("Please choose the year of your birth!");
		frm.DOByear.style.backgroundColor = '#ffff00';
		frm.DOByear.focus();
		return false;
	}
	if (frm.city_born.value == '') {
		alert("Please enter the birth city!");
		frm.city_born.style.backgroundColor = '#ffff00';
		frm.city_born.focus();
		return false;
	}
	if (frm.State_born.value == 'State') {
		alert("Please choose your birth state!");
		frm.State_born.style.backgroundColor = '#ffff00';
		frm.State_born.focus();
		return false;
	}
/*	if (frm.ss1.value == '' && frm.ss2.value == '' && frm.ss3.value == '') {
		alert("Please enter your social security number!");
		frm.ssl.style.backgroundColor = '#ffff00';
		frm.ss2.style.backgroundColor = '#ffff00';
		frm.ss3.style.backgroundColor = '#ffff00';
		frm.ss1.focus();
		return false;
	} else { */
/*	if (frm.ss1.length < 3 || frm.ss2.length < 2 || frm.ss3.length < 4) {
		alert("Your social security number is invalid!");
		frm.ssl.style.backgroundColor = '#ffff00';
		frm.ss2.style.backgroundColor = '#ffff00';
		frm.ss3.style.backgroundColor = '#ffff00';
		frm.ss1.focus();
		return false;
	} else { */
/*	if (isNaN(frm.ss1.value) || isNaN(frm.ss2.value) || isNaN(frm.ss3.value)) {
		alert("Social security number must be numeric!");
		frm.ssl.style.backgroundColor = '#ffff00';
		frm.ss2.style.backgroundColor = '#ffff00';
		frm.ss3.style.backgroundColor = '#ffff00';
		frm.ss1.focus();
		return false;
	} else { */
	if (frm.areacode.value == '' && frm.prefix.value == '' && frm.suffix.value == '') {
		alert("Please enter your home phone number!");
		frm.areacode.style.backgroundColor = '#ffff00';
		frm.prefix.style.backgroundColor = '#ffff00';
		frm.suffix.style.backgroundColor = '#ffff00';
		frm.areacode.focus();
		return false;
	}
	if (frm.areacode.length < 3 || frm.prefix.length < 3 || frm.suffix.length < 4) {
		alert("Your home phone number is invalid!");
		frm.areacode.style.backgroundColor = '#ffff00';
		frm.prefix.style.backgroundColor = '#ffff00';
		frm.suffix.style.backgroundColor = '#ffff00';
		frm.areacode.focus();
		return false;
	}
	if (isNaN(frm.areacode.value) || isNaN(frm.prefix.value) || isNaN(frm.suffix.value)) {
		alert("Home phone number must be numeric!");
		frm.areacode.style.backgroundColor = '#ffff00';
		frm.prefix.style.backgroundColor = '#ffff00';
		frm.suffix.style.backgroundColor = '#ffff00';
		frm.areacode.focus();
		return false;
	}
	if (frm.cellareacode.value != '' || frm.cellprefix.value != '' || frm.cellsuffix.value != '') {
		if (frm.cellareacode.length < 3 || frm.cellprefix.length < 3 || frm.cellsuffix.length < 4) {
			alert("Your cell phone number is invalid!");
			frm.cellareacode.style.backgroundColor = '#ffff00';
			frm.cellprefix.style.backgroundColor = '#ffff00';
			frm.cellsuffix.style.backgroundColor = '#ffff00';
			frm.cellareacode.focus();
			return false;
		} 
		if (isNaN(frm.cellareacode.value) || isNaN(frm.cellprefix.value) || isNaN(frm.cellsuffix.value))
		{
			alert("Cell phone number must be numeric!");
			frm.cellareacode.style.backgroundColor = '#ffff00';
			frm.cellprefix.style.backgroundColor = '#ffff00';
			frm.cellsuffix.style.backgroundColor = '#ffff00';
			frm.cellareacode.focus();
			return false;
		} 
	}
	if (frm.email.value != '' && check_email(frm.email.value) == false) {
		alert('Email format is invalid!');
		frm.email.style.backgroundColor = '#ffff00';
		frm.email.focus();
		return false;
	}
/*	if (frm.best_time.value == '') {
		alert('Please enter the best time to reach you!');
		frm.best_time.style.backgroundColor = '#ffff00';
		frm.best_time.focus();
		return false; 
	}
	if (frm.best_time.value.indexOf(":") == -1 && (frm.best_time.value.indexOf("AM") == -1 || frm.best_time.value.indexOf("PM") == -1 || frm.best_time.value.indexOf("am") == -1 || frm.best_time.value.indexOf("pm") == -1)) {
		alert('Best time has invalid format!');
		frm.best_time.style.backgroundColor = '#ffff00';
		frm.best_time.focus();
		return false; 
	}  else { */

	if (frm.month_to_start.value == 'Month') {
		alert("Please choose your start month!");
		frm.month_to_start.style.backgroundColor = '#ffff00';
		frm.month_to_start.focus();
		return false;
	}
	if (frm.day_to_start.value == 'Day') {
		alert("Please choose your start day!");
		frm.day_to_start.style.backgroundColor = '#ffff00';
		frm.day_to_start.focus();
		return false;
	}
	if (frm.year_start.value == 'Year') {
		alert("Please choose your start year!");
		frm.year_start.style.backgroundColor = '#ffff00';
		frm.year_start.focus();
		return false;
	}
	if (frm.Drivers_License.value == '') {
		alert("Your drivers license is required!");
		frm.Drivers_License.style.backgroundColor = '#ffff00';
		frm.Drivers_License.focus();
		return false;
	}
	if (frm.dl_state.value == 'State') {
		alert("Please select the state where you received your drivers license!");
		frm.dl_state.style.backgroundColor = '#ffff00';
		frm.dl_state.focus();
		return false;
	}
	if (frm.exp_month.value == 'Month') {
		alert("Please select the expiration month your drivers license!");
		frm.exp_month.style.backgroundColor = '#ffff00';
		frm.exp_month.focus();
		return false;
	}
	if (frm.exp_year.value == 'Year') {
		alert("Please select the expriration year of your drivers license!");
		frm.exp_year.style.backgroundColor = '#ffff00';
		frm.exp_year.focus();
		return false;
	}
	if (frm.Do_I_Have_A_CDL_License[0].checked == false && frm.Do_I_Have_A_CDL_License[1].checked == false) {
		alert("Please indicate whether you have your CDL license!");
		frm.Do_I_Have_A_CDL_License[0].focus();
		return false;
	}
	if (frm.CDL_license_in_another_state[0].checked == false && frm.CDL_license_in_another_state[1].checked == false) {
		alert("Please indicate whether you have a license in another state!");
		frm.CDL_license_in_another_state[0].focus();
		return false;
	}
	if (frm.CDL_license_in_another_state[0].checked == true) {
		if (frm.other_state.value == "State"){
			alert("Please choose the state you have a license for!");
			frm.other_state.style.backgroundColor = '#ffff00';
			frm.other_state.focus();
			return false;
		} 
/*		if (frm.other_license.value == ""){
			alert("License number required!");
			frm.other_license.style.backgroundColor = '#ffff00';
			frm.other_license.focus();
			return false;
		}  else { */
	}
	if (frm.Suspended_License[0].checked == false && frm.Suspended_License[1].checked == false) {
		alert("Please indicate whether you had your license suspended!");
		frm.Suspended_License[0].focus();
		return false;
	}
	if (frm.Suspended_License[0].checked == true) {
		if (frm.explanation_for_suspension.value == ""){
			alert("Please enter an explanation for the suspended license!");
			frm.explanation_for_suspension.style.backgroundColor = '#ffff00';
			frm.explanation_for_suspension.focus();
			return false;
		}
	}
	if (frm.Tickets.value != 'none') {
		if (frm.Tickets_For.value == ""){
			alert("Please enter an explanation for the traffic violations you have!");
			frm.Tickets_For.style.backgroundColor = '#ffff00';
			frm.Tickets_For.focus();
			return false;
		}
	}
	if (frm.Accidents.value != 'none') {
		if (frm.explain_accident.value == ""){
			alert("Please enter an explanation for the accidents you had!");
			frm.explain_accident.style.backgroundColor = '#ffff00';
			frm.explain_accident.focus();
			return false;
		}
	}
	if (frm.DUI_conviction[0].checked == false && frm.DUI_conviction[1].checked == false) {
		alert("Please indicate whether you have a DUI conviction!");
		frm.DUI_conviction[0].focus();
		return false;
	}
	if (frm.DUI_conviction[0].checked == true) {
		if (frm.DUI_When.value == ""){
			alert("Please enter an explanation for any DUI convictions you have!");
			frm.DUI_When.style.backgroundColor = '#ffff00';
			frm.DUI_When.focus();
			return false;
		}
	}
	if (frm.convicted_of_crime[0].checked == false && frm.convicted_of_crime[1].checked == false) {
		alert("Please indicate whether you have been convicted of a crime!");
		frm.convicted_of_crime[0].focus();
		return false;
	}
	if (frm.convicted_of_crime[0].checked == true) {
		if (frm.explanation_for_crime.value == ""){
			alert("Please enter an explanation for any crime convictions you have!");
			frm.explanation_for_crime.style.backgroundColor = '#ffff00';
			frm.explanation_for_crime.focus();
			return false;
		}
	}
	if (frm.Emp1.value == "" ) {
		alert("Please indicate current employer!");
		frm.Emp1.style.backgroundColor = '#ffff00';
		frm.Emp1.focus();
		return false;
	} 
	if (frm.E1startmonth.value == "Month" ) {
		alert("Please select the start month with current employer!");
		frm.E1startmonth.style.backgroundColor = '#ffff00';
		frm.E1startmonth.focus();
		return false;
	} 
	if (frm.E1startyear.value == "" ) {
		alert("Please select the start year with current employer!");
		frm.E1startyear.style.backgroundColor = '#ffff00';
		frm.E1startyear.focus();
		return false;
	}
/*	if (frm.E1address.value == "" ) {
		alert("Please enter the current employer's address!");
		frm.E1address.style.backgroundColor = '#ffff00';
		frm.E1address.focus();
		return false;
	} else { */
	if (frm.E1City.value == "" ) {
		alert("Please enter the current employer's city!");
		frm.E1City.style.backgroundColor = '#ffff00';
		frm.E1City.focus();
		return false;
	}
	if (frm.E1State.value == "State" ) {
		alert("Please enter the current employer's state!");
		frm.E1State.style.backgroundColor = '#ffff00';
		frm.E1State.focus();
		return false;
	}
	if (frm.E1zip.value == "" ) {
		alert("Please enter the current employer's city!");
		frm.E1City.style.backgroundColor = '#ffff00';
		frm.E1City.focus();
		return false;
	}
/*	if (frm.E1area_code.value == '' && frm.E1_prefix.value == '' && frm.E1_suffix.value == '') {
		alert("Please enter your employer's phone number!");
		frm.E1area_code.style.backgroundColor = '#ffff00';
		frm.E1_prefix.style.backgroundColor = '#ffff00';
		frm.E1_suffix.style.backgroundColor = '#ffff00';
		frm.E1area_code.focus();
		return false;
	} else { */
/*	if (frm.E1area_code.length < 3 || frm.E1_prefix.length < 3 || frm.E1_suffix.length < 4) {
		alert("Employer phone number is invalid!");
		frm.E1area_code.style.backgroundColor = '#ffff00';
		frm.E1_prefix.style.backgroundColor = '#ffff00';
		frm.E1_suffix.style.backgroundColor = '#ffff00';
		frm.E1area_code.focus();
		return false;
	} else { */
/*	if (isNaN(frm.E1area_code.value) || isNaN(frm.E1_prefix.value) || isNaN(frm.E1_suffix.value)) {
		alert("Employer phone number must be numeric!");
		frm.E1area_code.style.backgroundColor = '#ffff00';
		frm.E1_prefix.style.backgroundColor = '#ffff00';
		frm.E1_suffix.style.backgroundColor = '#ffff00';
		frm.E1area_code.focus();
		return false;
	} else { */
/*	if (frm.E1_extension.value != '' && isNaN(frm.E1_extension.value)) {
		alert("Please enter a valid extension number!");
		frm.E1_extension.style.backgroundColor = '#ffff00';
		frm.E1_extension.focus();
		return false;
	} else { */
/*	if (frm.E1_contact.value == "" ) {
		alert("Please enter the name of the contact person at your current job!");
		frm.E1_contact.style.backgroundColor = '#ffff00';
		frm.E1_contact.focus();
		return false;
	} else { */
	if (frm.E1_job_title.value == "" ) {
		alert("Please enter your current job title!");
		frm.E1_job_title.style.backgroundColor = '#ffff00';
		frm.E1_job_title.focus();
		return false;
	}
	if (frm.E1_month_quit.value != 'Month' && frm.E1_quit_year.value != 'Year') 
	{
		if (frm.E1_month_quit.value != "Still Employed" && frm.E1_left_because.value == "") 
		{
			alert("Please enter reason for leaving job!");
			frm.E1_left_because.style.backgroundColor = '#ffff00';
			frm.E1_left_because.focus();
			return false;
		}
	}
if (frm.Emp2.value != "" ) {
	if (frm.E2startmonth.value == "Month" ) {
		alert("Please select the start month with previous employer!");
		frm.E2startmonth.style.backgroundColor = '#ffff00';
		frm.E2startmonth.focus();
		return false;
	}
	if (frm.E2startyear.value == "Year" ) {
		alert("Please select the start year with previous employer!");
		frm.E2startyear.style.backgroundColor = '#ffff00';
		frm.E2startyear.focus();
		return false;
	}
/*	if (frm.E2address.value == "" ) {
		alert("Please enter the previous employer's address!");
		frm.E2address.style.backgroundColor = '#ffff00';
		frm.E2address.focus();
		return false;
	} else { */
/*	if (frm.E2City.value == "" ) {
		alert("Please enter the previous employer's city!");
		frm.E2City.style.backgroundColor = '#ffff00';
		frm.E2City.focus();
		return false;
	} else { */
	if (frm.E2State.value == "State" ) {
		alert("Please enter the previous employer's state!");
		frm.E2State.style.backgroundColor = '#ffff00';
		frm.E2State.focus();
		return false;
	}
	if (frm.E2zip.value == "" ) {
		alert("Please enter the previous employer's zip!");
		frm.E2zip.style.backgroundColor = '#ffff00';
		frm.E2zip.focus();
		return false;
	}
/*	if (frm.E2area_code.value == '' && frm.E2_prefix.value == '' && frm.E2_suffix.value == '') {
		alert("Please enter your previous employer's phone number!");
		frm.E2area_code.style.backgroundColor = '#ffff00';
		frm.E2_prefix.style.backgroundColor = '#ffff00';
		frm.E2_suffix.style.backgroundColor = '#ffff00';
		frm.E2area_code.focus();
		return false;
	} else { */
/*	if (frm.E2area_code.length < 3 || frm.E2_prefix.length < 3 || frm.E2_suffix.length < 4) {
		alert("Previous employer phone number is invalid!");
		frm.E2area_code.style.backgroundColor = '#ffff00';
		frm.E2_prefix.style.backgroundColor = '#ffff00';
		frm.E2_suffix.style.backgroundColor = '#ffff00';
		frm.E2area_code.focus();
		return false;
	} else { */
/*	if (isNaN(frm.E2area_code.value) || isNaN(frm.E2_prefix.value) || isNaN(frm.E2_suffix.value)) {
		alert("Previous employer phone number must be numeric!");
		frm.E2area_code.style.backgroundColor = '#ffff00';
		frm.E2_prefix.style.backgroundColor = '#ffff00';
		frm.E2_suffix.style.backgroundColor = '#ffff00';
		frm.E2area_code.focus();
		return false;
	} else { */
/*	if (frm.E2_extension.value != '' && isNaN(frm.E2_extension.value)) {
		alert("Please enter a valid extension number!");
		frm.E2_extension.style.backgroundColor = '#ffff00';
		frm.E2_extension.focus();
		return false;
	} else { */
/*	if (frm.E2_contact.value == "" ) {
		alert("Please enter the name of the contact person at your previous job!");
		frm.E2_contact.style.backgroundColor = '#ffff00';
		frm.E2_contact.focus();
		return false;
	} else { */
	if (frm.E2_job_title.value == "" ) {
		alert("Please enter your job title at your previous job!");
		frm.E2_job_title.style.backgroundColor = '#ffff00';
		frm.E2_job_title.focus();
		return false;
	}
	if (frm.E2_month_quit.value != 'Month' && frm.E2_quit_year.value != 'Year')
	{
		if (frm.E2_month_quit.value != "Still Employed" && frm.E2_left_because.value == "") 
		{
			alert("Please enter reason for leaving previous job!");
			frm.E2_left_because.style.backgroundColor = '#ffff00';
			frm.E2_left_because.focus();
			return false;
		}
	}
}
/*	if (frm.reference1_name.value == "" ) {
		alert("Please enter a name for a reference!");
		frm.reference1_name.style.backgroundColor = '#ffff00';
		frm.reference1_name.focus();
		return false; 
	} else { */
/*	if (frm.reference1_is_my.value == "" ) {
		alert("Please enter your relationship to the reference!");
		frm.reference1_is_my.style.backgroundColor = '#ffff00';
		frm.reference1_is_my.focus();
		return false;
	} else { */
/*	if (frm.R1_area_code.value == '' && frm.R1_prefix.value == '' && frm.R1_suffix.value == '') {
		alert("Please enter your reference's phone number!");
		frm.R1_area_code.style.backgroundColor = '#ffff00';
		frm.R1_prefix.style.backgroundColor = '#ffff00';
		frm.R1_suffix.style.backgroundColor = '#ffff00';
		frm.R1_area_code.focus();
		return false;
	} else { */
/*	if (frm.R1_area_code.length < 3 || frm.R1_prefix.length < 3 || frm.R1_suffix.length < 4) {
		alert("The phone number for the reference is invalid!");
		frm.R1_area_code.style.backgroundColor = '#ffff00';
		frm.R1_prefix.style.backgroundColor = '#ffff00';
		frm.R1_suffix.style.backgroundColor = '#ffff00';
		frm.R1_area_code.focus();
		return false;
	} else { */
/*	if (isNaN(frm.R1_area_code.value) || isNaN(frm.R1_prefix.value) || isNaN(frm.R1_suffix.value)) {
		alert("The phone number for the reference must be numeric!");
		frm.R1_area_code.style.backgroundColor = '#ffff00';
		frm.R1_prefix.style.backgroundColor = '#ffff00';
		frm.R1_suffix.style.backgroundColor = '#ffff00';
		frm.R1_area_code.focus();
		return false;
	} else { */
	popUpWin('','3');
	frm.action = "sendinfo.php";
	frm.target = "newWin";
	frm.submit();
	frm.reset();
	return false;
}

function validate_free_data()
{
	var frm = document.forms[0];
	
	if (frm.full_name.value == "")
	{
		alert("Your full name is required!");
		frm.full_name.style.backgroundColor = '#ffff00';
		frm.full_name.focus();
		return false;
	}
	if (frm.age.value == "")
   	{
		alert("Your age is required!");
		frm.age.style.backgroundColor = '#ffff00';
		frm.age.focus();
		return false;
	}
/*	if (frm.home_phone_area.value == "" || frm.home_phone_prefix.value == "" || frm.home_phone_suffix.value == "")
	{
		alert("Your home phone is required!");
		frm.home_phone_area.style.backgroundColor = '#ffff00';
		frm.home_phone_prefix.style.backgroundColor = '#ffff00';
		frm.home_phone_suffix.style.backgroundColor = '#ffff00';
		frm.home_phone_area.focus();
		return false;
	} else { */
		if (frm.home_phone_area.length < 3 || isNaN(frm.home_phone_area.value) || frm.home_phone_area.value == "") {
			alert("Home phone number is invalid!");
			frm.home_phone_area.style.backgroundColor = '#ffff00';
			frm.home_phone_area.focus();
			return false;
		}
		if (frm.home_phone_prefix.length < 3 || isNaN(frm.home_phone_prefix.value) || frm.home_phone_prefix.value == "") {
			alert("Home phone number is invalid!");
			frm.home_phone_prefix.style.backgroundColor = '#ffff00';
			frm.home_phone_prefix.focus();
			return false;
		}
		if (frm.home_phone_suffix.length < 4 || isNaN(frm.home_phone_suffix.value) || frm.home_phone_suffix.value == "") {
			alert("Home phone number is invalid!");
			frm.home_phone_suffix.style.backgroundColor = '#ffff00';
			frm.home_phone_suffix.focus();
			return false;
		}
//	}
	if (frm.cell_phone_area.value != "" || frm.cell_phone_prefix.value != "" || frm.cell_phone_suffix.value != "")
	{
		if (frm.cell_phone_area.length < 3 || isNaN(frm.cell_phone_area.value) || frm.cell_phone_area.value == "") 
		{
			alert("Cell phone number is invalid!");
			frm.cell_phone_area.style.backgroundColor = '#ffff00';
			frm.cell_phone_area.focus();
			return false;
		}
		if (frm.cell_phone_prefix.length < 3 || isNaN(frm.cell_phone_prefix.value) || frm.cell_phone_prefix.value == "")
		{
			alert("Cell phone number is invalid!");
			frm.cell_phone_prefix.style.backgroundColor = '#ffff00';
			frm.cell_phone_prefix.focus();
			return false;
		}
		if (frm.cell_phone_suffix.length < 4 || isNaN(frm.cell_phone_suffix.value) || frm.cell_phone_suffix.value == "")
		{
			alert("Cell phone number is invalid!");
			frm.cell_phone_suffix.style.backgroundColor = '#ffff00';
			frm.cell_phone_suffix.focus();
			return false;
		}
	}
	if (frm.email.value == "") 
	{
		alert("You must leave a valid email address!");
		frm.email.style.backgroundColor = '#ffff00';
		frm.email.focus();
		return false;
	}
	if (check_email(frm.email.value) == false)
	{
		alert('Email format is invalid!');
		frm.email.style.backgroundColor = '#ffff00';
		frm.email.focus();
		return false;
	}
	popUpWin('','3');
	frm.action = "sendinfo.php";
	frm.target = "newWin";
	frm.submit();
	frm.reset();
	return false;
}

function validate_testimonial_data() 
{
	var frm = document.forms[0];
	if (frm.testimonial_name.value == "")
	{
		alert("Your full name is required!");
		frm.testimonial_name.style.backgroundColor = '#ffff00';
		frm.testimonial_name.focus();
	} else {
		if (frm.testimonial_city.value != "" && frm.testimonial_state.value == "State")
		{
			alert("You must select the state for your city!");
			frm.testimonial_state.style.backgroundColor = '#ffff00';
			frm.testimonial_state.focus();
		} else {
			if (frm.testimonial_grad_year.value != "" && isNaN(frm.testimonial_grad_year.value)) 
			{
				alert("Graduation year must be numeric!");
				frm.testimonial_grad_year.style.backgroundColor = '#ffff00';
				frm.testimonial_grad_year.focus();
			} else {
				if (frm.testimonial_message.value == "") 
				{
					alert("You must enter a message in the testimonial field!");
					frm.testimonial_message.style.backgroundColor = '#ffff00';
					frm.testimonial_message.focus();
				} else {
					popUpWin('','3');
					frm.action = "sendinfo.php";
					frm.target = "newWin";
					frm.submit();
					frm.reset();
				}
			}
		}
	}
	return false;
}

function terms(){
	var frm = document.forms[0];
	if (frm.answer.checked == false)
	{
		alert("You must agree to the Terms Of Use before submitting the form!");
		return false;
	}
	if (validate_app_data() == false)
	{
		return false;
	}
}	

function check_email(email)
{
		var at_pos = email.indexOf("@");
		if (at_pos == -1)
		{
			return false;
		}
		
		var dot_pos = email.indexOf(".");
		if (dot_pos == -1)
		{
			return false;
		}
		
		var valid_chars = "abcdefghijklmnopqrstuvwxyz0123456789@_-.";
		var len = email.length;
		
		for (var i=0; i < len; i++)
		{
			var letter = email.charAt(i).toLowerCase();
			if (valid_chars.indexOf(letter) != -1) 	continue;
			return false;
		}
}

function place_object(){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"731\" height=\"266\">");
	document.write("<param name=\"movie\" value=\"Flash/header.swf\" />");
    document.write("<param name=\"quality\" value=\"high\" />");
    document.write("<param name=\"menu\" value=\"false\" />");
    document.write("<!--[if !IE]> <-->");
    document.write("<object data=\"Flash/header.swf\" width=\"731\" height=\"266\" type=\"application/x-shockwave-flash\">");
    document.write("<param name=\"quality\" value=\"high\" />");
    document.write("<param name=\"menu\" value=\"false\" />");
    document.write("<param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" />");
    document.write("FAIL (the browser should render some flash content, not this).");
    document.write("</object>");
    document.write("<!--> <![endif]-->");
	document.write("</object>");
}
