
 function ie_nick()
   {
	  var browser = navigator.appVersion;
	  if(browser.indexOf("MSIE") >= 1)
	  {
		return true;
	  }
	  else
	  {
		return false;
	  }
   }

function check_count(id, my , num)
{
 var oEvent = document.getElementById(id + 'show');
 var chks = oEvent.getElementsByTagName("INPUT");
 var count = 0;
 for(var i=0; i<chks.length; i++)
 {
      if(chks[i].type=="checkbox")
      {
      	if(chks[i].checked == true)
      	{
      		count ++;
      	}
      	if(count > num)
      	{
      		my.checked = false;
      		alert("最多只有选择" + num + "项");
      		return false;
      	}
	}
 }
}

   function Request(strName){
     var strHref = window.document.location.href;
     var intPos = strHref.indexOf("?");
     var strRight = strHref.substr(intPos + 1);
     var arrTmp = strRight.split("&");
     for(var i = 0; i < arrTmp.length; i++)
     {
       var arrTemp = arrTmp[i].split("=");
       if(arrTemp[0].toUpperCase() == strName.toUpperCase()) 
           return arrTemp[1];
     }
     return "";
   }
   
function img(){
     var valimg = document.getElementById("validate");
     valimg.src=valimg.src + '?';
 }
    
    
function build_select(first_id,second_id,first_array,second_array,def_value)
{
    if(def_value == "" || def_value == "0")
    {
        var k=1000;
        for( key in first_array )       {
            var sOption = document.createElement("OPTION");
            sOption.text = first_array[key];
            sOption.value = key;
            //sOption.value = first_array[key];
            document.getElementById(first_id).options.add(sOption,k);
            k--;
        }
    }
    else
    {
        pro_key = def_value.substr(0,2);
        var k=1000;
        for( key in first_array )
        {
            var sOption = document.createElement("OPTION");
            sOption.text = first_array[key];
            sOption.value = key;
            if(pro_key == key)
            {
                sOption.id = "sele_pro"+first_id;
            }
            document.getElementById(first_id).options.add(sOption,k);
            k--;
        }
        document.getElementById("sele_pro"+first_id).selected = true;
        var k=1000;
        for( key in second_array[pro_key] )     {
            var sOption = document.createElement("OPTION");
            sOption.text = second_array[pro_key][key];
            sOption.value = key;
            if(def_value == key)
            {
                sOption.id = "sele_city"+second_id;
            }
            document.getElementById(second_id).options.add(sOption,k);
        }
        k--;
        document.getElementById("sele_city"+second_id).selected = true;
    }
}

function build_second(first_value,second_id,second_array,setValue,setValueName)
{   document.getElementById(setValueName).value = setValue;
    document.getElementById(second_id).innerHTML = "";
    var k=1000;
    for( key in second_array[first_value]){
        var sOption = document.createElement("OPTION");
        sOption.text = second_array[first_value][key];
        //sOption.value = key;
        sOption.value = second_array[first_value][key];
        document.getElementById(second_id).options.add(sOption,k);
    }
    k--;
}

function build_second2(first_value,second_id,second_array,setValue,setValueName)
{   document.getElementById(setValueName).value = setValue;
    document.getElementById(second_id).innerHTML = "";
    var k=1000;
    for( key in second_array[first_value]){
        var sOption = document.createElement("OPTION");
        sOption.text = second_array[first_value][key];
        sOption.value = key;
        //sOption.value = second_array[first_value][key];
        document.getElementById(second_id).options.add(sOption,k);
    }
    k--;
}

function build_second3(setValue,setValueName)
{   
  document.getElementById(setValueName).value = setValue;  
}



 function showDiv(id,event_hdl,myLeft,myTop)
  { 
	xpos = 0;
	ypos = 0;
	if(ie_nick())
	{
		var Ypos;
		var Xpos;
		var Offwidth;
		var Offheight;
		var standardCompat = document.compatMode.toLowerCase();
		//判断CSS渲染模式
		if (standardCompat == "css1compat")
		{
			Ypos = document.documentElement.scrollTop;
		}
		else if (standardCompat == "backcompat" || standardCompat == "quirksmode" )
		{
			Ypos = document.body.scrollTop;
		}
		var top_tmp	= event_hdl.clientY	+ Ypos;
		var left_tmp = event_hdl.clientX;
	}
	else
	{
		var top_tmp	= event_hdl.pageY;
		var left_tmp = event_hdl.pageX;
	}

	left_tmp = left_tmp	+ xpos - myLeft ;
	top_tmp	= top_tmp + ypos - myTop ;

	document.getElementById(id).style.left = left_tmp + 'px';
	document.getElementById(id).style.top = top_tmp + 'px';
	document.getElementById(id).style.zIndex = 999;
	document.getElementById(id).style.display = 'block';
  }
  
   function cancel_show(id)
    {  
	   document.getElementById(id).style.display = 'none';
    }
    
 function showDivNo(ow,oh,objID){
 var bdy = (document.documentElement && document.documentElement.clientWidth)?document.documentElement:document.body;
 document.getElementById(objID).style.left = (bdy.offsetWidth - ow) / 2; 
 document.getElementById(objID).style.top = (bdy.offsetHeight - oh) / 2 + bdy.scrollTop;
 document.getElementById(objID).style.display = 'block';
 }