/*
	This code (unless otherwise stated) was all written by
	André Xuereb. Please refrain from using this code either
	in whole or in part before asking permission.
	Thanks.
*/

// ----------------------------------------------------------------------------------------

/* Function that returns:
	"IE" if the browser is Microsoft Internet Explorer
	"NN" if the browser is Netscape Navigator
	"??" if the browser is neither of the above */

function browserName() {
	var sBrowserName = navigator.appName;

	if (sBrowserName == "Netscape") {
		return "NN";
	}
	if (sBrowserName == "Microsoft Internet Explorer") {
		return "IE";
	}
	else {
		return "??";
	}
} // browserName

// Function that returns the browser version number
function browserVer() {
	if (browserName() == "IE") {
		var sTemp = navigator.appVersion;
		sTemp = sTemp.substr(sTemp.indexOf('; ') + 2, sTemp.length);
		sTemp = sTemp.substr(sTemp.indexOf(' ') + 1, sTemp.length);
		sTemp = sTemp.substr(0, sTemp.indexOf(';'));
		var nVer = parseFloat(sTemp);
	}
	else {
		var nVer = parseFloat(navigator.appVersion);
	}

	return nVer;
} // browserVer

// ----------------------------------------------------------------------------------------

// Functions that return TRUE if the screen size is...

// ... 640x480
function is640x480() {
	return (screen.width == 640);
} // is640x480

// ... 800 x 600
function is800x600() {
	return (screen.width == 800);
} // is800x600

// ... 1024 x 768
function is1024x768() {
	return (screen.width >= 1024);
} // is1024x768

// ... not 1024 x 768
function isNot1024x768() {
	return (screen.width != 1024);
} // isNot1024x768

// Function that returns the screen size as a string ("800x600" or "1024x768")
function screenSize() {
	if (is1024x768()) {
		return "1024x768";
	}
	else {
		return "800x600";
	}
} // screenSize

// Function that returns the right size
function convert(nSize) {
	if (is1024x768()) {
		return nSize;
	}
	else {
		return Math.round(nSize * 800 / 1024);
	}	
} // convert(nSize)