// JavaScript Document

// MLB Online Banking redirect

// This script calls function checkCookie() when the window loads.  Function checkCookie() checks 
// to see if there is already a cookie, and if so, redirects me to cnn.com 
// If it does not find a cookie, it creates one with function setCookie() and then redirects me to msnbc.com 

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
  {
  window.location = ("https://fiservla4.com/PBI1961.asp?Rt=121143794&amp;LogonBy=Connect3&amp;PRMAccess=Account&amp;URL=Start.htm");   // go to online banking because cookie is present
  }
  else 
  {
  username=prompt('Please enter your name:',"");
  if (username!=null && username!="")
    {
    setCookie('username',"MotherLodeBank",365);
               window.location = ("http://www.motherlodebank.com/online_banking_first-time.htm");  // go to fiserve disclosure because it's a first time visit
    }
  }
}
