/* JS Document */

/************************************************************************
*   
*   S I T E  W I D E  J A V A S C R I P T S
*   
*   Author:  Daniel Stondin
*   Date:    29 July 2010
*   Web:     http://alpinefinancial.com
*   Version: 1.0
* 
*************************************************************************/

/*-----------------------------------------------------------------------
DOM Ready
------------------------------------------------------------------------*/

$(function() {
  init_nav_animation();
  init_navigation_accordion();
});

/*-----------------------------------------------------------------------
Init
------------------------------------------------------------------------*/

function initCycle() {
  $('#slideshow').cycle();
}

//-----------------------------------------------------------------------

function init_nav_animation() {
  $('#navigation-main ul > li.current').each(function() {
    $(this).children('a:first').animate({backgroundPosition:"(0 0)"}, {duration: 800});
  });
}

//-----------------------------------------------------------------------

function init_navigation_accordion() {
  
  // Check for an active item in the menu and show its sub menu if applicable
	$("#navigation-main ul li.current").find("ul").slideToggle("normal");
		
	// main nav only not nested ul
	$("#navigation-main ul li.subnav > a").live('click', function() {
		  
	  // Close any open menus
		$(this).parent().siblings().find("ul").slideUp("normal");
		$(this).next().slideToggle("normal");		
		return false;
		
	});
	
	$("#navigation-main ul li a.link").click( 
		function () {
			window.location.href=(this.href);
			return false;
		}
	);
}

/*-----------------------------------------------------------------------
Extend
------------------------------------------------------------------------*/


