var agt=navigator.userAgent.toLowerCase();
var is_opera = (agt.indexOf("opera") != -1);
var appVer   = navigator.appVersion.toLowerCase();
var is_ie    = ((appVer.indexOf('msie')!=-1) && (!is_opera));
var is_mac   = (agt.indexOf("mac")!=-1);

var is_gecko = (agt.indexOf('gecko')!=-1);
function openAppWindow(url) {
	if(url.indexOf("?") != -1) {
		url = url + "&launched=true";
	}
	else {
		url = url + "?launched=true";
	}
	var features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,left=0,top=0';
	if (is_ie) {
		var width = (customArgs.width=="100%") ? screen.availWidth : customArgs.width;
		var height = (customArgs.height=="100%") ? (screen.availHeight-21) : customArgs.height;
		features += ',resizable=yes,width='+width+',height='+height;
	}
	else if(!(is_gecko || is_opera)) {
		// do not allow resizing on netscape < 5 b/c resizing causes the page to reload (including the flash movie)
		var swidth = (customArgs.width=="100%") ? ('outerWidth='+screen.availWidth) : ('width='+customArgs.width);
		var sheight = (customArgs.height=="100%") ? ('outerHeight='+screen.availHeight) : ('height='+customArgs.height);
		features += ',resizable=no,'+swidth+','+sheight;
	}
	else {
		var swidth = (customArgs.width=="100%") ? ('outerWidth='+(is_mac ? (screen.availWidth-30) : screen.availWidth)) : ('width='+customArgs.width);
		var sheight = (customArgs.height=="100%") ? ('outerHeight='+(is_mac ? (screen.availHeight-6) : screen.availHeight)) : ('height='+customArgs.height);
		features += ',resizable=yes,'+swidth+','+sheight;
	}
	var w = window.open(url, "_blank", features);
	// we can't specify negative offsets in the window.open() call from loader.html, so do it here
	// this allows us to have the window resize borders be offscreen on IE
	// if using a blocker, w may be null (netscape) or closed (IE) which will kill all javascript after this (like the html message warning against popups) if we try to manipulate w
	if(w!=null) {	
		if(!w.closed) {
			w.moveTo(-5, -5);  // in Netscape, this will act like moveTo(0, 0)
		}
	}
	return w;
}

