//var combodropimage='select_button.png'; //path to "drop down" image
var combodropoffsetY=0; //offset of drop down menu vertically from default location (in px)
var combozindex=100;

//if (combodropimage!="")
//	combodropimage='<img class="downimage" src="'+combodropimage+'" title="Select an option" />';

function dhtmlselect(selectid, selectwidth, optionwidth){
  var selectbox=document.getElementById(selectid);
  //document.write('<div id="dhtml_'+selectid+'" class="dhtmlselect">'+selectbox.title+" "+combodropimage+'<div id="dropdown_scrollable"><div class="dropdown" id="dropdown_">');
  document.write('<div id="dhtml_'+selectid+'" class="dhtmlselect"><span class="select_title" id ="select_title">'+selectbox.title+"</span> "+'<div id="dropdown_scrollable"><div class="dropdown" id="dropdown_">');
  for (var i=0; i<selectbox.options.length; i++)
    document.write('<a href="'+selectbox.options[i].value+'" class="'+ selectbox.options[i].className +'">'+selectbox.options[i].text+'</a>');
  document.write('</div><div id="track"><div id="handle"></div></div></div></div>');
  selectbox.style.display="none";
  var dhtmlselectbox=document.getElementById("dhtml_"+selectid);
  dhtmlselectbox.style.zIndex=combozindex;
  combozindex--;
  if (typeof selectwidth!="undefined")
    dhtmlselectbox.style.width=selectwidth;
  if (typeof optionwidth!="undefined")
    dhtmlselectbox.getElementsByTagName("div")[0].style.width=optionwidth;
  dhtmlselectbox.getElementsByTagName("div")[0].style.top=dhtmlselectbox.offsetHeight-combodropoffsetY+"px";
  //if (combodropimage!="")
    //dhtmlselectbox.getElementsByTagName("img")[0].style.left=dhtmlselectbox.offsetWidth-20+"px";
  dhtmlselectbox.onmouseover=function(){
    this.getElementsByTagName("div")[0].style.visibility="visible";
    document.getElementById("select_title").style.display="none";
  }
  if (navigator.appVersion.match('MSIE') && navigator.appVersion.match('MSIE') != null ) {
    dhtmlselectbox.onmouseleave=function(){
      this.getElementsByTagName("div")[0].style.visibility="hidden";
      document.getElementById("select_title").style.display="block";
    }
  } else {
    dhtmlselectbox.onmouseout=function(){
      this.getElementsByTagName("div")[0].style.visibility="hidden";
      document.getElementById("select_title").style.display="block";
    }
  }
}
