var mac = (navigator.appVersion.indexOf("Mac") != -1);
var win = (navigator.appVersion.indexOf("Win") != -1);
var agt = navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);
var iePos  = appVer.indexOf('msie');

 if (iePos !=-1) {
       is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
       is_major = parseInt(is_minor);
    }
var nav6Pos = agt.indexOf('netscape6');
    if (nav6Pos !=-1) {
       is_minor = parseFloat(agt.substring(nav6Pos+10))
       is_major = parseInt(is_minor)
    }

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_ns6 = ( is_nav && (document.getElementById));
var is_ie   = (iePos!=-1);
var is_ie5   = (is_ie && is_major == 5);
var is_ie5up = (is_ie && is_major >= 5);
var is_ie55 = (is_ie5 && is_minor >= 5.5);
var is_ie6 = (is_ie && is_major >= 6);


if ((win || mac) && (is_ie5up || is_ns6)) {

} else {

window.location='/download.html';

}

var strWin;
var strGameWin;
var strURL;
var strWinName;
var strScrollBar;
var iWinWidth;
var iWinHeight;
var strToolbar;
var strMenuBar;

function windowPopUp(strURL,strWinName,iWinWidth,iWinHeight,strScrollBar,strResize,strToolbar,strMenuBar)
{
	if (strScrollBar == "yes") {
		if (is.ie == true || is.ns == true) { iWinWidth = iWinWidth + 16; }
	}
	
	if (strWin!=null) {   		/*not first time we've opened the window?*/
		if(!strWin.closed) {	/*window is open now?*/
			strWin.focus();		/*focus on it*/
			strWin.focus();		/*focus on it again, sometimes the browser does not focus properly with one call only*/
								/*load the content again*/  

			strWin = window.open(strURL,strWinName, "toolbar="+strToolbar+",scrollbars="+strScrollBar+",location=0,directories=0,status=1,resizable="+strResize+",width="+iWinWidth+",height="+iWinHeight+",menubar="+strMenuBar);	
			return;
		}
	}
			strWin = window.open(strURL,strWinName, "toolbar="+strToolbar+",scrollbars="+strScrollBar+",location=0,directories=0,status=1,resizable="+strResize+",width="+iWinWidth+",height="+iWinHeight+",menubar="+strMenuBar);	/* open the window */
}

function gamePop(strURL,strWinName,iWinWidth,iWinHeight,strScrollBar,strResize,strToolbar,strMenuBar)
{
	if (strScrollBar == "yes") {
		if (is.ie == true || is.ns == true) { iWinWidth = iWinWidth + 16; }
	}
	
	if (strGameWin!=null) {   		/*not first time we've opened the window?*/
		if(!strGameWin.closed) {	/*window is open now?*/
			strGameWin.close();		/*close it*/

			strGameWin = window.open(strURL,strWinName, "toolbar="+strToolbar+",scrollbars="+strScrollBar+",location=0,directories=0,status=1,resizable="+strResize+",width="+iWinWidth+",height="+iWinHeight+",menubar="+strMenuBar);	
			return;
		}
	}
			strGameWin = window.open(strURL,strWinName, "toolbar="+strToolbar+",scrollbars="+strScrollBar+",location=0,directories=0,status=1,resizable="+strResize+",width="+iWinWidth+",height="+iWinHeight+",menubar="+strMenuBar);	/* open the window */
}


function printPage() {
window.print();
}

function printFramePage() {

	if (is_ns6) {
		parent.content.print();
	}
	else if(is_ie5up){
		parent.content.focus();
		parent.content.print();
		
	}
}


function expandCollapse() {
	for (var i=0; i<expandCollapse.arguments.length; i++) {
    var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display != "none") ? "none" : 'block';
	}
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

