// JavaScript Document

var undefined;



function LinkAlert(URL,target,type) {

	BANKNAME = "Osgood State Bank";
	MSG = new Array();
	MSG[0] =       "You are now leaving "+BANKNAME+"'s website and will be redirected to another site. "+BANKNAME+" makes no endorsement or claims about the accuracy or content of information contained within  third party sites to which you may be going. The security and privacy policies on these sites may be different from "+BANKNAME+".";
	
	myTarget = "_blank";
	if (target!=undefined) myTarget = target;
	if (type!="" && type!=undefined) alert(MSG[type]);
	else if (confirm(MSG[0])) window.open(URL,myTarget);
	}

function EmailAlert() {
	msg = "You have requested to send general comments, questions or suggestions via this unsecured email.  For your protection, please do not send any personal information (i.e. Social Security Number, account number, date of birth, etc.) If you have an issue regarding your account, please contact an OSB representative who will gladly assist you with your questions, or log on to our Online Banking website and send your question via secured email. For your safety and privacy, specific account questions will not be answered that are initiated via unsecured form.";
	return confirm(msg);
	}

function Calculator(URL) {
	window.open ("https://gateway.fundsxpress.com/calculators/"+URL,'myCalculator','width=580,height=450,scrollbars=yes');
	}

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];
	   }
 }
}
