/* =Helper Functions
----------------------------------------------- */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload !== 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		};
	}
}

/* =Rollovers
----------------------------------------------- */
function navRollover() {
	if (!document.getElementsByTagName || !document.getElementById || !document.getElementById("nav")) { return false; }
	var navContainer, links, i;
	navContainer = document.getElementById("nav");
	links = navContainer.getElementsByTagName("img");
	for (i = 0; i < links.length; i++) {
		if (links[i].className.match("currentPage")) {
			var oldSrc = links[i].src;
			var newSrc = oldSrc.replace(/.jpg/,"-over.jpg");
			links[i].src = newSrc;
		}
		else {
			links[i].onmouseover = function() {
			var oldSrc = this.src;
			var newSrc = oldSrc.replace(/.jpg/,"-over.jpg");
			this.src = newSrc;
			};
			links[i].onmouseout = function() {
				var oldSrc = this.src;
				var newSrc = oldSrc.replace(/-over.jpg/,".jpg");
				this.src = newSrc;
			};
		}
	}
}
addLoadEvent(navRollover);

/* =Disclaimers
----------------------------------------------- */
function mailConfirm(passedAddress) {
	if (confirm("You are about to send information over the internet that may not be transmitted in an encrypted or secure form. 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.) We cannot address account related or personal information through non-secure email.")) {
		window.location.href = passedAddress;
	}
}

function disclaimer(passedWebsite) {
	var oWin;
	if (confirm("ATTENTION!! You are leaving the First Commonwealth Bank site! We provide the following links for your information and convenience. First Commonwealth Bank does not endorse the viewpoints or actions of the site owner or its advertisers; nor does the bank gain financially by providing these links.")) {
		oWin = window.open(passedWebsite,"newWindow");
		if (oWin === null || typeof(oWin) === "undefined") {
			window.location.href = passedWebsite;
		} else {
			return true;
		}
	}
}

function openCalcs(passedWebpage) {
	 //if (passwedWebpage) {
		 window.open(passedWebpage,'calculators','scrollbars=yes,resizable=yes,width=640,height=480');
	// }
}