// JavaScript Document

var liveReqp = "";
var print_dt = "";
var chng = "";
var chng_1 = "";

function getdata(aa,tb,fld,folpth) {			
	chng = fld;
	
	if (window.XMLHttpRequest) {
		liveReqp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		liveReqp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	var sURL = folpth + "includes/get_cat.php?id="+aa+"&tbl="+tb;
	liveReqp.onreadystatechange = receivercode;
	liveReqp.open("GET", sURL);		
	liveReqp.send(null);
}

function receivercode(){
   if (liveReqp.readyState == 4) {
          
       var nummd =  document.getElementById(chng).length;	   
	   while(nummd > 1) {
		   nummd--;
		   document.getElementById(chng).options[nummd] = null;
	   }				    
	    
		var str=liveReqp.responseText;			
		var str_sr=str.split("#");
		var str_ln=str_sr.length
	
	    for (var k=0;k<str_ln-1;k++){
			 var second_sr=str_sr[k].split("/!");
			 document.getElementById(chng).options[k+1] = new Option(second_sr[0], second_sr[1]);
	    }
	}
 }
