if (typeof XMLHttpRequest=="undefined" && window.ActiveXObject){
	function XMLHttpRequest(){
		var arrSignatures = ["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
		for (var i=0; i<arrSignatures.length;i++){
			try{
				var oRequest = new ActiveXObject(arrSignatures[i]);
				return oRequest;
				}catch (oError){
					//ignore					
				}
			}
			throw new Error("MSXML is not installed on your system");
		}
	}

function send_mail(sName, sEmail, sMessage){
	var oRequest =new XMLHttpRequest();
	var sURL = "php/function.php?name="+encodeURIComponent(sName)+"&email="+encodeURIComponent(sEmail)+"&message="+encodeURIComponent(sMessage);
	oRequest.open("get", sURL, false);
	oRequest.send(null);
	if (oRequest.status=="200"){
		var oDivContent=document.getElementById('contact_content');
		oDivContent.innerHTML="<p>Thanks for your interest. I will get back to you shortly.</p><p>In the meantime why not visit <a href='http://www.aonghusflynn.com'>http://www.aonghusflynn.com</a> for articles on general pc use.</p>";
		}
}

function eval_form(){
	var bName = false;
	var bMessage = false;
	var bEmail = false;
	oNameBox = document.getElementById('name');
	oEmailBox = document.getElementById('email');
	oMessageBox = document.getElementById('message');
	if (oNameBox.value.length==0 || oEmailBox.value.length==0 || oMessageBox.value.length==0){
		alert('You must fill in all fields.');
	}else{
		bName = true;
		bMessage = true;
		var reEmail = /^(?:\w+\.?)*\w+@(?:\w+\.?)*\w+$/;
		if(!(reEmail.test(oEmailBox.value))){
			oEmailBox.focus();
			oEmailBox.select();
			alert('This is not a valid email address.');
		}else{
			bEmail=true;
			var sName = oNameBox.value;
			var sEmail = oEmailBox.value;
			var sMessage = oMessageBox.value;
		}
	}
	if (bEmail && bName && bMessage){
		send_mail(sName, sEmail, sMessage);
	}
}