var http = createRequestObject();

function createRequestObject() {  
	// find the correct xmlHTTP, works with IE, FF and Opera
	var xmlhttp;
	try {
  	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e) {
    try {
    	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e) {
    	xmlhttp=null;
    }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp=new XMLHttpRequest();
  }
	return  xmlhttp;
}

function sendRequest(cid,act,pid) {
	try{
		//alert("../../admin/php/getcat_prod.php?cid="+cid+"&action="+act+"&pid="+pid);
		http.open("Get", "../admin/php/getcat_prod.php?cid="+cid+"&action="+act+"&pid="+pid, true);
    	http.setRequestHeader('Content-Type',  "text/xml");
    	http.onreadystatechange = handleResponse;
	
		http.send(null);
	}
	catch(e){
		// caught an error
		alert('Request send failed.');
	
	}
}
function handleResponse() {

	try{
	
    if((http.readyState == 4)&&(http.status == 200))
	{
	
		var response = http.responseXML.documentElement;
		
			var _data = response.getElementsByTagName('catDetails');
			document.getElementById('relproun').length="";
			if(_data.length == 0){
				document.getElementById('relproun').options[0] = new Option("",'0');	
			}//end of if
			var i
			for ( i = 0 ; i < _data.length ; i ++ ){
				document.getElementById('relproun').options[i] = 
				new Option(response.getElementsByTagName('catName')[i].firstChild.data,
				response.getElementsByTagName('id')[i].firstChild.data);
			}//end of for
			set_cntr(_data.length);

			
			var _data = response.getElementsByTagName('catDetailsel');
			document.getElementById('lstrelpro').length="";
			if(_data.length == 0){
				document.getElementById('lstrelpro').options[0] = new Option("",'0');	
			}//end of if
			var i
			for ( i = 0 ; i < _data.length ; i ++ ){
				document.getElementById('lstrelpro').options[i] = 
				new Option(response.getElementsByTagName('catNamesel')[i].firstChild.data,
				response.getElementsByTagName('idsel')[i].firstChild.data);
			}//end of for
			set_cntl(_data.length);
	 }
  }
	catch(e){
		// caught an error
		alert('Response failed.'+e);
	}
	finally{}
}





