 
var $j=jQuery.noConflict();
var message = "You are leaving First Northern Bank's website and will be redirected to another site.  First Northern Bank makes no endorsement or claims about the accuracy or content of the information contained in these sites.  The security and privacy policies on these sites may be different than those of First Northern Bank.";

$j(document).ready(function(){
							
	$j("#obLogin form input#login-field").focus();
	
	// jQuery replacement for warn
	$j('a.warn, a.confirm').attr('target', '_blank');
	if( $j('a.warn').length > 0 ){
		$j('a.warn').click( function(){
			alert( message );
		});
	}
	
	if( $j('a.confirm').length > 0 ){
		$j('a.confirm').click( function( event ){
			event = new Event(event);
			if( confirm(message) ) {
				return true;
			} else {
				event.stop();
				return false;
			}
		});
	}
	
	
	
	// Home Featured Products
	$j("#homeFeaturedProducts li").hover(
		function() {
			$j(this).children('.shown').stop().animate({ top: "-175" }, 500);
			$j(this).children('.hidden').stop().animate({ top: "0" }, 500);
		},
		function() {
			$j(this).children('.shown').stop().animate({ top: "0" }, 500);
			$j(this).children('.hidden').stop().animate({ top: "175" }, 500);
		});	
	
	// Locations
	$j("#locations #legend a.icon").css('cursor', 'pointer');
	$j("#locations #legend a.icon").click( function(){
		var iconID = $j(this).attr("id");
		if( iconID != "reset" )
		{	$j("ul#locList li .blinds").slideUp().prev().addClass("closed");
			$j("ul#locList li").each( function(){
				if( $j(this).hasClass(iconID) )
				{	$j(this).find(".blinds").delay(300).slideDown();
					$j(this).find(".blinds").prev().removeClass("closed");
				}
			});
		}
		else
			$j("ul#locList li .blinds").slideDown().prev().removeClass("closed");
	});
	
	// locations show/hide
	$j('#locList .blinds').hide();
	$j('#locList .drawer-handle').toggleClass('closed').css('cursor', 'pointer');
	$j('#locList .drawer-handle').click(function(){
		$j(this).next('.blinds').toggle(200);
		$j(this).toggleClass('closed');
	});

	//$j("#locations ul#locList h2.drawer-handle").css('cursor', 'pointer');
	//$j("#locations ul#locList h2.drawer-handle").click( function(){
		//var iconID = $j(this).attr("id");
		//if( iconID != "reset" )
		//{	$j("ul#locList li .blinds").slideUp().prev().addClass("closed");
			//$j("ul#locList li").each( function(){
				//if( $j(this).hasClass(iconID) )
				//{	$j(this).find(".blinds").delay(300).slideDown();
					//$j(this).find(".blinds").prev().removeClass("closed");
				//}
			//});
	//	}
	//	else
	//		$j("ul#locList li .blinds").slideDown().prev().removeClass("closed");
	//});
	

	// bigTarget
	$j("#homeFeaturedProducts li").css('cursor', 'pointer');
	$j("#homeFeaturedProducts li div.shown a").bigTarget({
    	clickZone : '#homeFeaturedProducts li'
	});
	$j("#topUl li h3 a").bigTarget({
    	clickZone : '#topUl li'
	});
	$j("#wizardWrapper").css('cursor', 'pointer');
	$j("#mainContent.accountWizard #wizardWrapper #startNow a").bigTarget({
    	clickZone : '#wizardWrapper'
	});
	
	$j("#topUl > li")
	.css({'background-color': '#FFF'})
	.mouseover(function(){
		$j(this).stop().css( { backgroundColor: '#FFFCD9' }, 'fast')
	})
	.mouseout(function(){
		$j(this).stop().css( { backgroundColor: '#FFF' }, 'slow')
	});	
	http://thatsmybank.mortgagewebcenter.com/Default.asp?bhcp=1
	// adding things to product pages 
	// add special offer to checking
	$j("#prodGeneral p:contains('Receive a Totally Free Gift for opening a new account or referring a friend.')").replaceWith("<p id='specialOffer'><a href='/personal/checking/free-gift-personal.html'><img src='/custom/thatsmybank/image/Icon_FreeGift.png' alt='Free Gift' id='specialOffer1' /></a><a href='/personal/checking/free-gift-personal.html#checkBuyBack'><img src='/custom/thatsmybank/image/Icon_CashIn.png' alt='Cash In' id='specialOffer2' /></a></p>");
	
	$j("#prodGeneral p:contains('Receive a Totally Free Gift for opening a new account or referring a coworker.')").replaceWith("<p id='specialOffer'><a href='/business/checking/free-gift-business.html'><img src='/custom/thatsmybank/image/Icon_FreeGift.png' alt='Free Gift' id='specialOffer1' /></a><a href='/business/checking/free-gift-business.html#checkBuyBack'><img src='/custom/thatsmybank/image/Icon_CashIn.png' alt='Cash In' id='specialOffer2' /></a></p>");
	
	$j("#prodGeneral p:contains('Visit our Mortgage Web Center.')").replaceWith("<p id='specialOffer'><a href='http://thatsmybank.mortgagewebcenter.com/CheckRates/RateWatch.asp?PID=186' class='confirm'><img src='/custom/thatsmybank/image/rate-watch.png' alt='Cash In' class='lifelock' /></a><br /><a href='http://thatsmybank.mortgagewebcenter.com/CheckRates/SearchCriteria.asp?PID=22'>Visit our Mortgage Web Center.</a></p>");
	
	$j("#roi_tabs p:contains('Test Drive Online Banking.')").replaceWith('<form id="demoForm" action="https://online.thatsmybank.com/cgi-bin/hbproxy.exe/1079/newlogin" method="post" name="loginform"  target="_blank"><input type="image" id="demoButton" name="FormsButton21" alt="Online Banking Demo" src="/custom/thatsmybank/image/obl-demo.png" /><input type="hidden" name="v1" value="demo" /></form>');
	
	$j("#roi_tabs p:contains('Test Drive Cash Management Services.')").replaceWith('<form id="demoCMForm" action="https://online.thatsmybank.com/cgi-bin/hbproxy.exe/1079/newlogin" method="post" name="loginform"  target="_blank"><input type="submit" id="demoCMButton" name="FormsButton21" alt="Online Banking Demo" /><input type="hidden" name="v1" value="democ" /></form>');
	
	//js -> remove demo button image and replace with text link that will submit the form
	$j('#demoButton').remove();
	$j('#smallNav #demoForm').append('<a href="javascript:void(0)">Demo</a>').click( function(){ $j(this).submit() });
	$j('#roi_tabs #demoForm').append('<a href="javascript:void(0)">Test Drive Online Banking.</a>').click( function(){ $j(this).submit() });
	
	$j('#demoCMButton').remove();
	$j('#roi_tabs #demoCMForm').append('<a href="javascript:void(0)">Test Drive Cash Management Services.</a>').click( function(){ $j(this).submit() });
	
	                             
	//setting up for sliding bars
	$j('div#faqblurb div.slides, #bankOfficers .employees').hide();
	$j('div#faqblurb a.question, #bankOfficers h2, #bankOfficers h3').css('cursor', 'pointer');
	
	//faq sliding bars
	$j('div#faqblurb a.question, #bankOfficers h2, #bankOfficers h3').toggle(
		function() {
			$j(this).css('background-position', '0 -70px')
				.next().slideDown();
		},
		function() {
			$j(this).css('background-position', '0 -6px')
				.next().slideUp();
		});
	$j('div#faqblurb a.question:first').click();
	
	//handles link jumping to specific part of bank officers page
	var pathArray = window.location.pathname.split('/');
	if( pathArray.length == 4 )
	{	if( pathArray[3] == 'bank-officers.html')
		{	var selector = window.location.hash;
			if( selector != "" && selector != $j("#bankOfficers h2:first").attr("id") )
				$j(selector).click();
			else
				$j("#bankOfficers h2:first").click();
			console.log("selector: " + selector + " first id: " + $j("#bankOfficers h2:first").attr("id"));
		}
	}
	
	
	
	//fancybox
	$j('#financialCalculators li a, #paymentInfo a, #topQuestions a, #shareButton a, a.moreLocationsInfo, a.officerBio, a.officerLongBio, #ultraTopNav a.nthChild-2').not("#homeWrapper #ultraTopNav a.nthChild-2").addClass('iframe');
	
	$j("#financialCalculators li a").fancybox({
		'hideOnContentClick': false,
		'width': 660,
		'height': 400,
		'overlayOpacity': 0.9,
		'titleShow': false
	}); 
	
	$j("#paymentInfo a").fancybox({
		'hideOnContentClick': false,
		'width': 540,
		'height': 500,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("#topQuestions:not(.contactUs) a").fancybox({
		'hideOnContentClick': false,
		'width': 540,
		'height': 400,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("#shareButton a").fancybox({
		'hideOnContentClick': false,
		'width': 540,
		'height': 435,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("a.moreLocationsInfo").fancybox({
		'hideOnContentClick': false,
		'width': 450,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("a.officerBio").fancybox({
		'hideOnContentClick': false,
		'width': 300,
		'height': 250,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("a.officerLongBio").fancybox({
		'hideOnContentClick': false,
		'width': 300,
		'height': 580,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	$j("#ultraTopNav a.nthChild-2").not("#homeWrapper #ultraTopNav a.nthChild-2").fancybox({
		'hideOnContentClick': false,
		'width': 210,
		'height': 155,
		'overlayOpacity': 0.9,
		'titleShow': false
	});
	
	//historic photos gallery
	$j("#historicalPhotos a").click(function() {
		$j.fancybox(
			[	{	'href'  : '/custom/thatsmybank/image/historic-photos/founder.jpg',
					'title' : "Henry R. Timm was one of the founders in 1910 of the Northern Solano Bank, a predecessor to First Northern Bank, which opened for business on February 1, 1910. He was elected as the Bank's first president, and served from 1910 until his untimely death in 1917."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/wintersBand.jpg',
					'title' : "On May 1, 1911, the Winters Band paraded past the newly remodeled Northern Solano Bank building at the corner of First and B Streets in downtown Dixon. In December 1911, the state-chartered Northern Solano Savings Bank was incorporated. On January 2, 1912, the First National Bank was established under a federal charter. The two banks operated side-by-side, in the same quarters and under the same management, until April 8, 1955, when they were consolidated into the First National Bank of Dixon under federal charter. On January 2, 1980, First Northern Bank of Dixon was established under state charter."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/front-1912.jpg',
					'title' : "A front view of the bank building, showing the name First National Bank over the door. An Open House was held in this newly remodeled bank building on June 2, 1911. When Northern Solano Bank opened for business on February 1, 1910, it occupied temporary quarters in the old S.S. Silvey ice cream parlor, the store that adjoined the bank building on the left."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/interior1.jpg',
					'title' : "Interior of the Northern Solano Bank building, 1911. From left: unidentified customer, unidentified person peering over teller window, Angus Madden, Assistant Cashier; Harry L. Bissell, Cashier; and Henry R. Timm, President. The name above the bank vault reads: Northern Solano Bank."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/interior2.jpg',
					'title' : "Interior of Northern Solano Bank, 1911. Standing by the table, from left, are Angus Madden, Assistant Cashier and Henry R. Timm, President."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/front-1953.jpg',
					'title' : 'In November 1953, the interior and exterior of the bank were "modernized."'
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/front-1963.jpg',
					'title' : "In 1963, an entirely new bank building was constructed on the same corner - First and B streets - in downtown Dixon. The Open House for this new building was held June 29, 1963. Olin Henry Timm was president of the bank at this time; he was the son of founder Henry Timm. This mid-century architectural classic is still in use today by the Bank."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/olinHenryTimm.jpg',
					'title' : "Olin Henry Timm, son of founder Henry Timm, served as President of the Bank from 1963-1975 and as Chairman from 1975-1978. This photo was taken in May 1978."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/winters-1912.jpg',
					'title' : "<p>This striking Classical Revival building - an historic landmark - was designed in 1912 for the Citizens Bank of Winters, which underwent a series of ownership changes starting in 1928 that included the Bank of Italy and the Bank of America.</p><p>In 1970, the First National Bank of Dixon, expanded outside the City of Dixon when it opened the Winters Branch in 1970.</p><p>Except for iron grillwork removed from the windows, the structure remains unchanged from its original days, including impressive mahogany woodwork and marble counters and floors in the interior.</p>"
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/stateCharter.jpg',
					'title' : "On January 2, 1980, the federally chartered First National Bank of Dixon changed to the state-chartered First Northern Bank of Dixon."
				},
				{	'href'  : '/custom/thatsmybank/image/historic-photos/operationsCenter-drawing.jpg',
					'title' : "<p>Artist's rendition of the Dixon Operations Center, which opened on November 9, 1993.</p><p>The Operations Center comprises 33,000 sq. ft. and centralized seven administrative and operating departments, six of which had been housed in leased space. The Center also includes training and meeting rooms. The Annual Meeting of Shareholders is held in the building.</p>"
				}, 
				{	'href'  : '/custom/thatsmybank/image/historic-photos/bancorp-logo.jpg',
					'title' : "The year 2000 saw the formation of First Northern Community Bankcorp, the holding company for First Northern Bank of Dixon, to allow the Bank to better compete and grow in the future."
				}, 
				{	'href'  : '/custom/thatsmybank/image/historic-photos/solarPanels.jpg',
					'title' : '<p>First Northern Bank installed 1,675 photovoltaic panels totaling 26,767 square feet (more than half an acre) atop four buildings: the two Bank buildings in Dixon (shown here is the roof of the headquarters building at 195 N. 1st Street), the West Sacramento Branch, and the Winters Branch, which is an historic landmark. The system went operational in early 2009.</p><p>One year after flipping the "on" switch, the rooftop solar systems generated 461,000 kilowatt-hours of electricity. That\'s enough power to operate 42 homes for a year; avoid generating the gasses that 54 cars would emit over a year, or operate 4,208 60-watt light bulbs for a year.</p>'
				}, 
				{	'href'  : '/custom/thatsmybank/image/historic-photos/logo.jpg',
					'title' : '<p>Back in 1910, a group of local Dixon businesspeople believed they weren\'t getting the kind of banking services they needed, so in the do-it-yourself tradition of an independent farming community, they voted to open their own bank - an "enterprise with all local capital and no outside investment or affiliations."</p><p>In 2010, during one of the worse global economic recessions ever seen, First Northern celebrated its first 100 years in business.</p><p>While other banks have come and gone over the years, First Northern Bank remains steadfast in its commitment to remaining strong and independent in order to set its own course and make decisions at the local level. As a result, the Bank can respond - quickly - to customers\' needs and to changing business conditions.</p>'
				}
			], 
			{	'titlePosition': 'inside',
				'overlayOpacity': 0.9,
				'cyclic': true,
				'type': 'image',
				'titlePosition': 'outside'
			});
	}); 
	
	
	
}); //last closing bracket

