function getXMLHTTP() 
	{
		var xmlhttp;	
		var browser = navigator.appName;
		if(browser == "Microsoft Internet Explorer")
		 {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		 }
		else
		 {
			xmlhttp = new XMLHttpRequest();
		 }
		return xmlhttp;	
    }

function getdescription(category_id) 
 {		
	var strURL="http://"+window.location.host+"/get_category_description.php?category_id="+category_id;
	var req = getXMLHTTP();
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								 document.getElementById('category_div').innerHTML=req.responseText;
							}
						else 
							{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}
function select_subcat(category_id,sub_cat_id) 
{		
   // alert(sub_cat_id);
	var strURL="http://"+window.location.host+"/admin/select_subcat.php?category_id="+category_id+"&sub_catid="+sub_cat_id;
	var req = getXMLHTTP();
	//alert(strURL);
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
							    // alert(req.responseText);
								 document.getElementById('sub_cat').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function sub_category(category_id,sub_cat_id) 
{		
   // alert(sub_cat_id);
	var strURL="http://"+window.location.host+"/admin/getsubcategory.php?category_id="+category_id+"&sub_catid="+sub_cat_id;
	var req = getXMLHTTP();
	//alert(strURL);
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
							    // alert(req.responseText);
								 document.getElementById('sub_cat').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}
function select_product(sub_category_id,product_id,status_product)// status_product will contain DP SP direct product or subcategory product
{		
	var strURL="http://"+window.location.host+"/admin/select_product.php?sub_category_id="+sub_category_id+"&product_id="+product_id+"&status_product="+status_product;
	var req = getXMLHTTP();
	//alert(strURL);
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
								 document.getElementById('product').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}
function check_files(download_cat_id) 
{		
	var strURL="http://"+window.location.host+"/admin/select_files.php?download_cat_id="+download_cat_id;
	var req = getXMLHTTP();
	
	//alert(strURL);
	
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
								 document.getElementById('filetype').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function getProductImage(product_id) 
{		
	var strURL="http://"+window.location.host+"/get_product_image.php?product_id="+product_id;
	
	//alert(strURL);
	
	var req = getXMLHTTP();
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
								 document.getElementById('im').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function getsubapplication(app_id) 
{		
	var strURL="http://"+window.location.host+"/admin/get_subapplications.php?app_id="+app_id;
	var req = getXMLHTTP();
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
								 document.getElementById('sub').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function getsubapp(app_id,sub_app) 
{		
	var strURL="http://"+window.location.host+"/get_subapplications.php?app_id="+app_id+"&sub_app="+sub_app;
	var req = getXMLHTTP();
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
						{
								 document.getElementById('sub').innerHTML=req.responseText;
						}
						else 
						{
								//alert("There was a problem while using XMLHTTP:\n" + req.statusText);
						}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

