﻿function refresh() {
	location.reload();
	document.location = document.location;
	//return;
}

//=========================/[ MAIN PAGE METHODS ]\=================
/*
NOTES:
	setAnchor is called by Flash
	@a : string - section used in navClick() within the framework AND title to display in the browser delimited by "|"
*/
function setAnchor(a) {
	var myURL = new String(document.location);
	var oldPath = myURL.split(anchorSeparator)[1];
	myURL = myURL.split(anchorSeparator)[0]; //remove any anchors

	var path = a.split("|")[0];
	var title = a.split("|")[1];
	
	// Safari refreshes if you try to go to the same anchor twice, so we'll check before we set the anchor.
	if (oldPath != path) { document.location = myURL + anchorSeparator + path; }
	// update the titlebar.  If you don't, the title bar is changed to the URL in the address bar
	document.title = title;
}

/*
NOTES:
	1.  We set the swf ("main.swf") and check to see if browser is IE.  We'll pass this along to Flash
	2.  getAnchor is called to see what trails the "#" or "?" in the pages URL
	3.  Anything after the "#" or "?" is added as a variable "link=" using the fo.addVariable method in index.html
*/

function getAnchor() {
	sUrl = new String(document.location);
	aUrl = sUrl.split(anchorSeparator);
	if(aUrl.length > 1)
	{
		return aUrl[1];
	} else {
		return false;
	}
}

sAnchor = getAnchor();


/* To Catch FSCommand if browser type is IE. */

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var isIE = 0;

function main_DoFSCommand(command, args) {
	var FSCommandObj = isInternetExplorer ?  main : document.main;
	if(command=="setAnchor") setAnchor(args);
	if(command == "urchinTracker") urchinTracker(args);
	if(command == "closeme") window.close();
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) 
	{
		isIE = 1;
		document.write('<script type="text/vbscript"\> \n');
		document.write('on error resume next \n');
		document.write('Sub main_FSCommand(ByVal command, ByVal args)\n');
		document.write('	call main_DoFSCommand(command, args)\n');
		document.write('end sub\n');
		document.write('</script\> \n');
	} else {
		isIE = 0;
}


/* Call this function from Flash passing in the required version number to display the upgrade message */
function flashUpgradeDisplay (version) {
	var msg = '';
	var msgDiv = document.getElementById('flashcontent');
	
	msg += '<div class="error">';
	msg += '<p>We were unable to detect the correct version of the Flash player (version '+ version +') on your computer, which is required to view this content.</p>';
	msg += '<p><a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Please click here to download and install the plugin.</a></p>';
	msg += '</div>';
	
	if (msgDiv) 
		{msgDiv.innerHTML = msg;}
	else
		{alert('Please upgrade your Flash player. \n Visit http://www.macromedia.com/go/getflashplayer');}
}
//=========================\[ MAIN PAGE METHODS ]/======================
