function humansecurityQuestion()
{
 	var randomnumber=Math.floor(Math.random()*10);
	switch(randomnumber)
	{
		case 1:
		  document.AppForm.humanRandom.value='L';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 2nd letter of the company name ELECTROCOIN ?';
		  break;    
		case 2:
		  document.AppForm.humanRandom.value='E';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 3rd letter of the company name ELECTROCOIN ?';
		  break;
		case 2:
		  document.AppForm.humanRandom.value='C';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 4th letter of the company name ELECTROCOIN ?';
		  break;
		case 3:
		  document.AppForm.humanRandom.value='T';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 5th letter of the company name ELECTROCOIN ?';
		  break;
		case 4:
		  document.AppForm.humanRandom.value='R';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 6th letter of the company name ELECTROCOIN ?';
		  break;
		case 5:
		  document.AppForm.humanRandom.value='O';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 7th letter of the company name ELECTROCOIN ?';
		  break;
		case 6:
		  document.AppForm.humanRandom.value='C';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 8th letter of the company name ELECTROCOIN ?';
		  break;
		case 7:
		  document.AppForm.humanRandom.value='O';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 9th letter of the company name ELECTROCOIN ?';
		  break;
		case 8:
		  document.AppForm.humanRandom.value='I';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 10th letter of the company name ELECTROCOIN ?';
		  break;
		case 9:
		  document.AppForm.humanRandom.value='N';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 11th letter of the company name ELECTROCOIN ?';
		  break;
		default:
		  document.AppForm.humanRandom.value='E';
		  document.getElementById('humanRandomDiv').innerHTML='What is the 1st letter of the company name ELECTROCOIN ?';
	}
}


var xmlHttp
function chk_captcha_contact()
{
	var a = document.AppForm;
    if(a.name.value=="")
    {
    alert("Please enter your name");
    return false;
    }
    if(a.company.value=="")
    {
    alert("Please enter your Company Name");
    a.company.focus();
    a.company.select();
    return false;
    }
    
    if(a.enquiry.value=="")
    {
    alert("Please select the enquiry");
    a.enquiry.focus();
    a.enquiry.select();
    return false;
    }
    
    
    if(a.tele.value=="")
    {
    alert("Please enter your Telephone Number");
    a.tele.focus();
    a.tele.select();
    return false;
    }
    
    
    if(a.email.value=="")
    {
    alert("Please enter your Email");
     return false;
    }
    else
    {
        var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
        var returnval=emailfilter.test(document.AppForm.email.value)
        if (returnval==false)
        {
            alert("Please enter a valid email address.")
            document.AppForm.email.select()
            return false;
        }
    }
    
    if(a.humanQuestion.value!=a.humanRandom.value)
    {
		alert("Please enter the correct alphabet");
		a.humanQuestion.focus();
		a.humanQuestion.select();
		return false;
    }
	
    if(a.notes.value=="")
    {
    alert("Please enter your Notes");
    a.notes.focus();
    a.notes.select();
    return false;
    }
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var url="chk_captcha.php";
	var security_code_var;
	security_code_var = a.security_code.value;
  	url=url+"?security_code_var="+security_code_var;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

 }


function stateChanged() 
{ 

	if (xmlHttp.readyState==4)
	{    
			
			var error=xmlHttp.responseText;
			if(error)
			{
				document.getElementById('error').innerHTML = '<font style="color:#FF0033">'+error+'</font>';
				return false;
			}
			else
			{
				 document.AppForm.submit();
			}

	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
   xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


