var isDOM = document.getElementById?true:false; // all DOM based browsers including IE
var isNS4 = document.layers?true:false;
var isIE = document.all?true:false;
var isMac = (navigator.appVersion.indexOf("Mac") != -1)?true:false;
var isWin = (navigator.appVersion.indexOf("Win") != -1)?true:false;
var isLinux = (navigator.platform.indexOf("Linux") != -1)?true:false;
var usragent = navigator.userAgent.toLowerCase();
var isOperaBadDom = (usragent.substr(usragent.indexOf("opera")+6,1)<=6)?true:false; // this detects opera 6 or below which have crappy DOM support
var isOperaGoodDom = (usragent.substr(usragent.indexOf("opera")+6,1)>6)?true:false;
var isKonqueror = (usragent.indexOf("konqueror")>=0)?true:false;



/* Functions to hide/show plugins (ie. flash)
---------------------------------------------------- */
function hidePlugins(hideall) {
	// hide select boxes in IE versions > 7 because they show through menus
	var agt=navigator.userAgent.toLowerCase();
	if(isIE && (agt.indexOf("msie 4") >= 0 || agt.indexOf("msie 5") >= 0 || agt.indexOf("msie 6") >= 0)) {
		var selects = document.getElementsByTagName("select");
		for(var i = selects.length-1; i >=0 ; i--) {
			selects[i].style.visibility = "hidden";
		}
	}
	// hide flash content because it shows through navigation
	if(typeof flash != "undefined") {
		// if flash.forcehide, hide property has been manually set
		// if linux, wmode not supported, so hide flash
		// if flash version is less than 6,0,79,0 hide flash because wmode not supported widely
		if(flash.forcehide || isLinux || (flash.version <= 6 && flash.rev < 79) || isOperaGoodDom) hideFlash(hideall);
	}
	hiddenElmnts = true;
};

function hideFlash(hideall) {
	for(var i = 0; i < flash.movies.length; i++) {
		var elmt = document.getElementById("flash_"+i);
		var y = getXY(elmt)[1];
		if ((y > 0 && y < 418) || (typeof hideall != 'undefined' && hideall == 'all')) {
			//elmt.parentNode.style.background = "#e7e7e7";
			elmt.style.visibility = 'hidden';
		}
	}
};

function showPlugins(hideall) {
	// show select boxes in IE versions > 7 that were hidden because they show through menus
	var agt=navigator.userAgent.toLowerCase();
	if(isIE && (agt.indexOf("msie 4") >= 0 || agt.indexOf("msie 5") >= 0 || agt.indexOf("msie 6") >= 0)) {
		var selects = document.getElementsByTagName("select");
		for(var i = selects.length-1; i >=0 ; i--) {
			selects[i].style.visibility = "inherit";
		}
	}
	// show flash content that was hidden because it shows through navigation
	if(typeof flash != "undefined") {
		if(flash.forcehide || isLinux || (flash.version <= 6 && flash.rev < 79) || isOperaGoodDom) showFlash(hideall);
	}
	hiddenElmnts = false;
};

function showFlash(hideall) {
	for(var i = 0; i < flash.movies.length; i++) {
		var elmt = document.getElementById("flash_"+i);
		var y = getXY(elmt)[1];
		if ((y > 0 && y < 418) || (typeof hideall != 'undefined' && hideall == 'all')) {
			elmt.style.visibility = 'visible';
		}
	}
};
