
var xmlHttp;
function ChkCaptchaCode(frmName, frmField) {
	init();
    xmlHttp.onreadystatechange = codeValidator;
  xmlHttp.send("code=" + document.forms[frmName].elements[frmField].value); 
     return false;
	    }


	
		
function init() {

	xmlHttp = CreateXMLHttpRequestObject();
	

	var url = "/support/checkCaptchaCode.jsp";
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
}



 function codeValidator() {
    if (xmlHttp.readyState == 4) {
	        if (xmlHttp.status == 200) {
            var messageObj = xmlHttp.responseXML.getElementsByTagName("message")[0];
            var message = messageObj.childNodes[0].nodeValue;
			
			}
if (message == "true") {
document.getElementById("formCaptcha").submit(); 
 } else {
      
    document.getElementById("msg").innerHTML=eval( "'" +document.getElementById("wrongCode").value+"'");
	
		}
  }
    	
}	



 function CreateXMLHttpRequestObject()
  {
 
        try 
     {
         xmlHttp = new XMLHttpRequest();
     }
     catch(e)
     {
         var XMLHttpVersions = new Array('MSXML2.XMLHTTP.7.0',
'MSXML2.XMLHTTP.6.0',
'MSXML2.XMLHTTP.5.0',
'MSXML2.XMLHTTP.4.0',
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP', 
'Microsoft.XMLHTTP');
         for(var i=0; i<XMLHttpVersions.length && !xmlHttp; i++) {
             try 
             {
                 xmlHttp = new ActiveXObject(XMLHttpVersions[i]);
             }
             catch(e) {}
         }
     }
     if(!xmlHttp) {
        document.getElementById("formCaptcha").submit();
     }
     else {
        return xmlHttp;
     }
	 

  }

