function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    } 
  } 
}
return req;
}

var http = getXMLHTTPRequest();
  
function send() {
if (document.form_1.name.value.length < 4){
	alert("Sorry, you must enter your full name");
	return false;
	}

if (document.form_1.emad.value.length < 6){
	alert("Sorry, you email address appears to be to short");
	return false;
	}
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form_1.emad.value)){
	alert("Sorry, you must enter a valid email address");
	return false;
	}
if (document.form_1.quest.value != "GREEN"){
	alert("Sorry, you have answered the security question incorrectly");
	return false;
	}	
  var myurl = 'sendform.php';
  myRand = parseInt(Math.random()*999999999999999);
  
  var val = 0;
  var val2= 0;
  var val3= 0;
  var val4= 0;
  var val5= 0;
  var val6= 0;
  var val7= 0;
  var val8= 0;
  var val9= 0;
  
for( i = 0; i < document.form_1.RadioGroup1.length; i++ )
{
if( document.form_1.RadioGroup1[i].checked == true )
val = document.form_1.RadioGroup1[i].value;
} 

for( i = 0; i < document.form_1.RadioGroup2.length; i++ )
{
if( document.form_1.RadioGroup2[i].checked == true )
val2 = document.form_1.RadioGroup2[i].value;
} 

var val3 = "";
	for( var i = 0; i < document.form_1.extras3.length; i++ )
	{
	if( document.form_1.extras3[i].checked )
	{
	val3 = val3 + document.form_1.extras3[i].value + ",";
		} }
		
for( i = 0; i < document.form_1.RadioGroup4.length; i++ )
{
if( document.form_1.RadioGroup4[i].checked == true )
val4 = document.form_1.RadioGroup4[i].value;
}
for( i = 0; i < document.form_1.RadioGroup5.length; i++ )
{
if( document.form_1.RadioGroup5[i].checked == true )
val5 = document.form_1.RadioGroup5[i].value;
}
for( i = 0; i < document.form_1.RadioGroup6.length; i++ )
{
if( document.form_1.RadioGroup6[i].checked == true )
val6 = document.form_1.RadioGroup6[i].value;
}
val7 = document.form_1.name.value;
val8 = document.form_1.tel.value;
val9 = document.form_1.emad.value; 

if( document.form_1.contact.checked == true ) {
val_contact = document.form_1.contact.value;
} else {
val_contact = "Please email me with a quote";	
}
  var modurl = myurl+"?rand="+myRand+"&a=I am looking for a "+val+" website&b="+val2+"&c="+val3+"&d="+val4+"&e="+val5+"&f="+val6+"&g="+val7+"&h="+val8+"&j="+val9+"&k="+val_contact;  
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
  document.getElementById('showtext').style.display = 'none';
document.getElementById('P07').style.display = 'none';
document.getElementById('sentok').style.display = 'block';
document.getElementById('sentok').style.visibility = 'visible';
}

function useHttpResponse() {
   if (http.readyState == 4) {
   
    if(http.status == 200) { 
       document.getElementById('sentok').innerHTML = "<span style='padding:20px; background-color:#FF6600; color:#FFFFFF; font-size:14px;'><img src='images/tick.jpg' style='margin-bottom:-8px;'> Thank you, your enquiry has been sent to our mailbox and will be dealt with normally within 24 hours</span><br><br>";
	   document.getElementById('sentok').style.visibility = "visible";
    } 
  } else {
  document.getElementById('sentok').innerHTML = '<span class=style32>Sending your quote, please wait...<br><img src="./images/horizontalline-ajax-loaders.gif"></span><br>';
  document.getElementById('sentok').style.visibility = "visible";
    } 
}