var timerID = null;
var hideTime = 1500;

function toggleSelectionList(dropDown)
{
	var dropDownList = document.getElementById(dropDown);
	
	//show or hide the dropdown box
	if (dropDownList.style.visibility == 'visible') {
		dropDownList.style.visibility = 'hidden';
		dropDownList.style.display = 'none';
	} else {
		dropDownList.style.visibility = 'visible';
		dropDownList.style.display = 'block';
	}
	
	toggleTimer(dropDown);
}

function toggleTimer(dropDown)
{
	var dropDownList = document.getElementById(dropDown);
	
	if ((timerID == null) && (dropDownList.style.display == 'block')) {
		//set the roll up timer for the dropdown box since it's visible
		timerID = setTimeout('toggleSelectionList("' + dropDown + '")', hideTime);
	}
	else {
		//kill roll up timer
		clearTimeout(timerID);
		timerID = null;
	}
}

function selectOption(elem, selector, hideElem, changeElem)
{
	//capture the selected link
	var selOption = document.getElementById(changeElem);
	selOption.value = elem.href;
	
	//change the selected text
	var dropSelected = document.getElementById(selector);
	dropSelected.childNodes[0].nodeValue = elem.innerHTML;
	
	//hide the dropdown box
	var dropDownList = document.getElementById(hideElem);
	dropDownList.style.visibility = 'hidden';
	dropDownList.style.display = 'none';
	
	toggleTimer(hideElem);
}

function changeTarget(selectedElem, dropDown)
{
	var selValue = document.getElementById(selectedElem).value;
	
	//use the selected value or the first link will be selected by default
	//selValue = ((selValue!='') && (selValue!=null))? selValue: document.getElementById(dropDown).getElementsByTagName('A')[0]; 
	if ((selValue=='') || (selValue==null))
	{
		selValue = document.getElementById(dropDown).getElementsByTagName('A')[0];
		SetStartPageCookie('2');
	}
	//window.location.href = selValue;
	_uTrackLink(selValue);
}