// sniff
var isWin = window.navigator.platform.toLowerCase().indexOf('win') != -1 ? 1:0;
var isMac = window.navigator.platform.toLowerCase().indexOf('mac') != -1 ? 1:0;
var isDOM = document.getElementById ? 1:0;
var isIE = document.all ? 1:0;
var isIE4 = isIE && !isDOM ? 1:0;
var isIE5 = isIE && isDOM ? 1:0;
var isNS = navigator.appName=='Netscape';
var isNS4 = isNS && !isDOM ? 1:0;
var isNS6 = isNS && isDOM ? 1:0;
var isOp = window.opera ? 1:0;
var isDyn = isDOM||isIE||isNS4;

var dq = "";
var agt= navigator.userAgent.toLowerCase();
var is_nav = ((agt.indexOf('spoofer') > -1) || (agt.indexOf('webtv') > -1) || (agt.indexOf('hotjava') > -1));
if (!is_nav) {
	if ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)) { dq += "&os=win95"; }
	else if (agt.indexOf("mac")!=-1) { dq += "&os=mac";}
	else { dq += "&os=winX";}
} else { dq += "&os=other";}
dq += ((isIE) ? "&browser=IE" : "&browser=nonIE");



// topnav
var startList = function() {
	if (isIE5 == 1) { 
		var navRoot = document.getElementById("topNav");
		if(navRoot) {
			for (i=0; i<navRoot.childNodes.length; i++) {
				var node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function() {
						this.className += " over";
				  	}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
		  			}
				} 
			}
		}
	}   
} 
window.onload = startList;

// show/hide selects
function showHideSelectBoxes(val) {
	if (isIE5 == 1) {
		var selectBoxes = getElementsByClass("filter_box");
		if (!selectBoxes) return false;
		for (var i=0; i<selectBoxes.length; i++) {
			if (val) selectBoxes[i].style.visibility = "visible";
			else selectBoxes[i].style.visibility = "hidden"; 
		}
	}
}

  
// toggle
function toggle_display(obj) {
	if(typeof(obj) == 'string')
		 obj = document.getElementById(obj);
	if(obj.style.display != 'block') {
		obj.style.display = 'block';
	}
	else {
		obj.style.display = 'none';
	}
}


// get elements by class
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}  

// from mlb global
function addLoadEvent(func) {
	var oldFunc=window.onload;
	if (typeof window.onload!='function') { window.onload=func; } 
	else { window.onload=function() { oldFunc(); func(); } }
}

// open url in new window and maximize
function windowMaximize(url) {
	var w = window.open(url,'_blank');
	w.moveTo(0,0);
	w.resizeTo(screen.width,screen.height);
}


// open in parent
function openinparent(url) {
	parent.location.href = url;
	return false;
}