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
document.write('<meta name="keywords" content="Community Bank of Pennsylvania, Bank, cbthebank, 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


//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="images/";
sitedir="site/";
securedir="site/";
homedir="";
}
else if(window.absolutepage)
{
imgdir="http://www.cbthebank.com/images/"
sitedir="http://www.cbthebank.com/site/"
securedir="http://www.cbthebank.com/site/"
homedir="http://www.cbthebank.com/"
}
else if(window.securepage)
{
imgdir="https://www.cnbthebankonline.com/images/"
sitedir="http://www.cnbthebankonline.com/site/"
securedir="https://www.cnbthebankonline.com/site/"
homedir="http://www.cnbthebankonline.com/"
}
else
{
imgdir="../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


browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (((browserName == "Netscape") && (browserVer >= 3)) || ((browserName =="Microsoft Internet Explorer") && (browserVer >= 4)))
{
version = "ok";

aboutus_on = new Image(229,33);
aboutus_on.src = imgdir + "nav-aboutus-on.gif";

aboutus_off = new Image(229,33);
aboutus_off.src = imgdir + "nav-aboutus-off.gif";

persbkg_on = new Image(229,33);
persbkg_on.src = imgdir + "nav-persbkg-on.gif";

persbkg_off = new Image(229,33);
persbkg_off.src = imgdir + "nav-persbkg-off.gif";

busbkg_on = new Image(229,33);
busbkg_on.src = imgdir + "nav-busbkg-on.gif";

busbkg_off = new Image(229,33);
busbkg_off.src = imgdir + "nav-busbkg-off.gif";

contactus_on = new Image(229,33);
contactus_on.src = imgdir + "nav-contactus-on.gif";

contactus_off = new Image(229,33);
contactus_off.src = imgdir + "nav-contactus-off.gif";

currentrates_on = new Image(229,33);
currentrates_on.src = imgdir + "nav-currentrates-on.gif";

currentrates_off = new Image(229,33);
currentrates_off.src = imgdir + "nav-currentrates-off.gif";

assetmgt_on = new Image(229,33);
assetmgt_on.src = imgdir + "nav-assetmgt-on.gif";

assetmgt_off = new Image(229,33);
assetmgt_off.src = imgdir + "nav-assetmgt-off.gif";

insuranceservices_on = new Image(229,33);
insuranceservices_on.src = imgdir + "nav-insuranceservices-on.gif";

insuranceservices_off = new Image(229,33);
insuranceservices_off.src = imgdir + "nav-insuranceservices-off.gif";

loginbblogin_on = new Image(47,19);
loginbblogin_on.src = imgdir + "nav-loginbblogin-on.gif";

loginbblogin_off = new Image(47,19);
loginbblogin_off.src = imgdir + "nav-loginbblogin-off.gif";

loginpblogin_on = new Image(47,19);
loginpblogin_on.src = imgdir + "nav-loginpblogin-on.gif";

loginpblogin_off = new Image(47,19);
loginpblogin_off.src = imgdir + "nav-loginpblogin-off.gif";

splashaboutus_on = new Image(110,42);
splashaboutus_on.src = imgdir + "nav-splashaboutus-on.gif";

splashaboutus_off = new Image(110,42);
splashaboutus_off.src = imgdir + "nav-splashaboutus-off.gif";

splashbusinessbanking_on = new Image(105,43);
splashbusinessbanking_on.src = imgdir + "nav-splashbusinessbanking-on.gif";

splashbusinessbanking_off = new Image(105,43);
splashbusinessbanking_off.src = imgdir + "nav-splashbusinessbanking-off.gif";

splashcontact_on = new Image(110,43);
splashcontact_on.src = imgdir + "nav-splashcontact-on.gif";

splashcontact_off = new Image(110,43);
splashcontact_off.src = imgdir + "nav-splashcontact-off.gif";

splashhighview_on = new Image(105,49);
splashhighview_on.src = imgdir + "nav-splashassetmgt-on.gif";

splashhighview_off = new Image(105,49);
splashhighview_off.src = imgdir + "nav-splashhighview-off.gif";

splashpersonalbanking_on = new Image(105,43);
splashpersonalbanking_on.src = imgdir + "nav-splashpersonalbanking-on.gif";

splashpersonalbanking_off = new Image(105,43);
splashpersonalbanking_off.src = imgdir + "nav-splashpersonalbanking-off.gif";

splashrates_on = new Image(110,43);
splashrates_on.src = imgdir + "nav-splashrates-on.gif";

splashrates_off = new Image(110,43);
splashrates_off.src = imgdir + "nav-splashrates-off.gif";
}
else
version = "x";

function img_act(imgName)
{
if (version == "ok")
{
imgOn = eval(imgName + "_on.src");
document [imgName].src = imgOn;
}
}

function img_inact(imgName)
{
window.status = "";
 if (version == "ok")
{
imgOff = eval(imgName + "_off.src");
document [imgName].src = imgOff;
}
}

// 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 showMap(map)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 275)
var pHeight = (((parseInt(screen.height) / 2)) -240)
window.open(map,"hello","width=450,height=480,left=" + pWidth + ",top=" + pHeight + ",resizable=1,scrollbars=0");
}

function open_guestbook_apps(nameofapp)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
var pHeight = (((parseInt(screen.height) / 2)) - 300)
aWindow = window.open('https://www.cnbthebankonline.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 open_apps(nameofapp)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
var pHeight = (((parseInt(screen.height) / 2)) - 300)
aWindow = window.open('https://www.cbthebank.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 rateTable(n,d){
	var r = 0;
	var i = 0;
	var c = 0;
	//var nw = (w)? false : true;
	//var header = (h)? h : 0;
	var whole = '';
	var max_value = 0;
	
	for(var r=0; r<entryObjects[n].value.length; r++) {
		for(var i=0; i<entryObjects[n].value[r].length; i++) {
			if(entryObjects[n].value[r].length>max_value)
				max_value = entryObjects[n].value[r].length;
		}
	}

	for(var r=0; r<entryObjects[n].value.length; r++) {
		var text = "<tr>";
		var styleClass = (c%2==0) ? "tablecontent1" : "tablecontent2";
		if(r==0) {
			styleClass = "tableheader";
			c--;
		}
		if(r==d) {
			styleClass = "tabledisclaimer";
		}
		for(var i=0; i<entryObjects[n].value[r].length; i++) {
			/*if(nw) {
				var nowrap = (i==0) ? "nowrap" : "";
			}*/
			var nowrap="";
			var colspan="";
			if(max_value>entryObjects[n].value[r].length && i==entryObjects[n].value[r].length-1) {
				var num = max_value - entryObjects[n].value[r].length + 1;
				colspan = ' colspan="' +num+'"';
			}
			text += '<td'+colspan+' class="'+styleClass+'" valign="top" '+nowrap+'>'+entryObjects[n].value[r][i]+'</td>';
		}
		text += "</tr>";
		whole += text;
		c++;
	}
	document.write(whole);
}

function openIB(page) {
	var width = 300;
	var height = 320;
	var pWidth = (((parseInt(screen.width) / 2)) - (width / 2))
	var pHeight = (((parseInt(screen.height) / 2)) - (height / 2))
	if (page=="demo") {
		location.href ="https://www.cnbthebankonline.com/onlineserv/HB/demo.html";
	} else if (page=="register") {
		var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
		var pHeight = (((parseInt(screen.height) / 2)) - 300)
		
		if (getCookie("demo")) {
			if(confirm("In order to register, you must first exit the demo. Would you like to exit the demo?"))
			{
				document.location = "https://www.cnbthebankonline.com/onlineserv/HB/";
			}
			else
			{
				return false;
			}
		}
		else{ window.open('https://www.cnbthebankonline.com/onlineserv/HB/STDReg.cgi?STDRegStep1=yes&runmode=REGISTRATION','HBnew',"toolbar=1,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
		}
	} else if (page=="moreinfo") {
		location.href = sitedir + "personal_other_online.html";
	} else {
location.href ="https://www.cnbthebankonline.com/onlineserv/HB/";
	}
}

function openCM(page) {
	var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
	var pHeight = (((parseInt(screen.height) / 2)) - 300)
	if (page=="demo") {
		window.open('http://www.cmdemo.com/','CM',"toolbar=1,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
	} else if (page=="moreinfo") {
		location.href = sitedir + "business_other_online.html";
	} else {
		window.open('https://www.cnbthebankonline.com/onlineserv/CM/','CM',"toolbar=1,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
	}
}

function show_warning(page)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 250)
var pHeight = (((parseInt(screen.height) / 2)) - 150)
bWindow = window.open(page,'newWin',"toolbar=0,location=0,directories=0,status=0,menubar=0,width=300,height=280,top=" + pHeight + ",left=" + pWidth);
}


/************************************************************************************************************
* 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 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, target, msg) {
	target = (target) ? target : "_self";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(6);
    messages[0] = '<p>Products of our Asset Management & Trust Division</p>';
    messages[0] += '<ul>';
    messages[0] += '<li>are not bank deposits;</li>';
    messages[0] += '<li>are not obligations of any bank, nor are they guaranteed by one; </li>';
    messages[0] += '<li>are not insured or guaranteed by the Federal Deposit Insurance Corporation or any other government agency; and </li>';
    messages[0] += '<li>involve investment risk, including possible loss of principal. </li>';

	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\'">OK</a></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: 10pt; font-weight: normal; color: #000000; text-align: left; position: absolute; border: 2px solid #062f62; padding: 15px; display:none; z-index: 500; width:450px; top:50px; left:50px;"><!-- For IE --></div>');

function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}
