/* Page Load Helper */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

/* Random Montage Script */
function changeMontage() {
	if (!document.getElementById) return false;
	if (!document.getElementById("montage")) return false;
	var montageImg = document.getElementById("montage");
	var montageImgSrc = montageImg.getAttribute("src");
	var searchResult = montageImgSrc.search("homepage");
	if (searchResult != -1) {
		var montage = new Array();
		montage[0]="images/montages/homepage/montage01.jpg";
		montage[1]="images/montages/homepage/montage02.jpg";
		montage[2]="images/montages/homepage/montage03.jpg";
	} else {
		var montage = new Array();
		montage[0]="images/montages/interior/montage01.jpg";
		montage[1]="images/montages/interior/montage02.jpg";
	}
	var randomNumber = Math.floor(Math.random() * montage.length);
	montageImg.setAttribute("src",montage[randomNumber]);	
}

addLoadEvent(changeMontage);

/* Disclaimer */
function disclaimer(passedWebsite) {
	if (confirm("You are leaving the Guardian Bank website. Guardian Bank has no control over the website or the content therein. The existence of this link shall not constitute an endorsement by Guardian Bank of the website, the content of the website, or the operators of the website.")) {
		var oWin = window.open(passedWebsite,"newWindow");
		if (oWin == null || typeof(oWin) == "undefined") {
			window.location.href = passedWebsite;
		} else {
			return true;
		}
	}
}

function mailConfirm(passedAddress) {
	if (confirm("Messages that you send to us by e-mail may not be secure. We recommend that you do not send any confidential information to us by e-mail. If you choose to send any confidential information to us by e-mail, you accept the risk that a third party may intercept this information.")) {
		window.location.href = passedAddress;
	}
}

function evalLink(linkURL,linkTarget,disclaimerFlag,disclaimerText) {
	var regexp = /&quote;/g;
	disclaimerText = disclaimerText.replace(regexp,"\"");
	switch(linkTarget) {
		case 0: //Same window
			if(disclaimerFlag == 1) {
				if(confirm(disclaimerText)) window.location = linkURL;
			}
			else window.location = linkURL;		
		break;
		case 1: // New Window
			if(disclaimerFlag == 1) {
				if(confirm(disclaimerText)) window.open(linkURL);
			}
			else window.open(linkURL);		
		break;
	}
}

/* =Menu Functions
----------------------------------------------- */
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 P7_autoLayers() { //v1.5 by PVII
 var g,b,k,f,u,k,j,args=P7_autoLayers.arguments,a=parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.visibility="hidden";}}for(k=1;k<args.length;k++){
 if((g=MM_findObj(args[k]))!=null){b=(document.layers)?g:g.style;b.visibility="visible";f=false;
 for(j=0;j<p7c[a].length;j++){if(args[k]==p7c[a][j]) {f=true;}}
 if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}

var timeOut = null;

function navIn() {
	if (timeOut != null) {
		window.clearTimeout(timeOut);
	}
}

function navTimer() {
	if (timeOut != null) {
		window.clearTimeout(timeOut);
	}
	timeOut = window.setTimeout('hideMenuObjects()',250);
}

function hideNav(navItem, action) {
	MM_showHideLayers(navItem,'',action);
}
function hideMenuObjects(){
	menuObj = document.getElementById("navMain");
	menus = menuObj.getElementsByTagName("div");
	for ( n = 0; n < menus.length; n++) {
		menus[n].style.visibility = "hidden";
	}
}

/* Menu Scripts */
   NS4 = (document.layers); 
   IE4 = (document.all); 
  ver4 = (NS4 || IE4);    
 isMac = (navigator.appVersion.indexOf("Mac") != -1); 
isMenu = (NS4 || (IE4 && !isMac)); 
 
function popUp(){return};
function popDown(){return}; 
function startIt(){return}; 
if (!ver4) event = null; 

function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin"; }

if (isMenu) { 
  menuVersion = 3; 
 
  menuWidth = 90; 
  childOverlap = 1; 
  childOffset = 1; 
  perCentOver = -.5; 
  secondsVisible = .2; 
 
  fntCol = "#000000"; 
  fntSiz = "8"; 
  fntBold = true; 
  fntItal = false; 
  fntFam = "arial"; 
 
  backCol = "#9C9C9C"; 
  overCol = "#ffffff"; 
  overFnt = "#000000"; 
 
  borWid = 1; 
  borCol = "#000000"; 
  borSty = "outset"; 
  itemPad = 2; 
 
  imgSrc = ""; 
  imgSiz = 1;
  
  separator = 1; 
  separatorCol = "#000000"; 
 
  isFrames = false; 
  navFrLoc =  "left"; 
  mainFrName = "main"; 
 
  clickStart = false; 
  clickKill = false; 
 
  keepHilite = true; 
 
  NSfontOver = true; 
  showVisited = "#666666"; 
}