//最后更新日期：2008-05-19
//++++++++++++++++++++设置下拉框的高度++++++++++++++++++++
function Select_ChangeHeight(sDiv,iMaxNum,iHeight)
{
  var oDiv=document.getElementById(sDiv);

  if (oDiv.childNodes.length>iMaxNum) oDiv.style.height=iMaxNum*iHeight+"px";
}
//--------------------设置下拉框的高度--------------------

//++++++++++++++++++++显示或关闭下拉菜单++++++++++++++++++++
function Select_Show(sTB,sDiv)
{
  var oDiv=document.getElementById(sDiv);
  var iHeight=document.documentElement.scrollHeight;

  oDiv.style.display=((oDiv.style.display=="none" || oDiv.style.display=="")?"block":"none");
  if (oDiv.style.display=="block") Select_ChangePos(sTB,sDiv,iHeight);
}
//--------------------显示或关闭下拉菜单--------------------

//++++++++++++++++++++调整下拉菜单位置++++++++++++++++++++
function Select_ChangePos(sTB,sDiv,iHeight)
{
  var oTB=document.getElementById(sTB);
  var oDiv=document.getElementById(sDiv);
  var oHtml=document.documentElement;

  //++++获取对象的上、右、下、左++++
  function GetRect()
  {
    var sBrowser=navigator.appName;
    var arr_iBack=new Array();
    var oRect;

    if (sBrowser=="Microsoft Internet Explorer")//IE
    {
      oRect=oTB.getBoundingClientRect();
      arr_iBack.push(oRect.top+oHtml.scrollTop-2);
      arr_iBack.push(oRect.right+oHtml.scrollLeft-2);
      arr_iBack.push(oRect.bottom+oHtml.scrollTop-2);
      arr_iBack.push(oRect.left+oHtml.scrollLeft-2);
	}
    else if (sBrowser=="Netscape")//FF
    {
      oRect=document.getBoxObjectFor(oTB);
      arr_iBack.push(oRect.y);
      arr_iBack.push(oRect.x+oRect.width);
      arr_iBack.push(oRect.y+oRect.height);
      arr_iBack.push(oRect.x);
	}

    return arr_iBack;
  }
  //----获取对象的上、右、下、左----

  var arr_iBox=GetRect();
  if (arr_iBox[2]+oDiv.offsetHeight<iHeight) oDiv.style.top=(oTB.offsetHeight+1)+"px";
  else oDiv.style.top=(-oDiv.offsetHeight+3)+"px";
}
//--------------------调整下拉菜单位置--------------------

//++++++++++++++++++++设置选择的文本和值++++++++++++++++++++
function Select_SetValue(sTB,sText,sValue)
{
  document.getElementById(sTB).value=sText;
  document.getElementById(sTB+"Value").value=sValue;
}
//--------------------设置选择的文本和值--------------------

//++++++++++++++++++++关闭下拉菜单++++++++++++++++++++
function Select_Close(e,sTB,sDiv)
{
  var oDiv=document.getElementById(sDiv);
  var sID;

  if (oDiv.style.display=="none" || oDiv.style.display=="") return;

  if (e.srcElement) sID=e.srcElement.id;
  else if (e.target) sID=e.target.id;
  if (sID!=sTB) oDiv.style.display="none";
}
//--------------------关闭下拉菜单--------------------