function validateCaptcha(nameit, phoneit, emailit, phoneit, addressit, cityit, stateit, zipit)
{
window.addEvent('domready', function() {

     $('runAjax').addEvent('click', function(event) {
         event.stop();
         var req = new Request({
             method: 'get',
             url: $('runAjax').get('href'),
             data: { 'do' : '1' },
             onRequest: function() { alert('The request has been made, please wait until it has finished.'); },
             onComplete: function(response) { alert('The response is the following : ' + response); }
         }).send();
$('runAjax').removeEvent('click');
     });
});
	
	
	var html = "success";
 
	//console.log( html );
	if(html == "success") { 
		
		document.getElementById("captchaStatus").innerHTML = "Processing form...";
		//$("#captchaStatus").html("Processing form...");
		var html2 = $.ajax({  
 		type: "POST",  
  		url: "mailing_list/contactengine.php",  
  		data: 'nameit='+ nameit + '&phoneit=' + phoneit + '&emailit=' + emailit + '&addressit=' + addressit + '&cityit=' + cityit + '&stateit=' + stateit + '&zipit=' + zipit,
		async: false
		}).responseText;
			
		if(html2 == "success") {
			$("#wrapChange").fadeOut("fast", function(){
				$("#wrapChange").html("<h1>Thank you</h1><p>Your contact information has been sucessfully submitted. Thank you for joining our mailing list.")
			.hide()
			.fadeIn(1500);
													  });
			return false;
		}else{
			$("#captchaStatus").html("Mail didn't send!");
			return false;
		}
		return false;
	} else {
		$("#captchaStatus").html("The security code you entered did not match. Please try again.");
		Recaptcha.reload();
		return false;
	}
}	


function jcap(){

var errors_it = 1;
var focus_it = "";
document.getElementById("errors_display").innerHTML = "";

	var nameit = document.form1.Name.value;
	var phoneit = document.form1.Phone.value;
	var emailit = document.form1.Email.value;
	var phoneit = document.form1.Phone.value;
	var addressit = document.form1.Address.value;
	var cityit = document.form1.City.value;
	var stateit = document.form1.State.value;
	var zipit = document.form1.Zip.value; 
	
	
	if(nameit.length == 0) {
		document.getElementById("errors_display").innerHTML += "<div class=\"block\">&bull; The name field is blank, Please enter your name<\/div>";
		errors_it = errors_it + 1;
		if(focus_it == ""){focus_it = "form_name";}
	}
	
	var reg =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var address = document.form1.Email.value;
	if(emailit == "" || reg.test(address) == false) {
		document.getElementById("errors_display").innerHTML += "<div class=\"block\">&bull; Invalid e-mail address, Please re-enter your email address.<\/div>";
		errors_it = errors_it + 1;
		if(focus_it == ""){focus_it = "form_email";}
	}
	
	if(phoneit.length < 10) {
		document.getElementById("errors_display").innerHTML += "<div class=\"block\">&bull; The phone number is less than 10 digits, Please re-enter your phone number<\/div>";
		errors_it = errors_it + 1;
		if(focus_it == ""){focus_it = "form_phone";}
	}
	

	
	if(errors_it > 1){
		document.getElementById(focus_it).focus();
		return false;
	}else{
		validateCaptcha(nameit, phoneit, emailit, phoneit, addressit, cityit, stateit, zipit);
		return false;
	}

}

//  End -->