// Helpcenter window launcher
function helpCenter() {
	helpWindow = window.open("help","helpWindow","width=750,height=600,resizable");
	helpWindow.focus();
}

//NOT USED?
//var helpDir = "help";
// path to helpcenter docs from site root
//var helpDocs = "help";

function getHelp(theURL) 
{
var framewin = window.open("","helpWindow","width=750,height=600,resizable");
with (framewin.document) 
	{
	write('<html>');
	write('<head><title>CPANDA helpcenter</title></head>')
	write('<frameset rows="36,*" cols="*" frameborder="no" border="0" framespacing="0">');
	write('<frame src="' + 'help/header" name="topFrame" frameborder="no" scrolling="no" noresize="noresize">');
	write('<frameset cols="200,*" frameborder="no" border="0" framespacing="0">');
	write('<frame src="' + 'help/toc" name="leftFrame" frameborder="no" scrolling="no" noresize="noresize">');
	write('<frame src="' + theURL + '" &name="mainFrame" frameborder="no">');
	write('</frameset>');
	write('</frameset>');
	write('</html>');
	}
	return false;
	helpWindow.focus();
}

//Added by WS 3-01-05
//browser type variables
var DOM = document.getElementById?1:0;
var NS = document.layers?1:0;
var IE = document.all?1:0;
var OK = DOM||NS||IE?1:0;

//returns browser independent reference to layer's style object
function getLayerStyle(objName) {
	var obj;
	if (DOM) obj = document.getElementById(objName).style;
	else if (IE) obj = document.all(objName).style;
	else if (NS) obj = document.layers[objName];
	return obj;
}

//shows popup layer
function popupLayer(objName, leftPosition, topPosition) {
	if (OK) {
		var obj = getLayerStyle(objName);
		obj.left = leftPosition;
		obj.top = topPosition;
		zIdx++;
		obj.zIndex = zIdx;
		obj.visibility = VISIBLE;
	}
}

//closes popup layer
function closeLayer(objName) {
	if (OK) {
		var obj = getLayerStyle(objName);
		obj.visibility = "hidden";
	}
}

//closes all popup layers specified in objNames; objNames must be an array of names
function closeAllLayers(objNames) {
	if (OK) {
		var i, obj;
		for (i in objNames) {
			obj = getLayerStyle(objNames[i]);
			obj.visibility = "hidden";
		}
	}
}


//Window object that allows display customizations.
function CustomizableWindow() {
	this.url = "";
	this.name = "";
	this.toolbar = false;
	this.location = false;
	this.directories = false;
	this.status = false;
	this.menubar = false;
	this.scrollbars = false;
	this.resizable = true;
	this.centered = true;
	this.x = 0;
	this.y = 0;
	this.width = 200;
	this.height = 200;
	this.open = winOpen;
}

//Window object method to open new window.
function winOpen() {
	var winX, winY;
	if (this.centered) {
		if (IE) {
			winX = parseInt(document.body.clientWidth / 2 + window.screenLeft - this.width / 2);
			winY = parseInt(document.body.clientHeight / 2 + window.screenTop - this.height / 2);
		}
		else if (DOM || NS) {
			winX = parseInt(window.outerWidth / 2 + window.screenX - this.width / 2);
			winY = parseInt(window.outerHeight / 2 + window.screenY - this.height / 2);
		}
		else {
			winX = 200;
			winY = 200;
		}
	}
	else {
		winX = win.x;
		winY = win.y;
	}
	
	var winStyle = "toolbar=";
	winStyle += this.toolbar?"yes":"no";
	winStyle += ",location=";
	winStyle += this.location?"yes":"no";
	winStyle += ",directories=";
	winStyle += this.directories?"yes":"no";
	winStyle += ",status=";
	winStyle += this.status?"yes":"no";
	winStyle += ",menubar=";
	winStyle += this.menubar?"yes":"no";
	winStyle += ",scrollbars=";
	winStyle += this.scrollbars?"yes":"no";
	winStyle += ",resizable=";
	winStyle += this.resizable?"yes":"no";
	winStyle += ",width=" + this.width + ",height=" + this.height + ",left=" + winX + ",top=" + winY;
	
	return window.open(this.url, this.name, winStyle);
}


//open thesaurus in new window

function openThesaurus() {
  /*var MyURL = '/exist/cpanda/xq/getStatic.xql?id=thesaurus.index';*/
  var MyURL = 'thesaurus';
  var MyWindowName = 'Thesaurus';
  var MyWindowOptions = 'width=700,height=600,resizable=yes';
  window.open(MyURL, MyWindowName, MyWindowOptions);
}

//Makes JavaScript interpterter run a loop
//for the specified number of milliseconds

function wait(ms) {
	var exitTime = new Date().getTime() + ms;
	
	while (true) {
		if (new Date().getTime() > exitTime) break;
	}
}


//---Helpcenter------------//
//launches URL in parent window
function pLink(theURL){
	parent.opener.location=theURL;
	top.window.close();
}

function openwin(url) {
    win.url = url;
    win.open();
}

 
        
