function openWindow(theURL,winName, size) { 
	var params = 'scrollbars=yes'; // allow scrollbars
		params += ', resizable=yes'; // allow resize
		params += ', location=yes'; // allow resize
	
	switch (size) { // size can be empty or 'normal', 'large', 'max'
	  case "max": // fullscreen window
		 params += ', width=' + (screen.width-50); // calculate max. window width
		 params += ', height=' + (screen.height-50); // calculate max. window height
		 params += ', top=10, left=10' // position top left for fullscreen
		break;
	  case "large":
		 targetWidth = 1000;
		 params += ', width=' + targetWidth; 
		 params += ', height=' + (screen.height-150);
		 params += ', top=30, left=' + (screen.width - targetWidth)/2; 
		break;
	  default:
		 targetWidth = 680;
		 params += ', width=' + targetWidth; 
		 params += ', height=' + (screen.height-300);
		 params += ', top=30, left=' + ((screen.width - targetWidth)/2) ; 
		 break;
	 }

	if (winName != "opener") { // if winName is 'opener' don't open a new popup but open a new location in the parent window.
 	 newPopup =  window.open(theURL,winName, params);
	 if (window.focus) { newPopup.focus(); }
	}
	else {
        opener.location = theURL; 			
		if (window.focus) { opener.focus(); window.blur() }
	}
	return false;
}

function close_window() {
    window.close();
}
