// JavaScript Document

var undefined;



function LinkAlert(URL)
	{
	BANK_NAME = "New Windsor State Bank";
	MSG =       "You are leaving "+BANK_NAME+"'s website and will be redirected to another site. ";
	MSG = MSG + ""+BANK_NAME+" makes no endorsements or claims about the accuracy or content of ";
	MSG = MSG + "the information contained in these sites.  The security and privacy policies on ";
	MSG = MSG + "these sites may be different than those of "+BANK_NAME+".";
	if (URL!=undefined) 
		{
		if (confirm(MSG)) window.open(URL,"_blank");
		}
	else return confirm(MSG);
	}

function LaunchCalc(URL) {
	window.open (URL,'myCalculator','width=580,height=450');
	}

function newWindow() {
	window.open("","launch","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=400");
	}

function isValidEmail(parmValue) {
	var rex = new RegExp("^[\\w\\+-]+(\\.[\\w\\+-]+)?@((\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\|([\\w\\+-]+\\.[a-zA-Z]{2,}))$");
	var pos = parmValue.search(rex);
	if (pos < 0) {
		return false;
		} 
	else {
		return true;
		}
	}

function mail(link_string,user,domain,nickname,subject) {
    var nn = "";
    var s = "";

    if (nickname != "") nn = nickname + " ";
	else  nn = make_nickname(link_string);
    if (subject != "") s = "?subject=" + subject ;
    document.write(link_string.link(make_href(user,domain,nn,s)));
  }
 
function make_href(user,domain,nickname,subject) {
    address = "mail" + "to" + ":" + nickname + make_address(user,domain);
	if (subject!=undefined) address = address + subject;
	return address;
    }

function make_address(user,domain) {
    return "&lt;" + user + "@" + domain + "&gt;" ;
    }

function make_nickname(link_string) {
    var names = link_string.split(",");
    if (names.length == 2) {
      return names[1] + " " + names[0] + " ";
    } else {
      return "";
    }
  }


// This layer finds an object by ID and is cross-browser compliant.

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}
