var day = new Array("Sunday" , "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday" , "Saturday");
var month = new Array("January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , " November" , "December");
var today = new Date;
var hours = today.getHours();
var minutes = today.getMinutes();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += (hours >= 12) ? " P.M." : " A.M."
var formattedToday = day[today.getDay()] + ", " + month[today.getMonth()] + " " + today.getDate() + ", " + today.getFullYear();

function Include(section,subSection){
	this.section = section;
	if (this.section == "personalbanking") this.sectionCode = 6; 
	if (this.section == "businessbanking") this.sectionCode = 7; 
	if (this.section == "assetmgt") this.sectionCode = 8; 
	if (this.section == "us") this.sectionCode = 9;  
	if (this.section == "contactus") this.sectionCode = 10; 
	this.subSection = subSection;
	this.makeHeader = makeHeader;
	this.makeFooter = makeFooter;	
	if (this.section == "assetmgt") 
	{this.sectionHVT = '<div align="right" class="ficontent"> </div>';	
	}
	else
	{
	this.sectionHVT = ""
	}
	if (this.section == "assetmgt") 	
	{this.sectionPrivacy = 'hvt_privacy.html';	
	}
	else
	{
	this.sectionPrivacy = "privacy.html"
	}	
}

function makeHeader(){
	var header = new Array();
	var index = 0;
	header[index++] = '<tr>';
	if (this.section!="home"){
		var spacing = new Array(227,42,61);
		var bgcolor = "#BCBCC0";
		var bg = imgdir + 'back-login-bg.jpg';
		var searchbg = 'splash-search-bg.jpg';
	} else {
		var spacing = new Array(30,270,160);
		var bgcolor = "#BCBCC0";
		var bg = imgdir + 'splash-login-bg2.jpg'; // This header was installed in 201-40304. 
		var searchbg = 'splash-search-bg.jpg';
	}
	
	header[index++] = '<a name="top"></a>';
	header[index++] = '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="' + bgcolor + '"><tr><td width="100%" align="left" valign="top">';
	header[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0">';
	header[index++] = '<form name=seek method="GET" action="http://www.cnbthebankonline.com/DIUltraseek/nph-di_ultraseek.cgi">';
	header[index++] = '<td width="610" background="' + bg + '" ><img src="' + imgdir + 'clearpix.gif" width="1" height="51" alt="" border="0"><br>';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="' + spacing[0] + '" height="1" alt="spacing0" border="0">';
	header[index++] = '<a href="javascript:openIB(\'demo\');"><img src="' + imgdir + 'clearpix.gif" width="35" height="19" alt="Demo" border="0"></a><a href="javascript:openIB(\'moreinfo\');"><img src="' + imgdir + 'clearpix.gif" width="58" height="19" alt="More Info" border="0"></a><a href="javascript:openIB();" onMouseOver="img_act(\'loginpblogin\'); window.status=\'Personal Banking Login\'; return true" onMouseOut="img_inact(\'loginpblogin\');"><img src="' + imgdir + 'nav-loginpblogin-off.gif" width="47" height="19" alt="Personal Banking Login" border="0" name="loginpblogin"></a>';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="' + spacing[1] + '" height="1" alt="spacing1" border="0" />';
	header[index++] = ''; // The links for the two FDIC images in the header are absolutely positioned by CSS on the homepage.
	header[index++] = '<a href="javascript:openCM(\'demo\');"><img src="' + imgdir + 'clearpix.gif" width="35" height="19" alt="Demo" border="0"></a><a href="javascript:openCM(\'moreinfo\');"><img src="' + imgdir + 'clearpix.gif" width="58" height="19" alt="More Info" border="0"></a><a href="javascript:openCM();" onMouseOver="img_act(\'loginbblogin\'); window.status=\'Business Banking Login\'; return true" onMouseOut="img_inact(\'loginbblogin\');"><img src="' + imgdir + 'nav-loginbblogin-off.gif" width="47" height="19" alt="Business Banking Login" border="0" name="loginbblogin"></a>';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="' + spacing[2] + '" height="1" alt="spacing2" border="0"><br>';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="1" height="14" alt="" border="0"></td>';
	header[index++] = '<td width="150" background="' + imgdir + searchbg + '"><img src="' + imgdir + 'clearpix.gif" width="150" height="29" alt="Search This Site" border="0"><br>';
	header[index++] = '<input type=hidden name=reaction style="font-family: monospace" value="http://search.diginsite.com/query.html">';
	header[index++] = '<input type=text name=qt size=12 value="" maxlength=2047>';
	header[index++] = '<input type=hidden name=col value="search1">';
	header[index++] = '<input type=hidden name=qc value="search1">';
	header[index++] = '<input type=hidden name=qp value="+site:cnbthebankonline.com">';
	header[index++] = '<input type=hidden name=qs value="">';
	header[index++] = '<input type=hidden name=ws value="0">';
	header[index++] = '<input type=hidden name=qm value="0">';
	header[index++] = '<input type=hidden name=rq value="0">';
	header[index++] = '<input type=hidden name=st value="1">';
	header[index++] = '<input type=hidden name=nh value="10">';
	header[index++] = '<input type=hidden name=lk value="1">';
	header[index++] = '<input type=hidden name=rf value="0">';
	header[index++] = '<input type=hidden name=oq value="">';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="1" height="1" alt="" border="0"><input type="image" src="' + imgdir + 'search-go.gif" alt="Go" width="24" height="22" border="0"><br>';
	header[index++] = '<a href="' + sitedir + 'sitemap.html"><img src="' + imgdir + 'splash-nav-sitemap.gif" width="50" height="19" alt="Site Map" border="0"></a><img src="' + imgdir + 'splash-nav-divider.gif" width="4" height="19" alt="" border="0"><a href="' + sitedir +'help.html"><img src="' + imgdir + 'splash-nav-help.gif" width="36" height="19" alt="Help" border="0"></a><img src="' + imgdir + 'splash-nav-divider.gif" width="4" height="19" alt="" border="0"><a href="' + homedir + '"><img src="' + imgdir + 'splash-nav-home.gif" width="43" height="19" alt="Home" border="0"></a><br>';
	header[index++] = '<img src="' + imgdir + 'clearpix.gif" width="1" height="5" alt="" border="0"></td>';
	header[index++] = '</form></tr>';
	header[index++] = '</table>';
	header[index++] = '</td>';
	if (this.section!="home"){
		header[index++] = '<tr>';
		header[index++] = '<td width="100%" bgcolor="#FFFFFF"><img src="' + imgdir + 'clearpix.gif" width="246" height="1" alt="" border="0"></td>';
		header[index++] = '</tr>';
		header[index++] = '<tr>';
		header[index++] = '<td width="100%" bgcolor="#FFFFFF"><img src="' + imgdir + 'clearpix.gif" width="246" height="3" alt="" border="0"></td>';
		header[index++] = '</tr>';
	} else {
		header[index++] = '</tr>';
		header[index++] = '<tr>';
		header[index++] = '<td width="100%" bgcolor="#DDDDDF"><img src="' + imgdir + 'clearpix.gif" width="1" height="1" alt="" border="0"></td>';
		header[index++] = '</tr>';
		header[index++] = '<tr>';
		header[index++] = '<td width="100%" bgcolor="#A4A397"><img src="' + imgdir + 'clearpix.gif" width="1" height="2" alt="" border="0"></td>';
		header[index++] = '</tr>';
	}
	header[index++] = '</table>';
	// end logins table
	
	// begin time and date stamps
	header[index++] = '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#005F4B">';
	header[index++] = '<tr valign="top">';
	header[index++] = '<td width="100%" bgcolor="#005F4B">';
	header[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#005F4B">';
	header[index++] = '<tr valign="top">';
	if(this.section!="home"){
		header[index++] = '<td width="247" align="left" valign="middle"><a href="' + homedir + '"><img src="' + imgdir + 'logo-mid.gif" width="247" height="17" alt="Commercial Bank & Trust of PA" border="0"></a></td>';
		header[index++] = '<td width="256" align="left" valign="middle" class="datetime"><img src="' + imgdir + 'clearpix.gif" width="15" height="1" alt="" border="0">' + timeValue + '</td>';
		header[index++] = '<td width="257" align="right" valign="middle">';
	} else {
		header[index++] = '<td width="196" class="datetime" valign="middle"><img src="' + imgdir + 'clearpix.gif" width="15" height="1" alt="" border="0">' + timeValue + '<br><img src="' + imgdir + 'clearpix.gif" width="196" height="1" alt="" border="0"><br></td>';
		header[index++] = '<td width="378">';
		if (iedom||document.layers){
		header[index++] = '<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="middle" align="left">';
		if (iedom){
		header[index++] = tractor;
		header[index++] = '<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">';
		header[index++] = '<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">';
		header[index++] = '<div id="iemarquee" style="position:absolute;left:0;top:0"></div>';
		header[index++] = '</div>';
		}
		else if (document.layers){
		header[index++] = '<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>';
		header[index++] = '<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>';
		header[index++] = '</ilayer>';
		}
		header[index++] = '</td></tr></table>';
		}
		header[index++] = '</td>';
		header[index++] = '<td width="186" align="right" valign="middle">';
	}
	header[index++] = '<span class="datetime">' + formattedToday + '</span><img src="' + imgdir + 'clearpix.gif" width="16" height="1" alt="" border="0"><br><img src="' + imgdir + 'clearpix.gif" width="186" height="1" alt="" border="0"></td>';
	header[index++] = '</tr>';
	header[index++] = '</table>';
	header[index++] = '</td>';
	header[index++] = '</tr>';
	header[index++] = '</table>';
	// end time/date table
	
	// begin hed table
	header[index++] = '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#eeeeee">';
	header[index++] = '<tr>';
	header[index++] = '<td width="100%" valign="top" bgcolor="#ffffff">';
	if(this.section!="home"){
		header[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0">';
		header[index++] = '<tr valign="top">';
		header[index++] = '<td width="247"><a href="' + homedir + '"><img src="' + imgdir + 'logo-bottom.gif" width="247" height="59" alt="Commercial Bank & Trust of PA" border="0"></a></td>';
	if (this.section!="signon"){
		header[index++] = '<td width="513"><a href="javascript:void(0);" onMouseOver="popUp(\'HM_Menu' + this.sectionCode + '\',event); return true;" onMouseOut="popDown(\'HM_Menu' + this.sectionCode + '\'); return true;"><img name="header" src="' + imgdir + 'hed-' + this.section + '.gif" width="513" height="59" alt="" border="0"></a></td>';
	} else {
		header[index++] = '<td width="513"><img name="header" src="https://www.cnbthebankonline.com/onlineserv/HB/images/login-hed.gif" width="498" height="59" alt="" border="0"></td>';
	}
		header[index++] = '</tr>';
		header[index++] = '</table>';
		header[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0">';
		header[index++] = '<tr valign="top">';
		header[index++] = '<td width="229" background="' + imgdir + 'nav-bg.gif"><a href="' + sitedir +'personal.html" onMouseOver="img_act(\'persbkg\'); window.status=\'Personal Banking\'; popUp(\'HM_Menu1\',event); return true;" onMouseOut="img_inact(\'persbkg\'); popDown(\'HM_Menu1\'); return true;"><img src="' + imgdir + 'nav-persbkg-off.gif" width="229" height="33" alt="Personal Banking" border="0" name="persbkg"></a><br>';
		header[index++] = '<a href="' + sitedir +'business.html" onMouseOver="img_act(\'busbkg\'); window.status=\'Business Banking\'; popUp(\'HM_Menu2\',event); return true;" onMouseOut="img_inact(\'busbkg\'); popDown(\'HM_Menu2\'); return true;"><img src="' + imgdir + 'nav-busbkg-off.gif" width="229" height="33" alt="Business Banking" border="0" name="busbkg"></a><br>';
		//header[index++] = '<a href="' + sitedir + 'popup_3rd_party.html?location=http://www.cnbinsurance.com/" onMouseOver="img_act(\'insuranceservices\'); window.status=\'Insurance Services\'; return true;" onMouseOut="img_inact(\'insuranceservices\');" target="_blank"><img src="' + imgdir + 'nav-insuranceservices-off.gif" width="229" height="33" alt="Insurance Services" border="0" name="insuranceservices"></a><br>';
		header[index++] = '<a href="' + sitedir + 'hvt.html" onMouseOver="img_act(\'assetmgt\'); window.status=\'Asset Management & Trust\'; popUp(\'HM_Menu16\',event); return true;" onMouseOut="img_inact(\'assetmgt\'); popDown(\'HM_Menu16\'); return true;"><img src="' + imgdir + 'nav-assetmgt-off.gif" width="229" height="33" alt="Asset Management & Trust" border="0" name="assetmgt"></a><br>';
		header[index++] = '<a href="' + sitedir +'aboutus.html" onMouseOver="img_act(\'aboutus\'); window.status=\'About Us\'; popUp(\'HM_Menu4\',event); return true;" onMouseOut="img_inact(\'aboutus\'); popDown(\'HM_Menu4\'); return true;"><img src="' + imgdir + 'nav-aboutus-off.gif" width="229" height="33" alt="About Us" border="0" name="aboutus"></a><br>';
		header[index++] = '<a href="' + sitedir +'contactus.html" onMouseOver="img_act(\'contactus\'); window.status=\'Contact Us\'; popUp(\'HM_Menu5\',event); return true;" onMouseOut="img_inact(\'contactus\'); popDown(\'HM_Menu5\'); return true;"><img src="' + imgdir + 'nav-contactus-off.gif" width="229" height="33" alt="Contact Us" border="0" name="contactus"></a><br>';
		header[index++] = '<a href="' + sitedir + 'rates.html" onMouseOver="img_act(\'currentrates\'); window.status=\'Current Rates\'; return true;" onMouseOut="img_inact(\'currentrates\');"><img src="' + imgdir + 'nav-currentrates-off.gif" width="229" height="33" alt="Current Rates" border="0" name="currentrates"></a><br><br><br></td>';
		header[index++] = '<td width="17"><img src="' + imgdir + 'clearpix.gif" width="17" height="1" alt="" border="0"></td>';
		header[index++] = '<td width="514" class="ficontent" valign="top">' + this.sectionHVT + '<br>';
	}
	document.open("text/html","replace");
	document.writeln(header.join(""));
	document.close();
	return;
}

function makeFooter(){
	var footer = new Array();
	var index = 0;
	footer[index++] = '<br><br>';
	footer[index++] = '</td>';
	footer[index++] = '</tr>';
	footer[index++] = '</table>';
	footer[index++] = '</td>';
	footer[index++] = '</tr>';
	footer[index++] = '</table>';
	footer[index++] = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	footer[index++] = '<tr>';
	footer[index++] = '<td width="100%" bgcolor="#DDDDDF"><img src="' + imgdir + 'clearpix.gif" width="1" height="1" alt="" border="0"></td>';
	footer[index++] = '</tr>';
	footer[index++] = '<tr>';
	footer[index++] = '<td width="100%" bgcolor="#A4A397"><img src="' + imgdir + 'clearpix.gif" width="1" height="3" alt="" border="0"></td>';
	footer[index++] = '</tr>';
	footer[index++] = '<tr>';
	footer[index++] = '<td width="100%" bgcolor="#005F4B">';
	if(this.section!="home" && this.subSection!="index"){
		footer[index++] = '<a href="#top"><img src="' + imgdir + 'footer-backtotop.gif" width="140" height="17" alt="" border="0"></a>';
	} else {
		footer[index++] = '<img src="' + imgdir + 'clearpix.gif" width="140" height="17" alt="" border="0">';
	}
	footer[index++] = '<img src="' + imgdir + 'clearpix.gif" width="363" height="1" alt="" border="0"><img src="' + imgdir + 'clearpix.gif" width="257" height="17" alt="" border="0"></td>';
	footer[index++] = '</tr>';
	footer[index++] = '<tr valign="top">';
	footer[index++] = '<td width="100%" bgcolor="#EAEAEA">';
	//if(this.section!="assetmgt"){	
	footer[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#EAEAEA">';
	footer[index++] = '<tr valign="top">';
	footer[index++] = '<td>&nbsp;&nbsp;&nbsp;<a href="' + sitedir + 'personal_mastercard_securecode.html"><img src="' + imgdir + 'LogoLink.jpg" width="91" height="56" alt="MaterCard SecureCode" border="0" /></a></td><td><img src="' + imgdir + 'clearpix.gif" width="20" height="41" alt="" border="0"></td><td><a href="' + sitedir + 'popup_3rd_party.html?location=https://seal.verisign.com/splash?form_file=fdf/splash.fdf&amp;dn=WWW.CNBTHEBANKONLINE.COM&amp;lang=en" target="_blank"><img src="'+ imgdir + 'verisign-register.gif" width="74" height="41" alt="Verisign Secure Site" border="0"></a><!--<a href="' + sitedir + 'popup_3rd_party.html?location=https://digitalid.verisign.com/as2/6586e5f995a8b72732c41f8867c0ada5" target="_blank"><img src="' + imgdir + 'footer-verisign.gif" width="68" height="41" alt="VeriSign" border="0"></a>--></td>';
	footer[index++] = '<td width="120" align="center"><a href="' + sitedir + this.sectionPrivacy + '"><img src="' + imgdir + 'footer-privacySmall.gif" alt="Privacy Policy" border="0"></a><br>';
	footer[index++] = '<a href="' + sitedir + 'identity.html"><img src="' + imgdir + 'footer-protectyouridentityS.gif" alt="Protect Your identity" border="0"></a><br />';
	footer[index++] = '<a href="' + sitedir + 'credit_card_scam.html"><img src="' + imgdir + 'footer-importantinfoSmall.gif" alt="" border="0"></a><br /><a href="https://www.cnbthebankonline.com/onlineserv/HB/Protect_Yourself_from_Fraudulent_Emails.pdf" target="_new"><img src="' + imgdir + 'footer-phishing.gif" alt="" border="0"></a></td>';
	footer[index++] = '<td width="484"><a href="' + sitedir + 'popup_3rd_party.html?location=http://www.digitalinsight.com" target="_blank"><!--[if lt IE 7]><script type="text/javascript" src="https://www.cnbthebankonline.com/mstinc/web/js/png.js"></script><![endif]--><img src="https://www.cnbthebankonline.com/mstinc/web/images/di_140x34_1c_k.png" width="140" height="34" border="0" alt="" title="Digital Insight, an Intuit company" /></a><a href="' + sitedir + 'popup_3rd_party.html?location=http://www.hud.gov/" target="_blank"><img src="' + imgdir + 'footer-EHL.gif" width="80" height="41" alt="Equal Housing Lender" border="0"></a><a href="' + sitedir + 'popup_3rd_party.html?location=http://www.fdic.gov/" target="_blank"><img src="' + imgdir + 'footer-FDIC.gif" width="97" height="41" alt="Member FDIC" border="0"></a><img src="' + imgdir + 'footer-address.gif" width="160" height="41" alt="P.O. Box 429 900 Ligonier St. Latrobe PA, 15650" border="0"></td>';
	footer[index++] = '</tr>';
	footer[index++] = '</table>';	
	/*} else {	
	footer[index++] = '<table width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#EAEAEA">';
	footer[index++] = '<tr valign="top">';
	footer[index++] = '<td width="253" align="center"><img src="' + imgdir + 'clearpix.gif" width="72" height="41" alt="" border="0"><a href="https://seal.verisign.com/splash?form_file=fdf/splash.fdf&dn=WWW.CNBTHEBANKONLINE.COM&lang=en" target="_blank"><img src="'+ imgdir + 'verisign-register.gif" width="74" height="41" alt="Verisign Secure Site" border="0"></a><!--<a href="' + sitedir + 'popup_3rd_party.html?location=https://digitalid.verisign.com/as2/6586e5f995a8b72732c41f8867c0ada5" target="_blank"><img src="' + imgdir + 'footer-verisign.gif" width="68" height="41" alt="VeriSign" border="0"></a>--></td>';
	footer[index++] = '<td width="253" align="center"><a href="' + sitedir + this.sectionPrivacy + '"><img src="' + imgdir + 'footer-privacy.gif" width="136" height="22" alt="Privacy Policy" border="0"></a>';
	footer[index++] = '</td>';
	footer[index++] = '<td width="254" align="center"><a href="' + sitedir + 'popup_3rd_party.html?location=http://www.digitalinsight.com/" target="_blank"><img src="' + imgdir + 'footer-DI.gif" width="147" height="41" alt="Digital Insight, Inc." border="0"></a></td>';
	footer[index++] = '</tr>';
	footer[index++] = '</table>';	
	}*/
	footer[index++] = '</td>';
	footer[index++] = '</tr>';
	footer[index++] = '</table>';

	document.open("text/html","replace");
	document.writeln(footer.join(""));
	document.close();
	return;
}

