function Client() {
	this.appCodeName = navigator.appCodeName.toLowerCase();
	this.appName = navigator.appName.toLowerCase();
	this.appMinorVersion = navigator.appMinorVersion;
	this.platform = navigator.platform.toLowerCase();
	this.systemLanguage = navigator.systemLanguage;
	this.userLanguage = navigator.userLanguage;
	this.appVersion = parseInt(navigator.appVersion);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.cookieEnabled = navigator.cookieEnabled;
	
	if(this.userAgent.indexOf('msie')!=-1) {
		if(document.getElementById) { //May need to make this more detailed
			this.smellsGood = true;
			this.width = document.body.clientWidth;
			this.height = document.body.clientHeight;
			this.browsWidth = document.body.offsetWidth + 8;
			this.browsHeight = document.body.offsetHeight;
			this.browsXPos = window.screenLeft - 4; //Temporary - 4 is standard, user can change
			this.browsYPos = window.screenTop - 97; //Temporary - 97 is standard, user can change
			
			//Use VBScript function to detect Flash version
			if(CheckFlash() >= 6)
				this.hasFlash = true;
		
			document.onmousemove = GetMousePosition;
			this.mouseX = 0;
			this.mouseY = 0;
			
			//Filter out IE 5 for Mac - 5 stinks... maybe MS will fix with 6?
			if(this.userAgent.indexOf('mac')!=-1) {
				this.smellsGood = false;
			}
		} else {
			this.smellsGood = false;
		}
	} else if(this.userAgent.indexOf('netscape')!=-1) { //netscape, find out if it's not 4
		if(this.appVersion >= 5) {
			this.smellsGood = true;
			this.width = window.innerWidth;
			this.height = window.innerHeight;
			this.browsWidth = window.outerWidth;
			this.browsHeight = window.outerHeight;
			this.browsXPos = window.screenX;
			this.browsYPos = window.screenY;
			
			document.onmousemove = GetMousePosition;
			this.mouseX = 0;
			this.mouseY = 0;

			//Search to see if they have a mimetype handler for wav audio.
			for (var i = 0; i < navigator.mimeTypes.length; i++) {
			    if(navigator.mimeTypes[i].type == "application/x-shockwave-flash") {  //could also use a substring search for wav
					//Great, we have Flash, find out what version
					var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				    var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
				    var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
     				
					if(flashVersion >= 6)  { //Only Allow 5+
						this.hasFlash = true;
					}
			        break;
			    }
			}
			
		} else {
			this.smellsGood = false;
		}
	} else if(this.userAgent.indexOf('gecko')!=-1) { //the real Gecko/Mozilla
		this.smellsGood = true;
		this.width = window.innerWidth;
		this.height = window.innerHeight;
		this.browsWidth = window.outerWidth;
		this.browsHeight = window.outerHeight;
		this.browsXPos = window.screenX;
		this.browsYPos = window.screenY;
		
		//Search to see if they have a mimetype handler for wav audio.
		for (var i = 0; i < navigator.mimeTypes.length; i++) {
		    if(navigator.mimeTypes[i].type == "application/x-shockwave-flash") {  //could also use a substring search for wav
				//Great, we have Flash, find out what version
				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			    var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			    var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
    				
				if(flashVersion >= 6)  { //Only Allow 5+
					this.hasFlash = true;
				}
		        break;
		    }
		}

		document.onmousemove = GetMousePosition;
		this.mouseX = 0;
		this.mouseY = 0;
			
	} else if(this.userAgent.indexOf('konqueror')!=-1) { //Konqueror has lots of problems with this site 
		this.smellsGood = false;
	} else if(this.userAgent.indexOf('lynx')!=-1) { //Lynx
		this.smellsGood = false;
	} else if(document.getElementById) {  //Unknown - supports getElementById though
		this.smellsGood = true;
		//Sticking with the Netscape tack on width/height - the W3C doesn't have anything documented I know of for this.
		this.width = window.innerWidth;
		this.height = window.innerHeight;
		this.browsWidth = window.outerWidth;
		this.browsHeight = window.outerHeight;
		this.browsXPos = window.screenX;
		this.browsYPos = window.screenY;
		
		//Search to see if they have a mimetype handler for wav audio.
		for (var i = 0; i < navigator.mimeTypes.length; i++) {
		    if(navigator.mimeTypes[i].type == "application/x-shockwave-flash") {  //could also use a substring search for wav
				//Great, we have Flash, find out what version
				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			    var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			    var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
    				
				if(flashVersion >= 6)  { //Only Allow 5+
					this.hasFlash = true;
				}
		        break;
		    }
		}

		document.onmousemove = GetMousePosition;
		this.mouseX = 0;
		this.mouseY = 0;
			

	} else {
		this.smellsGood = false;
	}
}

function Trace(traceString) {
		document.traceForm.trace.value+= traceString + "\n";
		//document.traceForm.trace.value = traceString + "\n";
}

function GetMousePosition(e) {
	if(client.smellsGood) {
		if(!this.addEventListener) { //IE
			client.mouseX = window.event.clientX + document.body.scrollLeft; 
			client.mouseY = window.event.clientY + document.body.scrollTop; 
		} else {
			client.mouseX = e.pageX; 
			client.mouseY = e.pageY; 
		}
	}
}

function ShowMap(url, name, rs, w, h) {
	var resize = "";
	if (rs) {
		resize = "resizable,";
	}
	
	//Close window if already open
	if(window.map)
		window.map.close();
		
	//alert("preURL: " + url + "\nurl: " + url + "\nprotocol: " + window.location.protocol);
	window.map = window.open(url, name, "scrollbars=yes,menubar=yes," + resize + "width=" + w + ",height=" + h);
	//return false;
}

function FixHeight() {
	if(client.smellsGood) {
		//Get height of all elements
		var headerTableObj = document.getElementById("headerTable");
		var headerBottomTableObj = document.getElementById("headerBottomTable");
		var bodyTableObj = document.getElementById("bodyTable");
		var footerTableObj = document.getElementById("footerTable");
		var borderSpacerImgObj = document.getElementById("borderSpacerImg");
		
		var bodyHeight = parseInt(headerTableObj.offsetHeight) + parseInt(headerBottomTableObj.offsetHeight) + parseInt(bodyTableObj.offsetHeight) + parseInt(footerTableObj.offsetHeight);
		
		//alert(borderSpacerImgObj);
		if(bodyHeight < client.height) {
			borderSpacerImgObj.height = parseInt(client.height) - (bodyHeight - parseInt(bodyTableObj.offsetHeight) + 10);
		}
	}
}
