// preload login-box business background image
var login_box_business_bg = new Image();
login_box_business_bg.src = '/images/box_login_bg_business.gif';
var login_box_personal_bg = new Image();
login_box_personal_bg.src = '/images/box_login_bg_personal.gif';

function doLoginRefresh() 
{
	var x = document.forms.login_form;
	if (x.AccessIDvisible.value != "") 
	{
		//setup the hidden fields
		x.AccessID.value = x.AccessIDvisible.value;
		x.AccessIDvisible.value = "";
		x.nmUID.value = x.AccessID.value ;
		
		//if biz or personal are not select we need a default
		if (x.postUrl.value == "")
		{
			x.postUrl.value = "https://progressivebank.evault.ws/pbi_pbi1961/Pbi1961.asp?WCI=RemoteLogin&Rt=111102596&LogonBy=Connect3"
		}
		
		//set the action on the form and pass the accessid
		setAction(x.postUrl.value);
		
		return true;
	} else 
	{
		document.forms.login_form.AccessIDvisible.focus();
		return false;
	}	
}

function setAction(link) 
{
	var rtNum = "111102596";
	var x = document.forms.login_form;
	x.action = link;
}

function switch_login_box1( cur ) 
{
	// change background of login box via adding/removing a seperate class
	// cur = 0 personal, cur = 1 business
	var login_box = document.getElementById( 'login-box' );
	var login_links = document.getElementById( 'login-links' ).getElementsByTagName( 'a' );
	login_box.className = ( cur ) ? 'business' : 'personal';
	login_links[0].style.fontWeight = ( cur == 0 ) ? 'bold' : 'normal';
	login_links[1].style.fontWeight = ( cur == 1 ) ? 'bold' : 'normal';
  
  // set form action and hidden fields
  var login_form = document.getElementById( 'login_form' );
  var login_id = document.getElementById( 'AccessIDvisible' );
  
  if (cur == 1) 
  {
  		login_form.postUrl.value = "https://progressivebank.evault.ws/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T"
		login_box.style.background = 'url(' + login_box_business_bg.src + ') no-repeat 0px 25px';
		document.getElementById('login-id-text').innerHTML = 'Access ID:';
  } 
  else 
  {
  		login_form.postUrl.value = "https://progressivebank.evault.ws/pbi_pbi1961/Pbi1961.asp?WCI=RemoteLogin&Rt=111102596&LogonBy=Connect3"
		login_box.style.background = 'url(' + login_box_personal_bg.src + ') no-repeat 0px 25px';
		document.getElementById('login-id-text').innerHTML = 'User Code:';
  }
}

function remove_hidden_login_fields() {
  // get all hidden elements
  var form = $('login_form');
  $A(form.getInputs('hidden')).each(function(input) {
    $(input).remove();
  });
}

function SafeMail(name, domain, display, css, subject) {
  css       = (css)     ? ' class="' + css + '"' : '';
  subject   = (subject) ? '?subject=' + subject : '';
  displayed = (display) ? display : name + '@' + domain;
  mailto    = name + '@' + domain + subject;
  document.write('<a href="mailto:' + mailto + '"' + css + '>' + displayed + '</a>');
}

function ExitNotice(url) {
  if(!url) url = 'the outside website';
  var agree = confirm('You are now leaving Progressive Bank\'s website. Click OK to proceed to '+url+', or click cancel to return to the previous page on the Progressive Bank website.');
if (agree)
	return true;
else
	return false;
}
