/***
Jump Menu Script

Author: J.Stein 
2/6/2009
**/

function initSiteSelect(selectorID,widthOfSelector,widthOfOptionList,arrowImagePath,containerName){

//Set defaults here....

	var _selectorID=selectorID; //id of the original select
	var _widthOfSelector=widthOfSelector;
	var _widthOfOptionList=widthOfOptionList;
	var _arrowImagePath=arrowImagePath; //full path to image
	var _containerName=containerName; //div container where the select will live
		
		//init select rewrite
		dhtmlselect(_selectorID,_widthOfSelector,_widthOfOptionList,_containerName,_arrowImagePath);
	}

/***********************************************

* DHTML Select Menu- by JavaScript Kit (www.javascriptkit.com)
* Menu interface credits: http://www.dynamicdrive.com/style/csslibrary/item/glossy-vertical-menu/ 
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more

***********************************************/

/*** 
A large portion of this script was rewritten by J.Stein 
2/6/2009

**/

function dhtmlselect(selectid, selectwidth, optionwidth, theContainer, arrowImagePath){

var combodropimage=arrowImagePath; //path to "drop down" image
var combodropoffsetY=2; //offset of drop down menu vertically from default location (in px)
var combozindex=1501;

if (combodropimage!=""){
	combodropimage='<img class="downimage" src="'+combodropimage+'" title="Select an option" />';
	}

	//build dropdown
	var selectbox=document.getElementById(selectid);
	newSelect='<div id="dhtml_'+selectid+'" class="dhtmlselect">'+selectbox.title+" "+combodropimage+'<div class="dropdown">';
	
	//build option list
	for (var i=0; i<selectbox.options.length; i++)
		newSelect=newSelect+"<a href='"+selectbox.options[i].value+"'>"+selectbox.options[i].text+"</a>";
		newSelect=newSelect+"</div></div>";
	
	//hide old select
	selectbox.style.display="none";
	
	//output the new select
	document.getElementById(theContainer).innerHTML=newSelect;
	
	// new select has been created...
	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+-27+"px"
		
		dhtmlselectbox.onmouseover=function(){
			this.getElementsByTagName("div")[0].style.display="block"
		}
		dhtmlselectbox.onmouseout=function(){
			this.getElementsByTagName("div")[0].style.display="none"
		}
	}

}
