var xmlHttp

//Function to show the Result on Show-Sub-Cat.php page on selecting the Main Category 
function SubCategoryList(str,str1)
{
    //alert(str) ;
	//if chooose blank field of list box then the text box is to be empty
	if (str.length==0) 
	{ 
	    alert("You must Select Main Category to view SubCategory") ;
		document.getElementById("SubCategpry").focus() ;
		return false ;
	}
	
	//if browser not support the httprequest then show the appropriate message in alert box
	xmlHttp=GetXmlHttpObject() ; 
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request") ;
		return ;
	} 
	//alert("khush") ;
	
	var url="../AjaxPhpPage/GetSubCategory.php" ;
	url=url+"?TempId="+str+"&For="+str1 ;
	url=url+"&sid="+Math.random() ;
	xmlHttp.onreadystatechange=stateChanged ; 
	xmlHttp.open("GET",url,true) ;
	xmlHttp.send(null) ;
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		document.getElementById("SubCategpry").innerHTML =  xmlHttp.responseText ;	
	} 
}








//Function Used on Add-Product.php page for showing subCategory by selecting main Category
function FillSubCategoryList(str)
{
    //alert(str) ;
	//if chooose blank field of list box then the text box is to be empty
	if (str.length==0) 
	{ 
	    alert("You must Select Main Category to view SubCategory") ;
		document.getElementById("MainCategoryId").focus() ;
		return false ;
	}
	
	//if browser not support the httprequest then show the appropriate message in alert box
	xmlHttp=GetXmlHttpObject() ; 
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request") ;
		return ;
	} 
	//alert("khush") ;
	
	var url="../AjaxPhpPage/GetSubCategory1.php" ;
	url=url+"?TempId="+str ;
	url=url+"&sid="+Math.random() ;
	xmlHttp.onreadystatechange=stateChanged1 ; 
	xmlHttp.open("GET",url,true) ;
	xmlHttp.send(null) ;
} 

function stateChanged1() 
{    
    //alert(xmlHttp.responseText) ; 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		document.getElementById("SubCategoryDiv").innerHTML =  xmlHttp.responseText ;	
	} 
}







//Function Used on Show-Product.php page for showing subCategory by selecting main Category
function FillSubCategoryList1(str,str1)
{
    //alert(str) ;
	//if chooose blank field of list box then the text box is to be empty
	/*if (str.length==0) 
	{ 
	    alert("You must Select Main Category to view SubCategory") ;
		document.getElementById("MainCategoryId").focus() ;
		return false ;
	}*/
	
	//if browser not support the httprequest then show the appropriate message in alert box
	xmlHttp=GetXmlHttpObject() ; 
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request") ;
		return ;
	} 
	//alert("khush") ;
	
	var url="../AjaxPhpPage/GetSubCategory2.php" ;
	url=url+"?TempId="+str+"&For="+str1 ;
	url=url+"&sid="+Math.random() ;
	xmlHttp.onreadystatechange=stateChanged2 ; 
	xmlHttp.open("GET",url,true) ;
	xmlHttp.send(null) ;
} 

function stateChanged2() 
{    
    //alert(xmlHttp.responseText) ; 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		document.getElementById("SubCategoryDiv").innerHTML =  xmlHttp.responseText ;	
	} 
}















//Function to show the Result on Show-Product.php page on selecting the SubCategory Category 
function ProductList(str,str1)
{
    //alert(str + str1) ;
	//if chooose blank field of list box then the text box is to be empty
	if (str.length==0) 
	{ 
	    alert("You must Select Sub Category to view its Product") ;
		document.getElementById("CategoryId").focus() ;
		return false ;
	}
	
	//if browser not support the httprequest then show the appropriate message in alert box
	xmlHttp=GetXmlHttpObject() ; 
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request") ;
		return ;
	} 
	//alert("khush") ;
	
	var url="../AjaxPhpPage/GetProduct.php" ;
	url=url+"?TempId="+str+"&For="+str1 ;
	url=url+"&sid="+Math.random() ;
	xmlHttp.onreadystatechange=stateChangedProduct ; 
	xmlHttp.open("GET",url,true) ;
	xmlHttp.send(null) ;
} 

function stateChangedProduct() 
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		document.getElementById("Product").innerHTML =  xmlHttp.responseText ;	
	} 
}
















function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}