function writeTheNav(what,bgc) {
	if (hasRightVersion == true) {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="160" height="500" id="index" align="middle">');
		document.write('<param name="movie" value="/main/nav.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="'+bgc+'" />');
		document.write('<param name=FlashVars value="bgc=' + bgc + '&lcoVer=' + cd2 + '&' + what + '" />');
		document.write('<param name="menu" value="false" />');
		document.write('<embed menu="false" src="/main/nav.swf" quality="high" bgcolor="'+bgc+'" width="160" height="500" name="index" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="bgc=' + bgc + '&lcoVer=' + cd2 + '&' + what + '"></embed>');
		document.write('</object>');
	}
}
function writeTheContent(bgc,width,height,movie,MORE_VARS) {
	if (hasRightVersion == true) {
		if (!width) width = 600;
		if (!height) height = 500;
		if (!movie) movie = "/main/mainContent.swf";
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" id="index" align="middle">');
		document.write('<param name="movie" value="'+movie+'" />');
		document.write('<param name="quality" value="best" />');
		document.write('<param name="bgcolor" value="'+bgc+'" />');
		document.write('<param name=FlashVars value="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" />');
		document.write('<param name="menu" value="false" />');
		document.write('<embed menu="false" FlashVars="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" src="'+movie+'" quality="best" bgcolor="'+bgc+'" width="'+width+'" height="'+height+'" name="index" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object>');
	}
}
function writeTheContent7(bgc,width,height,movie,MORE_VARS) {
	if (hasRightVersion == true) {
		if (!width) width = 600;
		if (!height) height = 500;
		if (!movie) movie = "/main/mainContent7.swf";
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="index" align="middle">');
		document.write('<param name="movie" value="'+movie+'" />');
		document.write('<param name="quality" value="best" />');
		document.write('<param name="bgcolor" value="'+bgc+'" />');
		document.write('<param name=FlashVars value="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" />');
		document.write('<param name="menu" value="false" />');
		document.write('<embed menu="false" FlashVars="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" src="'+movie+'" quality="best" bgcolor="'+bgc+'" width="'+width+'" height="'+height+'" name="index" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object>');
	}
}
function writeTheContent8(bgc,width,height,movie,MORE_VARS) {
	if (hasRightVersion == true) {
		if (!width) width = 600;
		if (!height) height = 500;
		if (!movie) movie = "/main/mainContent8.swf";
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="index" align="middle">');
		document.write('<param name="movie" value="'+movie+'" />');
		document.write('<param name="quality" value="best" />');
		document.write('<param name="bgcolor" value="'+bgc+'" />');
		document.write('<param name=FlashVars value="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" />');
		document.write('<param name="menu" value="false" />');
		document.write('<embed menu="false" FlashVars="lcoVer=' + cd2 + ((MORE_VARS) ? MORE_VARS : "") + '" src="'+movie+'" quality="best" bgcolor="'+bgc+'" width="'+width+'" height="'+height+'" name="index" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object>');
	}
}
function writeIframe(what) {
	document.write('<IFRAME SRC="'+what+'" WIDTH="568" HEIGHT="462" FRAMEBORDER=0 TITLE="grownups_main" scrolling="auto"></IFRAME>');
	var e = document.getElementById('rightContainer');
	if (e) e.className = 'rightContainerBG';
}
function writeIframeNoLogin(what) {
	document.write('<IFRAME SRC="'+what+'" WIDTH="60" HEIGHT="50" FRAMEBORDER=0 TITLE="grownups_main" scrolling="auto"></IFRAME>');
	var e = document.getElementById('rightContainer');
	//if (e) e.className = 'rightContainerBG';
}
function maximizeMe() {
	top.window.moveTo(0,0);
	if (navigator.userAgent.indexOf("Netscape") != -1 || navigator.userAgent.indexOf("Opera") != -1) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	} else {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
}
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//
function index_DoFSCommand(command, args) {
	var indexObj = isInternetExplorer ? document.all.index : document.index;
	// Place your code here.
}
//
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub index_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call index_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

/********* general functions ***********/
function popwindow(what,force) {
	if (typeof(what) == 'undefined') what = false;
	if (typeof(force) == 'undefined') force = false;
	var w = 780;
	var h = 540;
	var t = 0;
	var l = 0;
	var loc = "/login/";
	if (self.top.innerWidth) {
		// firefox
		//alert('firefox');
		fw = top.innerWidth;
		fh = top.innerHeight;
		test = true;
	} else if (top.document.documentElement && top.document.documentElement.clientWidth) {
		//alert('ie compliance mode');
		fw = top.document.documentElement.clientWidth;
		fh = top.document.documentElement.clientHeight;
		test = true;
	} else if (top.document.body) {
		//alert('ie');
		// ie
		fw = top.document.body.clientWidth;
		fh = top.document.body.clientHeight;
		test = true;
	} else {
		//alert('unknown');
		test = false
	}
	
	//alert(fw+","+fh);
	if (test == true && fw > 760 && fh > 500 && !force) {
		//alert ("big");
		top.location.href = loc;
	} else {
		//alert ("small");
		if (screen.width) l = (screen.width - w) / 2;
		if (screen.height) t = (screen.height - h) / 2;
		var newwin = window.open(((what) ? what : loc+"popup.php"), "p4b", "toolbar=no,status=no,menubar=no,scrollbars=auto,resizable=yes,directories=no,location=no,width="+w+",height="+h+",left="+l+",top="+t);
		//if (!newwin) alert('A popup blocker may have preventing the login window from opening.');
	}
}

/********* browser detection ***********/
var ie = (document.all)? true:false;
var ns5 = (navigator.appName.indexOf("Netscape") !=-1 && parseInt(navigator.appVersion) >= 5) ? true : false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	
var isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false; 
var isIE4Mac = (isMac && isIE) ? true : false;
var isNS6 = ((navigator.appName.indexOf("Netscape") != -1) && (parseInt(navigator.appVersion) > 4)) ? true : false;

/********* code for flash detection ***********/
var requiredVersion = 6;	

var flash2Installed = false;		
var flash3Installed = false;		
var flash4Installed = false;		
var flash5Installed = false;		
var flash6Installed = false;	
var flash7Installed = false;	
var flash8Installed = false;	
var flash9Installed = false;	
var flash10Installed = false;	

var maxVersion = 10;					
var actualVersion = 0;				
var hasRightVersion = false;

if(isIE && !isMac){ 
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
	document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
	document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');
	document.write('</SCR' + 'IPT\> \n'); 			
}

if (navigator.plugins){								
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){		

		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var temp = flashDescription.indexOf(".") - 2;
		var flashVersion = parseInt(flashDescription.substring(temp,temp+2));

		flash2Installed = (flashVersion == 2)? true:false;		
		flash3Installed = (flashVersion == 3)? true:false;
		flash4Installed = (flashVersion == 4)? true:false;
		flash5Installed = (flashVersion == 5)? true:false;
		flash6Installed = (flashVersion == 6)? true:false;
		flash7Installed = (flashVersion == 7)? true:false;
		flash8Installed = (flashVersion == 8)? true:false;
		flash9Installed = (flashVersion == 9)? true:false;
		flash10Installed = (flashVersion == 10)? true:false;
	}
}

for (var i = 2; i <= maxVersion; i++){	
	if (eval("flash" + i + "Installed") == true) actualVersion = i;
}

if (actualVersion >= requiredVersion){ 				
	hasRightVersion = true;	
} 						

//if(hasRightVersion && location.hostname.substring(0,4).toLowerCase() == "www.") popwindow();
//if (location.hostname.substring(0,4).toLowerCase() != "www." && location.href.substring(0,5).toLowerCase() != "file:" && location.href.substring(0,16).toLowerCase() != "http://127.0.0.1") {
//	document.write ('Redirecting to: <a href="http://www.power4bones.com">www.power4bones.com</a>');
//	location.href = "http://www." + location.hostname + location.pathname
//} else {
	var errors = false;
	var agt=navigator.userAgent.toLowerCase();
	var is_mac = (agt.indexOf("mac")!=-1);
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
//}

function checkErrors() {
	if (navigator.cookieEnabled == false) writeError('Cookies must be enabled!');
	if (!hasRightVersion) writeError('You need at least version 6 of the Flash player!<br>Get it <a target="_top" style="font-family: Arial, Helvetica, sans-serif;color: #000000;" href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">here</a>');
}
function writeError(what) {
	if (errors == false) {
		document.write('<div class="center ns"><b class="nsred">ERROR(S):</b><div>');
		errors = true;
	}
	document.write('<div class="center ns"><b style="nsblack">'+what+'</b></div>');
}

cd1 = new Date();
cd2 = "lco" + cd1.getFullYear() + cd1.getMonth() + cd1.getDate() + cd1.getHours() + cd1.getMinutes() + cd1.getSeconds();
