// JavaScript Document
        var url = ""; // The server-side script 
        var TopType = "";
		var sId = "";
		document.getElementById( "DivLoader" ).style.visibility = 'hidden'; 
		document.getElementById( "DivLoader" ).style.display = 'none'; 
	   function handleHttpResponse() {    
	   			
			if( TopType == 'Main' ){
		        DivName = 'DivMain';
 				document.getElementById( 'DivSub' ).innerHTML  = "<select  name='sub_category' id='sub_category' style='width:185px;' size='5' multiple='multiple'><option value=''>Select Product</option></select>"; 
			}else
			  DivName = 'DivSub';
 			if (http.readyState == 4) { 
				//document.getElementById( 'DivLoader' ).innerHTML  = ""; 
			document.getElementById( "DivLoader" ).style.visibility = 'hidden'; 
			document.getElementById( "DivLoader" ).style.display = 'none'; 
				
				if(http.status==200) { 
				   var results=http.responseText; 
				   document.getElementById( DivName ).innerHTML = results; 
			    } 
			 } 
        } 
        
        function requestCustomerInfo( ID ,Type ) {      
            var sId = ID.value;
			TopType = Type;
			if( Type == 'sub')
			 document.getElementById( 'val_main_category' ).value = sId;
			url = "getCategorySearchAjax.php?LangDir=<?=$_SESSION['language']?>&id="; 
 			url = url + sId;
			url = url + "&type=" + Type;
			http.open("GET", url , true); 
 			http.onreadystatechange = handleHttpResponse; 
 			http.send(null); 
		//	document.getElementById( "DivLoader" ).innerHTML = "Processing..."; 
			document.getElementById( "DivLoader" ).style.visibility = "visible"; 
			document.getElementById( "DivLoader" ).style.display = 'inline'; 
			
        } 
		function getHTTPObject() { 
		  var xmlhttp; 
		  if(window.XMLHttpRequest){ 
			xmlhttp = new XMLHttpRequest(); 
		  } 
		  else if (window.ActiveXObject){ 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
			if (!xmlhttp){ 
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
			} 
		} 
		  return xmlhttp; 
 		} 
		var http = getHTTPObject(); // We create the HTTP Object 
 function setvalue( subcatId ){
    document.getElementById( 'val_sub_category' ).value = subcatId.value;
 }

