$(document).ready(function() 
{

	// ***** Header Menu Top Buttons *******//

	var btns = $("ul#headerMenu > li > a");
		btns.css("opacity","0");
	var numBtns = btns.size();
	var btnLength = 160;
	for(var i = 0; i<numBtns; i++)
	{		
		var theBtn	= btns[i];			
		$(theBtn).css( "background-position", (-btnLength * i) + "px -42px");
	}		
		// on mouse over
		$("ul#headerMenu > li > a").hover(function () {
			// animate opacity to full
			//$(this).stop().fadeOut(0);		
			$(this)
				.stop()
					.animate(
						{opacity : 1},{
							duration 	: 500,
							easing		: "easeOutQuart"						
						});
		},
		// on mouse out
		function () {			
			$(this).fadeTo(
					"slow",  0
				 );		
			
		});
		
		/**** Suckerfish Hover for IE *************/
		if (window.attachEvent) // check if IE //
		{
			var sfEls = document.getElementById("headerMenu").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"), "");
				}
			}
		}
		// ********** Header menu Drop Downs ************ //
		
		// let the js manage the rollOver - rather than the css //
		$("ul#headerMenu > li > ul").css( "left", "auto");
		
		// set menu start pos as height 0 for anim //
		$("ul#headerMenu li ul").slideToggle(0);			

		
		$("ul#headerMenu > li").hover(		
			
				function(){					
					$(this).children("ul").stop(true, true);
					$(this).children("ul").animate({ height: "toggle"}, 400, "easeOutQuart" );					
				},
				
				function(){
					
					$(this).children("ul").stop(true, true);
					$(this).children("ul").animate({ height: "toggle"}, 400, "easeInQuart" );					
				}			
		);
		
		// **********  Side menu rollovers ************ //		
		$("ul#sideBarMenu li ul li").hover(
				
			function(){
				
					$(this).find("a").not(".sideBarActivePage a").animate({ "paddingLeft": "10px"}, 150, "easeOutSine" );				
				},
			
			function(){
				
				$(this).find("a").not(".sideBarActivePage a").animate({ "paddingLeft": 0}, 300, "easeOutSine" );
			}				
		);		

		// gallery //
		var gv = $('#hozGallery').galleryView({
			panel_width: 728,
			panel_height: 350,
			frame_width: 60,
			frame_height: 40,
			nav_theme	: "light",
			panel_scale : "nocrop",		
			transition_speed: 1000,  
			transition_interval: 5000,		
			show_filmstrip : false,
			filmstrip_position : 'bottom',
			filmstrip_size: 0,
			pause_on_hover: true
		});		
		
		// *** accordian  ****//
		var btn;
		var cur;
		var old;
		var oldHeight;
		var curHeight; 		

		$('.accordian1 > li ul:gt(0)').hide();

		//var slider = $().alterPanelHeight( $("accordian1").height());		

		$('.accordian1 > li:first h5').addClass("accordianOpen").animate( {
			paddingLeft:"36px"
		} );

		$('.accordian1 > li h5:gt(0)').addClass("accordianClosed");			

		$('.accordian1 > li h5').click( function() 
		{				
			// Get the content that needs to be hidden
			old = $('.accordian1 > li ul:visible');		
			
			// Hide the old content
			//old.slideUp(500);
			//old.animate({ height: oldHeight },500);
			
			btn = $(this);
			cur = btn.next();			
		
			if ( cur.is(':visible') )
			{
				cur.slideUp(500);
				btn.stop().removeClass("accordianOpen").addClass( "accordianClosed ").animate( 
						{ paddingLeft:"20px" } );			
				return false;
			}			
			
			cur.show();
			curHeight = cur.height();
			cur.height( 0 );			

			//cur.stop().slideDown(500);
			cur.animate({ height: curHeight }, 500 );

			$(this).stop().removeClass("accordianClosed").addClass("accordianOpen").animate( {
				paddingLeft:"36px"
			} );
			
			old.prev().stop().animate( {
				paddingLeft:"20px"
			} );
		});
        
		$('#coda-slider-1').codaSlider({
			dynamicArrows 		: false,
			dynamicTabsAlign 	: "left",
			showTitle			: false,
			autoHeight			: true
		});
		
		
});

if (window.addEventListener)
{	
	window.addEventListener("load", init, false);
}else if (window.attachEvent) //IE exclusive method for binding an event
{
	window.attachEvent("onload", init);

}else if (document.getElementById) //support older modern browsers
{
	window.onload = init;
}

function init()
{	
	initLoadSequence("#hozGallery");
	$().galleryView.start();
}

