// JavaScript Document

function CheckContactFields() {
	
	if (document.getElementById("password1") != null&&document.getElementById("password2") != null) {
		if(document.getElementById("password1").value!=document.getElementById("password2").value) {
			alert("The password you entered did not match.  Please enter the same password in both fields.");
			return false;
		}
	}
	
	var errormsg = '';
	
	//if(document.getElementById('level').checked==false){
	//	if(document.ContactForm.SiteSponsorship[0].checked==false&&document.ContactForm.SiteSponsorship[1].checked==false){
	//		errormsg = errormsg+"Select a site sponsorship or select undecided."+"\n";
	//	}
	//	if(document.ContactForm.SectionSponsorship[0].checked==false&&document.ContactForm.SectionSponsorship[1].checked==false){
	//		errormsg = errormsg+"Select a Section sponsorship or select undecided."+"\n";
	//	}
	//	if(errormsg!=""){
	//		alert(errormsg);
	//	}
	//}
						
	///if(document.getElementById("pay1").checked==false&&document.getElementById("pay3").checked==false) {
		//alert("Please select a payment method.");
		//return false;
	//}
	
	//var impPrice2 = document.getElementById('Impressions').value*1;
	//var impMin = document.getElementById('ImpMin').value*1;
	
	//var impLen2 = impPrice2.length;
	//var newPrice2 = impPrice2%1000;

	//if(impLen2<4) {
	//	alert('Impressions must be a minimum of '+impMin+' and increments of 1000.');
	//	return false;
	//}
	
	//if((newPrice2!=0)||(impPrice2<impMin)){
	//	alert('Enter a valid number of impressions in increments of 1000 with a minimum of '+impMin+'.');
	//	return false;
	//}
	
	//Check to make sure the captcha is correct	
	TheuKey = document.ContactForm.uKey.value;			
	ThehKey = document.ContactForm.hKey.value;
	
	if(TheuKey == '' || ThehKey == '') {
		CaptchaFound = 0;
	}	
	else {	
		
		var strURL = "Ajax/MyFunctions.cfc?Method=FindCaptchaKey&TheuKey=" + TheuKey + "&ThehKey=" + ThehKey;
		
		if(window.XMLHttpRequest) {
			var objHTTP = new XMLHttpRequest();
			objHTTP.open("GET", strURL, false);					
			objHTTP.send(null);			
			CaptchaFound = dpWDDX('deserialize',objHTTP.responseText);				
		}
		else if (window.ActiveXObject) {
			var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");		
			objHTTP.open("GET",strURL,false);				
			objHTTP.send(null);		
			CaptchaFound = dpWDDX('deserialize',objHTTP.responseText);
		}
	}	
	
	if(CaptchaFound == 0) {			
		alert("The verification image key that you entered is incorrect. Please check it and try again.");
		return false;
	}	
	
}

