//javascript
/*
*******************************************************
************ Editableweb popup window code ************
************     www.editableweb.com       ************
************  Do not remove this notice    ************
************      V 1.1.ts Oct 2009        ************
************   Visit www.editableweb.com   ************
*******************************************************

================== INSTRUCTIONS =======================
copy this code to the folder containing your web pages

include the code in your page by adding the following line inside the <head> tags
<SCRIPT language=JavaScript src="popwin.js"></SCRIPT>

Call as required - most usually from an onClick event on a graphic or button e.g.
<img src="pic.gif" onClick="openwin('http://www.editableweb.com')">

See comments below for customisation options 
=======================================================
*/

var pagetoshow = null; 
var mwidth = 9; // percentage of screen width for main window (set to a single digit number if only opening a popup and not resizing main)
var pwidth = 93; // 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

function openwin(pagetoshow) {
 
  	if (window.screen) {
		windowheight = window.screen.availHeight;
		popwindowheight = windowheight -150; // -56 for full screen height if there are no toolbars on		
        mainwidth = (window.screen.availWidth * mwidth / 100) -5;		
        popupwidth = (window.screen.availWidth * pwidth / 104);
    }
	
	popupxpos = mainwidth -4;
	mainwin = self;
	
	// main popup window code below. set toolbar=0 and loaction=0 for a 'blank' window	

	popwin = window.open('','popwin','width='+popupwidth+',height='+popwindowheight+',toolbar=1,location=1,scrollbars=1,resizable=1,screenX='+popupxpos+',screenY=0,top=0,left='+popupxpos+'');
	popwin.location.href = pagetoshow ;
	if (popwin.opener == null) popwin.opener = self;
		
	// next two lines only if the main window is being repositioned and sized
	// mainwin.resizeTo(mainwidth,windowheight);
	// mainwin.moveTo(0,0);
		
	// give the popup focus after it has had a chance to open
	if (popwin.focus) {
		setTimeout ("popwin.focus()",500);
	}	
	doneopen = 1;

}

//next line if code is to be called when main page is first opened
//openwin('http://www.editableweb.com');
