<!--
var http = createRequestObject();
var areal = Math.random() + "";
var real = areal.substring(2,6);

function createRequestObject() {
	var xmlhttp;
	try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
  catch(e) {
    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
    catch(f) { xmlhttp=null; }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp=new XMLHttpRequest();
  }
	return  xmlhttp;
}

function sendRequest() {
	var rnd = Math.random();
	var name = escape(document.getElementById("name").value);
	var email2 = escape(document.getElementById("email2").value);
	var subject = escape(document.getElementById("subject").value);
	var message = escape(document.getElementById("message").value);

	try{
    http.open('POST',  'ajax_contact.php');
    http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    http.onreadystatechange = handleResponse;
		http.send('name='+name+'&email2='+email2+'&subject='+subject+'&message='+message+'&rnd='+rnd);
	}
	catch(e){}
	finally{}
}

function check_values() {
	var valid = document.getElementById("valid").value;
	if(real !== valid) {
		alert("Ant-Bot check failed.....nPlease enter the 4 digits as they appear.");
		return false;
	}

	var name = document.getElementById("name").value;
	var email2 = document.getElementById("email2").value;
	var subject = document.getElementById("subject").value;
	var message = document.getElementById("message").value;
	if(trim(name) == "" ||
		trim(email2) == "" ||
		trim(subject) == "" ||
		trim(message) == "") {
			alert("Please complete all fields");
	} else {
		if(isEmail(email2)) {
			document.getElementById("submit").disabled=true;
			document.getElementById("submit").value='Please Wait...';
			sendRequest();
		} else {
			alert("Email appears to be invalid. Please check.");
			document.getElementById("email2").focus();
			document.getElementById("email2").select();
		}
	}
}

function handleResponse() {
	try{
    if((http.readyState == 4)&&(http.status == 200)){
    	var response = http.responseText;
      document.getElementById("confirmation").innerHTML = response;
      document.getElementById("confirmation").style.display ="";
      document.getElementById("form").style.display = "none";
		}
  }
	catch(e){}
	finally{}
}

function isUndefined(a) {
   return typeof a == 'undefined';
}

function trim(a) {
	return a.replace(/^s*(S*(s+S+)*)s*$/, "$1");
}

function isEmail(a) {
   return (a.indexOf(".") > 0) && (a.indexOf("@") > 0);
}

function botCheckInfo() {
	alert("To prevent automatic programs (bots) from submitting spam through this form, we have added a simple validation check to the form. You must enter these 4 digits in the box provided in order to submit the form.");
}
 // -->