// JavaScript Document

// basic show and hide
jQuery(document).ready(function() {
	jQuery(".expand").click(function(){
		jQuery(".expandable").slideDown("slow");
		jQuery(".moreInfo").fadeOut('slow');
	});
	jQuery(".collapse").click(function(){
		jQuery(".expandable").slideUp("slow");
		jQuery(".moreInfo").fadeIn('slow');
	});
	jQuery(".accessibility h2").click(function(){
		jQuery(this).parent().children(".expandable").slideToggle("slow");
		if (jQuery(this).parent().children().children(".moreInfo").css("display") == 'none')
			jQuery(this).parent().children().children(".moreInfo").fadeIn('slow');
		else
			jQuery(this).parent().children().children(".moreInfo").fadeOut('slow');
		});
	jQuery(".accessibility h3").click(function(){
		jQuery(this).parent().children(".expandable").slideToggle("slow");
		if (jQuery(this).parent().children().children(".moreInfo").css("display") == 'none')
			jQuery(this).parent().children().children(".moreInfo").fadeIn('slow');
		else
			jQuery(this).parent().children().children(".moreInfo").fadeOut('slow');
		});
	jQuery(".moreInfo").click(function(){
		jQuery(this).parent().parent().children(".expandable").slideToggle("slow");
		if(jQuery(this).css("display") == 'none')
			jQuery(this).fadeIn('slow');
		else
			jQuery(this).fadeOut('slow');
		});

});





/* Homepage slideshow */
function slideSwitch() {
    var jQueryactive = jQuery('#slideshow IMG.active');

    if ( jQueryactive.length == 0 ) jQueryactive = jQuery('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var jQuerynext =  jQueryactive.next().length ? jQueryactive.next()
        : jQuery('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var jQuerysibs  = jQueryactive.siblings();
    // var rndNum = Math.floor(Math.random() * jQuerysibs.length );
    // var jQuerynext  = jQuery( jQuerysibs[ rndNum ] );


    jQueryactive.addClass('last-active');

    jQuerynext.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            jQueryactive.removeClass('active last-active');
        });
}

jQuery(function() {
    setInterval( "slideSwitch()", 4000 );
});


/* Spotlight */

jQuery(document).ready(function() {
            jQuery('#mycarousel').jcarousel({
            scroll: 4,
            visible:4
        });
    });


/* News Ticker */

jQuery(document).ready(
				function(){
					
					jQuery('#ticker').innerfade({
						speed: 1000,
						timeout: 6000,
						type: 'sequence',
						containerheight: '1em'
					});
					

			});

