/**
 * openInWindow functionality
 *
 * @version $Id: openWindow.js 368 2007-04-10 11:15:58Z slac $
 */
function openInWindow(windowURL,windowWidth,windowHeight) {
	var pos = setWindowPosition(windowWidth,windowHeight);
// Define windowName after windowURL substring
	var windowName;
	//Handle exceptions: 'http://','.','/'
	if (windowURL.indexOf("http://") != -1) {
		windowURL_spec = windowURL.substr((windowURL.indexOf("http://"))+7);
	}else{
		windowURL_spec = windowURL;
	}
	if (windowURL_spec.indexOf(".") < windowURL_spec.indexOf("/")) {
		windowName = windowURL_spec.substr(0,windowURL_spec.indexOf("."));
	}else{
		windowName = windowURL_spec.substr(0,windowURL_spec.indexOf("/"));
	}
//Open new window
	newWindow = window.open(windowURL,windowName,"scrollbars=yes,resizable=no,width="+windowWidth+",height="+windowHeight+",left="+pos['x']+",top="+pos['y']);
} //end of openInWindow
function setWindowPosition(windowWidth,windowHeight) {
//Check screen size and place new window centered
	var pos = new Array();
	//Width
	if (screen.availWidth < windowWidth) {
		pos['x'] = 0;
	}else{
		pos['x'] = (screen.availWidth-windowWidth)/2;
	}
	//Height
	if (screen.availHeight < windowHeight) {
		pos['y'] = 0;
	}else{
		pos['y'] = (screen.availHeight-windowHeight)/2;
	}
	return pos;
} //end of setWindowPosition