function getUsableScreenWidth() {//gets usable screen dims 100(%) or 900(px) are returned
	var SCREEN;
	SCREEN = parseInt(document.getElementById("SubMain").style.width);
	return SCREEN;
}

function getUsableScreen() {//gets usable screen dims
	var SCREEN;
	SCREEN = document.getElementById("Main").clientWidth + "%" +  document.getElementById("Main").clientHeight;
	return SCREEN;
}

function getMaxScreen() {var SCREEN;SCREEN = screen.availWidth + "%" +  screen.availHeight;return SCREEN;}//gets usable monitor dims

function getAppVersion() {return navigator.userAgent;}//gets browser data

function getOS() {
	var thisOpSys = navigator.userAgent.toLowerCase();
	//returns the operating system
	if (thisOpSys.indexOf("windows") != -1) {
		thisOpSys = "windows";
	}
	else if (thisOpSys.indexOf("mac") != -1) {
		thisOpSys = "mac";
	}
	else if (thisOpSys.indexOf("linux") != -1) {
		thisOpSys = "linux";
	}
	else if (thisOpSys.indexOf("unix") != -1) {
		thisOpSys = "unix";
	}
	else {
		thisOpSys = "unknown";
	}
	return thisOpSys;
}

function getBrowser() {
	var thisBrowserType = navigator.userAgent.toLowerCase();
	//returns the browser type
	if ((thisBrowserType.indexOf("netscape") != -1  || thisBrowserType.indexOf("navigator") != -1)) {
		thisBrowserType = "netscape";
	}
	else if (thisBrowserType.indexOf("camino") != -1) {
		thisBrowserType = "camino";
	}
	else if (thisBrowserType.indexOf("chrome") != -1) {
		thisBrowserType = "chrome";
	}
	else if (thisBrowserType.indexOf("opera") != -1) {
		thisBrowserType = "opera";
	}
	else if (thisBrowserType.indexOf("msie") != -1) {
		thisBrowserType = "ie";
	} 
	else if (thisBrowserType.indexOf("safari") != -1) {
		thisBrowserType = "safari";
	}
	else if (thisBrowserType.indexOf("firefox") != -1) {
		thisBrowserType = "firefox";
	}
	else {
		thisBrowserType = "unknown";
	}
	return thisBrowserType;
}


function getBrowserVersion() {
	var thisOS = getOS();
	var thisBrowser = getBrowser();
	var thisBrowserString = navigator.userAgent.toLowerCase();
	var thisBrowserVersion;
	//returns the browser version
	if (thisBrowser == "camino") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("camino") + 7);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf("."));
	}
	else if (thisBrowser == "chrome") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("chrome") + 7);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf("."));	
	}
	else if (thisBrowser == "netscape") {
		if (thisOS == "mac") {
			thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("navigator") + 10);
			thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
			thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
			thisBrowserVersion += "." + thisBrowserString.slice(0,2);
		} else if (thisOS == "windows") {
			thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("netscape") + 9);
			thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
			thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
			thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf("."));	
		} else {
			thisBrowserVersion = 0;
		}
	}
	else if (thisBrowser == "ie") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("msie") + 5);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf(";"));
	}
	else if (thisBrowser == "safari") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("version") + 8);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf("."));
	}
	else if (thisBrowser == "firefox") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("firefox") + 8);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,thisBrowserString.indexOf("."));
	}
	else if (thisBrowser == "opera") {
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf("version") + 8);
		thisBrowserVersion = thisBrowserString.slice(0,thisBrowserString.indexOf("."));
		thisBrowserString = thisBrowserString.slice(thisBrowserString.indexOf(".") + 1);
		thisBrowserVersion += "." + thisBrowserString.slice(0,2);
	}
	else {
		thisBrowserVersion = 0;
	}
	return thisBrowserVersion;
}
