//General function

function getXMLHTTP() 
{ 
	//fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    } 
	
//Function for retreiving categories
function sub_category(divid,value)  { 
	if(value!="") {	 
		var strURL="find_catogary.php?id="+value;
		var req = getXMLHTTP();
		
		if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200)
					 {	 
						 var result=req.responseText;
					 	 var result=result.split('hfgfgfai'); 
						 var image = result[0];
						 var referlink=result[1]; 
						 document.getElementById(divid).innerHTML=image;	 
						if(referlink==undefined) {    
						}
						else { 
							window.open(referlink,'newwindow');
						}
					}
					 else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}	
				else if (req.readyState < 4) {
					document.getElementById(divid).innerHTML="Loading.";
				}
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}	
	 }	
   }
	
	
	
	
	