﻿/* Helper Functions
-------------------------------------------------- */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload !== 'function') {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		};
	}
}

function printCheck() {
	if (window.print) {
		window.print();
	} else { 
		alert("Your browser does not support this print function. Please hit CTRL-P if you are using windows, or APPLE/ALT-P if using a Mac.");
	}
}

function focusLoginForm(){
	if(!document.getElementById) { return false; }
	if(document.getElementById("id")){
		document.getElementById("id").focus();
	}
}
addLoadEvent(focusLoginForm);

function changeWindowStatus() {
	var statusText = "Baxter State Bank"
	window.status = statusText;
}
addLoadEvent(changeWindowStatus);

function getthedate() {
	var mydate=new Date(),year=mydate.getYear();
	if (year < 1000) {
		year+=1900;
	}
	document.write("1998–" + year);
}

/*document.oncontextmenu = function() {return false}
if(document.layers) {
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown = function(e) {
		if(e.target==document)return false;
	}
}
else {
	document.onmousedown = function() {return false}
}*/

/* Disclaimers
-------------------------------------------------- */
var emailDisclaimer = "Email is not secure or encrypted, so you should not include any sensitive information such as account numbers, tax IDs, or passwords, etc. This Email link will launch a new window that is separate from your banking session. After sending your message, you may return to your secure Internet session without compromise.";
var linkDisclaimer = "You have selected a link to a third-party site. Baxter State Bank is not responsible for the content of any linked sites. We provide these links as a convenience and do not endorse the companies or contents of any linked sites.";

function mailConfirm(passedAddress) {
	if (confirm(emailDisclaimer)) {
		window.location.href = passedAddress;
	}
}

function disclaimer(passedWebsite) {
	var oWin;
	if (confirm(linkDisclaimer)) {
		oWin = window.open(passedWebsite,"newWindow");
		if (oWin === null || typeof(oWin) === "undefined") {
			window.location.href = passedWebsite;
		} else {
			return true;
		}
	}
}
