var xmlHttp;
var code="";

function verify_captcha()
{	val=document.getElementById('strCAPTCHA').value;
	val=val.toUpperCase();
	//alert(cod[1]);
	//alert(val);
	//alert(cod[0]);
	if(val!=cod[0]||val=="")
	{	alert('Your code could not be verified. Please try again.');
		document.getElementById('strCAPTCHA').value="";
		document.getElementById('strCAPTCHA').focus();
		return false;
	}
	return true;
}

function set_code()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url;
url="get_code.asp";

xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return true;
}

function stateChanged() 
{ 

	if (xmlHttp.readyState==4)
	{
		c=xmlHttp.responseText;
		cod=c.split('#');
		//alert(cod[0]);
		//alert(cod[1]);
	}
}

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;
}
