$(document).ready(function(){
/**** 3rd party warning for GRP links ********/
	for(i=0; i < document.links.length;i++)
	{
		var lnk = document.links[i];
		if(lnk.href)
		{
			// test every allowedDomain against every link with an href attrib.
			//alert(lnk.href);
			if(lnk.href == "https://www.bankfinancial.com/mstinc/grp/splash/index.html")
			{
				document.links[i].href= "javascript:showWarning('https://www.bankfinancial.com/mstinc/grp/splash/index.html','','_blank',0);"
				document.links[i].target= "_self";
			}
			if(lnk.href == "https://digitalinsight.eprize.net/treasurehunt/?page=rules")
			{
				document.links[i].href= "javascript:showWarning('https://digitalinsight.eprize.net/treasurehunt/?page=rules','','_blank',0);"
				document.links[i].target= "_self";
			}	
		}
	}
});


function stopError() {
 // return true;
}

window.onerror = stopError;

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 = 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;
}


document.write('<img src="'+dir+'/images/wcscreenrez.gif?width='+screen.width+'&height='+screen.height+'" width="1" height="1">'); 

function wcInternalPopup(url, height, width){
    var wide=width;
    var tall=height;
    var halfwide = (wide/2);
    var halftall = (tall/2);
    var pWidth = ( ((parseInt(screen.width) / 2)) - halfwide);
    var pHeight = (((parseInt(screen.height) / 2)) - halftall);
    var features = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
    window.open(url,'internalpopup',features);
} 

function wcPopup(url, height, width, disclaimer){
    var wide=width;
    var tall=height;
    var halfwide = (wide/2);
    var halftall = (tall/2);
    var pWidth = ( ((parseInt(screen.width) / 2)) - halfwide);
    var pHeight = (((parseInt(screen.height) / 2)) - halftall);
    var features = 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
    window.open(url,'externalpopup',features);
} 

function open_apps(nameofapp){
var winHeight = 550;
var winWidth = 750;
var pWidth = ( ((parseInt(screen.width) / 2)) - (winWidth/2))
var pHeight = (((parseInt(screen.height) / 2)) - (winHeight/2))
aWindow = window.open('https://www.bankfinancial.com/Forms/OnlineForm.cgi?form=' + nameofapp,'application',"toolbar=0,location=0,directories=0,status=0,menubar=0,width="+winWidth+",height="+winHeight+",top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
} 

function contactUs(cWho){
var winHeight = 600;
var winWidth = 500;
var pWidth = ( ((parseInt(screen.width) / 2)) - (winWidth/2))
var pHeight = (((parseInt(screen.height) / 2)) - (winHeight/2))
aWindow = window.open('https://www.bankfinancial.com/Forms/OnlineForm.cgi?form=wc_contact'+(cWho?'&type=' + cWho:''),'application',"toolbar=0,location=0,directories=0,status=0,menubar=0,width="+winWidth+",height="+winHeight+",top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
}

/************************************************************************************************************
* 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:('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/
function showWarning(lk, desc, target, msg){
	desc = (desc) ? desc : "Third Party Site";
	target = (target) ? target : "";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(8);
	messages[0] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>' +desc+ '</strong> are for the convenience of informational purposes only. Any products and services accessed through <strong>'+ lk +'</strong> are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.';
	
	//messages[1] = '<strong>Securities offered through ING Financial Partners, Inc., member SIPC. BankFinancial/Wealth Management is not a subsidiary of nor controlled by ING Financial Partners, Inc. Mutual funds, annuities, other investments and insurance products are not insured by the Federal Deposit Insurance Corporation (FDIC); are not deposits or other obligations of the Bank; are not guaranteed by the Bank or any other affiliated entity; are subject to investment risk, including possible loss of the principal invested; and are not insured by the Security Investors Protection Corporation (SIPC) as to loss of principal.</strong>';
	
	messages[1] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>' +desc+ '</strong> are for the convenience of informational purposes only. Any products and services accessed through <strong>'+ lk +'</strong> are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.';
	
	messages[2] = '<h2 style="text-align:center">Non-Secure Email Disclaimer</h2>As a convenience to you and to provide additional means of communications between you and <em>Bank<strong>Financial</strong></em>, you can use electronic mail (e-mail) to contact the bank regarding general inquiries and general access and maintenance issues. However communication via e-mail is not considered secure, and you agree that you will not use e-mail to transmit sensitive and/or confidential information such as account numbers, user IDs, or PINs, or to request or authorize any financial transaction.';
	
	messages[3] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>' +desc+ '</strong> are for the convenience of informational purposes only. Any products and services accessed through <strong>'+ lk +'</strong> are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.';
	
	messages[4] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>' +desc+ '</strong> are for the convenience of informational purposes only. Any products and services accessed through <strong>'+ lk +'</strong> are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.';
	
	messages[5] = '<strong>Securities offered through ING Financial Partners, Inc., member SIPC. BankFinancial/Wealth Management is not a subsidiary of nor controlled by ING Financial Partners, Inc. Mutual funds, annuities, other investments and insurance products are not insured by the Federal Deposit Insurance Corporation (FDIC); are not deposits or other obligations of the Bank; are not guaranteed by the Bank or any other affiliated entity; are subject to investment risk, including possible loss of the principal invested; and are not insured by the Security Investors Protection Corporation (SIPC) as to loss of principal.</strong>';
	
	messages[6] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>TurboTax</strong> are for the convenience of informational purposes only. Any products and services accessed through <strong>http://turbotax.intuit.com</strong> are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.';
	
	messages[7] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2>You are leaving <em>Bank<strong>Financial</strong></em>\'s website. Links that may be accessed via <strong>' +desc+ '</strong> are for the convenience of informational purposes only. Any products and services accessed through this site are not provided or guaranteed by <em>Bank<strong>Financial</strong></em>. The site you are about to visit may have a privacy policy that is different than <em>Bank<strong>Financial</strong></em>\'s. Please review their privacy policy. <em>Bank<strong>Financial</strong></em> does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.  This information is provided by BVS Performance Systems and is accurate as of 10/7/08.';
	
	messages[8] = 'This information is provided by BVS Performance Systems and is accurate as of 10/7/08.';

	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\'; showHidable();">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);
	
	if (window.homepage)
	{
	    hideHidable();
	}
}

function openIB(){
    showMessage();
}

function showMessage(){
    var content = new Array();
	var index = 0;
	content[index++] = '<h1>Coming Soon!!</h1><br/><p>You are attempting to access a page or product that is not yet available.</p>  <p>Please check back often. It will be available soon.</p><p>Thank you!</p>';
	content[index++] = '<br /><br /><br />';
	content[index++] = '<div align="center"><a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'; showHidable();"><strong>Close</strong></a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.display = "block";
	scrollTo(0,0);

	if (window.homepage)
	{
	    hideHidable();
	}
}

function checkSize()
{
    var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth ) )
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}
	else if( document.body && ( document.body.clientWidth ) )
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
    return myWidth;
}

function navSelect(fe){
	if (fe.value != '' && fe.selectedIndex != 0) document.location.href = fe.value;
}




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; top:125px; left:' + (parseInt(checkSize()/2)-175) + 'px; border: thin solid #1A448E; padding: 15px; display: none; z-index: 100000; width:350px;"></div>');
// OTHER FUNCTIONS ABOVE


function rand(number) {
	return Math.ceil((Math.random()* number));
};


function popUpKidsPage()
{
	window.open('/home/diFiles/skins/default/misc/kids.html', 'KidsPage',  'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=800,height=500');
} // popKidsPage()

function openVidTPD() {
    window.open('http://bvsperformance.bvsinc.com/demoCourses/FDIC/FDICmenu.asp','FDIC','Width=400,Height=300,Top=250,Left=300,resizable=yes,status=no');
} //openVidTPD()

//end of file