// JavaScript Document
	var timeout;
	var intervalholder;
	var arrMenu = new Array('personal','business', 'basic','tools','customer');
        var pageName ="";
	
	function openInter(type, idd){
		if (document.getElementById)
		if(type=='on')
			document.getElementById(idd).style.display="inline"; 
				else document.getElementById(idd).style.display="none";
	
		return false;
	}
	
	
	function hideMenus(){
		var arr_len = arrMenu.length;
		var arr_iterator = 0;
		
		for (arr_iterator; arr_iterator<arr_len; arr_iterator++){
			hideMenu(arrMenu[arr_iterator]);
		}
	}
	function startMenu(menuName){
		clearTimer();
		hideMenus();
		if (menuName != null){
			
			if(bas = document.getElementById(pageName)) {
				bas.style.display="none";
			}
			
			if(deny = document.getElementById(pageName+"_link")) {
					deny.classname="navnormal";
			}
			
			if(lyr = document.getElementById(menuName)) {
				lyr.style.display="inline";
			}
			
			if(btn = document.getElementById(menuName+"_link")) {
				btn.classname="navhover";
			}

		}
	}
	
	function stopMenu(menuName){
		if (checkTimer()){
			hideMenu(menuName);
		}
	}
	
	function startTimer(menuName){
		timeout = 0;
		mName = menuName;
		intervalholder = setInterval('stopMenu(mName)',300);
	}
	
	function clearTimer(){
		intervalholder = clearInterval(intervalholder);
		timeout = 0;
	}
	
	function checkTimer(){
		if (timeout >= 10){
			intervalholder = clearInterval(intervalholder);
			return true;
		} else {
			++timeout;
			return false;
		}
	}
	
	function hideMenu(menuName){
		
		if(lyr = document.getElementById(menuName)) {
			lyr.style.display="none";
		}
		
		if(btn = document.getElementById(menuName+"_link")) {
			btn.classname="navnormal";
		}
		if(bas = document.getElementById(pageName)) {
			bas.style.display="inline";
		}

		if(deny = document.getElementById(pageName+"_link")) {
			deny.classname="navhover";
		}
	}
	
// for faq's
	function showAnswer(q) {
		if(question = document.getElementById(q)) {
			if(question.style.display=="block") {
				question.style.display="none";
			} else {
				question.style.display="block";
			}
		}
	}
	
		function autoOpen() {
		path = location.href;
		segments = path.split("?")
		pageAnchor = location.hash;
		if (segments.length > 1) {
			param = segments[segments.length - 1]
			keyValuePair = param.split("=")
			if (2 == keyValuePair.length) {
				showAnswer(keyValuePair[1])
				
			}
			document.location = pageAnchor
		}
	}
// end for faq's

//for login box
function logInTo(currentPage) 
{ 
  var locationIndicator = "";
  //check to see if any argument was passed in, if so, assign that argument as the locationIndicator
  if(arguments.length == 1)
  {
    locationIndicator = locationIndicator + currentPage;
  }
  window.location.href = document.AccountForm.AccountSelect.options[document.AccountForm.AccountSelect.selectedIndex].value + locationIndicator; 
} 
//end login box
//for how can we help box
function firstGoTo(currentPage) 
{ 
  var locationIndicator = "";
  //check to see if any argument was passed in, if so, assign that argument as the locationIndicator
  if(arguments.length == 1)
  {
    locationIndicator=locationIndicator + currentPage;
  }
  window.location.href = document.FirstGoForm.FirstGoSelect.options[document.FirstGoForm.FirstGoSelect.selectedIndex].value + locationIndicator; 
} 

function secondGoTo(currentPage) 
{ 
  var locationIndicator = "";
  //check to see if any argument was passed in, if so, assign that argument as the locationIndicator
  if(arguments.length == 1)
  {
    locationIndicator= locationIndicator + currentPage;
  }

  window.location.href = document.SecondGoForm.SecondGoSelect.options[document.SecondGoForm.SecondGoSelect.selectedIndex].value + locationIndicator; 
} 
//end how can we help box
//locator_small_include
function unselectOthers(obj){
	if (obj != document.locateUs.ClientPOI1){
	  document.locateUs.ClientPOI1.checked = false;
	}
	if (obj != document.locateUs.ClientPOI2){
	  document.locateUs.ClientPOI2.checked = false;
	}
	if (obj != document.locateUs.ClientPOI3){
	  document.locateUs.ClientPOI3.checked = false;
	}
	if (obj != document.locateUs.ClientPOI4){
	  document.locateUs.ClientPOI4.checked = false;
	}
}
//end locator


//Created by Julie Dorsey, used for Ominture values. Grabs the URL
//and parses it for name/value pairs in the query string. For example,
//in the URL http://www.Great Florida Bank.com/bluejacketsbanking?source=123?id=987
//the name/value pairs would be source=123 and id=987 where source and id 
//are the names and 123 and 987 are the values, respectively

function getQueryStringValueFor(thisQuery) {
   //Get the query string
   location.url = /\?.+/.exec(location.href)
   // create the url array
   location.url = location.url?(location.url[0].substring(1).split('&')):[];
   
   // loop over the tag pairs
   for (var i=0,len=location.url.length;i<len;i++) {
     var nameValuePair = location.url[i].split('=');
     location.url[nameValuePair[0]]=unescape(nameValuePair[1]);
     if(nameValuePair[0] == thisQuery) {
       //alert("nameValuePair[1] is " + nameValuePair[1]);
       return nameValuePair[1];
     }
   }
   return;
}



//Created by Julie Dorsey, in order to check to make sure the page is 
//secure. Originally created for use on pages containing the 
//online banking login box.
    function isSecure()
    {
      var protocolOkay = (locationString.lastIndexOf("https"));
      if(protocolOkay == 0) //0 is okay
      {
        //alert("protocolOkay is (if) " + protocolOkay);

        if(document.location.hostname == "Great Florida Bank.com") {
          securedPage = locationString.replace("Great Florida Bank.com", "www.Great Florida Bank.com");
          //alert("securedPage is " + securedPage);
          location.replace(securedPage);
        }

        return;
      } else {
        //alert("protocolOkay is (else) " + protocolOkay);
        securedPage = locationString.replace("http", "https")

        if(document.location.hostname == "Great Florida Bank.com") {
          securedPage = locationString.replace("Great Florida Bank.com", "www.Great Florida Bank.com");
        }
        //alert("securedPage is " + securedPage);
        location.replace(securedPage);

      }

      return;
    }

//Originally created for whichTab, this function returns the string of 
//text that is between the 3rd and 4th "/" character in the URL string, 
//which is the top level directory. For example:
//    http://www.Great Florida Bank.com/home/pas/HNB1000.htm will return pas.
    function getSubString(locationString)
    {
      var splitLocation = locationString.split("/");
      return splitLocation[3];
  }

//Originally created for onlinebanking_include Log In To drop down box.
//This function gets the browser URL and removes everything before, and
//including the domain name. For example: 
//    http://www.Great Florida Bank.com/home/home.htm becomes home/home.htm
//
    function getLocationFromDocRoot(locationString)
    {
      var locationFromDocRoot = "";
      var splitLocation = locationString.split("/");
      for (var count = 3; count < splitLocation.length; count++)
      {
        locationFromDocRoot = locationFromDocRoot + splitLocation[count];
        //We want to put the "/" back in if it's not the last splitLocation 
        //(the "/" was taken out when it was used at the deliminter in the 
        //split function above
        if(count != splitLocation.length-1)
        {
          locationFromDocRoot = locationFromDocRoot + "/";
        }
      }

      return locationFromDocRoot;
  }

//Created by S. Fritchen to put cursor in the Online Banking log in box 5/2/05
	function homePageOnLoad()
	{
		document.details.USER.focus();
		browserCheck();
	}



//Code for whichTab.js to populate whichTab variable and Omniture s_channel tag
//Use to reside in whichTab.js but moved here by Jared Ellerbrock on 6/29/05

  //Using subLocation variable and getSubString function to make sure we always
  //use the top level directory to determine the tab to use.
  var locationString=("" + document.location + "");

  //Note: the getSubString function is in the /scripts/common.js file
  var subLocationString=getSubString(locationString);

  //Next var is set to "" so if nothing else matches, we'll have no tab selected
  var whichTab = "";
  
  var s_channel = "";

  //Let's start with the exceptions and oddballs first, so they don't get trapped
  //into one of the "normal" cases.

  if(locationString.indexOf("/home/home.htm"))
  {
    whichTab="basic";
	s_channel = "basic";
  }

  if(subLocationString == "rxtest") //just for testing Rhythmyx publishing
  {
    whichTab="basic";
	s_channel = "basic";
  }

  else if(subLocationString == "mf")
  {
    whichTab="";
	s_channel = "";
  }

  else if(locationString.indexOf("GetEquipmentLeaseAppServlet") >= 0)
  {
    whichTab = "business";
	s_channel = "business";
  }
  else if (locationString.indexOf("/pas/HNB1785.htm") >= 0 || locationString.indexOf("/pas/HNB1786.htm") >= 0
      || locationString.indexOf("/pas/HNB1787.htm") >= 0 || locationString.indexOf("/pas/HNB1788.htm") >= 0
      || locationString.indexOf("/pas/HNB1789.htm") >= 0 || locationString.indexOf("/pas/HNB2100.htm") >= 0 
      || locationString.indexOf("/pas/HNB2110.htm") >= 0 || locationString.indexOf("/pas/HNB217") >= 0 
      || locationString.indexOf("/pas/HNB2180.htm") >= 0)
  {
    whichTab = "tools";
	s_channel = "tools";
  }
  else if (locationString.indexOf("/pas/HNB1255.htm") >= 0 || 
           locationString.indexOf("ContactUsServlet") >= 0)
  {
    whichTab = "customer";
	s_channel = "customer";
  }

  //Now for all the "normal" stuff that fits into categories nicely

  else if (subLocationString == "us" || subLocationString == "hr" || 
           subLocationString == "contact_us" || subLocationString == "service" ||
           subLocationString =="news")
  {
    whichTab = "customer";
	s_channel = "customer";
  }

  else if (subLocationString == "pas" || subLocationString == "apply" || subLocationString == "password" ||
           subLocationString == "promos" || subLocationString == "rates"  || subLocationString == "pfg" || 
           subLocationString == "security" || subLocationString == "survey" 
           || locationString.indexOf("Servlet") >= 0 )
  {
    whichTab = "personal";
	s_channel = "personal";
  }
  else if (subLocationString == "bas" || subLocationString == "tm"
           || subLocationString == "trust" || subLocationString == "equipLease" 
           || subLocationString == "huntview")
  {
    whichTab = "business";
	s_channel = "business";
  }
  else if (subLocationString == "calculators" || subLocationString == "educators"
           || subLocationString == "accacc" || subLocationString == "planning")
  {
    whichTab = "tools";
	s_channel = "tools";
  }


//***************************************************************************
//Following functions were added for the localization  project
//***************************************************************************

      function validateZipCode() {
        var userZip = document.getElementById('zipCode').value;
        //alert("userZip is " + userZip);
        if(!isValidZipCode(userZip)) {
          alert("Please enter a valid 5-digit Zip Code.");
        } else {
          document.getElementById("regionalOffers").submit();
        }
      }

      function isValidZipCode(zipCode) {
        var numberValues = "0123456789";
        if(zipCode == null || zipCode == "") { 
            var zipCode = document.getElementById('zipCode').value;
        }
        //alert("in isValidZipCode zipCode is " + zipCode);
        if (zipCode == null || zipCode == "" || zipCode.length != 5) {
          return false;  //return early, no sense in going on
        }
        for (i=0; i < zipCode.length; i++) {
          if (numberValues.indexOf(zipCode.charAt(i),0) == -1) {
            return false; //not a number, so return false
          }
        }
        return true; //if we got here, it must be okay
      }

      function displayZip(zipCode)
      {
        //alert("starting displayZip function, zipCode is " + zipCode);
        if(zipCode != null && isValidZipCode(zipCode)) {
          //alert("in the if");
          document.getElementById("showZipOffer").style.display="inline";
          document.getElementById("showEnterZip").style.display="none";
          document.getElementById("userZip").innerHTML=zipCode;
        }
        else {
          //alert("in the else");
          document.getElementById("showEnterZip").style.display="inline";
          document.getElementById("showZipOffer").style.display="none";
        }
        //alert("ending displayZip function, zip is " + zipCode);
      }

      function getZipCode()
      {
        returnValue = false;
        zipcode=getCookie("zipCode");
        if (zipcode!=null) {
          returnValue = zipcode;
        }
       return returnValue;
      }

      function getCookie(cookieName)
      {
        //alert("cookie is " + document.cookie);
        if (document.cookie.length > 0)
        {
          cookieStart=document.cookie.indexOf(cookieName + "=");
          if (cookieStart!=-1)
          {
            cookieStart=cookieStart + cookieName.length+1;
            cookieEnd=document.cookie.indexOf(";",cookieStart);
            if (cookieEnd==-1) cookieEnd=document.cookie.length;
            return unescape(document.cookie.substring(cookieStart,cookieEnd));
          }
        }
        return null;
      }

      function clearCookies() {
        document.getElementById("clearCookies").value="yes";
        //alert("document.regionalOffers is " + document.regionalOffers);
        document.getElementById("regionalOffers").submit();
      }

     function checkURL() { 
       if(document.URL.indexOf("RegionServlet") < 0)
       { 
         window.location = "/RegionServlet";
       }
     }

//***************************************************************************
//End of functions added for the localization  project
//***************************************************************************


