function ClientSnifferJr() {
	this.ua = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);

	if (typeof(window.navigator.platform) != 'undefined') {
		var platform = window.navigator.platform.toLowerCase();
		if (platform.indexOf('win') != -1) {
			this.os = 'win';
    	} else if (platform.indexOf('mac') != -1) {
			this.os = 'mac';
    	} else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1) {
			this.os = 'nix';
		} else {
			this.os = 'other';
		}
  	}

	if (document.addEventListener && document.removeEventListener) this.dom2events = true;
	if (document.getElementById) this.dom1getbyid = true;
	if (window.opera) {
		this.opera = true;
		this.opera5 = (this.ua.indexOf("opera 5") != -1 || this.ua.indexOf("opera/5") !=- 1);
		this.opera6 = (this.ua.indexOf("opera 6") != -1 || this.ua.indexOf("opera/6") != -1);
		this.opera5or6 = this.opera5 || this.opera6;
		this.opera7 = (this.ua.indexOf("opera 7") !=-1 || this.ua.indexOf("opera/7") != -1);
		return;
	}
	this.konq = this.ua.indexOf('konqueror') != -1;
	this.ie = this.ua.indexOf('msie') != -1;
	if (this.ie) {
		this.ie3 = this.major < 4;
		this.ie4 = (this.major == 4 && this.ua.indexOf('msie 5') == -1 && this.ua.indexOf('msie 6') == -1);
		this.ie4up = this.major >= 4;
		this.ie5 = (this.major == 4 && this.ua.indexOf('msie 5.0') != -1);
		this.ie5up = !this.ie3 && !this.ie4;
		this.ie6 = (this.major == 4 && this.ua.indexOf('msie 6.0') != -1);
		this.ie6up = (!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5") == -1);
		return;
	}
	this.hotjava = this.ua.indexOf('hotjava') != -1;
	this.webtv = this.ua.indexOf('webtv') != -1;
	this.aol = this.ua.indexOf('aol') != -1;
	if (this.hotjava || this.webtv || this.aol) return;
	// Gecko, NN4, and NS6
	this.gecko = this.ua.indexOf('gecko') != -1;
	this.nav = (this.ua.indexOf('mozilla') != -1 && this.ua.indexOf('spoofer')== -1 && this.ua.indexOf('compatible') == -1);
	if (this.nav) {
		this.nav4 = this.major == 4;
		this.nav4up = this.major >= 4;
		this.nav5up = this.major >= 5;
		this.nav6 = this.major == 5;
		this.nav6up = this.nav5up;
	}
}

window.is = new ClientSnifferJr();

function isUndefined(v) {
    var undef;
    return v === undef;
}

//<<CT>> We need the address bar here, and scrolls!...
function raw_popup(url, target) {
	var winW, winH, winT, winL;
	var screenW = screen.availWidth;
	var screenH = screen.availHeight;

	if (screenH > 1024 || screenW > 1280) {
		winW = 1280;
		winH = 1024;
	} else {
		winW = (screenW - 10);
		winH = (screenH - 20);
	}

	//winT = ((screenH - winH) / 2);
	//winL = ((screenW - winW) / 2);
	winT = 0;
	winL = 0;

	if (isUndefined(target)) target = '_blank';

	if (is.nav) {
		features = 'resizable=1,scrollbars=1,toolbar=0,location=1,status=1,directories=0,menubar=0,width=' + winW + ',height=' + winH + ',screenX=' + winT + ',screenY=' + winL;
	} else {
		features = 'resizable=1,scrollbars=1,toolbar=0,location=1,status=1,directories=0,menubar=0,width=' + winW + ',height=' + winH + ',left=' + winL + ',top=' + winT;
	}

	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}

function link_popup(src) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank');
}

function link_tc_popup(src) {
	return tc_popwin(src.getAttribute('href'), src.getAttribute('target') || '_blank');
}

function tc_popwin(url, target) {
	var winW, winH, winT, winL;
	var screenW = screen.availWidth;
	var screenH = screen.availHeight;

	winW = 540;
	winH = 477;

	winT = 0;
	winL = 0;

	if (isUndefined(target)) target = '_blank';

	if (is.nav) {
		features = 'scrollbars=1,resizable=1,toolbar=0,location=0,status=0,directories=0,menubar=0,width=' + winW + ',height=' + winH + ',screenX=' + winT + ',screenY=' + winL;
	} else {
		features = 'scrollbars=1,resizable=1,toolbar=0,location=0,status=0,directories=0,menubar=0,width=' + winW + ',height=' + winH + ',left=' + winL + ',top=' + winT;
	}

	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}
