
var IE=false, domBrowser=false, Mac=false, Nav=false, opera=false; var macOffsetY = 0;
if (document.all != null) IE = true; else if (document.getElementById) domBrowser = true;
if (navigator.appVersion.indexOf("Mac") != -1) {
	Mac = true; if (IE == true) macOffsetY = 10;}
if (navigator.userAgent.indexOf("Opera") != -1) opera = true;

var popUpWin=0;
var navmenuids=["nav_tree"];

function buildsubmenus(){
	if (document.getElementById("navItems")) {
		var navItms=document.getElementById("navItems"); var niHtml,atags,a;
		for (var i=0; i<navmenuids.length; i++){
			var ultags=document.getElementById(navmenuids[i]).getElementsByTagName("ul"); niHtml="";
			for (var t=0; t<ultags.length; t++){
				atags = ultags[t].getElementsByTagName("a");
				for (var a=0; a<atags.length; a++) {niHtml+=atags[a].innerHTML+"<br>";}
				ultags[t].parentNode.onmouseover=function(){
					this.getElementsByTagName("ul")[0].style.visibility="visible";}
				ultags[t].parentNode.onmouseout=function(){
					this.getElementsByTagName("ul")[0].style.visibility="hidden";}}
			navItms.innerHTML = niHtml; var subMnuW=navItms.offsetWidth+8;
			for (t=0; t<ultags.length; t++) ultags[t].style.width=subMnuW+"px"; navItms.innerHTML="";}
	}
}

var navMenuTimeoutIds = new Object();
function navMenuMouseOver(menuDivObj) {
	menuDivObj.getElementsByTagName("ul")[0].style.visibility = "visible";
	if (navMenuTimeoutIds[menuDivObj.id]) window.clearTimeout(navMenuTimeoutIds[menuDivObj.id]);
}
function navMenuMouseOut(menuDivObj) {
	if (navMenuTimeoutIds[menuDivObj.id]) window.clearTimeout(navMenuTimeoutIds[menuDivObj.id]);
	navMenuTimeoutIds[menuDivObj.id] = window.setTimeout("navMenuHide('" + menuDivObj.id + "');", 120);
}
function navMenuHide(menuDivId) {
	navMenuTimeoutIds[menuDivId] = null;
	document.getElementById(menuDivId).getElementsByTagName("ul")[0].style.visibility = "hidden";
}

function ignore(something){}

function popUpWindow(URLStr, left, top, width, height){
	if (popUpWin) {if (!popUpWin.closed) popUpWin.close();}
	var features = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
	features += ",copyhistory=yes,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top;
	features += ",screenX=" + left + ",screenY=" + top;
	popUpWin = open(URLStr, 'popUpWin', features);
}

//display the control panel dialog when the button is clicked
function showDialog(flag){
	var sortCombo = document.getElementById('cmbSortOptions');
	if (flag == '') {
		if (sortCombo != null) sortCombo.style.visibility='hidden';
		var leftPos = event.x - /*Div Width*/260;
		var verticalScroll = document.all ? document.body.scrollTop : window.pageYOffset;
		var horizontalScroll = document.all ? document.body.scrollLeft : window.pageXOffset;
		if (leftPos < 0) leftPos = 0;
		divUserPrefs.style.left = leftPos + horizontalScroll;
		divUserPrefs.style.top = event.y + verticalScroll + 10;
		divUserPrefs.style.display = '';
		URLString = window.location.href;}
	if (flag == 'none') {
		if (sortCombo != null) sortCombo.style.visibility='';
		divUserPrefs.style.display = 'none';
		//saving the values set by the user by sending them in the request for the next load
		if (URLString.indexOf("config") != -1) {
			URLString = URLString.substring(0,URLString.indexOf("config")-1)}
		if (URLString.indexOf("?") == -1) URLString += "?"; else URLString += "&";
		URLString += 'cmcconfig=true';
		URLString += '&CMCAllowExplain=' + document.getElementById('SearchTopStrip_ChkExplanation').checked;
		URLString += '&CMCShowHighlights=' + document.getElementById('SearchTopStrip_ChkShowHighlights').checked;
		URLString += '&CMCShowScore=' + document.getElementById('SearchTopStrip_ChkShowScore').checked;
		URLString += '&CMCShowCounters=' + document.getElementById('SearchTopStrip_ChkShowCounters').checked;
		URLString += '&CMCShowSales=' + document.getElementById('SearchTopStrip_ChkShowSales').checked;
		window.location.href = URLString;}
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
