﻿// JScript 文件
var currentid;
            function MM_findObj(n, d) { 
                  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
                    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
                  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
                  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
                  if(!x && d.getElementById) x=d.getElementById(n); return x;
                }
            function MM_showHideLayers() {
             currentid=document.activeElement.id;
                  var i,p,v,obj,args=MM_showHideLayers.arguments;
                  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
                    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
                    obj.visibility=v; 
                    }
                }
            //隐藏select列表
            function showWindowedObjects(show) {
                if(show)
                    {
                    document.form1.Select_Grade.style.display='';
                    document.form1.Select_obj.style.display='';
                    }
                else
                    {
                    document.form1.Select_Grade.style.display='none';
                    document.form1.Select_obj.style.display='none';
                    }
            }
            function showSelect()
            {
                if(document.getElementById("Layer1").style.visibility=="hidden")
                    showWindowedObjects(true);
                else
                    showWindowedObjects(false);
            }
	        function regInput(obj, reg, inputStr)
	        {
		        var docSel	= document.selection.createRange()
		        if (docSel.parentElement().tagName != "INPUT")	return false
		        oSel = docSel.duplicate()
		        oSel.text = ""
		        var srcRange	= obj.createTextRange()
		        oSel.setEndPoint("StartToStart", srcRange)
		        var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		        return reg.test(str)
	        }
	        //查看市级数据
	         function ViewCity(strCode,strAreaName)
                {
                    //清除县级
                    document.getElementById("div_Country").innerHTML="";
                    document.getElementById("div_City").innerHTML=PublicClass.GetAreaCity(strCode,strAreaName).value;
                }
                //查看县级数据
            function ViewCountry(strCode,strAreaName)
                {
                   document.getElementById("div_Down").innerHTML="";
                    document.getElementById("div_Country").innerHTML=PublicClass.GetAreaCountry(strCode,strAreaName).value;
                }
                //查看镇级数据
 function ViewDown(strCode,strAreaName)
                {
                    document.getElementById("div_Village").innerHTML="";
                    document.getElementById("div_Down").innerHTML=PublicClass.GetAreaDown(strCode,strAreaName).value;
                }
//查看村级数据
 function ViewVillage(strCode,strAreaName)
                {
                    document.getElementById("div_Village").innerHTML=PublicClass.GetAreaVillage(strCode,strAreaName).value;
                }
                /************得到所选城市****************************/
                function SelectValue(strAreaCode,strAreaName)
                {
                    if(currentid=="Start_area_name")
                    {
                    document.getElementById("Start_area_name").value=strAreaName;
            document.getElementById("Start_area_code").value=strAreaCode;  
                    
                    }
                    else
                   if(currentid=="End_area_code_name")
                   { document.getElementById("End_area_code_name").value=strAreaName;
                    document.getElementById("End_area_code").value=strAreaCode; 
                   }
                    document.getElementById("Layer1").style.visibility="hidden";
                  
                         
                    
                } 
	   	        function ClearAreaValue()
	   	        {
	   	        //清空选择
	   	        if(currentid=="Start_area_name")
	   	        {document.getElementById("Start_area_name").value="--单击选择--";  
                    document.getElementById("Start_area_code").value="";
                    document.getElementById("Layer1").style.visibility="hidden";
	   	        }
	   	        else
	   	         if(currentid=="End_area_code_name")
	   	         {document.getElementById("End_area_code_name").value="--单击选择--";
                    document.getElementById("End_area_code").value=""; 
                    document.getElementById("Layer1").style.visibility="hidden";
	   	         }
	   	        
	   	             
	   	        }