﻿// JScript 文件

//显示对象
function showDisplay(objname){
	var showobj = document.getElementById(objname);
	if (showobj.style.display == "none")
		showobj.style.display = "";
	else
		showobj.style.display = "none";
}
//设置对象CSS
function setObjClassName(objname, cname) {
	var showobj = document.getElementById(objname);
	if (cname != "") showobj.className = cname;
}


var oBao=null; 
//创建xmlhttprequset对象 
       function createXMLHttpRequest()
       { 
           if(window.ActiveXObject){
             oBao = new ActiveXObject("Microsoft.XMLHttp");
            }else if(window.ActiveXObject){
             oBao = new ActiveXObject("Msxml2.XMLHTTP.4.0");
            }else if(window.ActiveXObject){
             oBao = new ActiveXObject("Msxml2.XMLHTTP");
            }else if(window.XMLHttpRequest){
             oBao = new XMLHttpRequest();
             }
       }
        function XmlPost(obj,fullName)
		{
				//求取当前下拉框的值
　　			var svalue = obj.value;
　　			var mytopname = "--请选择--";
　　			
　　			//定义要填充的对象
　　			var fullObj = document.getElementById("bottom1_Intypemore1_ddlist1");
　　			if(fullObj==null)
　　			{
　　			   //使用母版页会导致ID变形
　　			   fullObj = document.getElementById("ctl00_bottom1_Intypemore1_ddlist1");
　　			}
　　			//定义取值地址
　　			var webFileUrl = "Index.aspx?sortid=" + svalue;
　　			
　　			//定义返回值
　　			var result = "";
　　			
　　			//开始取值过程
　　			if(oBao==null)
                 {
                    createXMLHttpRequest(); 
                 }
　　			oBao.open("POST", webFileUrl, false);
　　			oBao.send("");
　　			result = oBao.responseText;
　　			//alert(result);


			　　//如果有取到值,则根据格式进行拆分
			　　//注意如果选择了第一行"请选择"空行时,是取不到值的,因此多加了一个条件
　　			if(result != "" && svalue != "")
　　			{
　　				//先清空原有的值
　　　　			fullObj.length=0;
　　　　			
　　　　			fullObj.options.add(new Option(mytopname,""));　　　　			
　　　　			
　　　　			//拆分值成数组
　　　　			var piArray = result.split(",");
　　　　			
　　　　			//循环数组
　　　　			for(var i=0;i<piArray.length;i++)
　　　　			{
　　　　				//再拆分成ID及名称
　　　　　　			var ary1 = piArray[i].toString().split("|");
　　　　　　			//逐一添加项
　　　　　　			fullObj.options.add(new Option(ary1[1].toString(),ary1[0].toString()));
　　　　			}
　　			}
　　			else
　　			{
　　　　			//如果没有取到值,则清空要填充的下拉框的值
　　　　			fullObj.length = 0;
　　　　			fullObj.options.add(new Option(mytopname,""));
　　			}
　　	}
