var SelectMenu = function(id,linkText,linkClass){
	var wrapper = document.getElementById(id);
	var unorderedList = wrapper.getElementsByTagName("ul")[0];
	//create form elements
	var selectForm = document.createElement("form");
	var selectFieldset = document.createElement("fieldset");
	var selectList = document.createElement("select");
	var submitLink = document.createElement("a");
	var submitLinkText = document.createTextNode(linkText);
	//add the listener to the button
	YAHOO.util.Event.addListener(submitLink,"click",function(e){
		window.location = selectList.options[selectList.selectedIndex].value;
        YAHOO.util.Event.preventDefault(e);
	});
	//build the form
	selectForm.appendChild(selectFieldset);
	selectFieldset.appendChild(selectList);
	selectFieldset.appendChild(submitLink);
	submitLink.appendChild(submitLinkText);
    submitLink.href = "#";
    YAHOO.util.Dom.addClass(submitLink,linkClass);
	//add options to the select list
	var listItems = YAHOO.util.Dom.getChildren(unorderedList);
	for(var i = 0; i < listItems.length; i++){
		var a = listItems[i].firstChild;
		var option = document.createElement("option");
        var optionTextNode = a.firstChild;
		option.value = a.href;
	    option.appendChild(optionTextNode);
		selectList.appendChild(option);
	}
	//replace the unordered list
	YAHOO.util.Dom.insertBefore(selectForm,unorderedList);
	wrapper.removeChild(unorderedList);
}


