﻿//login-----------------
setFocus = function() {
	document.forms.Remote.AccessIDVisible.focus();
}
//window.onload = setFocus;

function setAction() {
	//Fill in the Routing number below.
	var rtNum = "063114137";
	var x = document.forms.Remote;
	
	if(x.loginTo[0].checked) {
		x.action = 'https://ns.bankbyweb.net/pbi_pbi1961/PBI1961.asp?WCI=RemoteLogin&Rt=063114137&LogonBy=connect3&PRMACCESS=account';
		//         'https://ns.bankbyweb.net/PBI_PBI1961/pbi1961.asp?WCI=RemoteLogin&RT=063114137&LogonBy=connect3&PRMACCESS=Account'; 
	} 
	else {
		x.nmUID.value = x.AccessID.value;
		x.nmRTN.value = rtNum;
		x.action = 'https://ws2.bankbyweb.net/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T';
		//		   'https://www.ecorphost.net/ebc_ebc1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T&RT=063114137&MFA=2';
		//         'https://www.ecorphost.net/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=Request&RID=3000&RTN=063114137&mfa=2';
		//		   'https://ws.ecorphost.net/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=Request&RID=3000&RTN=063114137&mfa=2';
		//		   'https://ws.ecorphost.net/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T&RT=063114137&MFA=2';
	}
}
   
function doLoginRefresh() {
	var x = document.forms.Remote;
	
	if (x.AccessIDVisible.value != "") 
	{
		x.AccessID.value = x.AccessIDVisible.value;
		x.AccessIDVisible.value = "";
		
		setAction();
		return true;
	}
	else {
		alert("Please Enter a valid Access ID.  Thank you!"); 
		return false;
	} 
}

// DROPDOWN SCRIPT [IE6]
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// POPUP WINDOW SCRIPT
function showpop(page, pagewidth, pageheight){
	var p = page;
	var w = pagewidth;
	var h = pageheight;
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;

	window.open = function() {
		//(''+p+'','','width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+x+',top='+y+'');
		setFocus;
	}
}

//PAGE TITLES
function getPageTitle(pageNum, title) {
	var defPageName = "Community Bank of Manatee";	//default page name/bank name before page name
	var nameConnector = " - ";						//page name separator
	var pageList = new Array();
	
	//just add page names to this list and call the correct page number in the funtion argument
	pageList[0] = "Shell";
	pageList[1] = "Home";
	pageList[2] = "About Us";
	pageList[3] = "Contact Us";
	pageList[4] = "Lost or stolen card";
	pageList[5] = "Personal Checking";
	pageList[6] = "Manatee News";
	pageList[7] = "Personal Savings";
	pageList[8] = "Business Checking";
	pageList[9] = "Business Savings";
	pageList[10] = "Merchant Capture";
	pageList[11] = "Commercial Loans";
	pageList[12] = "Consumer Loans";
	pageList[13] = "Safety Deposit Boxes";
	pageList[14] = "Courier Service";
	pageList[15] = "Telephone Banking";
	pageList[16] = "New to Our Community?";
	pageList[17] = "Lakewood Ranch Location";
	pageList[18] = "Braden River Location";
	pageList[19] = "West Bradenton Location";
	pageList[20] = "South Tampa Location";
	pageList[21] = "Riverview Location";
	pageList[22] = "Banking Services";
	pageList[23] = "Locations";
	pageList[24] = "Leaving our site";
	pageList[25] = "Calculators";
	pageList[26] = "Privacy Policy";
	pageList[27] = "Online Security Statement";
	pageList[28] = "Site Map";
	pageList[29] = "Phishing";
	pageList[30] = "Terms of Use";
		pageList[31] = "Press Releases";
	
	if(pageList[pageNum]!=undefined && title==true)				//if the page number called exists
		document.write("<title>" + defPageName + nameConnector + pageList[pageNum] + "</title>");
	else if(pageList[pageNum]!=undefined && title==false)
		document.write(pageList[pageNum]);
	else if(pageList[pageNum]==undefined && title==true)
		document.write("<title>" + defPageName + "</title>");
	else if(pageList[pageNum]==undefined && title==false)
		document.write(defPageName);
	
}

//CALCULATOR FUNCTIONS
function floor(number)
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}

function dosum()
{
  var mi = document.temps.IR.value / 1200;
  var base = 1;
  var mbase = 1 + mi;
  for (i=0; i<document.temps.YR.value * 12; i++)
  {
    base = base * mbase
  }
  document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
  document.temps.MT.value = floor(document.temps.AT.value / 12)
  document.temps.MI.value = floor(document.temps.AI.value / 12)
  var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) +
        document.temps.AT.value / 12 + 
        document.temps.AI.value / 12;
  document.temps.MP.value = floor(dasum);
}

function floor(number)
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}

function dosum()
{
  var mi = document.temps.IR.value / 1200;
  var base = 1;
  var mbase = 1 + mi;
  for (i=0; i<document.temps.YR.value * 12; i++)
  {
    base = base * mbase
  }
  document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
  document.temps.MT.value = floor(document.temps.AT.value / 12)
  document.temps.MI.value = floor(document.temps.AI.value / 12)
  var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) +
        document.temps.AT.value / 12 + 
        document.temps.AI.value / 12;
  document.temps.MP.value = floor(dasum);
}

function checkNumber(input, min, max, msg)
{   
	msg = msg + " field has invalid data: " + input.value;
    var str = input.value;
    for (var i = 0; i < str.length; i++)
        {   var ch = str.substring(i, i + 1)
            if ((ch < "0" || ch > "9") && ch != '.')
                {   alert(msg);    return false;    }
        }
    var num = parseFloat(str)
    if (num < min || num > max)
        {   alert(msg + " not in the range " + min + " to " + max);
            return false;
        }
    input.value = str;
    return true;
}
    
function computeField(input)
{   
	if (    input.value != null && input.value.length != 0    )
              input.value = "" + eval(input.value);
    computeForm(input.form);
}

function computeForm(form)
{   
	if (   form.payments.value == null ||
            form.payments.value.length == 0 ||
            form.interest.value == null ||
            form.interest.value.length == 0 ||
            form.principal.value == null ||
            form.principal.value.length == 0  )
        return;
    if (   !checkNumber(form.principal, 100, 9999999, "Principal") ||
            !checkNumber(form.payments, 1, 480, "Number of Payments") ||
            !checkNumber(form.interest, .001, 99, "Interest")    )
        {   form.payment.value = "Invalid";    return;    }
    var i = form.interest.value;
    if (    i < 1    )
        {   i *= 100;    form.interest.value = i;    }
    i /= 1200;
    var pow = 1;
    for (var j = 0; j < form.payments.value; j++)
         pow = pow * (1 + i);
    monthly = (form.principal.value * pow * i) / (pow - 1)
    form.payment.value = Math.ceil(100 * monthly)/100
}

function clearForm(form)
{   
	form.principal.value = "";
    form.payments.value = "";
    form.interest.value = "";
}

<!-- Original:  Michael C. Hundt (mchundt@nglic.com) -->
<!-- Web Site:  http://www.cinet.net/~mhundt/mystuff.htm -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

var i = 0; // interest
var m = 0; // months
var f = 0; // factor
var den = 0; 
var s = "0"; // string
var d = 0; // decimal place

function CalcA()
{
	if(document.calform.interest.value=="" || document.calform.months.value=="" || document.calform.payment.value=="") {
	alert("Please fill in all of the required fields.");
} else {
	if(document.calform.period.options[1].selected == true) 
	{
		m = document.calform.months.value * 12;
	} else {
		m = document.calform.months.value;
	}
	i = Math.pow(((document.calform.interest.value/100)+1),.0833333)-1;
	den = i / (i+1);
	f = Math.pow((i+1),m)-1;
	f /= den;
	f *= document.calform.payment.value;
	d = String(f).indexOf(".");
	s = String(f).substring(0,(d+3));
	document.calform.total.value = "$" + s;  
	}
}