function Dsy()
{
    this.Items = {};
}
Dsy.prototype.add = function(id,iArray)
{
    this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id)
{
    if(typeof(this.Items[id]) == "undefined") return false;
    return true;
}

function change(v,Flag)
{
   if(Flag==1)
   {  
     str0 = "ctl00$ContInfo$";
     str1 = "ctl00_ContInfo_";
   }
   else
   {  
      str0 = "";
      str1 = "";
   } 
   var str="0";
   var ss=document.getElementById(str0+s[v]);
   with(ss)
   {
      length = 0;
      if(v && document.getElementById(str0+s[v-1]).selectedIndex>=0)
         str=document.getElementById(str0+s[v-1]).options[document.getElementById(str0+s[v-1]).selectedIndex].value;
      if(dsy.Exists(str))
      {
         ar = dsy.Items[str];
         for (i = 0; i < ar.length; i++)
         {
            var ss = ar[i].split(",");
            options[length] = new Option(ss[0], ss[1]);
         }
      }

   }
	  if(v=="1")
	  {
	     var len = document.getElementById(str0+s[v+1]).options.length;
		 for (var i=len-1;i>=0;i--)document.getElementById(str0+s[v+1]).options[i]=null;
	  }
}

var dsy = new Dsy();

dsy.add("0",["体育用品,85","办公设备,1","皮肤用化学品,14","家电,57","门窗五金,15","行业设备,9","服装服饰,21","IT数码产品,26","数码产品,27","广播系统,16","电工电子,6","手机配件,12" ]);
dsy.add("85",["足球,185","篮球,186","跳绳,187","铅球,188","溜溜球,189","羽毛球,190","乒乓球,191","跳跳板,192","跳山羊,193" ]);
dsy.add("1",["自行车,4","电动车,5","复印机,2","传真机,3","保险柜,35","固定电话,36","碎纸机,37","钉书机,38","点钞机、验钞机,39","打字机、刻字机,84","考勤机,102","裁纸机,103" ]);
dsy.add("4",[]);
dsy.add("5",[]);
dsy.add("2",["零部件,53","磨具磨料,54","五金锁具,55","极限运动用品,56" ]);
dsy.add("3",[]);
dsy.add("39",[]);
dsy.add("14",["制服、工作服,143","鑫华制衣,144","尼萨福,145","阿琳利,146","娜尔诗/NURSE,147" ]);
dsy.add("57",["厨房电器,129","家居小家电,130","卫浴电器,131","个人生活小家电,132","冰箱/冰柜/展示柜,133","洗衣机/干衣机,134","空调,135","电视机,136" ]);
dsy.add("15",["接头,148","其他五金配件,149","脚轮、万向轮,150","钢珠、滚珠,151","机械工业,152","汽车维修保养,153","水工业,154" ]);
dsy.add("9",["球磨机,137","破碎机,138","家电维修、安装,139","制药工业,140","机械工业,141","食品工业,142" ]);
dsy.add("21",["上装,161","女裤,162","裙装,163","伊芙嘉,164","艾米莉亚,165","萝依莱,166","霞黛芳,167","JEFFERSON,168","卡逸妃拉,169" ]);
dsy.add("26",["网络设备,28","工具软件,29","笔记本,170","台式整机,171","整机配件,172","普通数码相机,173","数码摄像机,174" ]);
dsy.add("27",["维修工具,18","活性炭,78","工业润滑油,79","催化剂,80" ]);
dsy.add("16",["广告伞,155","广播系统,17","广告灯箱,156","广告牌,157","广告气球,158","充气模型,159","广告机/三面翻,160" ]);
dsy.add("17",[]);
dsy.add("6",["集成电路,175","传感器,176","显示器件,177","整流器,178","功率放大器,179","电位器,180","印刷线路板,181","光电子、激光器件,182","频率元件,183","开关元件,184" ]);
dsy.add("12",["电视手机,121","拍照手机,122","音乐手机,123","布线产品,124","智能手机,125","录音电话,126","CDMA模块,127","网卡,128" ]);
var s=["SortB","SortM","SortS"];
function setup(Flag)
{
   if(Flag==1)
     str0 = "ctl00$ContInfo$";
   else
      str0 = "";
   for(i=0;i<s.length-1;i++)
   document.getElementById(str0+s[i]).onchange=new Function("change("+(i+1)+","+Flag+")");
   change(0,Flag);
}

function initialize(Flag)
{
   if(Flag==1)
   {  
     str0 = "ctl00$ContInfo$";
     str1 = "ctl00_ContInfo_";
   }
   else
   {  
      str0 = "";
      str1 = "";
   } 
   for(i=0;i<s.length-1;i++)document.getElementById(str0+s[i]).onchange=new Function("change("+(i+1)+","+Flag+")");
   var v="0";
   s1=document.getElementById(str1+s[0]);
   s2=document.getElementById(str1+s[1]);
   s3=document.getElementById(str1+s[2]);
   var ProvinceID=document.getElementById(str1+"txtSortB").value;
   var cityID=document.getElementById(str1+"txtSortM").value;
   var CountyID=document.getElementById(str1+"txtSortS").value;


   with(s1)
   {
      if(dsy.Exists(0))
      {
         arr = dsy.Items[0];
         for(i=0;i<arr.length;i++)
         {
            var ss = arr[i].split(",");
            options[length] = new Option(ss[0], ss[1]);
            if(options[i].value==ProvinceID)
               options[i].selected = true;
            }
         }
       };
   with(s2)
   {
      if(dsy.Exists(ProvinceID))
      {
         arr = dsy.Items[ProvinceID];
         for(i=0;i<arr.length;i++) 
         {
            var ss = arr[i].split(",");
            options[length] = new Option(ss[0], ss[1]);
            if(options[i].value==cityID)
               options[i].selected = true;
         }
      }
   };
   with(s3)
   {
      if(dsy.Exists(cityID))
      {
         arr = dsy.Items[cityID];
         for(i=0;i<arr.length;i++)
         {
            var ss = arr[i].split(",");
            options[length] = new Option(ss[0], ss[1]);
            if(options[i].value==CountyID)
               options[i].selected = true;
         }
      }
   }
}
