	/******************************************************
	** Description: Global.js Custom API for Browser 
	**		Variables and Global Constants
	**
	** Authors: Max Philipson
	** Date created: 20/12/00
	**
	******************************************************/


// global variables
var isNav, isIE
var coll = ""
var styleObj = ""
// global variable for sub window reference
var newWindow
// version flag for relic browsers ( Nav2/IE3)
var relic
var openImg = new Image();
openImg.src = "/images/treeview/open.gif";
var closedImg = new Image();
closedImg.src = "/images/treeview/closed.gif";


if(parseInt(navigator.appVersion) >= 4) {
	if(navigator.appName =="Netscape") {
		isNav = true;
	}else {
		isIE = true;
		coll = "all.";
		styleObj = ".style";
	}
} else {
	if(parsInt(navigtor.appversion) < 3) {
		relic = true;
	}
}


// Convert object name string or object reference
// into a valid object reference
function getObject(obj) {
	var theObj
	if(typeof obj == "string") {
		theObj = eval("document." + coll + obj + styleObj);
	} else {
		theObj = obj;
	}
	return theObj;
}


// Handle Navigator ver4 window resizing bug
function handleResize() {
	location.reload();
	return false;
}
if(isNav) {
	window.captureEvents(Event.RESIZE);
	window.onresize = handleResize;
}


// Returns the available content width space in a browser window
function getInsideWindowWidth() {
	if(isNav) {
		return window.innerWidth;
	} else {
		return document.body.clientWidth;
	}
}


// Returns the available content height space in a browser window
function getInsideWindowHeight() {
	if(isNav) {
		return window.innerHeight;
	} else {
		return document.body.clientHeight;
	}
}


//Generic new window opener
function openWindow(url, name, features) {
	newWindow = window.open(url, name, features) 
	// handle navigator2 which doesn't have an opener property
	if(!newWindow.opener) {
		newWindow.opener = window;
	}
	if(!relic) {
		//bring window to front
		newWindow.focus();
	}
}

// open window and write content
function openWriteWindow(name, features, content) {
	var strContent = content;
	var newContent = "<html><head></head><body>\n"
	    newContent += "<p>" + strContent + "</p>\n"
	    newContent += "</body>\n</html>\n"
	newWindow = window.open("", name, features); 
	newWindow.document.write(newContent);
	newWindow.document.close(); //close layout stream
	// handle navigator2 which doesn't have an opener property
	if(!newWindow.opener) {
		newWindow.opener = window;
	}
	if(!relic) {
		//bring window to front
		newWindow.focus();
	}
}


// Write content to the status bar
function setMsg(msg) {
	window.status = msg;
	return true;
}


// Write content to an alert window
function setAlert(msg) {
	window.alert(msg);
}

function syncTOC(id,iDepth,pid1,pid2,pid3,pid4){
	if(id != ''){
		if(pid1 != ''){
			if(pid1 != 0){
				for(i=iDepth;i >= 1; i--){
					showBranch('branch'+eval('pid'+ i));
					swapFolder('folder'+eval('pid'+ i));
				}
				var objLeaf = document.getElementById('leaf'+(id)).style;
				objLeaf.color="black";
			}else{
				var objLeaf = document.getElementById('leaf'+(id)).style;
				objLeaf.color="black";
			}
		}
	}
}

function showBranch(branch){
	var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block")
		objBranch.display="none";
	else
		objBranch.display="block";
}

function swapFolder(img){
	objImg = document.getElementById(img);
	if(objImg.src.indexOf('/images/treeview/closed.gif')>-1)
		objImg.src = openImg.src;
	else
		objImg.src = closedImg.src;
}
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Setting the visibility of an object to visible
function showHideLayer(obj) {
	var theObj = document.getElementById(obj).style;
	if(theObj.display=="block")
		theObj.display="none";
	else
		theObj.display="block";
}


// Setting the visibility of an object to hidden
function hide(obj) {
	var theObj = getObject(obj);
	theObj.visibility = "hidden";
}