// POPUP Routine
// by Kimara Sajn
//
// (c) 2000 General Rubric
//
// handles special case of multiple windows via Name argument -- blank is default
// and also is sizable (note: all blank arguments default to empty popup window 560 x 365)
//

	function popup(url, name, width, height, winvar) {
		var n;

		// specify size here

		if (width && height) {
				var w = width;
				var h = height;

				if (w == 0) { w = 560; }
				if (h == 0) { h = 365; }
		}
		else {
			var w = 560;
			var h = 365;
		}

		// END OF SIZE CONTROL SETTINGS
	
		if (name == "") {
			n = "popupWindow"; 
		}
		else {
			n = name;
		}

		// use for customisable dimensions

			var popupControlWindow = window.open(url,n,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h);

		if (winvar) {
			setTimeout("refocus(" + winvar + ")",1000);
			return popupControlWindow;
		}
	}


	// Popup with position specified (x,y)

	function popup_xy(url, name, x, y, width, height, winvar) {
		var n;

		// specify X, Y start coords here

		if (x && y) {
				var scr_x = x;
				var scr_y = y;
		}
		else {
			var scr_x = 0;
			var scr_y = 0;
		}		

		// specify size here

		if (width && height) {
				var w = width;
				var h = height;

				if (w == 0) { w = 560; }
				if (h == 0) { h = 365; }
		}
		else {
			var w = 560;
			var h = 365;
		}

		// END OF SIZE CONTROL SETTINGS
	
		if (name == "") {
			n = "popupWindow"; 
		}
		else {
			n = name;
		}

		// use for customisable dimensions

			var popupControlWindow = window.open(url,n,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+",screenX="+scr_x+",screenY="+scr_y+",left="+scr_x+",top="+scr_y);

		if (winvar) {
			setTimeout("refocus(" + winvar + ")",1000);
			return popupControlWindow;
		}
	}

	function refocus(w) {
		if (w.closed) {
			// no op
		}
		else {
			w.focus();
		}
	}

