/* JAVASCRIPT -global methods- ***********************************
/* SUFFIXES ******************************************************
 	W- wrapper, L- label, S- submit, R- reset, F- field row, I- indicator
	hvr- hover, acv- active, vtd- visited, lnk- link, err- error
/* DEPENDANCIES **************************************************/

/* BROWSER EVALUATION ********************************************/
/* objects/methods ***********************************************/
function branch(){
	if((returnDOM() != 'w3dom') && (returnDOM() != 'ie6dom')){ 
		window.location.replace('compatability.html'); 
	}
	else if(returnFlash() < 7){
		window.location.replace('compatability.html'); 
	}
}
/* objects/methods ***********************************************/
/* WINDOW AREA ***************************************************/
var WIDTH = (getWindowWidth()>100)?(getWindowWidth()):100; //browser window width
var HEIGHT = (getWindowHeight()>100)?(getWindowHeight()):100; //browser window height
/* objects/methods ***********************************************/
function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
		windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body && document.body.clientWidth) {
			windowWidth = document.body.clientWidth;
			}
		}
	}
	return(windowWidth);
}
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
			windowHeight = document.body.clientHeight;
			}
		}
	}
	return(windowHeight);
}
/* BROWSER TYPE **************************************************/
/* objects/methods ***********************************************/
function returnBrowser(){
	var br;
	br = ((navigator.appName == 'Microsoft Internet Explorer')?'explorer':br);
	br = ((navigator.appName == 'Netscape')?'netscape':br);
	br = ((navigator.userAgent.indexOf('Firefox') > -1)?'mozilla construct':br);
	br = ((navigator.userAgent.indexOf('Firebird') > -1)?'mozilla construct':br);
	br = ((navigator.userAgent.indexOf('Opera') > -1)?'opera':br);
	br = ((navigator.userAgent.indexOf('Safari') > -1)?'safari':br);
	br = ((navigator.userAgent.indexOf('Konqueror') > -1)?'konqueror':br);
	return br = ((br)?br:'other');
}
function returnVersion(){
	var ver = navigator.appVersion;
	return((ver.indexOf('MSIE') >0)?ver.substring(ver.indexOf('MSIE') +5, ver.indexOf('MSIE') +6):parseFloat(ver));
}
/* COMPATIBLE DOM ************************************************/
/* objects/methods ***********************************************/
function returnDOM(){
	var BROWSER = returnBrowser();
	var VERSION = returnVersion();
	var dom;
	dom = ((BROWSER == 'explorer') && (VERSION < 5))?'iedom':dom;
	dom = ((BROWSER == 'explorer') && (VERSION == 5))?'ie5dom':dom;
	dom = ((BROWSER == 'explorer') && (VERSION == 6))?'ie6dom':dom;
	dom = ((BROWSER == 'explorer') && (VERSION > 6))?'ie7dom':dom;
	dom = ((BROWSER == 'netscape') && (VERSION < 6))?'nsdom':dom;
	dom = ((BROWSER == 'netscape') && (VERSION > 5))?'w3dom':dom;
	dom = (BROWSER == ('mozilla construct'))?'w3dom':dom;
	dom = ((BROWSER == 'opera') && (VERSION < 4))?'opdom':dom;
	dom = ((BROWSER == 'opera') && (VERSION > 3))?'w3dom':dom;
	dom = (BROWSER == 'safari')?'w3dom':dom;
	dom = (BROWSER == 'konqueror')?'w3dom':dom;
	return((dom)?dom:'unknown');
}
/* OPERATING SYSTEM **********************************************/
/* objects/methods ***********************************************/
function returnSystem(){
	var os;
	os = ((navigator.userAgent.indexOf('Win') > -1)?'win32':os);
	os = ((navigator.userAgent.indexOf('Mac') > -1)?'Mac':os);
	return((os)?os:'other');
}
/* FLASH VERSION *************************************************/
var FLASHINSTALLED; // '1' flash !installed / '2' flash installed
var FLASHVERSION; // '-1' flash unknown / '0' flash !installed / 'x' flash version
/* objects/methods ***********************************************/
function returnFlash(){
	var DOM = returnDOM();
	if(DOM == 'ie6dom'){
		document.write('<script language="VBScript"> 													\n');
		document.write('on error resume next 															\n');
		document.write('for i = 2 to 10 																\n');
		document.write('	If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then 	\n');
		document.write('	Else 																		\n');
		document.write('		FLASHINSTALLED = 2 														\n');
		document.write('		FLASHVERSION = i 														\n');
		document.write('	End If 																		\n');
		document.write('Next 																			\n');
		document.write('If FLASHINSTALLED = 0 Then 														\n');
		document.write('	FLASHINSTALLED = 1 															\n');
		document.write('End If 																			\n');
		document.write('</script> 																		\n');
	}
	if(navigator.plugins && navigator.plugins.length){
		var x = navigator.plugins['Shockwave Flash'];
		if(x){
			FLASHINSTALLED = 2;
			if(x.description){ 
				y = x.description;
				FLASHVERSION = y.charAt(y.indexOf('.') -1);
			}
		}
		else FLASHINSTALLED = 1;
		if(navigator.plugins['Shockwave Flash 2.0']){
			FLASHINSTALLED = 2;
			FLASHVERSION = 2;
		}
	}
	else if(navigator.mimeTypes && navigator.mimeTypes.length){
		var x = navigator.mimeTypes['application/x-Shockwave-flash'];
		if(x && x.enabledPlugin) FLASHINSTALLED = 2;
		else FLASHINSTALLED = 1;
	}
	if(FLASHINSTALLED == 2) return (FLASHVERSION);
	else if(FLASHINSTALLED == 1) return (0);
	else return(-1);
}
/* JAVASCRIPT VERSION ********************************************/
/* objects/methods ***********************************************/
function returnJsVer(){
	var jsMax = 1.5;
	var jsLoop = jsMax * 10;
	for(var i = 10; i < jsLoop; i++){
		document.write('													\n' 
					   	+ '<script language="javascript' + i / 10 + '">		\n' 
					   	+ '		if(!jsVer){ var jsVer = ' + (i / 10) + '; }	\n' 
						+ '		else{ jsVer = ' + (i / 10) + '; }			\n'
						+ '</script>										\n');
	}
	return(jsVer);
}
/* CLIENT BANDWIDTH **********************************************/
/* objects/methods ***********************************************/
function returnKbps(imageSrc){
	img = new Image();
	img.src = imageSrc;
	var start = (new Date()).getTime();
	var loader = getHTTPObject();
	loader.open('GET', HOST + imageSrc, true);
	loader.onreadystatechange = function(){
		if(loader.readyState == HTTP_COMPLETE){
			var duration = (new Date()).getTime() - start;
			var imgSize = img.fileSize;
			window.Kbps = Math.round((imgSize * 8) / (duration));
		}
	}
	loader.send(null);
	return(window.Kbps);
}



