//window.onerror = function(){ return true; }

                    // the following script checks for certian page labels the FI has requested to redirect to their new section - bs.bs_ms 
                    curURI = document.location.href;
                    watchFor = "ab.ab_pr,bs.bs_coa,per.per_dd,ab.ab_pp,ab.ab_di,per.per_oc".split(',');
                    for (var i=0;watchFor.length>i;i++) {
                        if(curURI.indexOf('?pageLabel='+watchFor[i]) != -1) {
                            document.location.replace('?pageLabel=bs.bs_ms');
                        }
                    }

// fix wc bug
var url = document.location.href;
var eSign = url.indexOf('=');
if(eSign > -1){
    queryString = url.substring(eSign+1);
    rIsProblem = /^[^_\.]+_[^\.]+\./;
    if(rIsProblem.test(queryString)){
        rFixProblem = /^([^_]+)(.*)$/;
        parsedQueryString = rFixProblem.exec(queryString);
        newQueryString = parsedQueryString[1]+"."+parsedQueryString[1]+parsedQueryString[2];
        newURL = "?pageLabel="+newQueryString;
        document.location.replace(newURL);
    }
} 

if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;


/*
META TAGS CONTENT AND DESCRIPTION BELOW
META TAGS CONTENT AND DESCRIPTION BELOW
META TAGS CONTENT AND DESCRIPTION BELOW
*/
document.write('<meta name="keywords" content="First Bank Alaska, Bank, firstbankak, A financial institution of excellence, featuring secure Internet-based services including Home Banking, Bill Payment, Bill Presentment, Quicken and Money interfaces, Stock Quotes, on-line applications, financial calculators, useful links and a wealth of financial information">');


document.write('<meta name="description" content="ATM, ATM Locations, Account Access, Account Transfer, Automobile Loans, AutoVantage, Bank, Bank Account, Banking, Bill Payment, Bill Presentment, Brokerage, Cash, CDs, Certificates of Deposit, Checks, Checking Accounts, Consumer Loans, Convenience Services, Credit, Credit Card, Credit Card Applications, Credit Union, Digital Insight, Finance, Financial Calculator, Financial Institution, Financial Wizard, Loans, Home Loans, IRA, Money, Term Investment, Online Banking, Order Checks, Personal Financial Management, Rates, Mortgage Rates, Loan Rates, Terms, Retirement, Savings Accounts, Savings, Savings and Loan, Stock Quotes, Stocks, Student Loans, Student, Term Share Certificates, Thrifts, Visa Credit Cards">');
/*
META TAGS CONTENT AND DESCRIPTION ABOVE
META TAGS CONTENT AND DESCRIPTION ABOVE
META TAGS CONTENT AND DESCRIPTION ABOVE
*/


/*
CALL TO CORRECT DIRECTORY
CALL TO CORRECT DIRECTORY
CALL TO CORRECT DIRECTORY
CALL TO CORRECT DIRECTORY
*/


//if you are on homepage you need <script> var homepage = "yes";</script> to make codework properly

var imgdir;
var sitedir;
var securedir;
var homedir;

if(window.homepage)
{
imgdir="diFiles/skins/default/images/";
sitedir="site/";
securedir="site/";
homedir="";
}
else if(window.absolutepage)
{
imgdir="http://www.firstbankak.com/images/"
sitedir="http://www.firstbankak.com/site/"
securedir="https://www.firstbankak.com/site/"
homedir="http://www.firstbankak.com/"
}
else if(window.securepage)
{
imgdir="https://www.firstbankak.com/images/"
sitedir="http://www.firstbankak.com/site/"
securedir="https://www.firstbankak.com/site/"
homedir="http://www.firstbankak.com/"
}
else
{
imgdir="diFiles/skins/default/images/";
sitedir="";
securedir="";
homedir="../";
}


// ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW
// ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW
// ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW ROLLOVER CODE BELOW

function makeNavImage(name,width,height){
dir = "diFiles/skins/default";
if(!(width)) { width=372; }
if (!(height)) { height=31; }
if ((name != 'ab') && (name != 'cu') && (name != 'crs') && (name != 'loc')) {
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 = dir + '/images/' + this.name_on;
this.newimage_off = new Image(width,height);
this.newimage_off.src = dir + '/images/' + this.name_off;
}
}

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 ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE
// ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE
// ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE ROLLOVER CODE ABOVE

//style sheet sniffer
//document.write('<scr'+ 'ipt src="' + securedir + '_styles.js"></scr' + 'ipt>');

function showCalc(calc)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 275)
var pHeight = (((parseInt(screen.height) / 2)) -240)
window.open(calc,"hello","width=550,height=480,left=" + pWidth + ",top=" + pHeight + ",resizable=1,scrollbars=1");

}

function openPDF(url,name,width,height,options){
var n = name;
var w = width;
var h = height;
var o = options;
//url += fiDir + '/documents/';
n = (n==null)?"_blank":n;
w = (isNaN(w) || w==null)?700:w;
h = (isNaN(h) || h==null)?500: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(fiDir + '/documents/' + url,n,"width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY + o);
}



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)?500: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_apps(nameofapp)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
var pHeight = (((parseInt(screen.height) / 2)) - 300)
aWindow = window.open('https://www.firstbankak.com/Forms/OnlineForm.cgi?form=' + nameofapp,'application',"toolbar=0,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
}

function disableFields(field,booleanDisabled) {
  	for (var i=0; i<field.length; i++) {
      	field[i].disabled = booleanDisabled;
	}
  }

function anchor_to(where,anc) {
        if (where == "") { where = "#"; }
        if (anc == "") { anc = "#"; }
        
        self.location.href=where;
        document.anc.scrollIntoView('true');

}


/************************************************************************************************************
* 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("\""));
	}
	show_warning(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:('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/


		/****
  		 *useage: <a href="javascript:show_warning('http://www.hotmail.com');">Test Link</a>
                 *
                 *author:Erron Austin
                 */
                 
function show_warning(lk, desc, target, msg){

	desc = (desc) ? desc : "Third Party Site";
	target = (target) ? target : "";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(5);
	messages[0] = '<span class="header">Third Party Site Disclaimer</span><br />By accessing the noted link, you will be leaving the First Bank website and entering a website hosted by another party. This Vendor is a trusted partner site, however, we encourage you to read and evaluate the privacy and security policies of any web site you enter.';
	
	messages[1] = '<span class="header">Third Party Site Disclaimer</span><br />By accessing the noted link, you will be leaving the First Bank website and entering a website hosted by another party. This Vendor is a trusted partner site, however, we encourage you to read and evaluate the privacy and security policies of any web site you enter.';
	
	messages[2] = '<span class="header">Third Party Site Disclaimer</span><br />By accessing the noted link, you will be leaving the First Bank website and entering a website hosted by another party. This Vendor is a trusted partner site, however, we encourage you to read and evaluate the privacy and security policies of any web site you enter.';
	
	messages[3] = '<span class="header">Third Party Site Disclaimer</span><br />By accessing the noted link, you will be leaving the First Bank website and entering a website hosted by another party. This Vendor is a trusted partner site, however, we encourage you to read and evaluate the privacy and security policies of any web site you enter.';
	
	messages[4] = '<span class="header">E-mail Disclaimer</span><br />Warning:  E-mail is an unsecure method of communication. Any information contained in your message could be viewed by a third party.  Sensitive information such as passwords or social security numbers should be omitted from e-mail messages.';

	var content = new Array();
	var index = 0;
	content[index++] = messages[msg];
	content[index++] = '<br /><br /><br />';
	content[index++] = '<div align="center"><a href="'+lk+'" target="'+target+'" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Continue</a>&#160;&#160;<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Decline</a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.display = "block";
	scrollTo(0, 0);
}

function mail_warning(url){
			//content creation
			var content = new Array();
        		var index = 0;
			content[index++] = '<span class="header">E-mail Disclaimer</span><br />Warning:  E-mail is an unsecure method of communication. Any information contained in your message could be viewed by a third party.  sensitive information such as passwords or social security numbers should be omitted from e-mail messages.';
			content[index++] = '<br /><br /><br />';
			content[index++] = '<div align="center"><a href="javascript:void(\'0\');" onclick="window.open(\''+url+'\');document.getElementById(\'ex_dis\').style.display = \'none\'">Continue</a>&nbsp;&nbsp;<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Decline</a></div></div>';	
			document.getElementById("ex_dis").innerHTML = content.join("");
	        document.getElementById("ex_dis").style.display = "block";
			scrollTo(0, 0);
		}
document.write('<div id="ex_dis" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #000000; text-align: left; position:absolute; margin:25% 25%; border: thin solid #146559; padding: 15px; display: none; z-index: 100000; width:350px; FILTER: progid:DXImageTransform.Microsoft.dropShadow( Color=2D776C,offX=7,offY=8,positive=true);"></div>');
