/* FLEXIBLE POPUP WINDOW WHICH LOADS A URL */
/* Uses JSON technology */
var popup_class = {
	address : '',
	window_width : 400,
	window_height : 400,
	window_xpos : 100,
	window_ypos : 100,
	window_centred : 'Y',
	window_resize : 'Y',
	window_tools : 'N',
	window_menu : 'N',
	window_scroll : 'Y',
	window_location : 'N',
	browser_width : 1024,
	browser_height : 768,
	show : function() {
		var wresize = (this.window_resize == 'Y') ? 'yes' : 'no';
		var wtools = (this.window_tools == 'Y') ? 'yes' : 'no';
		var wmenu = (this.window_menu == 'Y') ? 'yes' : 'no';
		var wscroll = (this.window_scroll == 'Y') ? 'yes' : 'no';
		var wlocation = (this.window_location == 'Y') ? 'yes' : 'no';
		if ( this.window_centred == "Y" ) {
			if (document.all) {
				this.browser_width = document.body.clientWidth;
				this.browser_height = document.body.clientHeight;
			} else {
				this.browser_width = window.innerWidth;
				this.browser_height = window.innerHeight;
			}
			this.window_xpos = (this.browser_width - this.window_width) / 2;
			this.window_ypos = (this.browser_height - this.window_height) / 2;
		}
		var params = 'left='+this.window_xpos+',top='+this.window_ypos+',width='+this.window_width+',height='+this.window_height+',resizable='+wresize+',toolbar='+wtools+',menubar='+wmenu+',location='+wlocation+',scrollbars='+wscroll;
		window.open( this.address, 'newWindow', params);
	}
}
function PopupWindow() {
	/*
	*	PARAMETERS
	*	0	-	Address (URL)
	*	1	-	Window Width (pixels)
	*	2	-	Window Height (pixels)
	*	3	-	Window X position
	*	4	-	Window Y position
	*	5	-	Window centered? ("Y" or "N") overrides args 3 and 4 (defaults to "Y")
	*	6	-	Window resizable? ("Y" or "N" defaults to "Y")
	*	7	-	Window toolbar? ("Y" or "N" defaults to "N")
	*	8	-	Window menubar? ("Y" or "N" defaults to "N")
	*	9	-	Window scrollbars? ("Y" or "N" defaults to "Y")
	*	10	-	Window location bar? ("Y" or "N" defaults to "N")
	*/
	var args=PopupWindow.arguments;
	if ( args[0] ) popup_class.address = args[0];
	if ( args[1] ) popup_class.window_width = args[1];
	if ( args[2] ) popup_class.window_height = args[2];
	if ( args[3] ) popup_class.window_xpos = args[3];
	if ( args[4] ) popup_class.window_ypos = args[4];
	if ( args[5] ) popup_class.window_centred = args[5];
	if ( args[6] ) popup_class.window_resize = args[6];
	if ( args[7] ) popup_class.window_tools = args[7];
	if ( args[8] ) popup_class.window_menu = args[8];
	if ( args[9] ) popup_class.window_scroll = args[9];
	if ( args[10] ) popup_class.window_location = args[10];
	popup_class.show();
}
function CloseWindow() {
	window.close();
}