//-----------------------------------------------------------------------------
// Default.js - Code that is included in the default-N and -F htm pages.
//-----------------------------------------------------------------------------
var sDefaultPage = "";		// Variable used to refresh the Web document.
var oSelectedKey = null;	// Used to navigate by doc or item KeyID
var sSelectedItem = "";		// Variable used to maintain the selected Tree item.
var bBlancLoaded = true;	// Variable used to refresh the Blanc document.
var bToolbarVisible = null;
var sBody = "";						// Variable used to fill up the Blanc document.

var sWeb;									// Variable that storess the default Web site; initialized at startup.

//-----------------------------------------------------------------------------
var oPrintWindow;					// Handle to the Printer Window.
var oPrintDocument;				// Handle to the to Print Document.
//-----------------------------------------------------------------------------

// Initialize this variable. This make all code telatively independent of the web site! (e.g. Zetel)
//if (sWeb == null) {
//	sWeb = getWebSite();
//}

//-----------------------------------------------------------------------------
// Common code to the document
//-----------------------------------------------------------------------------
// Determine the Root Web 
//function getWebSite()
//{
//	var aWeb = window.location.pathname.split("/");
//	return("/" + aWeb[1]);
//}
//-----------------------------------------------------------------------------
// Nagigate using WegID and KeyID
//function navigateToWebDoc(lWebID, lKeyID) {
//	var oDoc;
//	var eSrc;
//
//	oDoc = window.top.frames["iMBar"].document;
//
//	//Find the Web-Site
//	eSrc = oDoc.all["Item-" + lWebID];
//	
//	//Set the Title & Locator in main document
//	window.top.Title.innerText = eSrc.title;
//	window.top.Locator.innerHTML = "<b>" + eSrc.title + "</b>";
//	
//	//Navigate the MenuBar
//	window.top.frames["iMBar"].SetSelection(eSrc);
//	
//	//Reset the OverViews 
//	window.top.sBody = "";
//	
//	if (eSrc != null)		{	//If found, navigate the iTree
//		window.top.frames["iTree"].location = window.top.sWeb + "/XML/" + eSrc.dataSrc;
//		oDoc = window.top.frames["iTree"].document;
//		oSelectedKey = lKeyID; //This value will be used in MenuTree.js onreadystatechange event
//	}
//}
//-----------------------------------------------------------------------------
// Handles the onclick events of the main document; specific for the Locator object!
//function document.onclick()	{
//	var eSrc = window.event.srcElement;
//	var oChild = window.frames("iTree").document;
//	var eImg;
//	var eChild;
//	
//	//Check if LOCATOR clicked
//	if ((eSrc.className.indexOf("Locator") != -1) && (eSrc.tagName == "SPAN")) {
//		//Get the child's child ;-)
//		eChild = oChild.all(eSrc.id).nextSibling;
//		eImg = eChild.previousSibling.children[1];
//		
//		if (eChild.className.indexOf("clsKids") != -1)	{
//			eChild.style.display = ("block" == eChild.style.display ? "none" : "block");
//			
//			//If IMG present, replace  arrow_rightw - arrow_bottom_w & arrow_right - arrow_bottom
//			if (eImg.src.indexOf("arrow_right") != -1) {
//				re = /arrow_right/g;
//				eImg.src = eImg.src.replace(re, "arrow_bottom");
//			}
//			else	{
//				re = /arrow_bottom/g;
//				eImg.src = eImg.src.replace(re, "arrow_right");
//			}
//
//			//Update the locator
//			document.all("Locator").innerHTML = window.top.BuildLocator(eChild);
//		}
//	}
//}
//-----------------------------------------------------------------------------
// End of code block
//-----------------------------------------------------------------------------

//Hides or Shows the Toolbar on the main document.
//function ShowToolbar()
//{
//	var Toolbar = document.all["ToolbarColumn"];
//	Toolbar.style.display = ("block" == Toolbar.style.display ? "none" : "block");
//	bToolbarVisible = ("block" == Toolbar.style.display ? true : false);
//	
//	var Toolbaricon = document.all["ToolBarIcon"];
//	var URL_Open = 'images/right_menu_close.gif'
//	var URL_Close = 'images/right_menu_open.gif'
//
//	if (bToolbarVisible) {ToolBarIcon.src = URL_Open;}
//	else {ToolBarIcon.src = URL_Close;}
//}

//-----------------------------------------------------------------------------
// End of code block
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Locator: Build & Navigate
//-----------------------------------------------------------------------------
// BuildLocator code builds the string with navigation beneath it!
//function BuildLocator(eSrc) {
//	var s = String("");
//	var eParent = eSrc.previousSibling;
//	
//	if (eParent.className.indexOf("clsKids") != -1) {	//Document
//		eParent = eParent.previousSibling;
//	}
//	while (eParent.tagName == "DIV")	{
//		s = " > <span id='" + eParent.id + "' class='Locator'>" + eParent.innerText + "</span> " + s;
//		eParent = eParent.parentNode.previousSibling;
//		if (eParent == undefined ) 
//			break;
//	}
//	//Add Site locator
//	s = "<b>" + window.top.document.all("Title").innerHTML + "</b>" + s;
//	return (s);
//}
//-----------------------------------------------------------------------------
// End of code block
//-----------------------------------------------------------------------------

function Slide() {
	var Toolbar = document.all["ToolbarColumn"];
	var Menupic = document.all["menupic"];

	if (Toolbar.style.width.substr(0,Toolbar.style.width.length-2) <=0) {
		Xslide(8);
		Menupic.src="images/TabOpen.gif";
 	} else {
		Xslide(-8);
		Menupic.src="images/TabClosed.gif";
	}
}

function Xslide(inc) {
	var Toolbar = document.all["ToolbarColumn"];

	x = parseInt(Toolbar.style.width.substr(0,Toolbar.style.width.length-2)) +inc;
	if (x <= 0) {
		x=0;
		Toolbar.style.display="none";
	}
	else	{
		Toolbar.style.display="block";
	}
	if (x > 200) x=200;

	Toolbar.style.width = x+"px";
	if (x>0 && x < 200) {
		setTimeout("Xslide("+inc+")",2);
	}
}
//-----------------------------------------------------------------------------
// End of code block
//-----------------------------------------------------------------------------