var helpWin=null;

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
if      (bName == "Netscape" && bVer >= 5) ver = "Moz";
if      (bName == "Netscape" && bVer == 4) ver = "n4";
if      (bName == "Netscape" && bVer == 3) ver = "n3";
if		(bName == "Netscape" && bVer == 2) ver = "n2";
if		(navigator.userAgent.indexOf("Netscape")!=-1) {
	if (bVer == 5) {
		ver = "n5";
	}
}
else if (bName == "Microsoft Internet Explorer" && bVer >= 2) ver = "e3";
	if (bName == "Microsoft Internet Explorer" && bVer >= 4) ver = "e4";
Bsys  = 'win'
bApp  = navigator.appVersion
if (bApp.indexOf('Mac') != -1 || bApp.indexOf('PPC')!= -1){Bsys='mac'}
baseref  = location.href.substring(0, location.href.lastIndexOf('/')+1)

function openHelpSrolls(w,url,urln,sect,subsect,showScrolls) {
	helpsect = sect;
	helpsubsect = subsect;

	origWidth = document.body.clientWidth;
	origHeight = document.body.clientHeight + 128;
	
	//alert(origWidth + " & " + origHeight);
	
	screenWidth = screen.width;
	screenHeight = screen.height;
	screenWidthRmdr = screenWidth - w - 10;
	
	// calculation for macintosh
	if (Bsys == 'mac') {
		h = screen.availHeight;
	} else {
		h = screen.availHeight - 30;
	}
	
	// starting point for new window
	startX = screenWidth - w - 10;
	startY = 0;

        url += '?section=' + sect;
        if (subsect != null) {
            url += '&anchor=' + subsect;
        }

	// opens the new window and puts it in focus
	helpWin = window.open(url,urln,'width='+w+',height='+h+',scrollbars='+showScrolls+',status=0,screenX=0,left='+startX+',screenY=0,top='+startY+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,status=0,toolbar=0')
	helpWin.focus();
	
	helpWin.outerheight = h;
	if (Bsys == 'mac') {
		helpWin.resizeTo(w, screen.availHeight);
	}

	// moves main window to top left
	this.moveTo(0, 0)
	if (bName == 'Microsoft Internet Explorer') {
		screenOpenerH = screen.availHeight;
		screenOpenerW = screenWidthRmdr;
		this.resizeTo(screenWidthRmdr, screenOpenerH);
	} else if (Bsys == 'mac') {
		this.outerHeight = screen.availHeight;
		this.outerWidth = screenWidth - w;
	} else {
		this.outerHeight = screen.availHeight;
		this.outerWidth = screenWidth - w - 10;
	}
}

function openHelp(w,url,urln,sect,subsect) {
	openHelpSrolls (w,url,urln,sect,subsect,'1');
	opener=this;
}


function resizeFunc() {
	// calls resizeFunc2 so popup window will 
	// get the time to close itself
	setTimeout('resizeFunc2()', 1);
}

function resizeFunc2() {
	if ((helpWin != null) && (helpWin.closed == false)) {
		helpWin.focus();
	} else {
		if (bName == 'Microsoft Internet Explorer') {
			this.outerHeight = origHeight; //screen.availHeight;
			this.outerWidth = origWidth; //screen.availWidth;
			//alert(origWidth + " & " + origHeight);
			this.resizeTo(origWidth, origHeight);
			//this.resizeTo(screen.availWidth, screen.availHeight);
		} else {
			this.outerHeight = origHeight; //screen.availHeight;
			this.outerWidth = origWidth; //screen.availWidth;
		}
		this.moveTo(0, 0);
	}
}
