var myTimer;

function dropDownMaster (ElmntID) {
	menuelement1 = document.getElementById('dropdown1');
	menuelement2 = document.getElementById('dropdown2');
	menuelement3 = document.getElementById('dropdown3');
	menuelement4 = document.getElementById('dropdown4');
	arrowelement1 = document.getElementById('arrow1');
	arrowelement2 = document.getElementById('arrow2');
	arrowelement3 = document.getElementById('arrow3');
	arrowelement4 = document.getElementById('arrow4');
	dropDown(ElmntID);
	if (ElmntID == 1) {
		menuelement2.style.display = "none";
		arrowelement2.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement3.style.display = "none";
		arrowelement3.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement4.style.display = "none";
		arrowelement4.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
	}
	else if (ElmntID == 2) {
		menuelement1.style.display = "none";
		arrowelement1.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement3.style.display = "none";
		arrowelement3.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement4.style.display = "none";
		arrowelement4.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
	}
	else if (ElmntID == 3) {
		menuelement2.style.display = "none";
		arrowelement2.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement1.style.display = "none";
		arrowelement1.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement4.style.display = "none";
		arrowelement4.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
	}
	else if (ElmntID == 4) {
		menuelement2.style.display = "none";
		arrowelement2.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement3.style.display = "none";
		arrowelement3.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		menuelement1.style.display = "none";
		arrowelement1.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
	}
}


function dropDown (ElmntID) {
	menuelement = document.getElementById('dropdown'+ElmntID);
	arrowelement = document.getElementById('arrow'+ElmntID);
	if (menuelement.style.display == "block") {
		menuelement.style.display = "none";
		arrowelement.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
		if (ElmntID == 1 || ElmntID == 2) {
			window.location.hash="top";
			scroll(0,200);
		}
		IEfixHideSelect('searchsubchoises','view');
	}
	else {
		menuelement.style.display = "block";
		arrowelement.style.backgroundImage = "url('/img/searchdropdown/ArrowMainOpen.gif')";
		changeSize(ElmntID);
		if (ElmntID == 1 || ElmntID == 2) {
			window.location.hash="selection";
			scroll(0,200);
		}
		IEfixHideSelect('searchsubchoises','hide');
	}
}


function changeSize (ElmntID) {
	var browserName=navigator.appName;
	ContainerWidth = document.getElementById('dropdowncontainer'+ElmntID).offsetParent.offsetWidth;
	if (browserName=="Microsoft Internet Explorer") {
		NewContainerWidth = ContainerWidth;
	}
	else {
		NewContainerWidth = ContainerWidth - 2;
	}
	if (ElmntID == 1 || ElmntID == 2) {
		NewContainerWidth = NewContainerWidth * 1.9;
		document.getElementById('dropdown'+ElmntID).style.width = NewContainerWidth;
	}
	else if (ElmntID == 4) {
		NewContainerWidth = NewContainerWidth * 1.5;
		document.getElementById('dropdown'+ElmntID).style.width = NewContainerWidth;
	}
	else if (ElmntID == 3) {
		// Do nothing
	}
}

function toggleCatHide (ElmntID) {
	menuelement = document.getElementById('dropdown'+ElmntID);
	arrowelement = document.getElementById('arrow'+ElmntID);
	menuelement.style.display = "none";
	arrowelement.style.backgroundImage = "url('/img/searchdropdown/ArrowMainClosed.gif')";
	if (ElmntID == 1 || ElmntID == 2) {
		window.location.hash="top";
		scroll(0,200);
	}
	IEfixHideSelect('searchsubchoises','view');
}

function toggleCatShow (ElmntID) {
	menuelement = document.getElementById('dropdown'+ElmntID);
	arrowelement = document.getElementById('arrow'+ElmntID);
	menuelement.style.display = "block";
	arrowelement.style.backgroundImage = "url('/img/searchdropdown/ArrowMainOpen.gif')";
	changeSize(ElmntID);
	if (ElmntID == 1 || ElmntID == 2) {
		window.location.hash="selection";
		scroll(0,200);
	}
	IEfixHideSelect('searchsubchoises','hide');
}


function toggleCat (ElmntID) {
	var subelement = document.getElementById('sub'+ElmntID);
	if (subelement.style.display == "block") {
		subelement.style.display = "none";
		document.getElementById('cat'+ElmntID).className='normal';
	}
	else {
		subelement.style.display = "block";
		document.getElementById('cat'+ElmntID).className='open';
	}
}


function IEfixHideSelect (ElmtName,HideView) {
	element = document.getElementById(ElmtName);
	if (HideView == 'hide') {
		element.style.visibility = "hidden";
	}
	else {
		element.style.visibility = "visible";
	}
}


function toggleMouseOver (ElmntID) {
	menuelement1 = document.getElementById('dropdown1');
	menuelement2 = document.getElementById('dropdown2');
	menuelement3 = document.getElementById('dropdown3');
	menuelement4 = document.getElementById('dropdown4');
	status1 = menuelement1.style.display;
	status2 = menuelement2.style.display;
	status3 = menuelement3.style.display;
	status4 = menuelement4.style.display;
	if (ElmntID == 1) {
		if (status2 == 'block' || status3 == 'block' || status4 == 'block') {
			dropDownMaster(ElmntID);
		}
	}
	else if (ElmntID == 2) {
		if (status1 == 'block' || status3 == 'block' || status4 == 'block') {
			dropDownMaster(ElmntID);
		}
	}
	else if (ElmntID == 3) {
		if (status2 == 'block' || status1 == 'block' || status4 == 'block') {
			dropDownMaster(ElmntID);
		}
	}
	else if (ElmntID == 4) {
		if (status2 == 'block' || status3 == 'block' || status1 == 'block') {
			dropDownMaster(ElmntID);
		}
	}	
}
