function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

function send_contact(){
	
	var con_name = document.getElementById('contact_name');
	var comp_name = document.getElementById('company_name');
	var tel_num = document.getElementById('tel_num');
	var email_add = document.getElementById('email_add');
	var budget = document.getElementById('aprox_bud');
	var num_pages = document.getElementById('num_pages');
	var comp_desc = document.getElementById('comp_desc');
	var site_out = document.getElementById('site_out');
	
	if(trim(con_name.value)==""){
		alert('You must enter a contact name');
		con_name.focus();
		return false;
	}
	if(trim(tel_num.value)==""){
		alert('You must enter a telephone number');
		tel_num.focus();
		return false;
	}
	if(trim(email_add.value)==""){
		alert('You must enter an email address');
		email_add.focus();
		return false;
	}
	
	if(budget.selectedIndex==0){
		alert('You must select an approximate budget');
		budget.focus();
		return false;
	}
	if(num_pages.selectedIndex==0){
		alert('You must select the number of pages you would like');
		num_pages.focus();
		return false;
	}
	if(trim(comp_name.value)!==""){
		if(trim(comp_desc.value)==""){
			alert('You must enter a brief outline of your company');
			comp_desc.focus();
			return false;
		}
	}
	if(trim(site_out.value)==""){
		alert('You must give a brief outline of the required project');
		site_out.focus();
		return false;
	}
	if(echeck(email_add.value)==false){
		alert('The email address you have entered is not formatted correctly');
		email_add.focus();
		return false;	
	}
	document.getElementById('contact_form').submit();
	return true;
}
function retry_cap(){
	document.getElementById('ref').value = 'true';	
	document.getElementById('contact_form').submit();	
}