function Is() {
    var agent   = navigator.userAgent.toLowerCase();
    this.major  = parseInt(navigator.appVersion);
    this.minor  = parseFloat(navigator.appVersion);
    this.ns     = ((agent.indexOf('mozilla')   != -1) &&
                  (agent.indexOf('spoofer')    == -1) &&
                  (agent.indexOf('compatible') == -1) &&
                  (agent.indexOf('opera')      == -1) &&
                  (agent.indexOf('webtv')      == -1));
    this.ns2    = (this.ns && (this.major      ==  2));
    this.ns3    = (this.ns && (this.major      ==  3));
    this.ns4    = (this.ns && (this.major      ==  4));
    this.ns6    = (this.ns && (this.major      >=  5));
    this.ie     = (agent.indexOf("msie")       != -1);
    this.ie3    = (this.ie && (this.major      <   4));
    this.ie4    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   == -1));
    this.ie5    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   != -1));
    this.ieX    = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();

function launch(newURL, newName, newFeatures, orgName) {
	var PopWin = open(newURL, newName, newFeatures);
	if (PopWin.opener == null) // if something went wrong
		PopWin.opener = window;
		PopWin.opener.name = orgName;
	return PopWin;
}

var ah = 480;
var aw = 640;

function launchPop(url,toolbar,resize,scroll,size) {
	if(is.ns4||is.ns6) {
		available_width=innerWidth;
		available_height=innerHeight;
	} else if(is.ie4||is.ie5) {
		available_width=document.body.clientWidth;
		available_height=document.body.clientHeight;
	}

	if(size=='login') {
		ah = 320;
		aw = 320;
	}else if(size=='calendar') {
		ah = 180;
		aw = 160;
	} else if(size=='landscape') {
		ah = 530;
		aw = 658;
	} else if(size=='portrait') {
		ah = 658;
		aw = 530;
	} else if(size=='printer') {
		ah = available_height;
		aw = 660;
	} else if(size=='full') {
		ah = available_height;
		aw = available_width;
	}

	var popLeft = (available_width/2)-(aw/2);
	var popTop = (available_height/2)-(ah/2);
	var str = "left="+popLeft+",screenX="+popLeft+",top="+popTop+",screenY="+popTop;

	if (!window.myPop || window.myPop.closed) {
		str += ",height=" + ah;
		str += ",innerHeight=" + ah;
		str += ",width=" + aw;
		str += ",innerWidth=" + aw;
		if(scroll){
			str += ",scrollbars=yes";
		}
		if(toolbar){
			str += ",toolbar=yes";
		}
		if(resize){
			str += ",resizable";
		}
		str += ",status=no";
		myPop = open(url, "myPop", str);
		myPop.focus();
	} else {
		myPop.location.href = url;
		myPop.focus();
	}
}