// JQUERY PLUGIN
jQuery.fn.h18_accordian_menu = function() {
	return this.each(function() {
		
		// kill any clicks on expanding links
		$(this).find('li.expanded > a').click(function(){
			return false;
		});
				
		$(this).find('li.expanded > a').click(function() {
			$(this).parent().parent().find('li.expanded > ul').slideUp(500);
			$(this).parent().find('> ul').slideToggle({queue:false});
			return false;
		});
		
		// ----------------------------------------------------------------------------------------	
		// initial collapse
		$(this).find('li.expanded > ul').slideUp(1);
		// ----------------------------------------------------------------------------------------	
		// active item should be expanded
		$(this).find('li.active-trail > ul.menu').slideDown(1);
		$(this).find('a.active').parent().parent().slideDown(1);
		
	});
};


////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
$(document).ready(function () {
    // Code here
	$('div#block-menu-primary-links > div.content > ul.menu').h18_accordian_menu();
///animated hide/show code follows for sidebar2 - marc@noassembly.ca did this///
///////////////////////////////////////////////////////////////////////////////
    $('.scroll-pane').hide();
    $('[id$=Video]').hide();
    $('#HomeVideo').show();
    $('#home').show();
    $('[id^=link]').click(function () {
        $('#home').hide();
        $('.scroll-pane').slideUp(50); 
        $('[id$=Video]').hide();
        var wasClicked = $(this).attr('id');
        var toStrip = wasClicked.replace("link", "");
        var forVideo = toStrip.replace(/[0-9]/, "");
        var div = "#" + toStrip;
        var divVideo = "#" + forVideo + "Video";
        $(div).slideDown(1);
        $(divVideo).show();
        return false; 
    }); 
////end of animated hide/show///////////////////////////////////////////////////

});// JavaScript Document
