/*----------------------------------------
Brando theme Javascript
Author: Mitch Dunaway
Last Updated: December 20, 2011
(c) 2011 Affiniscape, Inc.
All Rights Reserved. This JavaScript file must not be reproduced without the express written permission of Affiniscape, Inc.
For questions regarding licensing or setup please contact Affiniscape, projects @ affiniscape dot com
----------------------------------------*/

var j = jQuery.noConflict();
j(document).ready(function($){    

	// Expand collapse Right Nav content sections
    $('#cms-content-right h5')
		.each(function(){ $(this).nextUntil('h5, h6').wrapAll('<div class="wrap"></div>'); })		
		.hover(
			function(){ $(this).addClass('hover'); },
			function(){ $(this).removeClass('hover'); })
		.click(
			function(){
				$(this).toggleClass('open');
				$(this).next('.wrap').slideToggle();
			});
    $('#cms-content-right h5:first').addClass('open');
    $('#cms-content-right h5:first + div').slideDown('slow');
	
	// Set column heights
	if ($('#cms-content-left').length || $('#cms-content-right').length){
		var h = 0;
		$('#cms-content-left, #cms-content-main, #cms-content-right').each(function(){
			if( $(this).height() > h){
				h = $(this).height();
			}			
		}).height(h);			
	}		
	
	// Sliding Flyouts
	$('nav > ul').navFlyouts({
		speedDown: 200,
		speedUp: 400
	});
    
});

