// Browser Detect v2.1.6
// code by Cris Nott (cris[at]dithered[dot]com)
// slightly altered
function detectBrowser() {
	// user agent
	var myUserAgent = navigator.userAgent.toLowerCase();	
	// browser engine name
	this.isGecko = (myUserAgent.indexOf('gecko') != -1 && myUserAgent.indexOf('safari') == -1);
	this.isAppleWebKit = (myUserAgent.indexOf('applewebkit') != -1);
	// browser name
	this.isWebtv = (myUserAgent.indexOf('webtv') != -1);
	this.isDreamcast = (myUserAgent.indexOf('dreamcast') != -1);
	this.isKonqueror = (myUserAgent.indexOf('konqueror') != -1);
	this.isSafari = (myUserAgent.indexOf('safari') != -1);
	this.isOmniweb = (myUserAgent.indexOf('omniweb') != -1);
	this.isOpera = (myUserAgent.indexOf('opera') != -1);
	this.isICab = (myUserAgent.indexOf('icab') != -1);
	this.isAOL = (myUserAgent.indexOf('aol') != -1);
	this.isIE = (myUserAgent.indexOf('msie') != -1 && !this.isOpera && (myUserAgent.indexOf('webtv') == -1));
	this.isMozilla = (this.isGecko && myUserAgent.indexOf('gecko/') + 14 == myUserAgent.length);
	this.isFirebird = (myUserAgent.indexOf('firebird/') != -1);
	this.isNS = ((this.isGecko) ? (myUserAgent.indexOf('netscape') != -1) : ((myUserAgent.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (myUserAgent.indexOf('spoofer') == -1) && (myUserAgent.indexOf('compatible') == -1) && (myUserAgent.indexOf('webtv') == -1) && (myUserAgent.indexOf('hotjava') == -1)));
	// spoofing and compatible browsers
	this.isIECompatible = ((myUserAgent.indexOf('msie') != -1) && !this.isIE);
	this.isNSCompatible = ((myUserAgent.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
	// rendering engine versions
	this.geckoVersion = ((this.isgecko) ? myUserAgent.substring((myUserAgent.lastIndexOf('gecko/') + 6), (myUserAgent.lastIndexOf('gecko/') + 14)) : -1);
	this.equivalentMozilla = ((this.isGecko) ? parseFloat(myUserAgent.substring(myUserAgent.indexOf('rv:') + 3)) : -1);
	this.appleWebKitVersion = ((this.isAppleWebKit) ? parseFloat(myUserAgent.substring(myUserAgent.indexOf('applewebkit/') + 12)) : -1);
	// browser version
	this.versionMinor = parseFloat(navigator.appVersion);
	// correct version number
	if (this.isGecko && !this.isMozilla) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('/',myUserAgent.indexOf('gecko/') + 6) + 1));
	} else if (this.isMozilla) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('rv:') + 3));
	} else if (this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('msie') + 5));
	} else if (this.isKonqueror) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('Konqueror/') + 10));
	} else if (this.isSafari) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.lastIndexOf('safari/') + 7));
	} else if (this.isOmniweb) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.lastIndexOf('omniweb/') + 8));
	} else if (this.isOpera) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('opera') + 6));
	} else if (this.isICab) {
		this.versionMinor = parseFloat(myUserAgent.substring(myUserAgent.indexOf('icab') + 5));
	}
	this.versionMajor = parseInt(this.versionMinor);
	// DOM support changed to work better in safari
	this.isDOM1 = false;
	if (document.getElementById) {
		this.isDOM1 = true;
	}
	this.isDOM2 = false;
	if (document.addEventListener && document.removeEventListener) {
		this.isDOM2 = true;
	}
	// CSS compatibility mode
	this.CSSMode = document.compatMode ? document.compatMode : 'BackCompat';
	// platform
	this.isWin = (myUserAgent.indexOf('win') != -1);
	this.isWin32 = (this.isWin && (myUserAgent.indexOf('95') != -1 || myUserAgent.indexOf('98') != -1 || myUserAgent.indexOf('nt') != -1 || myUserAgent.indexOf('win32') != -1 || myUserAgent.indexOf('32bit') != -1 || myUserAgent.indexOf('xp') != -1));
	this.isMac = (myUserAgent.indexOf('mac') != -1);
	this.isMac = (myUserAgent.indexOf('mac') != -1);
	this.isUnix = (myUserAgent.indexOf('unix') != -1 || myUserAgent.indexOf('sunos') != -1 || myUserAgent.indexOf('bsd') != -1 || myUserAgent.indexOf('x11') != -1);
	this.isLinux = (myUserAgent.indexOf('linux') != -1);
	// specific browser shortcuts
	this.isNS4x = (this.isNS && this.versionMajor == 4);
	this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
	this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
	this.isNS4up = (this.isNS4x && this.versionMinor >= 4);
	this.isNS6x = (this.isNS && this.versionMajor == 6);
	this.isNS6up = (this.isNS4x && this.versionMajor >= 6);
	this.isNS7x = (this.isNS && this.versionMajor == 7);
	this.isNS7up = (this.isNS4x && this.versionMajor >= 7);
	this.isIE4x = (this.isIE && this.versionMajor == 4);
	this.isIE4up = (this.isIE && this.versionMajor >= 4);
	this.isIE5x = (this.isIE && this.versionMajor == 5);
	this.isIE55 = (this.isIE && this.versionMajor == 5.5);
	this.isIE5up = (this.isIE && this.versionMajor >= 5);
	this.isIE6x = (this.isIE && this.versionMajor == 6);
	this.isIE6up = (this.isIE && this.versionMajor >= 6);
	this.isIE4xMac = (this.isIE4x && this.isMac);
}

// Resize 1.1 by MaxxBlade http://www.maxxblade.co.uk
function resizePopUp(targetWidth,targetHeight) {
	function winWidth() { return (ns4 || ns6) ? window.innerWidth : document.body.clientWidth; }
	function winHeight() { return (ns4 || ns6) ? window.innerHeight : document.body.clientHeight; }
	function centerX() { return (ns4 || ns6) ? parseInt((screen.width / 2) - (width / 2)) : parseInt((screen.availWidth / 2) - (width / 2)); }
	function centerY() { return (ns4 || ns6) ? parseInt((screen.height / 2) - (height / 2)) : parseInt((screen.availHeight / 2) - (height / 2)); }
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
	// and... action!
	top.resizeTo(targetWidth,targetHeight);
	var width = winWidth();
	var height = winHeight();
	var difX = targetWidth - winWidth();
	var difY = targetHeight - winHeight();
	width += (difX * 2);
	height += (difY * 2);
	if (height > 700) {
		height = 545;
	}
	top.resizeTo(width,height);
	//top.moveTo(centerX(),centerY());
}
function relocatePopUp(targetWidth,targetHeight) {
	function winWidth() { return (ns4 || ns6) ? window.innerWidth : document.body.clientWidth; }
	function winHeight() { return (ns4 || ns6) ? window.innerHeight : document.body.clientHeight; }
	function centerX() { return (ns4 || ns6) ? parseInt((screen.width / 2) - (width / 2)) : parseInt((screen.availWidth / 2) - (width / 2)); }
	function centerY() { return (ns4 || ns6) ? parseInt((screen.height / 2) - (height / 2)) : parseInt((screen.availHeight / 2) - (height / 2)); }
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
	// and... action!
	top.resizeTo(targetWidth,targetHeight);
	var width = winWidth();
	var height = winHeight();
	var difX = targetWidth - winWidth();
	var difY = targetHeight - winHeight();
	width += (difX * 2);
	height += (difY * 2);
	if (height > 700) {
		height = 545;
	}
	top.resizeTo(width,height);
	top.moveTo(centerX(),centerY());
}
// break out of any framesets
function breakOut() {
	top.location.href = location.href;
}

