﻿// JScript 文件

   function gotosearch()
   {
     var forms=document.getElementById("myforms").value;
     var lever=document.getElementById("lever").value;
     var city=document.getElementById("city").value;
            if(city=="请选择城市名" && forms=="")
            {
                alert("请选择一个城市或选择一个分类");
                window.event.returnValue=false;
            }
            else
            {
               window.open("WangSearch.aspx?forms="+forms+"&lever="+lever+"&city="+city+"")
            }
  }
  
   function checkSelect(obj)
          {
            alert("选中用户成功，可以抢他的买家了.");
			 document.getElementById("Text1").value=obj.value;
			  window.event.returnValue=false;
          }
          
  function gotoqiang()
  {
      window.open("QiangTaoBao.aspx","_blank")
  }
  var xmldom = new ActiveXObject("Microsoft.XMLDOM");
var province = [];
var cities = [];
function init()
{
    xmldom.async = true;
    xmldom.onreadystatechange = statInit;
    window.setTimeout(function()
    {
        xmldom.load("city.xml");
    }
    , 10);
}

function statInit()
{

    if (xmldom.readyState == 4)
    {
        if (xmldom == null || xmldom.documentElement == null)
        {
            alert("XML文件不存在或没有菜单项");
            return ;
        }
        createProvince();
    }
}

function createProvince()
{
    var provinces = xmldom.getElementsByTagName("province");
    delitem(document.all.province);
    delitem(document.all.city);
    for (var i = 0; i < provinces.length; i++)
    {
        province[i] = provinces[i].getAttribute("name");
        cities[i] = provinces[i].getAttribute("cities");
        document.all.province.add(window.Option(province[i], province[i]));
    }
    provinceChange(0);
}

function provinceChange(index)
{
    var city = cities[index].split(" ");
    delitem(document.all.city);
    for (var i = 0; i < city.length; i++)
    {
        document.all.city.add(window.Option(city[i], city[i]));
    }
}

function delitem(options)
{
    optioncount = options.length;
    for (i = optioncount - 1; i >= 0; i--)
    {
        options.options[i] = null
    }
}