/* fading nav menu 

   $(function() {
 //remove styling on a:hover
 $("ul#nav li:not(.active) a").addClass("jshidden");
 // set opacity to nill on page load
 $("ul#nav span").css("display", "block");
 $("ul#nav span").css("opacity","0");
   $("ul#nav li.active span").css("opacity","1");
 // on mouse over
 
 $("ul#nav span:not(.active)").hover(function () {
 
 // animate opacity to full
 $(this).stop().animate({
 opacity: 1
 }, 'slow');
 },
// on mouse out
function () {
// animate opacity to nill
$(this).stop().animate({
opacity: 0
}, 'slow');
});
}); 
 -------------------------------------------------------------------*/




/* frontpage banner image swap on timed interval
 
 function swapImages(){
      var $active = $('#showcase .active');
      var $next = ($('#showcase .active').next().length > 0) ? $('#showcase .active').next() : $('#showcase img:first');
      $active.fadeOut(function(){
      $active.removeClass('active');
      $next.fadeIn().addClass('active');
      });
    }

    $(function(){
      // Run our swapImages() function every 5secs
      setInterval('swapImages()', 5000);
  }); 

   -------------------------------------------------------------------*/






	
/* collapsible accordion
-------------------------------------------------------------------*/
jQuery(document).ready(function($) {
	$(".collapse_content").hide();
	$(".collapse_content_open").show();
	
	// Change <h2> above to have a class of active, which changes the icon to a 
	// (-) instead of (+)
	$('.collapse_content_open').prev('h2').addClass('active')

	$(".collapse h2").each( function() {

		$(this).click( function() {
			if( $(this).hasClass("active") ) {
				$(this).removeClass("active");
				$(this).next().slideUp("fast");
			} else {
				$(this).addClass("active");
				$(this).next().slideDown("fast");
			}
		});
	});
});



 $(document).ready(function(){
		
   /* tabbed content
  -------------------------------------------------------------------*/

  // When a link is clicked
  $("a.tab").click(function () {
    
    // switch all tabs off
    $(".tabbed_area .active").removeClass("active");
    
    // switch this tab on
    $(this).addClass("active");
    
    // slide all content up
    $(".content").hide();
    
    // slide this content up
    var content_show = $(this).attr("title");
    $("#"+content_show).show();
    
  });
	
	  
  /* Initialise prettyPhoto */	  
  if ($.prettyPhoto) {
		$("a[rel^='lightbox']").prettyPhoto();
  }


  /* truncate options
  see  http://www.reindel.com/truncate/ for more info and options
  -------------------------------------------------------------------*/
  if ($.truncate) {
    $(".truncate").truncate( 120,{
        chars: /\s/,
        trail: [ " ( <a href='#' class='truncate_show'>more</a> . . . )", "( . . . <a href='#' class='truncate_hide'>less</a> )" ]
    });
  }

  /* Add css class to last atom */
  $("ul.atom li.atom:last").addClass("last");
});


