// JavaScript Document
// code to call popup panel alongside current page 
var pagetoshow = null; 
var mwidth = 70; // percentage of screen width for main window
var pwidth = 31; // percentage of screen width for popup
var doneopen = 0;
var hasfocus = null;
var popwin = null;
var mainwidth = 540, windowheight = 440, popwindowheight = 440, popupwidth = 100; // defaults
var mainwind = self; // assign window handle for current window
	
	// get screen height and set vaviables for main and popup window heights and widths
    if (window.screen) {
		windowheight = window.screen.availHeight;
		popwindowheight = (window.screen.availHeight) -36;		
        mainwidth = (window.screen.availWidth * mwidth / 100) -5;		
        popupwidth = (window.screen.availWidth * pwidth / 104);
    }
	popupxpos = mainwidth -4;
	
// a function to open a popup and align alongside the current window - suitable for a help panel
function openWindows(pagename) {
	pagetoshow = "../../ewwguide/" + pagename + ".htm";

	// get a handle and open a popup window and position it as well as this window to allow space
	popwin = window.open('','popupright','width='+popupwidth+',height='+popwindowheight+',toolbar=0,location=0,scrollbars=1,resizable=1,screenX='+popupxpos+',screenY=0,top=0,left='+popupxpos+'');
	popwin.location.href = pagetoshow ;
	if (popwin.opener == null) popwin.opener = mainwind;
	//give the popup focus after it has had a chance to open - js code on the popup will resize the main window
	setTimeout ("popwin.focus()",500);
	doneopen = 1;
}
