

function GetCategoryName(TypeId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
  
    var url="../Ajax/Ajax_Mst.aspx?Type="+TypeId;
    xmlHttp.onreadystatechange=CategoryName;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 

}


function CategoryName()
{

     var ctlName =document.getElementById('ddlCategory');  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
      {
        
       for(var i = ctlName.length-1;i>=0;i--)
        {
            ctlName.options[i] = null;
        }
        var response = xmlHttp.responseText;     
        
        var mainList = response.split('#');
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if(mainList.length > 0)
        {
            var cnt;
            cnt = 0;
            while(cnt<mainList.length)
            {
                var temp = mainList[cnt].split('%');
                ctlName.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
        
    }
}



function ManufactureName(SelectorId)
{
  
    xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
  
    var url="/Ajax/Ajax_Mst.aspx?SelectorId="+SelectorId;
    xmlHttp.onreadystatechange=Manufacture;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 

}



function Manufacture()
{
    var ctlName =document.getElementById('ddlmanufacture');  
//    var ctlName1 =document.getElementById('ddlproduct');  
//    var ctlName2 =document.getElementById('ddlCondition');
  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
      {
        
       for(var i = ctlName.length-1;i>=0;i--)
        {
            ctlName.options[i] = null;
        }
//        for(var i = ctlName1.length-1;i>=0;i--)
//        {
//            ctlName1.options[i] = null;
//        }
//        for(var i = ctlName2.length-1;i>=0;i--)
//        {
//            ctlName2.options[i] = null;
//        }
        var response = xmlHttp.responseText; 
        
        var reponseList = response.split('^');        
        var manufaclist = reponseList[0].split('#');
        var productlist=reponseList[1].split('#');
        var operatinglist=reponseList[2].split('#');
        
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if(manufaclist.length > 0)
        {       
             
            var cnt;
            cnt = 0;
            while(cnt<manufaclist.length)
            {
                var temp = manufaclist[cnt].split('%');
                ctlName.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
//         ctlName1.options[0] = new Option("--Select--","0",false,false);
//        if(productlist.length>0)
//        {
//            var cnt;
//            cnt=0;
//            while(cnt<productlist.length)
//            {
//                var temp = productlist[cnt].split('%');
//                ctlName1.options[cnt+1] = new Option(temp[1],temp[0],false,false);
//                cnt++;
//            }
//        }
//        
//         ctlName2.options[0] = new Option("--Select--","0",false,false);
//        if(operatinglist.length>0)
//        {
//            var cnt;
//            cnt=0;
//            while(cnt<operatinglist.length)
//            {
//                var temp = operatinglist[cnt].split('%');
//                ctlName2.options[cnt+1] = new Option(temp[1],temp[0],false,false);
//                cnt++;
//            }
//        }
    }

}


///Get only Price Subcategoty
function PriceSubcategoryName(PriceCatId)
{

 xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
  
    var url="/Ajax/Ajax_Master.aspx?PriceCatId="+PriceCatId;
    xmlHttp.onreadystatechange=PriceSybcategory;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 
}


function PriceSybcategory()
{
    var ctlName =document.getElementById('ddlsubcategory');  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
      {
        
       for(var i = ctlName.length-1;i>=0;i--)
        {
            ctlName.options[i] = null;
        }
        var response = xmlHttp.responseText;        
        var mainList = response.split('#');
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if(mainList.length > 0)
        {       
             
            var cnt;
            cnt = 0;
            while(cnt<mainList.length)
            {
                var temp = mainList[cnt].split('%');
                ctlName.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
        
    }
}



//




// Get Price SubcategoryId
function SubcategoryName(PriceCategoryId)
{

 xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
  
    var url="/Ajax/Ajax_Mst.aspx?PCategoryId="+PriceCategoryId;
    xmlHttp.onreadystatechange=Subcategory;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 
}


function Subcategory()
{
    var ctlName =document.getElementById('ddlsubcategory');  
     var ctlName1 =document.getElementById('ddlQuantity');  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
      {
       
       for(var i = ctlName.length-1;i>=0;i--)
        {
            ctlName.options[i] = null;
        }
        for(var i = ctlName1.length-1;i>=0;i--)
        {
            ctlName1.options[i] = null;
        }
        
        var response = xmlHttp.responseText; 
        var reponseList = response.split('^');
               
        var manufaclist = reponseList[0].split('#');
        var productlist=reponseList[1].split('#');
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if(manufaclist.length > 0)
        {       
             
            var cnt;
            cnt = 0;
            while(cnt<manufaclist.length)
            {
                var temp = manufaclist[cnt].split('%');
                ctlName.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
         ctlName1.options[0] = new Option("--Select--","0",false,false);
        if(productlist.length>0)
        {
       
            var cnt;
            cnt=0;
            while(cnt<productlist.length)
            {
                var temp = productlist[cnt].split('%');
                ctlName1.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        }
    }

}


function product(SelectorId)
{
    xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
  
    var url="/Ajax/Ajax_Mst.aspx?LubeSeclId="+SelectorId;
    xmlHttp.onreadystatechange=Productname;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 
}

function Productname()
{
     var ctlName =document.getElementById('ddlproduct');
      var ctlName1 =document.getElementById('ddlmanufacture');  
      if (xmlHttp.readyState==4 || xmlHttp.readyState=='complete')
      {
        
       for(var i = ctlName.length-1;i>=0;i--)
        {
            ctlName.options[i] = null;
        }
        var response = xmlHttp.responseText;  
         var reponseList = response.split('^');  
        var mainList = reponseList[0].split('#');
        var Manufactuelist=reponseList[1].split('#');
        
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if(mainList.length > 0)
        {       
             
            var cnt;
            cnt = 0;
            while(cnt<mainList.length)
            {
                var temp = mainList[cnt].split('%');
                ctlName.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
         ctlName1.options[0] = new Option("--Select--","0",false,false);
        if(Manufactuelist.length > 0)
        {       
             
            var cnt;
            cnt = 0;
            while(cnt<Manufactuelist.length)
            {
                var temp = Manufactuelist[cnt].split('%');
                ctlName1.options[cnt+1] = new Option(temp[1],temp[0],false,false);
                cnt++;
            }
        } 
    }
}




function GetXmlHttpObject()
{
    var objXMLHttp=null    
    try
    {
    // Firefox, Opera 8.0+, Safari
    objXMLHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return null;
        }
      }
    }
    return objXMLHttp;
}



