// ================================
// START Pop-Up Image Code
// ================================

// Use the following as a link to utilise the pop-up commands:
// javascript:popImage('<Image Path>','<Alt text description>')

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth = 660;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// ================================
// Pop-Up Image Source .....
// ================================

if (parseInt(navigator.appVersion.charAt(0))>=4)
{
	 var isNN=(navigator.appName=="Netscape")?1:0;
	 var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle)
{
  if (isNN)
	{
	 imgWin=window.open('about:blank','',optNN);
	}
  if (isIE)
	{
	  imgWin=window.open('about:blank','',optIE);
	}
  with (imgWin.document)
	{
    writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
    writeln('<sc'+'ript>');
    writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
    writeln('isNN=(navigator.appName=="Netscape")?1:0;');
    writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
    writeln('function reSizeToImage(){');
    writeln('if (isIE){');
    writeln('window.resizeTo(100,100);');
    writeln('width=100-(document.body.clientWidth-document.images[0].width);');
    writeln('height=100-(document.body.clientHeight-document.images[0].height);');
    writeln('window.resizeTo(width,height);}');
    writeln('if (isNN){');       
    writeln('window.innerWidth=document.images["George"].width;');
    writeln('window.innerHeight=document.images["George"].height;}}');
    writeln('function doTitle(){document.title="'+imageTitle+'";}');
    writeln('</sc'+'ript>');
    if (!AutoClose)
  	  writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
    else
  	  writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
  
    writeln('<img name="TheImage" src='+imageURL+' style="display:block"></body></html>');
    close();		
	}
}

function popupSelfClose(theURL,theTitle,theBestWidth,theBestHeight)
{
  if (isNN)
	{
	 theWin=window.open('about:blank','',optNN);
	}
  if (isIE)
	{
	  theWin=window.open('about:blank','',optIE);
	}
  with (theWin.document)
	{
    writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
    writeln('<sc'+'ript>');
    writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
    writeln('isNN=(navigator.appName=="Netscape")?1:0;');
    writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
    writeln('function reSizeToBest(){');
    writeln('window.resizeTo(theBestWidth,theBestHeight);}');
//    writeln('}');
    writeln('function doTitle(){document.title="'+theTitle+'";}');
    writeln('</sc'+'ript>');
    writeln('</head><body bgcolor=FFFFFF onload="reSizeToBest();doTitle();self.focus()" onblur="self.close()">');
  
    writeln('<FRAME name="theFrame" src='+theURL+'></body></html>');
    close();		
}
}

// ================================
// END Pop-Up Image Code
// ================================

// ================================
// START Pop-Up Window Code
// ================================

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
	if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

// ================================
// End Pop-Up Window Code
// ================================

// ================================
// START Pop-Up Window Code 2 - Scrolling
// ================================

var popUpWin2=0;
function popUpWindow2(URLStr, left, top, width, height)
{
  if(popUpWin2)
  {
	if(!popUpWin2.closed) popUpWin2.close();
  }
  popUpWin2 = open(URLStr, 'popUpWin2', 'toolbar=no,location=no,directories=no,status=no,menub ar=yes,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

// ================================
// End Pop-Up Window Code 2
// ================================


// =====================================
// START Expand ACFM TreeMenu from Node
// =====================================

function expandACFMNode(BranchURL)
{
	if (parent.parent.ACFMtree != null)
	{
		var node = parent.parent.ACFMtree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand ACFM TreeMenu from Node
// =====================================

// =====================================
// START Expand SM TreeMenu from Node
// =====================================

function expandSMNode(BranchURL)
{
	if (parent.parent.SMtree != null)
	{
		var node = parent.parent.SMtree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand SM TreeMenu from Node
// =====================================

// =====================================
// START Expand Other TreeMenu from Node
// =====================================

function expandOtherNode(BranchURL)
{
	if (parent.parent.Othertree != null)
	{
		var node = parent.parent.Othertree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand Other TreeMenu from Node
// =====================================

// =====================================
// START Expand Tech TreeMenu from Node
// =====================================

function expandTechNode(BranchURL)
{
	if (parent.parent.Techtree != null)
	{
		var node = parent.parent.Techtree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand Tech TreeMenu from Node
// =====================================

// =====================================
// START Expand News TreeMenu from Node
// =====================================

function expandNewsNode(BranchURL)
{
	if (parent.parent.Newstree != null)
	{
		var node = parent.parent.Newstree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand News TreeMenu from Node
// =====================================

// =====================================
// START Expand TSC TreeMenu from Node
// =====================================

function expandTSCNode(BranchURL)
{
	if (parent.parent.TSCtree != null)
	{
		var node = parent.parent.TSCtree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand TSC TreeMenu from Node
// =====================================

// =====================================
// START Expand ACPD TreeMenu from Node
// =====================================

function expandACPDNode(BranchURL)
{
	if (parent.parent.ACPDtree != null)
	{
		var node = parent.parent.ACPDtree.nodeByURL(BranchURL);          
		
		while (node)
		{
			if (!node.expanded) node.treeView.expandNode(node.index);
			node = node.parentNode;
		}
	}
}

// =====================================
// END Expand ACPD TreeMenu from Node
// =====================================

// =====================================
// START Tooltip Code
// =====================================

// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 
/*
MOVE this to the <body>:
<div align="left" id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="JavaScript"><!--
initToolTips(); //--></script>
*/
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

// =====================================
// END Tooltip Code
// =====================================
