// JavaScript Document
function switchSubscribeSubmit(validBOOL,submit_element) {
	
	if(validBOOL == true){
		if(submit_element.value == 'Complete Purchase'){ 
			//document.getElementById('submitButton').style.display = 'none';			
			submit_element.value = 'Please Wait.';			
			
			return true;
		} else {
			alert('You have already hit the submit button and your transaction may already be processing. If you\'ve already pushed your transaction through, but were sent back to this page, please try hitting the "submit" button again.');
			submit_element.value = 'Complete Purchase';
			
			return false;
		}
	} else {
		return false;
	}
}

function updateError(formElement,errorMsg) {
	//var errDisplay = document.getElementById('error_' + formElement.name);
	
	var container_p = document.createElement('p');
	container_p.className = "error";
	
	container_p_text = document.createTextNode(errorMsg);	
	container_p.appendChild(container_p_text);	
	
	var errDisplay = document.getElementById('error_' + formElement.id);	
	//alert('error_' + formElement.id + " " + errorMsg);
	errDisplay.appendChild(container_p);	
	new Effect.Appear('error_' + formElement.id);
}


function clearPreviousError(formElement) {
	var errDisplay = document.getElementById('error_' + formElement.id);
	
	if(errDisplay.hasChildNodes()) {
		errDisplay.display = 'none';
		errDisplay.removeChild(errDisplay.firstChild);
	}
}

function displayErrorHeader() {
	var errorDivID = 'errorMsgHeader'
	errorDiv = document.getElementById(errorDivID);	
	errorMsg = "Please correct the errors highlighted below";
	if(errorDiv) {	
		var container_p = document.createElement('p');
		container_p.className = "error";
		
		container_p_text = document.createTextNode(errorMsg);
		container_p.appendChild(container_p_text);	
		
		errorDiv.appendChild(container_p);
		new Effect.Appear(errorDiv);
	} else {
		alert(errorMsg);
	}
}

function clearPreviousErrors(formOBJ) {
	var errorDivID = 'errorMsgHeader';	
	errorHeader = document.getElementById(errorDivID);		
	
	if(errorHeader) {		
		errorHeader.display = 'none';
		if(errorHeader.hasChildNodes())
			errorHeader.removeChild(errorHeader.firstChild);
	}	
		
	for (var i = 0; i < formOBJ.elements.length; i++) {	
		current_input_error = document.getElementById('error_' + formOBJ[i].id);
		
		if(current_input_error && current_input_error.hasChildNodes())
		{
			//alert(current_input_error.id);
			//new Effect.Fade(current_input_error.id);
			current_input_error.style.display = "none";
			for(j=0;j<current_input_error.childNodes.length;j++) {
				current_input_error.removeChild(current_input_error.childNodes[j]);
			}
		}			
	}
}



function submitLostPassword(x) {
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(!checkEmail(x.email)) {		
		updateError(x.email,'Please enter a valid email address');
		if(!firstField) firstField = x.email;
		validBOOL = false;		
	} 
		
	if(!checkRadio(x.account_type)) {
		updateError(x.account_type_error,'Please select your Account Type.');		
		validBOOL = false;
	}	
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
}

function submitLogin(x) {
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(!checkEmail(x.email)) {		
		updateError(x.email,'Please enter a valid email address');
		if(!firstField) firstField = x.email;
		validBOOL = false;		
	} 
	
	if(x.password.value=="") {		
		updateError(x.password,'Please enter your password.');
		if(!firstField) firstField = x.password;
		validBOOL = false;	
	}
	
	if(!checkRadio(x.account_type)) {
		updateError(x.account_type_error,'Please select your Account Type.');		
		validBOOL = false;
	}	
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
}

function submitAddOns(x) {	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(!x.ExtendPosting.checked && !checkSelected(x.MarketID)) {
		updateError(x.ExtendPosting,'You must either Extend Your Job Posting or Select Additional Markets to Purchase.');		
		if(!firstField) firstField = x.ExtendPosting;
		validBOOL = false;
	}
	
	if(x.BillingFirstName.value=="") {		
		updateError(x.BillingFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.BillingFirstName;
		validBOOL = false;		
	} 
	
	if(x.BillingLastName.value=="") {
		updateError(x.BillingLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.BillingLastName;
		validBOOL = false;
	} 
	
	if(x.BillingTitle.value=="") {
		updateError(x.BillingTitle,'Please enter your Title/Position.');
		if(!firstField) firstField = x.BillingTitle;
		validBOOL = false;
	} 
	
	if(x.BillingAddress.value==""){		
		updateError(x.BillingAddress,'Please enter your Billing Address.');
		if(!firstField) firstField = x.BillingAddress;
		validBOOL = false;
	} 
	
	if(x.BillingCity.value==""){		
		updateError(x.BillingCity,'Please enter your City.');
		if(!firstField) firstField = x.BillingCity;
		validBOOL = false;
	} 
	
	if(x.BillingStateID.value==""){		
		updateError(x.BillingStateID,'Please select your State.');
		validBOOL = false;
	} 
	
	if(!checkZip(x.BillingZip)) {		
		updateError(x.BillingZip,'Please enter your Zip Code in the following format (##### or #####-####).');
		if(!firstField) firstField = x.BillingZip;
		validBOOL = false;
	} 		
	
	if(!checkPhone(x.BillingPhone)) {
		updateError(x.BillingPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.BillingPhone;
		validBOOL = false;
	} 	
	
	if(x.card_name.value==""){		
		updateError(x.card_name,'Please enter the Name on Card.');
		if(!firstField) firstField = x.card_name;
		validBOOL = false;
	}
	
	if(!checkCheckbox(x.terms_checkbox)) {			
		updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
		validBOOL = false;
	}
		
	if (validBOOL == true) {		
		if(!CheckCardNumber(x)) {
			return false;
		} else {
			if(switchSubscribeSubmit(validBOOL,x.submitMe)){			
				return true;
			} else {
				return false;
			}
		}
	} else {	
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}	
}

function submitCredits(x) {	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.BillingFirstName.value=="") {		
		updateError(x.BillingFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.BillingFirstName;
		validBOOL = false;		
	} 
	
	if(x.BillingLastName.value=="") {
		updateError(x.BillingLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.BillingLastName;
		validBOOL = false;
	} 
	
	if(x.BillingTitle.value=="") {
		updateError(x.BillingTitle,'Please enter your Title/Position.');
		if(!firstField) firstField = x.BillingTitle;
		validBOOL = false;
	} 
	
	if(x.BillingAddress.value==""){		
		updateError(x.BillingAddress,'Please enter your Billing Address.');
		if(!firstField) firstField = x.BillingAddress;
		validBOOL = false;
	} 
	
	if(x.BillingCity.value==""){		
		updateError(x.BillingCity,'Please enter your City.');
		if(!firstField) firstField = x.BillingCity;
		validBOOL = false;
	} 
	
	if(x.BillingStateID.value==""){		
		updateError(x.BillingStateID,'Please select your State.');
		validBOOL = false;
	} 
	
	if(!checkZip(x.BillingZip)) {		
		updateError(x.BillingZip,'Please enter your Zip Code in the following format (##### or #####-####).');
		if(!firstField) firstField = x.BillingZip;
		validBOOL = false;
	} 
	
	if(!checkPhone(x.BillingPhone)) {
		updateError(x.BillingPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.BillingPhone;
		validBOOL = false;
	} 
	
	if(x.credits.value == "") {
		updateError(x.credits,'Please select the number of credits you wish to purchase');
		if(!firstField) firstField = x.credits;
		validBOOL = false;
	}
	
	if(x.card_name.value==""){		
		updateError(x.card_name,'Please enter the Name on Card.');
		if(!firstField) firstField = x.card_name;
		validBOOL = false;
	}
	
	if(!checkCheckbox(x.terms_checkbox)) {			
		updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
		validBOOL = false;
	}
	
	if (validBOOL == true) {		
		if(!CheckCardNumber(x)) {
			return false;
		} else {
			if(switchSubscribeSubmit(validBOOL,x.submitMe)){			
				return true;
			} else {
				return false;
			}
		}
	} else {	
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
}

function submitContact(x) {	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.ContactFirstName.value=="") {		
		updateError(x.ContactFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.ContactFirstName;
		validBOOL = false;		
	} 
	
	if(x.ContactLastName.value=="") {
		updateError(x.ContactLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.ContactLastName;
		validBOOL = false;
	} 
	
	if(x.ContactTitle.value=="") {
		updateError(x.ContactTitle,'Please enter your Title.');
		if(!firstField) firstField = x.ContactTitle;
		validBOOL = false;
	} 
	
	if(x.ContactAddress.value==""){		
		updateError(x.ContactAddress,'Please enter your Address.');
		if(!firstField) firstField = x.ContactAddress;
		validBOOL = false;
	} 
	
	if(x.ContactCity.value==""){		
		updateError(x.ContactCity,'Please enter your City.');
		if(!firstField) firstField = x.ContactCity;
		validBOOL = false;
	} 
	
	if(x.StateID.value==""){		
		updateError(x.StateID,'Please select your State.');
		validBOOL = false;
	} 
	
	if(!checkZip(x.ContactZip)) {		
		updateError(x.ContactZip,'Please enter your Zip Code in the following format (##### or #####-####).');
		if(!firstField) firstField = x.ContactZip;
		validBOOL = false;
	} 	
	
	if(!checkPhone(x.ContactDayPhone)){		
		updateError(x.ContactDayPhone,'Please enter your Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.ContactDayPhone;
		validBOOL = false;
	}
	
	if(x.ContactFax.value != "") {
		if(!checkPhone(x.ContactFax)) {		
			updateError(x.ContactFax,'Please enter your Fax in the following format 555-555-5555.');
			if(!firstField) firstField = x.ContactFax;
			validBOOL = false;
		}
	}
	
	if(!checkEmail(x.ContactEmail)) {
		updateError(x.ContactEmail,'Please enter a valid Email address.');
		if(!firstField) firstField = x.ContactEmail;
		validBOOL = false;
	} 
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
	
}

function submitEmployer(x) {	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.RecruiterFirstName.value=="") {		
		updateError(x.RecruiterFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.RecruiterFirstName;
		validBOOL = false;		
	} 
	
	if(x.RecruiterLastName.value=="") {
		updateError(x.RecruiterLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.RecruiterLastName;
		validBOOL = false;
	} 
	if(x.RecruiterTitle.value=="") {
		updateError(x.RecruiterTitle,'Please enter your Title/Position.');
		if(!firstField) firstField = x.RecruiterTitle;
		validBOOL = false;
	} 
	
	if(!checkPhone(x.RecruiterDayPhone)) {
		updateError(x.RecruiterDayPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.RecruiterDayPhone;
		validBOOL = false;
	} 
	if(!checkEmail(x.RecruiterEmail)) {
		updateError(x.RecruiterEmail,'Please enter a valid Email address.');
		if(!firstField) firstField = x.RecruiterEmail;
		validBOOL = false;
	} else if(x.RecruiterEmail.value != x.RecruiterEmailConfirm.value) {		
		updateError(x.RecruiterEmail,'Your email addresses do not match.');
		if(!firstField) firstField = x.RecruiterEmail;
		validBOOL = false;
	} 
	
	
	if(x.RecruiterPassword.value == '' || x.RecruiterPasswordConfirm == '') {		
		updateError(x.RecruiterPassword,'Please enter and confirm your Password');
		if(!firstField) firstField = x.RecruiterPassword;
		validBOOL = false;
	} else if(!checkPassword('password','password_confirm')) {
		updateError(x.RecruiterPassword,'Your Passwords Do Not Match')
		if(!firstField) firstField = x.RecruiterPassword;
		validBOOL = false;
	} 
	
	if(x.RecruiterCompany.value=="") {		
		updateError(x.RecruiterCompany,'Please enter your Company Name.');
		if(!firstField) firstField = x.RecruiterCompany;
		validBOOL = false;
	} 
	
	if(x.CompanyTypeID.value==""){		
		updateError(x.CompanyTypeID,'Please select your Company Type');
		validBOOL = false;
	} 
	
	/*if(x.EmployeeNumberID.value==""){		
		updateError(x.EmployeeNumberID,'Please select your Number of Employees');
		validBOOL = false;
	} */
	
	if(x.CompanySizeID.value==""){		
		updateError(x.CompanySizeID,'Please select your Company Category or Size');
		validBOOL = false;
	} 
	
	if(!checkCheckbox(x.size_agreement)) {	
		updateError(x.size_agreement,'You must agree to the company category/size agreement');
		validBOOL = false;
	}
	
	if(x.IndustryID.value==""){		
		updateError(x.IndustryID,'Please select your Industry');
		validBOOL = false;
	} 
	
	if(!checkIndustryMax(x.IndustryID)) {		
		updateError(x.IndustryID,'You may select up to 3 Industry Focii.');
		validBOOL = false;
	} 
	
	if(x.ContactAddress.value==""){		
		updateError(x.ContactAddress,'Please enter your Company Address.');
		if(!firstField) firstField = x.ContactAddress;
		validBOOL = false;
	} 
	
	if(x.ContactCity.value==""){		
		updateError(x.ContactCity,'Please enter your Company City.');
		if(!firstField) firstField = x.ContactCity;
		validBOOL = false;
	} 
	
	if(x.StateID.value==""){		
		updateError(x.StateID,'Please select your Company State.');
		validBOOL = false;
	}
	
	if(!checkZip(x.ContactZip)) {		
		updateError(x.ContactZip,'Please enter your Zip Code in the following format (##### or #####-####).');
		if(!firstField) firstField = x.ContactZip;
		validBOOL = false;
	}
	
	if(!checkPhone(x.ContactDayPhone)){		
		updateError(x.ContactDayPhone,'Please enter your Company Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.ContactDayPhone;
		validBOOL = false;
	} 
	
	if(x.ContactFax.value != "") {
		if(!checkPhone(x.ContactFax)) {		
			updateError(x.ContactFax,'Please enter your Company Fax in the following format 555-555-5555.');
			if(!firstField) firstField = x.ContactFax;
			validBOOL = false;
		}
	} 
	
	if(x.RecruiterWebsite.value==""){		
		updateError(x.RecruiterWebsite,'Please enter your Company Website.');
		if(!firstField) firstField = x.RecruiterWebsite;
		validBOOL = false;
	} 
	
	if(x.RecruiterHowDidYouHear.value==""){	
		updateError(x.RecruiterHowDidYouHear,'Please enter how you heard about us.');
		if(!firstField) firstField = x.RecruiterHowDidYouHear;
		validBOOL = false;
	} 
	
	if(x.JobPostingID.value==""){			
		updateError(x.JobPostingID,'Please select how many job openings you have per month.');
		validBOOL = false;
	}
	
	if(!checkCheckbox(x.terms_checkbox)) {			
		updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
		validBOOL = false;
	}
		
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
	
}

function submitEmployerProfile(x) {	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.RecruiterFirstName.value=="") {		
		updateError(x.RecruiterFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.RecruiterFirstName;
		validBOOL = false;		
	} 
	
	if(x.RecruiterLastName.value=="") {
		updateError(x.RecruiterLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.RecruiterLastName;
		validBOOL = false;
	} 
	if(x.RecruiterTitle.value=="") {
		updateError(x.RecruiterTitle,'Please enter your Title/Position.');
		if(!firstField) firstField = x.RecruiterTitle;
		validBOOL = false;
	} 
	if(!checkPhone(x.RecruiterDayPhone)) {
		updateError(x.RecruiterDayPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
		if(!firstField) firstField = x.RecruiterDayPhone;
		validBOOL = false;
	} 
	if(!checkEmail(x.RecruiterEmail)) {
		updateError(x.RecruiterEmail,'Please enter a valid Email address.');
		if(!firstField) firstField = x.RecruiterEmail;
		validBOOL = false;
	} else if(x.RecruiterEmail.value != x.RecruiterEmailConfirm.value) {		
		updateError(x.RecruiterEmail,'Your email addresses do not match.');
		if(!firstField) firstField = x.RecruiterEmail;
		validBOOL = false;
	} 
	
	/*if(x.RecruiterPassword.value == '' || x.RecruiterPasswordConfirm == '') {		
		updateError(x.RecruiterPassword,'Please enter and confirm your Password');
		if(!firstField) firstField = x.RecruiterPassword;
		validBOOL = false;
	} else */if(!checkPassword('password','password_confirm')) {
		updateError(x.RecruiterPassword,'Your Passwords Do Not Match')
		if(!firstField) firstField = x.RecruiterPassword;
		validBOOL = false;
	} 
	
	if(x.RecruiterCompany.value=="") {		
		updateError(x.RecruiterCompany,'Please enter your Company Name.');
		if(!firstField) firstField = x.RecruiterCompany;
		validBOOL = false;
	} 
	
	if(x.CompanyTypeID.value==""){		
		updateError(x.CompanyTypeID,'Please select your Company Type');
		validBOOL = false;
	} 
	
	if(x.CompanySizeID.value==""){		
		updateError(x.CompanySizeID,'Please select your Company Category or Size');
		validBOOL = false;
	} 
	
	if(!checkCheckbox(x.size_agreement)) {	
		updateError(x.size_agreement,'You must agree to the company category/size agreement');
		validBOOL = false;
	}
	
	if(x.IndustryID.value==""){		
		updateError(x.IndustryID,'Please select your Industry');
		validBOOL = false;
	} 
	
	if(!checkIndustryMax(x.IndustryID)) {		
		updateError(x.IndustryID,'You may select up to 3 Industry Focii.');
		validBOOL = false;
	} 
	
	if(x.RecruiterWebsite.value==""){		
		updateError(x.RecruiterWebsite,'Please enter your Company Website.');
		if(!firstField) firstField = x.RecruiterWebsite;
		validBOOL = false;
	} 
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
	
}

var clicked = 'action';

function submitPostingSelect(x) {		
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";	
	
	if(clicked != 'Resumes' && x.PostingID.value=="") {	
		updateError(x.PostingID,'Please select a Job Posting to Edit.');		
		validBOOL = false;
	}
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}	
}

function submitContactSelect(x) {		
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.ContactID.value=="") {	
		updateError(x.ContactID,'Please select a Contact to Edit.');		
		validBOOL = false;
	} 
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
	
}

function submitPosting(x) {		
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	//alert(x.submitB.value);
	/*
	elementsARR = document.getElementsByTagName('input');
	
	for(i=0;i<elementsARR.length;i++) {
		if(elementsARR[i].name == 'submitB') {
			alert(elementsARR[i].name.alt);
		}
		//alert(elementsARR[i].name);
	}
	*/
	
	if(x.PostingTitle.value=="") {		
		updateError(x.PostingTitle,'Please enter the Job Title.');
		if(!firstField) firstField = x.PostingTitle;
		validBOOL = false;		
	} 
	
	if(x.PostingStatusID.value=="") {	
		updateError(x.PostingStatusID,'Please enter the Job Status.');		
		validBOOL = false;		
	} 
	
	if(!checkIndustryMax(x.PostingStatusID)) {		
		updateError(x.PostingStatusID,'You may select up to 3 Job Statuses.');		
		validBOOL = false;
	} 
	
	if(x.PostingLength.value=="") {		
		updateError(x.PostingLength,'Please enter the Job Length/Term.');
		if(!firstField) firstField = x.PostingLength;
		validBOOL = false;		
	}
	
	if(x.PostingStartDate.value != '' && !checkDate(x.PostingStartDate)) {		
		updateError(x.PostingStartDate,'Please enter the Start Date in the following format (MM/DD/YYYY).');
		if(!firstField) firstField = x.PostingStartDate;
		validBOOL = false;	
	}
	
	/*if(x.PostingEndDate.value != '' && !checkDate(x.PostingEndDate)) {			
		updateError(x.PostingEndDate,'Please enter the End Date in the following format (MM/DD/YYYY).');
		if(!firstField) firstField = x.PostingEndDate;
		validBOOL = false;
	} */
	
	if(!checkZip(x.PostingZip)) {		
		updateError(x.PostingZip,'Please enter your Zip Code in the following format (##### or #####-####).');
		if(!firstField) firstField = x.PostingZip;
		validBOOL = false;
	} 
	
	if(x.PostingZip.value != "00000" && x.PostingCity.value == "") {		
		updateError(x.PostingCity,'Please enter the Location City.');
		if(!firstField) firstField = x.PostingCity;
		validBOOL = false;
	} 
	
	if(x.PostingZip.value != "00000" && (x.StateID.value == "" || x.StateID.value == "52")) {		
		updateError(x.StateID,'Please select a Location State.');
		if(!firstField) firstField = x.StateID;
		validBOOL = false;
	} 
	
	if(x.PostingSalary.value=="") {		
		updateError(x.PostingSalary,'Please enter the Salary.');
		if(!firstField) firstField = x.PostingSalary;
		validBOOL = false;
	}
	
	if(x.PostingReference.value=="") {		
		updateError(x.PostingReference,'Please enter the Reference Number.');
		if(!firstField) firstField = x.PostingReference;
		validBOOL = false;
	} 
	
	if(x.PostingEducation.value=="") {		
		updateError(x.PostingEducation,'Please enter the Required Education.');
		if(!firstField) firstField = x.PostingEducatione;
		validBOOL = false;
	} 
	
	if(x.PostingExperience.value=="") {		
		updateError(x.PostingExperience,'Please enter the Required Experience.');
		if(!firstField) firstField = x.PostingExperience;
		validBOOL = false;
	} 
	
	if(x.IndustryID.value=="") {	
		updateError(x.IndustryID,'Please select up to 3 Job Types.');		
		validBOOL = false;
	} 
	
	if(!checkIndustryMax(x.IndustryID)) {		
		updateError(x.IndustryID,'You may select up to 3 Industry Focii.');		
		validBOOL = false;
	} 
	
	if(x.PostingDescription.value=="") {		
		updateError(x.PostingDescription,'Please enter the Job Description.');
		if(!firstField) firstField = x.PostingDescription;
		validBOOL = false;
	}
	
	if(x.PostingRequirements.value=="") {		
		updateError(x.PostingRequirements,'Please enter the Job Requirements.');
		if(!firstField) firstField = x.PostingRequirements;
		validBOOL = false;
	} 
	
	/*
	if(!checkSkills(x)) {			
		updateError(x.SkillID,'You must select at least one Transferable Skill');		
		validBOOL = false;
	} 
	*/
	
	if(!checkSkillsMax(x)) {			
		updateError(x.SkillID,'You must select 1 Transferable Skill from each Skill Set (5 total)');		
		validBOOL = false;
	} 
	
	if( (document.getElementById('PremierPosting') != null && document.getElementById('PremierPosting').checked) || (document.getElementById('ExtendPosting') && document.getElementById('ExtendPosting').checked) ){
		if(x.BillingFirstName.value=="") {		
			updateError(x.BillingFirstName,'Please enter your First Name.');
			if(!firstField) firstField = x.BillingFirstName;
			validBOOL = false;		
		} 
		
		if(x.BillingLastName.value=="") {
			updateError(x.BillingLastName,'Please enter your Last Name.');
			if(!firstField) firstField = x.BillingLastName;
			validBOOL = false;
		} 
		
		if(x.BillingTitle.value=="") {
			updateError(x.BillingTitle,'Please enter your Title/Position.');
			if(!firstField) firstField = x.BillingTitle;
			validBOOL = false;
		} 
		
		if(x.BillingAddress.value==""){		
			updateError(x.BillingAddress,'Please enter your Billing Address.');
			if(!firstField) firstField = x.BillingAddress;
			validBOOL = false;
		} 
		
		if(x.BillingCity.value==""){		
			updateError(x.BillingCity,'Please enter your City.');
			if(!firstField) firstField = x.BillingCity;
			validBOOL = false;
		} 
		
		if(x.BillingStateID.value==""){		
			updateError(x.BillingStateID,'Please select your State.');
			validBOOL = false;
		} 
		
		if(!checkZip(x.BillingZip)) {		
			updateError(x.BillingZip,'Please enter your Zip Code in the following format (##### or #####-####).');
			if(!firstField) firstField = x.BillingZip;
			validBOOL = false;
		} 		
		
		if(!checkPhone(x.BillingPhone)) {
			updateError(x.BillingPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
			if(!firstField) firstField = x.BillingPhone;
			validBOOL = false;
		} 	
		
		if(x.card_name.value==""){		
			updateError(x.card_name,'Please enter the Name on Card.');
			if(!firstField) firstField = x.card_name;
			validBOOL = false;
		}
		
		if(!checkCheckbox(x.terms_checkbox)) {			
			updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
			validBOOL = false;
		}	
	}
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
}

function submitSeeker(x) {	
	
	var validBOOL = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.SeekerFirstName.value=="") {		
		updateError(x.SeekerFirstName,'Please enter your First Name.');
		if(!firstField) firstField = x.SeekerFirstName;
		validBOOL = false;		
	} 
	
	if(x.SeekerLastName.value=="") {		
		updateError(x.SeekerLastName,'Please enter your Last Name.');
		if(!firstField) firstField = x.SeekerLastName;
		validBOOL = false;		
	} 
	if(!checkEmail(x.SeekerEmail)) {		
		updateError(x.SeekerEmail,'Please enter a valid email address.');
		if(!firstField) firstField = x.SeekerEmail;
		validBOOL = false;		
	} 
	
	if(x.SeekerEmail.value != x.SeekerEmailConfirm.value) {		
		updateError(x.SeekerEmail,'Your email addresses do not match.');
		if(!firstField) firstField = x.SeekerEmail;
		validBOOL = false;		
	} 
	
	if(x.SeekerHowDidYouHear && (x.SeekerPassword.value == '' || x.SeekerPasswordConfirm == '')) {	
		updateError(x.SeekerPassword,'Please enter and confirm your Password');
		if(!firstField) firstField = x.SeekerPassword;
		validBOOL = false;	
	}
	
	if(!checkPassword('password','password_confirm')) {
		updateError(x.SeekerPassword,'Your passwords do not match');
		if(!firstField) firstField = x.SeekerPassword;
		validBOOL = false;	
	} 
	
	if(x.SeekerAddress.value==""){		
		updateError(x.SeekerAddress,'Please enter your Address');
		if(!firstField) firstField = x.SeekerAddress;
		validBOOL = false;	
	} 
	
	if(x.SeekerCity.value==""){
		updateError(x.SeekerCity,'Please enter your City');
		if(!firstField) firstField = x.SeekerCity;
		validBOOL = false;	
	} 
	
	if(x.StateID.value==""){		
		updateError(x.StateID,'Please select your State');		
		validBOOL = false;	
	} 
	/*
	if(x.SeekerZip.value == "") {	
		updateError(x.SeekerZip,'Please enter your Zip Code');	
		if(!firstField) firstField = x.SeekerZip;
		validBOOL = false;	
	} 
	*/
	
	if(!checkZip(x.SeekerZip)) {	
		updateError(x.SeekerZip,'Please enter your Zip Code in the following format (##### or #####-####)');	
		if(!firstField) firstField = x.SeekerZip;
		validBOOL = false;	
	} 
	
	if(x.SeekerGender.value==""){
		updateError(x.SeekerGender,'Please select your Gender');	
		if(!firstField) firstField = x.SeekerGender;
		validBOOL = false;	
	} 
	
	if(x.SeekerBirthYear.value != '') {
		if(!checkYear(x.SeekerBirthYear)){	
			updateError(x.SeekerBirthYear,'Please enter your Birth Year in the following format (YYYY)');	
			if(!firstField) firstField = x.SeekerBirthYear;
			validBOOL = false;	
		} 
	}
	
	/*if(x.HouseholdIncomeID.value==""){		
		updateError(x.HouseholdIncomeID,'Please select your Household Income');		
		validBOOL = false;
	}*/
	
	if(x.DegreeID.value==""){			
		updateError(x.DegreeID,'Please select your Education Level');		
		validBOOL = false;
	} 
	
	if(x.IndustryID.value==""){			
		updateError(x.IndustryID,'Please select up to 3 Industry Focii');		
		validBOOL = false;
	} 
	
	if(!checkIndustryMax(x.IndustryID)) {		
		updateError(x.IndustryID,'You may select up to 3 Industry Focii');		
		validBOOL = false;
	}
	
	if(x.SeekerHowDidYouHear && x.SeekerHowDidYouHear.value==""){	
		updateError(x.SeekerHowDidYouHear,'Please enter how you heard about us.');
		if(!firstField) firstField = x.SeekerHowDidYouHear;
		validBOOL = false;
	}
	
	if(x.terms_checkbox && !checkCheckbox(x.terms_checkbox)) {	
		updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
		validBOOL = false;
	}
	
	if (x.Resume) {
		var file = x.Resume.value;
		if (file != "") {
			if (file.length < 4) {
				validBOOL = false;
			} else {
				ext3 = file.substring(file.length-3);
				if (ext3 != "doc" && ext3 != "txt" && ext3 != "pdf" && file.substring(file.length-4) != "docx") {
					updateError(x.Resume, "Your cover letter must be in document format (.doc, .docx, .txt, or .pdf)");
					validBOOL = false;
				}
			}
		}
	}
	
	if (x.CoverLetter) {
		var file = x.CoverLetter.value;
		if (file != "") {
			if (file.length < 4) {
				validBOOL = false;
			} else {
				ext3 = file.substring(file.length-3);
				if (ext3 != "doc" && ext3 != "txt" && ext3 != "pdf" && file.substring(file.length-4) != "docx") {
					updateError(x.CoverLetter, "Your cover letter must be in document format (.doc, .docx, .txt, or .pdf)");
					validBOOL = false;
				}
			}
		}
	}
	
	
	
	if (validBOOL == true) {		
		return true;
	} else {
		if(firstField)
			firstField.focus();
			
		displayErrorHeader();		
		return false;
	}
}

function submitAdvertising() {
	var x = document.advertising_opportunities;
	var theBool = true;
	
	clearPreviousErrors(x);
	var firstField = "";
	
	if(x.BannerAdvertising.checked==true){
		if(x.BannerAdvertisingQuantity.value==''){
			alert('You must enter a quantity to purchase banner advertising.');
			x.BannerAdvertisingQuantity.focus();
			theBool = false;
		} else if(!IsNumeric(x.BannerAdvertisingQuantity.value)){
			alert('You must enter a numeric quantity to purchase banner advertising.');
			x.BannerAdvertisingQuantity.focus();
			theBool = false;
		}
		
		//Billing section
		if(x.BillingFirstName.value=="") {		
			updateError(x.BillingFirstName,'Please enter your First Name.');
			if(!firstField) firstField = x.BillingFirstName;
			theBool = false;		
		} 
		
		if(x.BillingLastName.value=="") {
			updateError(x.BillingLastName,'Please enter your Last Name.');
			if(!firstField) firstField = x.BillingLastName;
			theBool = false;
		} 
		
		if(x.BillingTitle.value=="") {
			updateError(x.BillingTitle,'Please enter your Title/Position.');
			if(!firstField) firstField = x.BillingTitle;
			theBool = false;
		} 
		
		if(x.BillingAddress.value==""){		
			updateError(x.BillingAddress,'Please enter your Billing Address.');
			if(!firstField) firstField = x.BillingAddress;
			theBool = false;
		} 
		
		if(x.BillingCity.value==""){		
			updateError(x.BillingCity,'Please enter your City.');
			if(!firstField) firstField = x.BillingCity;
			theBool = false;
		} 
		
		if(x.BillingStateID.value==""){		
			updateError(x.BillingStateID,'Please select your State.');
			theBool = false;
		} 
		
		if(!checkZip(x.BillingZip)) {		
			updateError(x.BillingZip,'Please enter your Zip Code in the following format (##### or #####-####).');
			if(!firstField) firstField = x.BillingZip;
			theBool = false;
		} 		
		
		if(!checkPhone(x.BillingPhone)) {
			updateError(x.BillingPhone,'Please enter your Daytime Phone in the following format 555-555-5555.');
			if(!firstField) firstField = x.BillingPhone;
			theBool = false;
		} 	
		
		if(x.card_name.value==""){		
			updateError(x.card_name,'Please enter the Name on Card.');
			if(!firstField) firstField = x.card_name;
			theBool = false;
		}
		
		if(!checkCheckbox(x.terms_checkbox)) {			
			updateError(x.terms_checkbox,'You must agree to the Terms and Conditions to proceed.');
			theBool = false;
		}	
	} else {
		alert('You must select at least one advertising option to continue.')
		theBool = false;	
	}
	
	if(theBool){
		x.submit();
	}
}

function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) { IsNumber = false; }
   }
   return IsNumber;
}