function tamingselect()
{
	if(!document.getElementById && !document.createTextNode){return;}
	
	// Classes for the link and the visible dropdown
	var ts_selectclass='turnintodropdown'; 	// class to identify selects
	var ts_listclass='turnintoselect';		// class to identify ULs
	
	var ts_boxclass='dropcontainer'; 		// parent element
	var ts_triggeron='activetrigger'; 		// class for the active trigger link
	var ts_triggeroff='trigger';			// class for the inactive trigger link
	var ts_dropdownclosed='dropdownhidden'; // closed dropdown
	var ts_dropdownopen='dropdownvisible';	// open dropdown
	/*
		Turn all selects into DOM dropdowns
	*/
	var count=0;
	var toreplace=new Array();
	/*
		Turn all ULs with the class defined above into dropdown navigations
	*/	

	var uls=document.getElementsByTagName('ul');
	for(var i=0;i<uls.length;i++)
	{
		if(ts_check(uls[i],ts_listclass))
		{
			//var newform=document.createElement('form');
			var newselect=document.createElement('select');
			
			for(j=0;j<uls[i].getElementsByTagName('a').length;j++)
			{
				var newopt=document.createElement('option');
				newopt.title=uls[i].getElementsByTagName('a')[j].href;
				newopt.value=uls[i].getElementsByTagName('a')[j].id;
				newopt.appendChild(document.createTextNode(uls[i].getElementsByTagName('a')[j].innerHTML));	
				newselect.appendChild(newopt);
			}
			
			newselect.onchange = function()
			{
				window.location.href = this.options[this.selectedIndex].title;
			}
			
			newselect.id = "listBrand";
			//newform.appendChild(newselect);
			uls[i].parentNode.insertBefore(newselect,uls[i]);
			toreplace[count]=uls[i];
			count++;
		}
	}
	for(i=0;i<count;i++){
		toreplace[i].parentNode.removeChild(toreplace[i]);
	}
	function ts_check(o,c)
	{
	 	return new RegExp('\\b'+c+'\\b').test(o.className);
	}
	function ts_swapclass(o,c1,c2)
	{
		var cn=o.className
		o.className=!ts_check(o,c1)?cn.replace(c2,c1):cn.replace(c1,c2);
	}
	function ts_addclass(o,c)
	{
		if(!ts_check(o,c)){o.className+=o.className==''?c:' '+c;}
	}
}

window.onload = function()
{
	tamingselect();
}