// AJAX/JAVASCRIPT Document
/*	******************************************************************	
	Modified By: Raja Rizwan: Evast Computer System Designs Inc.
	Dated:  18/12/2008: 11.06 AM
	Description: OpenSource Script - Get and Show subCategories - free to use modify and distribute
	******************************************************************	*/

function ajax_user(strURL,frm,fld,myDIV) {
	//alert(strURL + "," +  frm + "," +  fld + "," + myDIV);
	document.getElementById( myDIV ).innerHTML = ''; 
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
	
    }
    // Internet Exp
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			
			if(myDIV!="")
          update_request_page(self.xmlHttpReq.responseText,myDIV);
			 var a= self.xmlHttpReq.responseText;
			 if(a==1){ //alert(self.xmlHttpReq.responseText);
			 //window.location="userIndex.php";
			// if(window.location=="http://www.alawar.ae/user_register.php")
			 //window.location="index.php";
			// else
			 window.location.reload();
			 }
        }
    }
	
   self.xmlHttpReq.send(get_query_string(frm,fld));

	
}
function get_query_string(frm,fld) {
    var form     = document.forms[frm];	
	var fld = document.forms[frm].elements[fld].value;
 	//alert(fld);												//alert(sub_cat);												
	qstr = 'w=' + escape(fld);
	//alert(	qstr );										//qstr = 'w=' + escape(word)+',sub_cat' + escape(sub_cat);  // NOTE: no '?' before querystring
	//alert(qstr);
    return qstr;
}
function update_request_page(str,trgDIV){
	if(trgDIV!="")
    document.getElementById(trgDIV).innerHTML = str;
	//document.getElementById("result5").innerHTML= str;
}
/*
function getdivbyname(){	
	var collection = document.getElementsByTagName('DIV');
  	var output = collection[1].getAttribute('result');
	//alert(collection.getElement());

	
}
*/
