/*
Language: CS Javascript
Name: popup
Description:
	Pops up a window of specified dimensions and disables href where appropriate to avoid
	double window creation. Therefore safe to use hrefs in an a tag in case of no javascript.
	In case of no dimensions specified, it uses a percentage of the screen size.
*/
var widthPercent=0.6;
var heightPercent=0.95;

function popup(url, title, w, h) {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if (!w) {
		if (document.body) {
			w=document.body.clientWidth*widthPercent;
			h=document.body.clientHeight*heightPercent;
		}
		else {
			if (window.innerWidth) {
				w=window.innerWidth*widthPercent;
				h=window.innerHeight*heightPercent;
			}
			else {
				w=300;
				h=400;
			}
		}
	}
	window.open(url, title, 'width='+w+',height='+h+',toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // do follow link
	else return false; // don't follow link
}
