/*
	5RB jQuery Javascript
*/

//	Document Ready
	$(document).ready(function(){
	
	//	Accordion Menu
		$(".story").css("cursor","pointer"); // Make the area appear clickable
		$(".story").click(function(){ // When clicked:
			$(".story .content:visible").slideUp("slow"); // Slide up and hide any visible stories
			$(this).children(".content:hidden").slideDown("slow"); // Slide down and show the hidden story you clicked on
		}); // End
		
	//	Text Resize
		$("span.normal").click(function(){ // When this element is clicked:
			$("#wrap").css("font-size","1em"); // Change the font size of #wrap to this value
			$("#nav li a").css("padding","5px 14px");
			$("#nav li a.last").css("padding","5px 12px");
		}); // End
		$("span.large").click(function(){
			$("#wrap").css("font-size","1.2em");
			$("#nav li a").css("padding","5px 7px");
		});
		$("span.largest").click(function(){
			$("#wrap").css("font-size","1.4em");
			$("#nav li a").css("padding","5px 3px");
		});
		
	}); // End Document
	
	
	
	
/*** 
    Simple jQuery Slideshow Script
***/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    	//var $next =  $active.next().length ? $active.next()
        //: $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5500 );
});


function slideSwitchBarry() {
    var $active = $('#slideshowBarry span.active');

    if ( $active.length == 0 ) $active = $('#slideshow span:last');

    // use this to pull the divs in the order they appear in the markup
    //var $next =  $active.next().length ? $active.next()
        //: $('#slideshow span:first');

    // uncomment below to pull the divs randomly
     var $sibs  = $active.siblings();
     var rndNum = Math.floor(Math.random() * $sibs.length );
     var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 400, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchBarry()", 5500 );
});


function slideSwitchClerks() {
    var $active = $('#slideshowClerks span.active');

    if ( $active.length == 0 ) $active = $('#slideshow span:last');

    // use this to pull the divs in the order they appear in the markup
    //var $next =  $active.next().length ? $active.next()
        //: $('#slideshow span:first');

    // uncomment below to pull the divs randomly
     var $sibs  = $active.siblings();
     var rndNum = Math.floor(Math.random() * $sibs.length );
     var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 400, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchClerks()", 5500 );
});
