﻿// Constants used by this file
var MAX_FLASH_VERSION = 6

// Create a global browser capabilities.
var browser = new BrowserCapabilities();
// array for storing references to onload functions
var onLoadFunctionsAcsys=[];


/********************************************************************
* The input argument must be a string type.
*/
function AddWindowOnload(f)
{
	if (typeof(f) != "string") return;
	
	if (browser.IsIEmac && browser.IsIE4)
	{
		// IE 4.5 blows out on testing window.onload, I'm not sure I care
		window.onload = WindowOnload;
	}
	else if  (window.onload && (window.onload != AcsysWindowLoad))
	{
		onLoadFunctionsAcsys[onLoadFunctionsAcsys.length] = window.onload.toString();
		window.onload = AcsysWindowLoad;
	}
	else
	{
		window.onload = AcsysWindowLoad;
	}
	onLoadFunctionsAcsys[onLoadFunctionsAcsys.length] = f;
}

function AcsysWindowLoad()
{
	for (var i=0,len=onLoadFunctionsAcsys.length;
		i<len;
		eval(onLoadFunctionsAcsys[i++])
	);
}

/********************************************************************
* This class encapsulates the version of the current browser and also
* provides information javascript and flash capabilities.
*/
function BrowserCapabilities()
{
	this.IsMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
	this.IsWindows = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
	this.IsNN4 = (document.layers) ? true : false;
	this.IsIE = (document.all) ? true : false;
	this.IsIE4 = this.IsIE && !document.getElementById ? true : false;
	this.IsDOM = document.getElementById ? true : false;
	this.IsIEmac = ((this.IsIE)&&(this.IsMac)) ? true : false;
	this.JavaScript = new JavaScriptSupport(this);
	//this.Flash = new FlashSupport(this);
}

function JavaScriptSupport(browserCapabilities)
{
	this.SniffVersions = _JavaScriptSupport_SniffVersion;
	this.SniffVersions();
	this.Browser = browserCapabilities;
	this.Version1_0 = window["JavaScript1_0"];
	this.Version1_1 = window["JavaScript1_1"];
	this.Version1_2 = window["JavaScript1_2"];
	this.Version1_3 = window["JavaScript1_3"];
	this.Version1_4 = window["JavaScript1_4"];
}

function _JavaScriptSupport_SniffVersion()
{
	window["JavaScript1_0"] = false;
	window["JavaScript1_1"] = false;
	window["JavaScript1_2"] = false;
	window["JavaScript1_3"] = false;
	window["JavaScript1_4"] = false;

	document.write('<SCR' + 'IPT LANGUAGE="JavaScript"\>\n');
	document.write('JavaScript1_0 = true;\n');
	document.write('</SCR' + 'IPT\>\n');

	document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1"\>\n');
	document.write('JavaScript1_1 = true;\n');
	document.write('</SCR' + 'IPT\>\n');

	document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.2"\>\n');
	document.write('JavaScript1_2 = true;\n');
	document.write('</SCR' + 'IPT\>\n');

	document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.3"\>\n');
	document.write('JavaScript1_3 = true;\n');
	document.write('</SCR' + 'IPT\>\n');

	document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.4"\>\n');
	document.write('JavaScript1_4 = true;\n');
	document.write('</SCR' + 'IPT\>\n');
}