function doSub(){
	var sub = z('submit');
	sub.value="Submitting...";
	sub.disabled="disabled";
	var first = z('first').value;
	var last = z('last').value;
	var mail = z('mail').value;
	var phone = z('phone').value;
	if((phone.length<7||!phone.match(new RegExp(/[0-9]/)))&&!mail.match(new RegExp(/.+@.+\..+/))){
		return !resetSub("We need a way to contact you");
	}
	var ckdesign = (z('ckdesign').checked) ? "on" : "";
	var ckdev = (z('ckdev').checked) ? "on" : "";
	var ckprint = (z('ckprint').checked) ? "on" : "";
	var ckmarket = (z('ckmarket').checked) ? "on" : "";
	if(ckdesign==""&&ckdev==""&&ckprint==""&&ckmarket==""){
		return !resetSub("Surely you need at least one service");
	}
	var detail = z('detail').value;
	if(detail.length<10){
		return !resetSub("Perhaps you can be a bit more verbose with the details");
	}
	var ckagree = (z('ckagree').checked) ? "on" : "";
	if(ckagree!="on"){
		return !resetSub("Make sure you agree with the terms");
	}
	return ajaxPost('/mail.php','first='+first+'&last='+last+'&mail='+mail+'&phone='+phone+'&ckdesign='+ckdesign+'&ckdev='+ckdev+'&ckprint='+ckprint+'&ckmarket='+ckmarket+'&detail='+detail+'&ckagree='+ckagree,function(t){
		if(t!="Error"){
			z('submit').value="Submitted!";
		}else{
			resetSub("There was an error processing your request. Try again and if the problem persists you can e-mail us via the contact page.");
		}
	});
}
function resetSub(txt){
	var sub = z('submit');
	sub.value="Submit";
	sub.disabled="";
	alert(txt);
	return false;
}
function ajaxInit(){
	var xmlHttp;
	try{
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){
				return false;
			}
		}
	}
	return xmlHttp;
}
function ajaxPost(page,param,targFunc){
	if(page==""){return;}
	var xmlHttp=ajaxInit();
	if (xmlHttp == false) { return false; }

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			targFunc(xmlHttp.responseText);
		}
	}
	xmlHttp.open("POST",page,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(param);
	return true;
}