
function validatecontact() {
	var emailaddress=document.contactform.contactemail

	if (document.contactform.contactname.value=="") {
		alert("Please fill out the Your Name field.");
		document.contactform.contactname.focus();
		return false;
	}

	if (document.contactform.contactemail.value=="") {
		alert("Please fill out the E-mail field.");
		document.contactform.contactemail.focus();
		return false;
	}

	if (checkemail(emailaddress.value)==false){
		emailaddress.value="";
		emailaddress.focus();
		return false;
	}

	if (document.contactform.contactcomments.value=="") {
		alert("Please fill out the Tell Us How We Can Help You field.");
		document.contactform.contactcomments.focus();
		return false;
	}

	document.contactform.submit();

}

function validateorder() {
	var emailaddress=document.orderform.Email

	if (document.orderform.Company_Name.value=="") {
		alert("Please fill out the Company Name field.");
		document.orderform.Company_Name.focus();
		return false;
	}

	if (document.orderform.Contact_Name.value=="") {
		alert("Please fill out the Contact Name field.");
		document.orderform.Contact_Name.focus();
		return false;
	}

	if (document.orderform.Direct_Number.value=="") {
		alert("Please fill out the Direct Phone Number field.");
		document.orderform.Direct_Number.focus();
		return false;
	}

	if (document.orderform.Email.value=="") {
		alert("Please fill out the Email Address field.");
		document.orderform.Email.focus();
		return false;
	}

	if (checkemail(emailaddress.value)==false){
		emailaddress.value="";
		emailaddress.focus();
		return false;
	}

//	if (document.orderform.Street_Address.value=="") {
//		alert("Please fill out the Address 1 field.");
//		document.orderform.Street_Address.focus();
//		return false;
//	}

//	if (document.orderform.Addtl_Address.value=="") {
//		alert("Please fill out the Address 2 field.");
//		document.orderform.Addtl_Address.focus();
//		return false;
//	}

//	if (document.orderform.City.value=="") {
//		alert("Please fill out the City field.");
//		document.orderform.City.focus();
//		return false;
//	}

//	if (document.orderform.Zip.value=="") {
//		alert("Please fill out the Zip field.");
//		document.orderform.Zip.focus();
//		return false;
//	}

//	if (document.orderform.Phone.value=="") {
//		alert("Please fill out the Phone field.");
//		document.orderform.Phone.focus();
//		return false;
//	}

//	if (document.orderform.Fax.value=="") {
//		alert("Please fill out the Fax field.");
//		document.orderform.Fax.focus();
//		return false;
//	}

	if (document.orderform.Position_Title.value=="") {
		alert("Please fill out the Position Title field.");
		document.orderform.Position_Title.focus();
		return false;
	}

//	if (document.orderform.Work_Hours.value=="") {
//		alert("Please fill out the Work Hours field.");
//		document.orderform.Work_Hours.focus();
//		return false;
//	}

//	if (document.orderform.Start_Date.value=="") {
//		alert("Please fill out the Start Date field.");
//		document.orderform.Start_Date.focus();
//		return false;
//	}

//	if (document.orderform.Department.value=="") {
//		alert("Please fill out the Department field.");
//		document.orderform.Department.focus();
//		return false;
//	}

//	if (document.orderform.Report_To.value=="") {
//		alert("Please fill out the Report To field.");
//		document.orderform.Report_To.focus();
//		return false;
//	}

//	if (document.orderform.Avg_OT_Week.value=="") {
//		alert("Please fill out the Average Overtime / Week field.");
//		document.orderform.Avg_OT_Week.focus();
//		return false;
//	}

//	if (document.orderform.Education_Req.value=="") {
//		alert("Please fill out the Education Required field.");
//		document.orderform.Education_Req.focus();
//		return false;
//	}

//	if (document.orderform.Years_Experience.value=="") {
//		alert("Please fill out the Years Experience Required field.");
//		document.orderform.Years_Experience.focus();
//		return false;
//	}

//	if (document.orderform.Must_Know.value=="") {
//		alert("Please fill out the Candidate Must Know field.");
//		document.orderform.Must_Know.focus();
//		return false;
//	}

//	if (document.orderform.Ideal_Would_Know.value=="") {
//		alert("Please fill out the Ideal Candidate Would Know field.");
//		document.orderform.Ideal_Would_Know.focus();
//		return false;
//	}

	if (document.orderform.Duties.value=="") {
		alert("Please fill out the Duties field.");
		document.orderform.Duties.focus();
		return false;
	}

	document.orderform.submit();

}

function checkemail(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("Please enter a valid Email Address.");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid Email Address.");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid Email Address.");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid Email Address.");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid Email Address.");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid Email Address.");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a valid Email Address.");
		    return false;
		 }

 		 return true;
	}
