// Changes a name to proper case not all lowercase or all uppercase
function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
frmObj.value = tmpStr;
}

// Check to see if required field is filled in
function checkRequired(object) {
if (object.length=0) {
alert("Please enter information in the.");
return false;
}
}

// Disclosure alert for external site
function externalSite(url) {
input_box=confirm("You are visiting a site outside of 1st Advantage Federal Credit Union. 1st Advantage \ncan not ensure the completeness of the information that is presented on the site.\n\n- To proceed to the requested site, select OK.\n- To return to the 1st Advantage site, select Cancel.");

if (input_box==true){ 
//document.location.href=url - Same page
//window.open(url) - New page
window.open(url); 
}

else{}
}

// Disclosure alert for unsecure e-mail
function unsecureEmail(email) {
input_box=confirm("Please be aware that this is not a secure email contact. Do not send any sensitive information such as account numbers, social security numbers etc. Any information that is sent non-encrypted through e-mail my be read by a third party. Please use one of our secure online forms to send your query. \n\n- To return to the 1st Advantage site, select Cancel. \n- To proceed to the requested email contact, select OK.");

if (input_box==true){ 
document.location.href=email; 
}

else{}
}

// A basic popup window
function popup_window(url,bars,width,height)
 {
new_window = window.open(url,"window","location=0,status=0,scrollbars="+bars+",width="+width+",height="+height+"");
new_window.moveTo(0,0);
 }
 
 function Redirect(place) {
 document.location.href=place;  
 }
 
 function carZoom(url)
 {
new_window = window.open(url,"window","location=0,status=0,scrollbars=no,width=448,height=293");
new_window.moveTo(0,0);
 }
 
 function picZoom(url,w,h)
 {
new_window = window.open(url,"window","location=0,status=0,scrollbars=no,width="+w+",height="+h+"");
new_window.moveTo(0,0);
 }
 
 function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Adds a page and title to the browser bookmarks
function addBookmark(bookmarkurl,bookmarktitle)
{
bookmarkurl="http://www.1stadvantage.org"
bookmarktitle="1st Advantage FCU Home"
if (document.all) 
{window.external.AddFavorite(bookmarkurl,bookmarktitle)}
}

// To check for blank search form before it is submitted
function checkSearch () {
if (document.Search.Terms.value == '')
{
alert('Please enter a search phrase in the box. Thank You');
return false;
document.Search.reset();
document.Search.Terms.focus();
} else {
return true;
document.Search.submit();
}
}

//javaWrite 1.1 Copyright 2004 CommonBond Communications, Inc.

function JavaWrite(calcFile,width,height,bgcolorVar,srcFile)
{
	if(srcFile) {
		document.write('<applet code="'+calcFile+'" codebase="/class/'+srcFile+'/" align="center" width="'+width+'" height="'+height+'" id="'+calcFile+'"><param name="background" value="'+bgcolorVar+' "></applet>');
	}
	else {
		document.write('<applet code="/class/'+calcFile+'" align="center" width="'+width+'" height="'+height+'" id="'+calcFile+'"><param name="background" value="'+bgcolorVar+' "></applet>');
	}

}

// Popup window for Andera
function openAccount(tid){
	// alert('We are sorry, This link is temporarily unavailable. You may use our printable membership application to join. We apologize for any inconvenience.');
	// window.open('http://www.1stadvantage.org/pdf/membership-application.pdf');
	var cfgToken=''; 
	var w=766; 
	var h=screen.height*0.75; 
	var winl=(screen.width-w)/2;
	// Check for promo and display the appropriate andera link
	if (tid == 'NULL') {
		var wint=((screen.height-h)/2)*0.75; if(openAccount.arguments.length){cfgToken="&selectedProducts="+openAccount.arguments[0];} window.open('https://secure.andera.com/index.cfm?fiid=E90D113146A74333B5BE8068BEC25742'+cfgToken,'openAccount','height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,menubar=no,status=yes,toolbar=no,resizable=yes'); 
	}
	else {
		var wint=((screen.height-h)/2)*0.75; if(openAccount.arguments.length){cfgToken="&selectedProducts="+openAccount.arguments[0];} window.open('https://secure.andera.com/index.cfm?fiid=E90D113146A74333B5BE8068BEC25742&promotionalCode='+tid+''+cfgToken,'openAccount','height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,menubar=no,status=yes,toolbar=no,resizable=yes'); 
	}
}

// Show Checking Account Features/FAQ
function showDiv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.hideShow.visibility = 'visible';
}
else { // IE 4
document.all.hideShow.style.visibility = 'visible';
}
}
} 

function hideDiv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideShow').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideShow.visibility = 'hidden';
}
else { // IE 4
document.all.hideShow.style.visibility = 'hidden';
}
}
}

function getURL() {
	var loc=window.location;
	var url='http://validator.w3.org/checklink?uri='+loc+'&summary=on&hide_redirects=on&hide_type=all&no_accept_language=on&depth=&check=Check';
	window.location = url;
}
