
/************* GOOGLE EVENT TRACKING *************

function recordOutboundLink(link, category, action) {  try { var pageTracker=_gat._getTracker("UA-15890856-1"); pageTracker._trackEvent(category, action); setTimeout('document.location = "' + link.href + '"', 100)   }catch(err){} return false; }

*/


/************* SPEEDBUMB FUNCTION *************/
	function outboundLink()
	{
		
				var answer =  confirm("You are leaving FSBNH.com.\n\n"+
								"You are leaving Franklin Savings Bank's website\n"+
								"and linking to a non-affiliated third party website.\n\n"+
								"Franklin Savings Bank assumes no liability for the products\n"+
								"and services, policies, security or content of third party\n"+
								"sites accessed through fsbnh.com.\n\n"+
								"Please review the terms and conditions posted\n"+
								"on these web sites before using them as you will be\n"+
								"subject to their terms of use.\n\n"+
								"Please click OK to continue ...");	
		
		return answer;
	}
	
/*******************************************************************
******************* Email Speed Bumb ******************************
******************************************************************/
	function emailBumb() {
		var answer = confirm("E-MAIL DISCLAIMER \n\n"+ 
							"The security and privacy of your information is \n"+
							 "important to us. When communicating with us via \n"+
							 "e-mail please do not send any information that is \n"+
							 "considered confidential or sensitive in nature.\n"+
							 "If you need to communicate any personal, confidential \n"+
							 "information (such as account numbers, social security \n"+
							"number, etc.), please call our Customer Contact Center \n"+
							 "at (603) 934-4445 or visit us and speak with a \n"+
							 "Personal Banker. \n\n\n"+
							 "Please click OK to continue ... \n\n");
			return answer;
		}


// JavaScript Document

 sfHover = function() {
	var sfEls = document.getElementById("navigation_main_menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover); 


$(document).ready(function() {
						   
    var agent= navigator.userAgent.toLowerCase();
	var ie = agent.indexOf("msie")>=0;
	var ie6=ie && agent.indexOf("msie 6")>=0;
	var ie7=ie && agent.indexOf("msie 7")>=0;

	
	
	/******* Products Dropdown ********/
	function showMember()
	{
		//get effect type from 
		var selectedEffect = "slide";
		var options = {direction: "up", left: "-130"}; //{direction: 'up'};
		
		//ie6 test
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").hide();
		}
		$("#nav1_products_ddown").css("z-index", "99");
		$("#nav1_products_ddown").css({'top' : '95px' , 'left' : '-130px'});
		//$("#nav1_products_ddown").show(selectedEffect,options,300);
		$("#nav1_products_ddown").fadeIn(300);
	};
	function hideMember()
	{
		//get effect type from 
		var selectedEffect = "slide";
		var options = {direction: 'up', left: "-80"};
		
		//ie6 test
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").show();
		}
		$("#nav1_products_ddown").css("z-index", "99");			
		$("#nav1_products_ddown").css({'top' : '95px' , 'left' : '-130px'});
		//$("#nav1_products_ddown").hide(selectedEffect,options,150);
		$("#nav1_products_ddown").fadeOut(200);
	};
	  
	function addMega()
	{
		//$(this).addClass("hovering");
		showMember();
	}
	
	function removeMega()
	{
		//$(this).removeClass("hovering");
		hideMember();
	}
		
    var megaConfig = {
         interval: 100,
         sensitivity: 7,
         over: addMega,
         timeout: 200,
         out: removeMega
    };
	/************************************/
	
	/********* ABOUT DROPDOWN *********/
	function showAboutMember()
	{
		//run the effect
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").hide();
		}
		$("#nav1_learn_ddown").css("z-index", "99");
		$("#nav1_learn_ddown").css({'top' : '95px' , 'left' : '0px'});
		//$("#nav1_about_ddown").show(selectedEffect,options,300);
		$("#nav1_learn_ddown").fadeIn(300);
	};
	function hideAboutMember()
	{
		
		//run the effect
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").show();
		}
		$("#nav1_learn_ddown").css("z-index", "99");			
		$("#nav1_learn_ddown").css({'top' : '95px' , 'left' : '0px'});
		//$("#nav1_about_ddown").hide(selectedEffect,options,150);
		$("#nav1_learn_ddown").fadeOut(200);
	};
	  
	function addAboutMega()
	{
		//$(this).addClass("hovering");
		showAboutMember();
	}
	
	function removeAboutMega()
	{
		//$(this).removeClass("hovering");
		hideAboutMember();
	}
	
	var megaAboutConfig = {
         interval: 100,
         sensitivity: 7,
         over: addAboutMega,
         timeout: 200,
         out: removeAboutMega
    };
    
	
	/********* LOGIN DROPDOWN *********/
	function showLoginMember()
	{
		//ie6 test
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").hide();
		}
		$("#nav1_login_ddown").css("z-index", "99");
		$("#nav1_login_ddown").css({'top' : '95px' , 'left' : '0px'});
		//$("#nav1_about_ddown").show(selectedEffect,options,300);
		$("#nav1_login_ddown").fadeIn(300);
	};
	function hideLoginMember()
	{
		//ie6 test
		if(ie6 || ie7)
		{
			$("#sub_navigation ul").show();
		}
		$("#nav1_login_ddown").css("z-index", "99");			
		$("#nav1_login_ddown").css({'top' : '95px' , 'left' : '0px'});
		//$("#nav1_about_ddown").hide(selectedEffect,options,150);
		$("#nav1_login_ddown").fadeOut(200);
	};
	  
	function addLoginMega()
	{
		//$(this).addClass("hovering");
		showLoginMember();
	}
	
	function removeLoginMega()
	{
		//$(this).removeClass("hovering");
		hideLoginMember();
	}
	
	var megaLoginConfig = {
         interval: 100,
         sensitivity: 7,
         over: addLoginMega,
         timeout: 200,
         out: removeLoginMega
    };
	
	
	
	
	$("#nav1_products").hoverIntent(megaConfig);
	$("#nav1_learn").hoverIntent(megaAboutConfig);
	$("#nav1_login").hoverIntent(megaLoginConfig);
	

      
    });
/****************************************************************************************************
************************************ Kid's Calculator ***********************************************
*****************************************************************************************************/
function calculate()
{
			 /*	 var amountVal = parseFloat(calculator.amountVal.value);
			 var intRate = parseFloat(calculator.intRate.value)/100.;
			 var months = parseFloat(calculator.months.value); */
			 var amountVal = parseFloat(document.getElementById('amountVal').value);
			 var intRate = parseFloat(document.getElementById('intRate').value)/100.;
			 var months = parseFloat(document.getElementById('months').value);
			 
			 
			 
			if(!isNaN(document.getElementById('amountVal').value) && document.getElementById('amountVal').value != ""){
							if(!isNaN(document.getElementById('intRate').value) && document.getElementById('intRate').value != ""){
												if(!isNaN(document.getElementById('months').value) && document.getElementById('months').value != ""){
											   //calculating APY
												 var apyValue = Math.pow((1.0+intRate/months),months) - 1;
												 var apyValue = apyValue * 100;
											   //rounding APY upto 3 decimal places
												 var apyValue = Math.round(apyValue*1000.0)/1000.0;  
												 
												 var totalInt = amountVal + apyValue;
												 //rounding totalInt upto 2 decimal places
												 var totalInt = Math.round(totalInt*100.0)/100.0;
												 
											   
												 document.getElementById('apyValue').value = apyValue;
												 document.getElementById('totalInt').value = totalInt;
												 document.getElementById('amountVal').value = amountVal;
												 document.getElementById('intRate').value = intRate*100;
												 document.getElementById('months').value = months;
												}
												else {
													alert("Enter Valid number of months");
													return false;
												}
						}
						else {
							alert("Enter valid Interest Rate");
							return false;
						}
			}
			else {
			alert("Enter valid Amount");
			return false;
			}
}
/******************************************* Calculator Function Ends Here *************************************/


