xmlhttp = false;
 //var requestURL = "dataFetch.aspx?term=";
 
 function load(state){ 
          var drp2 = document.getElementById("DropDL_City");
          for (i = drp2.length; i >= 0; i--)
          { 
          drp2.options.remove(i); 
          }
          getHTTPRequestObject();
        if(xmlhttp)
        {
            xmlhttp.open("GET", "getData.aspx?state="+state, true);
            xmlhttp.onreadystatechange = callback2; 
            xmlhttp.send(null);
        }
} 

function callback2(response)
{
        if(xmlhttp.readyState == 4) 
        {
            if(xmlhttp.status ==200)
            {
              result= xmlhttp.responseText;
              
              var oDoc = new ActiveXObject("MSXML2.DOMDocument"); 

              oDoc.loadXML(result); 
              items1 = oDoc.selectNodes("//CITY/Table/parentId"); 
              items2 = oDoc.selectNodes("//CITY/Table/name"); 
              if(items2.length>0)
              {
                  document.getElementById("city").style.display="block";
              
                  var itemsLength=items1.length; 
                  var drp2 = document.getElementById("DropDL_City");
                  var newOption = document.createElement("OPTION"); 
                   newOption.text="请选择";
                   newOption.value="请选择";
                   drp2.options.add(newOption); 
                  for(i=0;i<itemsLength;i++) 
                  //将小类的类名和编号赋予DropDownList2 
                 { 
                   var newOption = document.createElement("OPTION"); 
                   newOption.text=items2[i].text; 
                   newOption.value=items1[i].text; 
                   drp2.options.add(newOption); 
                 }
             }
             else
             {
              document.getElementById("city").style.display="none";
             }
           }
        }
} 

/*window.onload = function(){load('2');}

function getNames(currentTerm)
{

    if (currentTerm.length > 0)
    {
        // a proper term has been entered
        var url = requestURL + currentTerm;
 
        getHTTPRequestObject();

        if(xmlhttp)
        {
            xmlhttp.open("GET", url, true);
            xmlhttp.onreadystatechange = callback; 
            xmlhttp.send(null);
        }
    }
    else
    {
        //no search term entered - empty the div
        var findDIV = document.getElementById("divResults")
        findDIV.className = 'hide';
    }  
}

function callback(response)
{
        if(xmlhttp.readyState == 4) 
        {
            if(xmlhttp.status ==200)
            {
                eval("var objResults = " + xmlhttp.responseText);
                
              var displaytext = "";
              
              for (var i=0; i < objResults.Results.shops.length; i++)
              {
                displaytext += objResults.Results.shops[i].Name + "<br>"; 
              }
              if(displaytext.length > 0)
              {
                    var findDIV = document.getElementById("divResults");
                    findDIV.className = 'show';
                    findDIV.innerHTML = displaytext;
              }
                   
            }
        }
}*/

function getFubiao()
{
    if(!xmlhttp)
        getHTTPRequestObject();
    if(xmlhttp)
    {
        xmlhttp.open("GET", "banshizhinan/fubiao.aspx", true);
        xmlhttp.onreadystatechange = callbackFubiao; 
        xmlhttp.send(null);
    }
}
function callbackFubiao(response)
{
    if(xmlhttp.readyState == 4) 
    {
        if(xmlhttp.status ==200)
        {
            if(xmlhttp.responseText.length>0)
            {
                var array=new Array();
                array=xmlhttp.responseText.split('|');
                document.getElementById("news").innerHTML=array[1];
                document.getElementById("fu_biao").innerHTML=array[0];
            }
        }
    }
}


function getNews()
{
    if(!xmlhttp)
        getHTTPRequestObject();
    if(xmlhttp)
    {
        xmlhttp.open("GET", "picnews/news.aspx", true);
        xmlhttp.onreadystatechange = callbackNews; 
        xmlhttp.send(null);
    }
}
function callbackNews(response)
{
    if(xmlhttp.readyState == 4) 
    {
        if(xmlhttp.status ==200)
        {
            if(xmlhttp.responseText.length>0)
            {
                document.getElementById("news").innerHTML=xmlhttp.responseText;
            }
        }
    }
}


function getHTTPRequestObject()
{
    try
    {
        // try legacy object first
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
            // try IE implementation now
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(E)
        {
            xmlhttp = false;
        }
    }
    if(!xmlhttp && typeof XMLHttpRequest!= 'undefined')
    {
        // we must be using a mozilla based browser
        // so create a native request object now
        xmlhttp = new XMLHttpRequest();
    }
}

