/*
window.onresize=resize;
function resize(){
self.location.href=self.location.href;
}
*/
if(window.event + "" == "undefined") event = null;
//FOR COOLMENU BELOW
function showMenu(){return false};
function mout(){return false};
function dummyObject() {this.mout=mout};
oM = new dummyObject();
// FOR COOLMENU ABOVE

// CALL TO CORRECT DIRECTORY BELOW - if you are on homepage you need <script> var homepage = "yes";</script> to make codework properly
var imgdir = "../images/";
var sitedir = "";
var securedir = "";
var homedir = "../";
if(window.homepage)
{
imgdir="images/";
sitedir="site/";
securedir="site/";
homedir="";
}
else if(window.absolute)
{
imgdir="http://www.atholsb.com/images/"
sitedir="http://www.atholsb.com/site/"
securedir="http://www.atholsb.com/site/"
homedir="http://www.atholsb.com/"
}
else if(window.secure)
{
imgdir="https://www.atholsb.com/images/"
sitedir="http://www.atholsb.com/site/"
securedir="https://www.atholsb.com/site/"
homedir="http://www.atholsb.com/"
}
else if(window.calculators)
{
var imgdir = "../images/";
var sitedir = "../site/";
var securedir = "../site/";
var homedir = "../";
}
// CALL TO CORRECT DIRECTORY ABOVE

// ROLLOVER CODE BELOW
function makeNavImage(name,width,height){
this.name_on="nav-" + name +"-on.gif";
this.name_off="nav-" + name +"-off.gif";
this.width=width;
this.height=height;
this.newimage_on = new Image(width,height);
this.newimage_on.src = imgdir + this.name_on;
this.newimage_off = new Image(width,height);
this.newimage_off.src = imgdir + this.name_off;
}

var navitems = new Array();
navitems["busbkg"] = new makeNavImage("busbkg",135,29);
navitems["eforms"] = new makeNavImage("eforms",59,29);
navitems["loans"] = new makeNavImage("loans",44,29);
navitems["persbkg"] = new makeNavImage("persbkg",141,29);
navitems["rates"] = new makeNavImage("rates",40,29);
navitems["serv"] = new makeNavImage("serv",115,29);

function img_act(imgName){
document[imgName].src = navitems[imgName].newimage_on.src;
}

function img_inact(imgName){
window.status = "";
document[imgName].src = navitems[imgName].newimage_off.src;
}
// ROLLOVER CODE ABOVE

// OTHER FUNCTIONS BELOW
function openWin(url,name,width,height,options){
var n = name;
var w = width;
var h = height;
var o = options;
n = (n==null)?"_blank":n;
w = (isNaN(w) || w==null)?700:w;
h = (isNaN(h) || h==null)?600:h;
o = (o==null)?"toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1":(o.indexOf(",")!=0)?","+o:o;

var posX = Math.ceil((parseInt(screen.width) - w) / 2);
var posY = Math.ceil((parseInt(screen.height) - h) / 2);
aWindow = window.open(url,n,"width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY + o);
}

function open_discl(nameofdiscl){
	openWin(sitedir+nameofdiscl);
}

function open_apps(nameofapp){
	alert("Coming Soon!");
}

function open_pdf(nameofapp){
	openWin(sitedir+nameofapp+".pdf");
}

function warning(url){
	self.location.href=sitedir+"disclaimer.html?"+url
}

function showEmailWarning(email)
{
	var content = new Array();
	var index = 0;
	content[index++]	=	'<p style="color: red"><strong>We ask that you please</strong></p>';
	content[index++]	=	'<p style="color: red"><strong>do not</strong></p>';
	content[index++]	=	'<p style="color: red"><strong>send confidential information to us via email.</strong></p>';

	content[index++]	=	'<p><strong>E-mail is not necessarily secure against interception.</strong></p>';

	content[index++]	=	'<p>If your communication is very sensitive, or includes personal information such as</p>';
	content[index++]	=	'<p>account numbers, social security numbers, Login IDs, Passwords, or balance information,</p>';
	content[index++]	=	'<p>we suggest you call us at 978-249-3200 or toll free 888-830-3200</p>';
	
	content[index++]	=	'<p><a href="mailto:' + email + '">Continue</a> | <a href="#" onClick="javascript: document.getElementById(\'emailWarningDiv\').style.visibility = \'hidden\';">Decline</a></p>';

	document.getElementById("emailWarningDiv").innerHTML = content.join("");
	document.getElementById("emailWarningDiv").style.visibility = "visible";
}

function proceed(){
	var url = self.location.search.substring(1,self.location.search.length);
	if(url.indexOf('sbli.com')!=-1)
		self.location.href="http://www.sbli.com/partner_athol";
	else {
		openWin(url,'thirdParty','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,status=1');
		history.go(-1);
	}
}

function loan_proceed(){
	var url = self.location.search.substring(1,self.location.search.length);
		openWin('disclaimer.html?'+url,'thirdParty','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,status=1');
		history.go(-1);
}

function openIB(page){
	if(page=="register"){
		openWin(homedir+"registrationDemoCheck.html");
	} else if (page=="demo") {
		self.location.href=homedir+"index.html?demo";
	} else {
		self.location.href=homedir+"index.html";
	}
}

function openCM(){
	alert("Coming Soon!");
}

function kids(){
	openWin(sitedir+"kids.html",null,800,520,null);
}
// OTHER FUNCTIONS ABOVE


/************************************************************************************************************
* This function is used in the onclick of the a tag to display the external site warning. 
* @param msg - Integer specifying the which message to display.
* @param lk - The a link object
* Usage: <a href="http://wwww.mysite.com" onclick="return displayThirdPartyAlert(1,this);">My Site</a>
**************************************************************************************************************/
function displayThirdPartyAlert(msg,lk){
	var description = lk.innerHTML;
	if(description.indexOf('alt="') != -1){
		var x = description.indexOf('alt="')+5;
		var temp = description.substring(x);
		description = temp.substring(0,temp.indexOf("\""));
	}
	showWarning(lk.href, description, lk.target, msg)
	return false;
}

/************************************************************************************************************
* This function is used in the href of the a tag to display the external site warning. 
* @param lk - The url of the site to be opened
* @param desc - The description of the site to be opened, i.e. the name of the site.
* @param target - Allows for the window to opened in a new window
* @param msg - Integer specifying the which message to display.
* Usage: <a href="javascript:showWarning('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/

function showWarning(lk, desc, target, msg){
	desc = (desc) ? desc : "Third Party Site";
	target = (target) ? target : "_blank";
	msg = (msg) ? msg : 0;
	lk = (lk.substring(0,1)=="/" && !(lk.substring(0,8)=="/mstinc/"))? contextPath + lk: lk; // for local pages
	
	var messages = new Array(6);
	// Standard 3rd Party Warning
	messages[0] = '<h2 style="text-align:center; font-weight: bold; color: #000000;">IMPORTANT NOTICE</h2><p>You are entering a site that is not affiliated with Athol Savings Bank. Athol Savings Bank does not control the content or links associated with this outside site, nor do we guarantee the services or links offered there.<br /><br />We strongly recommend that you review all security and privacy standards associated with any outside links before you provide any personal information.</p><h2 style="text-align:center; font-weight: bold; color: #000000;">Important Notices:</h2><p>1) If more than one applicant is applying for credit, the intent to apply for joint credit must be established. If you click <strong>CONTINUE</strong> below, it will serve as confirmation of your intent to apply for joint credit.<br /><br />2) Alimony, Child Support or Separate Maintenance Income need not be revealed if either Borrower or Co-Borrower does not choose to have it considered as a basis for repaying this loan.</p>';
	messages[1] = '<h2 style="text-align:center; font-weight: bold; color: #000000;">IMPORTANT NOTICE</h2><p>You are entering a site that is not affiliated with Athol Savings Bank. Athol Savings Bank does not control the content or links associated with this outside site, nor do we guarantee the services or links offered there.<br /><br />We strongly recommend that you review all security and privacy standards associated with any outside links before you provide any personal information.</p>';
	// Standard Partner Warning
	messages[2] = '<h2 style="text-align:center; font-weight: bold; color: #000000;">Partner Site Disclaimer</h2><p>By accessing the noted link you will be leaving our website and entering a partner site which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>';
	// Standard Affiliate Warning
	messages[3] = '<h2 style="text-align:center; font-weight: bold; color: #000000;">Affiliate Site Disclaimer</h2><p>By accessing the noted link you will be leaving our website and entering an affiliate site located which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>';
	// Customize if requested
	messages[4] = messages[0];
	// Standard mailto: Insecure Warning
	messages[5] = '<h2 style="text-align:center; font-weight: bold; color: #000000;">Email Disclaimer</h2><p>This is <strong>NOT</strong> a secured e-mail transmission. Please <strong>do not send personal/financial information</strong> via this method.</p>';

	var content = new Array();
	var index = 0;
	content[index++] = messages[msg];
	content[index++] = '<div style="margin-top:1em;text-align:center"><a href="'+lk+'"'+(target?' target="'+target+'"':'')+' onclick="$(\'#ex_dis\').hide()">Continue</a>&#160;&#160;<a href="#" onclick="$(\'#ex_dis\').hide();return false;">Decline</a></div>';	
	$("#ex_dis").html(content.join("")).show();
	scrollTo(0,0);
}


function makeFooter() {
	var content = "";

	content += '<div class="footstretch">';
	content += '<div class="foot" style="width: 760px;">';
	content += '<div class="footleft">';
	content += '<img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://www.hud.gov/\');"><img src="'+imgdir+'footer-ehl.gif" width="53" height="77" alt="Equal Housing Lender" border="0" /></a><img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://ifs.intuit.com\');"><img src="/mstinc/web/images/logo_91x22.gif" alt="" border="0" /></a><img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://www.fdic.gov/\');"><img src="'+imgdir+'footer-fdic.gif" width="41" height="77" alt="Member FDIC" border="0" /></a><img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://www.difxs.com/\');"><img src="'+imgdir+'footer-dif.gif" width="64" height="77" alt="DIF" border="0" /></a><img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://www.sum-atm.com/\');"><img src="'+imgdir+'footer-sum.gif" width="49" height="77" alt="SUM" border="0" /></a><img src="'+imgdir+'footer-spacer.gif" width="20" height="77" alt="" border="0" /><a href="javascript:warning(\'http://www.sbli.com/\');"><img src="'+imgdir+'footer-sbli.gif" width="58" height="77" alt="SBLI" border="0" /></a>';
	content += '</div>';
	content += '<div class="footright">';
	content += '<a href="'+sitedir+'disclosures.html"><img src="'+imgdir+'footer-disclosures.gif" width="83" height="77" alt="Disclosures" border="0" /></a><a href="'+sitedir+'privacy.html"><img src="'+imgdir+'footer-privacy.gif" width="53" height="77" alt="Privacy" border="0" /></a><a href="'+sitedir+'security.html"><img src="'+imgdir+'footer-security.gif" width="71" height="77" alt="Security" border="0" /></a>';
	content += '</div>';
	content += '</div><!-- end foot -->';
	content += '</div><!-- end footstretch -->';

	document.write(content);
	return 1;
}
