// JavaScript Document
function validate_required(field,alerttxt){
	with (field){
		if (value==null||value==""){
			alert(alerttxt);return false;}
		else {return true}
	}
}
function validate_state(field,alerttxt){
	with (field){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);return false;}
		else {return true;}
	}
}
function validate_email(field,alerttxt){
	with (field){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);return false;}
		else {return true;}
	}
}
function validate_form(thisform){
	with (thisform){
		if (validate_required(company_name,"Company Name must be filled out")==false){
			company_name.focus();return false;}
	}  
	with (thisform){
		if (validate_required(address,"Address Name must be filled out")==false){
			address.focus();return false;}
	}  
	with (thisform){
		if (validate_required(city,"City  must be filled out")==false){
			city.focus();return false;}
	}  
	with (thisform){
		if (validate_required(state,"State must be selected")==false){
			state.focus();return false;}
	}  
	with (thisform){
		if (validate_required(zipcode,"Zipcode must be filled out")==false){
			zipcode.focus();return false;}
	}  
	with (thisform){
		if (validate_required(job_title,"Job Title must be filled out")==false){
			job_title.focus();return false;}
	}  
	with (thisform){
		if (validate_required(contact_name,"Contact Name must be filled out")==false){
			contact_name.focus();return false;}
	}  
	with (thisform){
		if (validate_required(contact_phone,"Contact Phone must be filled out")==false){
			contact_phone.focus();return false;}
	}	
	with (thisform){
		if (validate_email(contact_email,"Please enter a valid e-mail address")==false){
			contact_email.focus();return false;}
	}
	with (thisform){
		if (validate_required(company_website,"Company Website must be filled out")==false){
			company_website.focus();return false;}
	}	
	with (thisform){
		if (validate_required(job_description,"Job Description must be filled out")==false){
			job_description.focus();return false;}
	}	
}
function setbg(color)
{
document.getElementById("styled").style.background=color
}
