window.onerror=null;
//new
SameWindow = 0;
NewWindow = 1;
SearchWindow = 2;
ExternalURL = 3;
ESearchWindow = 4;
Subscribe = 5;
LoginSameWindow = 6;
PopUpWindow = 7;
NewPopUpWindow = 8;
PrintFriendlyWindow = 9;
Promotion=10;

var mouse=false
var eblayers=false;

//BEGIN 
//New eBankHome code 27-4-2004

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} }

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"
))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x; }

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for
(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?
'hidden':v; }
    obj.visibility=v; }
}

// Using a popup window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//New eBankHome code
//END 


//this.document.all[0].onmouseout = buttonUp;
function buttonUp(e) {
resetImages();
clearLayers(1);
if(mouse==true)
{

mouse=false
}
//return true;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function hide(f2)
 {
    flyover.style.visibility = "hidden";
 }

function show(f2)
 {
 
   if (FlyOverDesc[f2] != "") 
    {   
      FlyOverText = "<table bgcolor=#6162A2 border=0 cellpadding=6 cellspacing=0 width=150>"
      FlyOverText = FlyOverText + "<tr>"
      FlyOverText = FlyOverText + "<td>"
      FlyOverText = FlyOverText + "<span class=nav>" + FlyOverDesc[f2] + "</span>"
      FlyOverText = FlyOverText + "</td>"
      FlyOverText = FlyOverText + "</tr>"
      FlyOverText = FlyOverText + "</table>"
      
       flyover.innerHTML = "<span class=nav>" + FlyOverText + "</span>"
       flyover.style.visibility = "visible";
    }
 }

 function OpenURL(TheURL, UrlType)
{
	var NewUrl = document.location.href;

	if (TheURL.substr(0,7) == "http://"){NewUrl = TheURL;}

	else if (TheURL.substr(0,8) == "https://"){NewUrl = TheURL;	}

	else if (UrlType == SearchWindow)
	{
		NewUrl =  siteurl + TheURL ;
		NewUrl = NewUrl + '?SearchView&Query=';
		QueryString = document.Search.Query.value;
		while (QueryString.indexOf(" ")>-1){QueryString =QueryString.replace(" ","+");
	}


		NewUrl = NewUrl + "(FIELD+Body+CONTAINS+\"" + QueryString+"\"+OR+FIELD+PageTitle+CONTAINS+\"" + QueryString+"\"+OR+FIELD+Description+CONTAINS+\"" + QueryString+"\"+OR+FIELD+SiteSearchKeywords+CONTAINS+\"" + QueryString+"\")";
                                var LANGTerms = "";
                                if (document.Search.Language.value == "Greek")
                                        LANGTerms = "FIELD+Language+CONTAINS+Greek";
                                else
                                        LANGTerms = "FIELD+Language+CONTAINS+English";
                                NewUrl = NewUrl + "+AND+("+LANGTerms+")";
		NewUrl = NewUrl + "&Term=" + document.Search.Query.value;
		NewUrl = NewUrl + "&Language=" + document.Search.Language.value;
		while (NewUrl.indexOf(" ")>-1){      NewUrl = NewUrl.replace(" ","+");}
	}
	else if ((UrlType == NewWindow) | (UrlType == SameWindow))
	{
		if (TheURL.indexOf("/") == 0) {
			NewUrl = TheURL;
		}
		else if (TheURL.indexOf(".") == 0) {
			NewUrl = TheURL;
		}
		else {
			NewUrl =  pagepath + TheURL;
		}
	}
	else if(UrlType==Promotion){
		if(TheURL.indexOf("/")==0){
			NewUrl=TheURL;}
		else if(TheURL.indexOf(".")==0){
			NewUrl=TheURL;}
		else{
			NewUrl=promotionurl+TheURL;}
	}
	else if ((UrlType == Subscribe))
	{ 
		var email = "";
		var search = "personal=";


	   if (window.document.cookie.length > 0) 
		   { 
	     offset = document.cookie.indexOf(search) 
	     if (offset != -1) 
			  { 
	        offset += search.length 
	      end = document.cookie.indexOf(";", offset) // set index of end of cookie value
	         if (end == -1)
				 {
				end = document.cookie.length;
	            pcoc=unescape(document.cookie.substring(offset, end));
				if (pcoc == null)
					{
					pcoc="Empty";
					} 
			 	MyArrayOfS=pcoc.split("=");
				}
		   }
		
	{	
		
		// - 9/6/05-- NewUrl = SubscriptionURL +  MyArrayOfS[3] +"&Language=" + document.Search.Language.value
		//NewUrl = SubscriptionURL + "&Language=" + document.Search.Language.value
		NewUrl = siteurlfull + "/GetSubscription?OpenAgent&email=&Language=" + document.Search.Language.value


	} 
	
	
		features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=620,height=360';
		popWindow = window.open(NewUrl, 'Subcribe', features);
		popWindow.focus();

		
		
	}
	else{
		//NewUrl = SubscriptionURL + "&"+"Language=" + document.Search.Language.value
		NewUrl = siteurlfull + "/GetSubscription?OpenAgent&email=&Language=" + document.Search.Language.value
 

	}

	}//else if

		

	else if ( UrlType == LoginSameWindow ) {
		NewUrl =pagepath + TheURL + '?OpenDocument&Login'
	}
    
	if ( UrlType == SameWindow | UrlType == LoginSameWindow | UrlType==Promotion)
		document.location.href = NewUrl;     // Open the URL in the same window
	else if (UrlType == NewWindow | UrlType == SearchWindow) 
		window.open(NewUrl);     // Open the URL in a NEW window

//New Code for exit warning
	else if (UrlType == ExternalURL)
	{
	
		NewUrl = siteurl + "/ExitWarning?ReadForm&Language=" + language + "&url=" + TheURL
		features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=275,height=250, top=50, left=50';
		popWindow = window.open(NewUrl, 'ExitWarning', features);
		popWindow.focus();

		//window.open(TheURL);     // Open the URL in a NEW window


	}
	else if (UrlType == Subscribe)  
	{
		features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=620,height=360';
		popWindow = window.open(NewUrl, 'Subcribe', features);
		popWindow.focus();
	}
	else if (UrlType == NewPopUpWindow)  
	{
		NewUrl =  pagepath + TheURL;
		features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+PopUpSize+',height=250, top=50, left=50';
		popWindow = window.open(NewUrl, 'Preview', features);
		popWindow.focus();
	}


	else if (UrlType == PopUpWindow)  
	{
		NewUrl =  TheURL;
		features = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=630,height=550';
		popWindow = window.open(NewUrl, 'Preview', features);
		popWindow.focus();
	}

	else if (UrlType == PrintFriendlyWindow)  
	{
		NewUrl =  printurl + TheURL;
		features = 'top=10,left=10, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=630,height=500';

		popWindow = window.open(NewUrl, 'PrintFriendly', features);
		popWindow.focus();
	}


}
//new
var blnSearch = false;
var blnForm = false;
// Default layers
var arrLayers1 = new Array();
var arrCurrent = new Array();
// Active Background Images
var arrToggles = new Array();
// Visibility attribute conventions
strOn = "visible";
strOff = "hidden";
//not used in ie
function showne(object) {}
function hidene(object) {}
// Set image toggle
function setImageToggle(imgName,toggleFlag) { 
	toggleFlag ? arrToggles[arrToggles.length] = imgName : deleteFromArray(arrToggles, imgName);
}

//check for image state and toggle accordingly
function checkToggle(theImg,newSrc) {
	if (!checkArray(arrToggles,theImg)) {
		toggleImage(theImg,newSrc,theImg.substr(0,theImg.length - 3) + "bg");
	}
}

// Toggle layer
function toggleLayer(id,mode) {
	strLayer = document.getElementById(id).style;
	if (mode == 'on') {
		strLayer.visibility = strOn;
		checkSearch(id);
	} else if (mode == 'off') {
		strLayer.visibility = strOff;
	} else {
		strImg = id.replace("menu", "img");
		if (strLayer.visibility != strOff) {	
			clearLayers(1);
			strLayer.visibility = strOff;
			setImageToggle(strImg,false);

		} else {	
			//clear layers manually for cross browsers (can't call clearlayers)
			clearLayers(1,id);
			//turn on clicked layer and toggle image
			resetImages();

			strLayer.visibility = strOn;
			checkSearch(id);
			setImageToggle(strImg,true);
		}
	}
	if (id=="lyapply0menu" && mode=="toggleEB") {
		eblayers=true;
		toggleEbLayers();
	}
	mouse=true;
}

function toggleEbLayers(){
	var strLayer=document.getElementById("lyapply0menu").style;
	var ratesLayerFg=document.getElementById("lyRates0fg").style;
	var ratesLayerBg=document.getElementById("lyRates0bg").style;
	if (strLayer.visibility==strOn){
	ratesLayerFg.visibility = strOff;
	ratesLayerBg.visibility = strOff;}
	else {
	ratesLayerFg.visibility = strOn;
	ratesLayerBg.visibility = strOn;};
}

// Change image source
function toggleImage(theSrc,newSrc,theLayer){
	document.images[theSrc].src = eval(newSrc).src;
}


visParentLayer = "";
visChildLayer = "";
// Clear all layers
function clearLayers(mode,thisLayer) {
//	alert( 'Mode: ' + mode + ', thislayer: ' + thisLayer);
	if (mode == 2) {	
		if (visChildLayer != "") { document.getElementById(visChildLayer).style.visibility = "hidden";	}
		if (thisLayer) { visChildLayer = thisLayer; }
	} else {
		if (visParentLayer != "") { 
			document.getElementById(visParentLayer).style.visibility = "hidden";
			if (visChildLayer != "") { document.getElementById(visChildLayer).style.visibility = "hidden"; }
		}
		if (thisLayer) { visParentLayer = thisLayer; }	
	}	

	//turn back on search layer if present
	if (mode == 1 && blnSearch) {
		strLayer3 = document.getElementById("lysearch").style ;
		strLayer3.visibility = strOn;
		if (document.getElementById("logonSelect")) {
			document.getElementById("logonSelect").style.visibility = "visible";
		}
		if (document.getElementById("accountSelect")) {
			document.getElementById("accountSelect").style.visibility = "visible";
		}
	}
	if (mode == 1 && blnForm){
		strLayer3 = document.getElementById("lyfe0").style ;
		strLayer3.visibility = strOn;
	}
	checkForm();
}

//reset images to default state and empty arrays
function resetImages() {
		for (var n=0; n < arrToggles.length; n++) {
		if (arrToggles[n] != "") {
			document.images[arrToggles[n]].src = document.images[arrToggles[n]].src.replace("_nav1_","_nav_");
			document.images[arrToggles[n]].src = document.images[arrToggles[n]].src.replace("_nav1_","_nav_");
			document.images[arrToggles[n]].src = document.images[arrToggles[n]].src.replace("_nav2_","_nav_");
			document.images[arrToggles[n]].src = document.images[arrToggles[n]].src.replace("_nav2_","_nav_");

		}
	}
	arrToggles.length = 0;
}

//triggered by event capture
function checkHouse(e) {

	if(e.target.name != "" && e.target.tagName != "IMG" && e.target.tagName != "DIV") {
		clearLayers(1);
		clearBackgrounds();
		resetImages();
		showne('SearchForm');
	}
}

//pass on click event to checkHouse
document.onmouseup = checkHouse; 

// Checks Array for value
function checkArray(arrayName, val) {
	for (var i=0; i < arrayName.length; i++) {
		if (arrayName[i] == val) {
			return true;
		}
	}
	return false;
}

// Deletes Value from array
function deleteFromArray(arrayName, val) {
	for (var i=0; i < arrayName.length; i++) {
		if (arrayName[i] == val) {
			arrayName[i] = "";
		}
	}
	return arrayName;
}

// External Link Toggles
function imgOn(imgName) {
	document[imgName].src = eval(imgName + "on.src");
}
function imgOff(imgName) {
	document[imgName].src = eval(imgName + "off.src");
}

//Builds Default layers and Current Layers
function initLayers() {
	
	buildCurrent();
	initMain();
	
	//detect the search layer
	blnSearch = false;
	blnForm = false;
	
	if (document.getElementById("lysearch")) { blnSearch = true; }			
	if (document.getElementById("lyfe0")) { blnForm = true; }
//	for(n=0;n<document.forms.length;n++) {
//		if ((navigator.appVersion.indexOf("MSIE 4") > -1) && (navigator.appVersion.indexOf("Mac") > -1)) {
//			if (document.forms[n].offsetParent.id == "lyfe0") {	theFormObj = document.forms[n];	}
//		} else {
//			if (document.forms[n].offsetParent.id == "formContainer") { theFormObj = document.forms[n];	}
//		}
//	}

	//position the search layer to right side of screen
	if (blnSearch) {
		lysearch.style.left = document.body.scrollWidth - lysearch.clientWidth;
		lysearch.style.visibility = strOn;
	}
	//position the form layer to bottom of FormContent Layer
	if (blnForm) {
		document.getElementById("lyfe0").style.top = parseInt(document.getElementById("lyfeContent").clientHeight) + 176;
		document.getElementById("lyfe0").style.visibility = strOn;
		document.getElementById("footer").style.top = parseInt(document.getElementById("lyfe0").style.top) + parseInt(document.getElementById("lyfe0").clientHeight);
		document.getElementById("footer").style.visibility = strOn;
		if (navigator.appVersion.indexOf("Mac") > -1) {
			document.images[arrTier2Arrows[0]].src = nav_hlt.src
		}
	}
}


//hides search form if layers are on top
function checkSearch(id) {	
	if (blnSearch) {	
		// Assign all postioning variables
		strLayerSearch 			= document.getElementById("lysearch");
		strLayerId       		= document.getElementById(id);
		strLayerIdRightPos 		= strLayerId.clientWidth + strLayerId.offsetLeft;
		strLayerIdTopPos		= parseInt(strLayerId.style.top);
		strLayerIdBotPos 		= parseInt(strLayerId.style.top) + strLayerId.clientHeight;
		strLayerSearchLeftPos 	= strLayerSearch.offsetLeft;
		strLayerSearchTopPos	= parseInt(strLayerSearch.style.top);
		strLayerSearchBotPos 	= parseInt(strLayerSearch.style.top) + strLayerSearch.clientHeight;
		hideLayer();
	}
	checkForm();
	return;
}

function checkForm() {
	if ((navigator.appVersion.indexOf("Mac") > -1) && (navigator.appVersion.indexOf("MSIE") > -1)) {return;}
	if (blnForm) {
		// Assign all postioning variables
		for (f=0;f<theFormObj.elements.length;f++) {
			theFormObj.elements[f].style.visibility = strOn;
		}
		for (l=0;l<arrLayers1.length;l++) {
			if (document.getElementById(arrLayers1[l]).style.visibility == "visible") {
				for (f=0;f<theFormObj.elements.length;f++) {
					if (theFormObj.elements[f].type.indexOf("select") > -1) {
						strLayerSearch 			= theFormObj.elements[f];
						strLayerId       		= document.getElementById(arrLayers1[l]);
						strLayerIdRightPos 		= strLayerId.clientWidth + strLayerId.offsetLeft;
						strLayerIdTopPos		= parseInt(strLayerId.style.top);
						strLayerIdBotPos 		= parseInt(strLayerId.style.top) + strLayerId.clientHeight;
						strLayerSearchLeftPos 	= strLayerSearch.offsetParent.offsetLeft + 225;
						strLayerSearchRightPos 	= strLayerSearchLeftPos + strLayerSearch.clientWidth;
						if (navigator.appVersion.indexOf("MSIE 4") > -1) {
							strLayerSearchTopPos = strLayerSearch.offsetParent.offsetParent.offsetTop + document.getElementById("lyfeContent").clientHeight + 200;
						} else {
							strLayerSearchTopPos = strLayerSearch.offsetParent.offsetTop + document.getElementById("lyfeContent").clientHeight + 200;
						}
						strLayerSearchBotPos 	= strLayerSearchTopPos + strLayerSearch.clientHeight;
						if ((strLayerIdRightPos > strLayerSearchLeftPos) && (strLayerIdBotPos > strLayerSearchTopPos) && (strLayerSearchBotPos > strLayerIdTopPos) && (strLayerId.offsetLeft < strLayerSearchRightPos)) {
							strLayerSearch.style.visibility = strOff;
						}
					}
				}
			}
		}
	}
}


 function hideLayer() {
	if ((navigator.appVersion.indexOf("Mac") > -1) && (navigator.appVersion.indexOf("MSIE") > -1)) {return;}
 	// Hide if visible	
	if ((strLayerIdRightPos > strLayerSearchLeftPos) && (strLayerIdBotPos > strLayerSearchTopPos) ) {
		if (document.getElementById("logonSelect")) {
			document.getElementById("logonSelect").style.visibility = "hidden";
		}
		if (document.getElementById("accountSelect")) {
			document.getElementById("accountSelect").style.visibility = "hidden";
		}
	} else {
		if (document.getElementById("logonSelect")) {
			document.getElementById("logonSelect").style.visibility = "visible";
		}
		if (document.getElementById("accountSelect")) {
			document.getElementById("accountSelect").style.visibility = "visible";
		}
	} 
 }

//Navigator Layer Bug Window Resizing Fix
function netscapeFix() {
	if (blnSearch) {
		document.getElementById("lysearch").style.left = document.body.scrollWidth - document.getElementById("lysearch").clientWidth;
	}
}
start_width = document.width;
start_height = document.height;
window.onresize = netscapeFix;

// change background color of layer to effect highlight
function rollMen(obj, toggle, nest) {
	document.getElementById(obj).setAttribute('className',toggle);
}

hlLayer = "";
function clearBackgrounds(thisLayer) {
	if (hlLayer != "") {
		document.getElementById(hlLayer).setAttribute('className','brcolor0');
	}
	if (thisLayer) {hlLayer = thisLayer};
}

// Misc vars
var layerPrefix      = 'ly';
var itemCount        = 0;

// jpmMenuTree constructor (pseudo-public)
function jpmMenuTree(name, leftPos, topPos, width, colorCode) {
	this.name           = name;
	this.section        = getSectionId(name);
	this.left           = leftPos;
	this.top            = topPos;
	this.width          = width;
	this.color		    = colorCode;
	this.brcolor        = 'brcolor' + colorCode;
	this.items          = new Array();
	this.addMenuItem    = tier1addMenuItem;
	this.toHtml         = tier1toHtml;	
	this.renderChildren = tier1childrenToHtml;
	arrLayers1[arrLayers1.length] = layerPrefix + name;
}

// jpmMenu constructor (pseudo-public)
function jpmMenu(name, leftPos, topPos, width, colorCode) {
	this.name         = name;
	this.color		  = colorCode;
	this.brcolor      = 'brcolor' + colorCode;
	this.items        = new Array();
	this.addMenuItem  = tier2addMenuItem;
	this.toHtml       = tier2toHtml;
	arrLayers1[arrLayers1.length] = layerPrefix + name;
}

// jpmMenuItem constructor (pseudo-private)
function jpmMenuItem(menuText, menuHref, childId) {
	this.id       = ++itemCount;
	this.text     = menuText;
	this.href     = menuHref;
	this.child    = childId;
	this.hasChild = (childId != "") ? 1 : 0;
}


// Add one menu item for Tier 1 menu (pseudo-private)
function tier1addMenuItem(itemHref, itemText, itemChild) {
	this.items[this.items.length] = new jpmMenuItem(itemText, itemHref, itemChild);
}

// Add one menu item for Tier 2 menu (pseudo-private)
function tier2addMenuItem(itemHref, itemText) {
	this.items[this.items.length] = new jpmMenuItem(itemText, itemHref, '');
}

// Write HTML for Tier 1 menu (pseudo-public)
function tier1toHtml() {
	theItems = this.items;
	theName = this.name;
	theWidth = this.width;
	theColor = this.brcolor;
	theTop = this.top;
	theLeft = this.left;
	menuHLColor = 'highlight';
	html = '';
	html += '<SPAN id=TBDownLevelDiv><table cellpadding="0" cellspacing="0" border="0" class="' + theColor + '" width="'+theWidth+'" id="colorTable'+theName+'"><tr><td align="center">'
	html += '<table cellpadding="0" cellspacing="0" border="0" bgcolor="' + menuBgColor + '" width="'+(theWidth - 2)+'">'
	html += '<tr><td class="bc-spacer">&nbsp;</td></tr>';
	for (var p = 0; p < theItems.length; p++) {
		theItemObj = theItems[p];	
		html += '<tr class="padLeft">';
		if (theItemObj.hasChild == 1) {
			html += '<td id="Sub'+ layerPrefix + theName + p +'" onmouseover="clearBackgrounds(\''+ 'Sub' + layerPrefix + theName + p +'\');rollMen(\'Sub'+layerPrefix + theName + p+'\', \''+menuHLColor+'\', \''+layerPrefix + theName+'\');clearLayers(2,\'' + layerPrefix + theItemObj.child + '\');toggleLayer(\'' + layerPrefix + theItemObj.child + '\',\'on\');" onclick="javascript:location=\'' + theItemObj.href + '\';"><a class="navsub5" href="' + theItemObj.href + '">';
		} else {
			html += '<td id="Sub'+ layerPrefix + theName + p +'" onmouseover="clearBackgrounds(\''+ 'Sub' + layerPrefix + theName + p +'\');rollMen(\'Sub'+layerPrefix + theName + p+'\', \''+menuHLColor+'\', \''+layerPrefix + theName+'\');clearLayers(2);" onmouseout="clearBackgrounds(\''+ 'Sub' + layerPrefix + theName + p +'\');" onclick="javascript:location=\'' + theItemObj.href + '\';"><a class="navsub5" href="' + theItemObj.href + '">';
		}
		html += theItemObj.text + '</a></td></tr>';
		html += '<tr><td class="bc-spacer-cell"><span class="bc-spacer">&nbsp;</span></td></tr>';
	}
	html += '</table></td></tr>'
	html += '<tr><td class="bc-spacer-big">&nbsp;</td></tr>';
	html += '</table>&nbsp;</span>'
	
	document.getElementById(layerPrefix + theName).innerHTML = html;
	document.getElementById(layerPrefix + theName).style.top = theTop;
	document.getElementById(layerPrefix + theName).style.left = theLeft;
	this.renderChildren();
	
}

// Write HTML for Tier 2 menu (pseudo-public)
function tier2toHtml() {
	theItems = this.items;
	theName = this.name;
	theWidth = this.width;
	theColor = this.brcolor;
	theTop = this.top;
	theLeft = this.left;
	menuHLColor = 'highlight';
	html = '';		
	html += '<table cellpadding="0" cellspacing="0" border="0" class="' + theColor + '" width="'+theWidth+'">'
	html += '<tr><td><span class="bc-spacer">&nbsp;</span></td></tr>';
	html += '<tr><td align="center">';
	html += '<table cellpadding="0" cellspacing="0" border="0" bgcolor="' + menuBgColor + '" width="'+(theWidth - 2)+'"><tr><td>'
	html += '<tr><td class="bc-spacer">&nbsp;</td></tr>';
	for (var p = 0; p < theItems.length; p++) {
		theItemObj = theItems[p];
		html += '<tr class="padLeft"><td id="'+layerPrefix + theName + p +'" onmouseover="rollMen(\''+layerPrefix + theName + p+'\', \''+menuHLColor+'\', \''+layerPrefix + theName+'\')" onmouseout="rollMen(\''+layerPrefix + theName + p+'\', \'brcolor0\', \''+layerPrefix + theName+'\')" onclick="javscript:location=\'' + theItemObj.href + '\';"><a href="' + theItemObj.href + '" class="navsub5">' + theItemObj.text + '</a></td></tr>';
		html += '<tr><td class="bc-spacer-cell"><span class="bc-spacer">&nbsp;</span></td></tr>';
	}
	html += '</table></td></tr>'
	html += '<tr><td class="bc-spacer-big">&nbsp;</td></tr>';
	html += '</table>&nbsp;'
	
	document.getElementById(layerPrefix + theName).innerHTML = html;
	document.getElementById(layerPrefix + theName).style.top = theTop;
	document.getElementById(layerPrefix + theName).style.left = theLeft - 3;

}

// Generate Tier 2 menus
function tier1childrenToHtml() {
	theNewItems = this.items;
	thisWidth = this.width;
	thisLeft = this.left;
	thisTop = this.top;
	for (var c = 0; c < theNewItems.length; c++) {
		theItemObj = theNewItems[c];
		if (theItemObj.hasChild == 1) {
			lMenu = eval(theItemObj.child);
			lMenu.width = thisWidth;
			if(thisLeft+2*thisWidth > 800)
			{lMenu.left=thisLeft-thisWidth+5;}
			else
			{lMenu.left=thisLeft+thisWidth;};
			// Set height
			if ((navigator.appVersion.indexOf("MSIE 4") > -1) && (navigator.appVersion.indexOf("Mac") == -1)) {
				lMenu.top = document.getElementById("Subly"+lMenu.name).offsetParent.offsetTop + thisTop;
			} else if((navigator.appVersion.indexOf("MSIE 5") > -1) && (navigator.appVersion.indexOf("Mac") > -1)) {
				lMenu.top = document.getElementById("Subly"+lMenu.name).clientTop + thisTop;
			} else {
				lMenu.top = document.getElementById("Subly"+lMenu.name).offsetTop + thisTop;
				if(document.getElementById("Subly"+lMenu.name).offsetTop<100){
				lMenu.top=thisTop+3;}
				else {
				lMenu.top=document.all["Subly"+lMenu.name].offsetTop+thisTop;}
			};
			lMenu.toHtml();
		}
	}
}

// Get section ID from string
function getSectionId(str) {
	return str.substring(0,2);
}

// Builds the current section box
function buildCurrent(){
	if (arrCurrent.length > 0) {
		html = '<table border="0" cellpadding="0" cellspacing="0" width="'+arrCurrent[3]+'" height="20" class="brcolor'+arrCurrent[4]+'">';
		html += '<tr><td width="4"><span class="bc-current">&nbsp;&nbsp;</span></td><td height="16" width="'+(arrCurrent[3] -4)+'"><span class="bc-current">'+arrCurrent[0]+'</span></td></tr>';
		html += '</table>&nbsp;';
		document.getElementById(layerPrefix + "current").innerHTML = html;
		document.getElementById(layerPrefix + "current").style.top = arrCurrent[2];
		document.getElementById(layerPrefix + "current").style.left = arrCurrent[1];
	}
}


//cookies code for page popup

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
		} 
	else begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function fixDate(date) {

	var base = new Date(0);

	var skew = base.getTime();

	if (skew > 0)

	date.setTime(date.getTime() - skew);

}

//scroll layers
var clipTop = 0;
var clipBottom = 91;
var clipBottomInit = 91;
var clipWidth = 152;
var topper = 338;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function initAnnouncer()
{
	DHTML = (document.getElementById || document.layers)
	if (!DHTML) return;
	var x = new getObj('announcer');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById)
	{
		lyrheight = x.obj.offsetHeight;
		var clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		x.style.clip = clipstring;
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;

	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper;
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper + 'px';
	}
	time = setTimeout('realscroll()',theTime);
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('announcer');
	f.style.visibility = val;
}

function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  //else if (document.all)
  //{
  //  this.obj = document.all[name];
  //  this.style = document.all[name].style;
  //}
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
