function GetSubcategoryName(TypeId,CatId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Mst.aspx?TypeId="+TypeId+"&CatId="+CatId;
    xmlHttp.onreadystatechange=SubcategorryName;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}


function GetSubcategoryName1(CatId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Mst.aspx?CatId1="+CatId;
    xmlHttp.onreadystatechange=SubcategorryName1;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}

///get Subcategory Name
function SubcategorryName()
{

     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( response.split('#') !="")
         {
            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 SubcategorryName1()
{

     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( response.split('#') !="")
         {
            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 Location  Name

function GetLocationName(StateId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Mst.aspx?&StateId="+StateId;
    xmlHttp.onreadystatechange=Location;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}

function Location()
{

     var ctlName =document.getElementById('ddlLocation');  
      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( response.split('#') !="")
         {
            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 Territory  Name

function GetTerritoryName(StateId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Master.aspx?&State="+StateId;
    xmlHttp.onreadystatechange=Territory;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}

function Territory()
{

     var ctlName =document.getElementById('ddlTerritory');  
      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( response.split('#') !="")
         {
            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 Territory  Name

function GetTerritoryName(StateId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Master.aspx?&State="+StateId;
    xmlHttp.onreadystatechange=Territory;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}

function Territory()
{

     var ctlName =document.getElementById('ddlTerritory');  
      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( response.split('#') !="")
         {
            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 City  Name

function GetCityName(TerritoryId)
{

xmlHttp=GetXmlHttpObject()    
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
    var url="../Ajax/Ajax_Master.aspx?&Territory="+TerritoryId;
    xmlHttp.onreadystatechange=City;   
    xmlHttp.open("GET",url,true);    
    xmlHttp.send(null);
}

function City()
{

     var ctlName =document.getElementById('ddlcity');  
      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( response.split('#') !="")
         {
            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 Nodel name
function ModelName(selectorId,ManufactureId)
{
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }       
 
 
    var url="/Ajax/Ajax_Mst.aspx?SelId="+selectorId+"&ManufactId="+ManufactureId;
    xmlHttp.onreadystatechange=Model;   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null);
}


function Model()
{
     var ctlName =document.getElementById("lstModel");  
      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( response.split('#') !="")
         {
            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++;
                }
            } 
         }
        
    }

}

////////Manufacture Name
function SelectManufactureName(SelId) 
{
      
         xmlHttp=GetXmlHttpObject()    
        if (xmlHttp==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }       
 
  
    var url="/Ajax/Ajax_Master.aspx?MabufacSelId="+SelId;
    xmlHttp.onreadystatechange=GetName; //get Manufacture Name   
    xmlHttp.open("GET",url,true);    
     xmlHttp.send(null); 
}

function GetName()
{
    var ctlName =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 mainList = response.split('#');
        ctlName.options[0] = new Option("--Select--","0",false,false);
        if( response.split('#') !="")
         {
            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 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;
}
