$(document).ready(function(){
						   
	//image rollover
	$.swapImage(".swapImage");	
	
	//easyslider	
	$("#slider").easySlider({
		auto: true, 
		continuous: true,
		numeric: true
	});
			
	//PNG fix
    $(function(){
		$(document).pngFix();
	});
	
	
	
	//primaryNav	
	$("ul.topnav li").hover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).find("ul.subnav").show(); //Drop down the subnav on click

		$(this).hover(function() {
		}, function(){	
			$(this).find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up
		});
	});

});	

// accordion
$(function(){
	$("#accordionContainer").accordion({ 
		header: '.productCategory'
	});							   
	
	var accordions = $("#accordionContainer");
	
	$("#showAll").click(function() {
		$(".basic a").addClass('selected');		
		accordions.accordion("destroy");
		wizardButtons.unbind("click");		
	});
});


// quicknav
$(function(){	
	
	// by default the css value of quicknav on load is set to invisible so it does not show with js switched off. This sets it to visible if user has js active.
	$('#quicknav').css("visibility","visible");	

	// BUTTONS
	$('.fg-button').hover(
		function(){ $(this).removeClass('ui-state-quicknav-default').addClass('ui-state-quicknav-focus'); },
		function(){ $(this).removeClass('ui-state-quicknav-focus').addClass('ui-state-quicknav-default'); }
	);
	
	// MENUS    	
	$('#flat').menu({ 
		content: $('#flat').next().html(), // grab content from this page
		showSpeed: 400 
	});
	
	$('#hierarchy').menu({
		content: $('#hierarchy').next().html(),
		crumbDefaultText: ' '
	});
	
	$('#hierarchybreadcrumb').menu({
		content: $('#hierarchybreadcrumb').next().html(),
		backLink: false
	});
	
	// or from an external source
	$.get('menuContent.html', function(data){ // grab content from another page
		$('#flyout').menu({ content: data, flyOut: true });
	});
});	
	
	
// scrollable
$(function() {	
	// by default the css value of the next arrow on load is set to invisible so it does not show with js switched off. This sets it to visible if user has js active.
	$('.next').css("visibility","visible");		
		
	// initialize scrollable 
	$("div.scrollable").scrollable({
		size: 3,
		items: '#thumbs',  
		hoverClass: 'hover'
	});		
	
	/* tooltip remover */
	$(".next").click(function(){
		$("#tooltipright").css("display","none");
	});
	
	$(".prev").click(function(){
		$("#tooltipleft").css("display","none");
	});		
	
});


// LAUNCH SAVINGS PRODUCT COMPARISON APPLICATION
$(function(){	
	
	// if javascript is turned off, make sure the Savings Account Tool doesn't show
	$("#scrollableSavingsComparison").css('display','block');
	$(".savingsCompareBanner").css('display','block');

	// LAUNCH
	$('#launchApplication').click(function() {
		window.open('/savings/comparison/index.html', '', 'location=no,width=1024,height=768,resizable=yes,scrollbars=yes,toolbar=no,status=no');
	});
	
});