function openSub (newHeight, maxHeight) {
	var browseContainer = getElem('silas_browseBox');
	if ( maxHeight > newHeight) {
		setHeight(browseContainer, newHeight)
		setTimeout('openSub(' + (newHeight + 10) + ',' + maxHeight +')', 10)	
	}
	else {
		setHeight(browseContainer, maxHeight)
	}
}
function showBrowse(inID) {
	clearTimeout(window._silas_hideBrowseTimeout);
	if (inID != window._silas_prevBrowseElement) {
	
		var prevUL = getElem(window._silas_prevBrowseElement+"_ul");
		if (prevUL) {
//			hideBrowseTimeout(prevUL.offsetHeight, prevUL.offsetHeight);
            hideDisplayElem(prevUL)
		}

		var browseContainer = getElem('silas_browseBox');
		setClass(browseContainer, 'silas_'+inID);
		setHeight(browseContainer, 0);
				
		var onUL = getElem(inID+"_ul");
		showDisplayElem(onUL);
		var maxHeight = onUL.offsetHeight;
		showElem(browseContainer);
			
		openSub(0, maxHeight);
		
	}
	window._silas_prevBrowseElement = inID;		
}
function hideBrowseTimeout(newHeight, startHeight) {
	var prevUL = getElem(window._silas_prevBrowseElement+"_ul");
	var browseContainer = getElem('silas_browseBox');
	hideDisplayElem(prevUL);
	if ( 0 < newHeight) {
		setHeight(browseContainer, newHeight);
		setTimeout('hideBrowseTimeout(' + (newHeight - 10) + ',' + startHeight + ')', 1);
	}
	else {
		window._silas_prevBrowseElement = '';
		return;
	}	
}

function hideBrowse(inID) {
	var prevUL = getElem(window._silas_prevBrowseElement+"_ul");
	window._silas_hideBrowseTimeout = setTimeout('hideBrowseTimeout('+prevUL.offsetHeight+','+prevUL.offsetHeight+')', 1000);
}
















function showNavTimeout(inElemID, eventType) {
		if (eventType == "click") {
			clearTimeout(window._silas_showNavTimeout);
		}	
		
		if (window._silasCurrentOpenNav != "byTypeNav") setClass(getElem('byTypeNav'), 'root');
		if (window._silasCurrentOpenNav != "byRegionNav") setClass(getElem('byRegionNav'), 'root');
		if (window._silasCurrentOpenNav != "byPriceNav") setClass(getElem('byPriceNav'), 'root');
		
		setClass(getElem(inElemID), 'root selected');
}
function showNav(inElem) {
	clearTimeout(window._silas_hideNavTimeout);
	if (inElem.id != window._silas_currentNavElement) {
		clearTimeout(window._silas_showNavTimeout);
		window._silas_showNavTimeout = setTimeout('showNavTimeout("'+inElem.id+'", "mouse")', 500);
	}
	window._silas_currentNavElement = inElem.id;
}
function hideNavTimeout(inElemID) {
	setClass(getElem(inElemID), 'root');
	window._silas_currentNavElement = "";
}
function hideNav(inElem) {
	if (inElem.id != window._silas_currentNavElement) {
		clearTimeout(window._silas_showNavTimeout);
	}
	window._silas_hideNavTimeout = setTimeout('hideNavTimeout("'+inElem.id+'")', 1000);
}

function checkForDiv() {
	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;

	if (checkIt('konqueror')) {
			browser = "Konqueror";
			OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (!checkIt('compatible')) {
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	
	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}

	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
	var topNumber = 269;
	
	if (browser == "Internet Explorer") {
		topNumber = 279;
	}
	
	var additionalCheck = getElem('AdditionalGift');
	if (additionalCheck.id = 'AdditionalGift') {
		var searchButton = getElem('silas_CatalogSearch');
		searchButton.style.top = topNumber
	}	
}
