﻿/* =Helper Functions
-----------------------------------------------*/
// Dreamweaver functions
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_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_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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Non-destructive way to add new functions to the window.onload event
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload !== 'function') {
    window.onload = func;
  } else {
    window.onload = function () {
      oldonload();
      func();
    };
  }
}
function addUnLoadEvent(func) {
	var oldonload = window.onunload;
	if (typeof window.onunload !== 'function') {
		window.onunload = func;
	} else {
		window.onunload = function() {
			oldonunload();
			func();
		};
	}
}

/* =Menu Functions
-----------------------------------------------*/
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";
	}
}

/* =Window Functions
-----------------------------------------------*/
function windowFunctions() {
	if (!document.getElementsByTagName) { return false; }
	var links, i;
	links = document.getElementsByTagName("a");
	for (i = 0; i < links.length; i++) {
		if (links[i].className.match("extLink")) {
			links[i].onclick = function() {
				linkConfirm(this.href);
				return false;
			};
		}
		if (links[i].className.match("emailLink")) {
			links[i].onclick = function() {
				mailConfirm(this.href);
				return false;
			};
		}
		if (links[i].className.match("testBrowser")) {
			links[i].onclick = function() {
				window.open(this.href,'securityAdvisor','scrollbars=yes,resizable=yes,width=400,height=450');
				return false;
			};
		}
		if (links[i].className.match("calcLink")) {
			links[i].onclick = function() {
				window.open(this.href,'calculators','scrollbars=yes,resizable=yes,width=640,height=480');
				return false;
			};
		}
		if (links[i].className.match("newWindow")) {
			links[i].onclick = function() {
				window.open(this.href);
				return false;
			};
		}
	}
}
addLoadEvent(windowFunctions);

/* =Disclaimers
-----------------------------------------------*/
var emailDisclaimer = "You are about to send information over the Internet that may not be transmitted in an encrypted or secure form. E-mail is not secure. It might be possible for others to see what you are sending. For your protection, please do not send any personal information (i.e. Social Security Number, account number, date of birth, etc.) Bank of Commerce cannot address account related or personal information through non-secure e-mail. If you have a concern regarding your account, please contact Bank of Commerce at 1-307-324-2265, or simply stop by the bank.";
var linkDisclaimer = "You are leaving the www.BOCRawlins.com website. Bank of Commerce is not responsible for the quality, delivery or timeliness of goods or services of outside websites. Bank of commerce is not responsible for any liability for errors or omissions in these pages. All information is provided “as is” or \“as available\” at the date of publication for the user, without express or implied warranties of any kind.  Bank of commerce will not be liable for any inaccuracy, malicious code or computer viruses in outside websites. Any and all hyperlinks accessed from this web site are not endorsed or controlled by Bank of Commerce.";

function mailConfirm(passedAddress) {
	if (confirm(emailDisclaimer)) {
		window.location.href = passedAddress;
	}
}

function linkConfirm(passedWebsite) {
	var oWin;
	if (confirm(linkDisclaimer)) {
		oWin = window.open(passedWebsite);
		if (oWin === null || typeof(oWin) === "undefined") {
			window.location.href = passedWebsite;
		} else {
			return true;
		}
	}
}

//eval link function
function evalLink(linkURL,linkTarget,disclaimerFlag) {
  switch(linkTarget) {
		case 0: //Same window
			if(disclaimerFlag == 1) {
				if(confirm(linkDisclaimer)) window.location = linkURL;
			}
			else window.location = linkURL;
			break;

		case 1: // New Window
			if(disclaimerFlag == 1) {
				if(confirm(linkDisclaimer)) window.open(linkURL);
			}
			else window.open(linkURL);
			break;

		case 2: // Popup Window
			if(disclaimerFlag == 1) {
				if(confirm(linkDisclaimer)) window.open(linkURL,'popup','scrollbars=yes,resizable=yes,width=640,height=480');
			}
			else window.open(linkURL,'popup','scrollbars=yes,resizable=yes,width=640,height=480');
			break;
	}
}

/* =Show/Hide Functions
----------------------------------------------- */

//Product Matrix Show/Hide Code With Highlight.
function toggleMoreInfoHighlight(id) {
	if (document.getElementById("moreInfo" + id).className == "hideMoreInfo") {
		document.getElementById("moreInfo" + id).className = "showMoreInfo";
		document.getElementById("linkText" + id).innerHTML = "&laquo;Hide";
		document.getElementById("productRowHighlight" + id).className = "rowHighlight";
	}
	else {
		document.getElementById("moreInfo" + id).className = "hideMoreInfo";
		document.getElementById("linkText" + id).innerHTML = "More&raquo;";
		document.getElementById("productRowHighlight" + id).className = "";
	}
}

//FAQs Show All Code.
function toggleFaqVisibility(id) {
	if (document.getElementById("displayObject" + id).className == "faqAnswerHidden") {
		document.getElementById("displayObject" + id).className = "faqAnswer";
	} else {
		document.getElementById("displayObject" + id).className = "faqAnswerHidden";
	}
	return;
}

//FAQs Show/Hide Code.
function toggleFaqVisibilityAll(display,startRow,stopRow) {
	for (var n = startRow; n <= stopRow; n++) {
		if (display == "show") {
			document.getElementById("displayObject" + n).className = "faqAnswer";
		} else {
			document.getElementById("displayObject" + n).className = "faqAnswerHidden";
		}
	}
		return;
}