//IMAGES HOVER
$(document).ready(function(){
$("img.a").hover(function() {
  $(this).stop().animate({opacity: ".7"}, 'slow');
},
function() {
  $(this).stop().animate({opacity: "1"}, 'slow'); 
});
});


$(document).ready(function(){
$("img.b").hover(function() {
  $(this).stop().animate({opacity: "1"}, 'slow');
},
function() {
  $(this).stop().animate({opacity: "0"}, 'slow'); 
});
});

//SLIDESHOW
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');


	$active.addClass('last-active');

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

$(function() {
	setInterval( "slideSwitch()", 5000 );
});

//GALLERY
$(document).ready(function(){
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-170px'},{queue:false,duration:300,easing: 'easeOutQuad'});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300,easing: 'easeOutQuad'});
	});

});

//LINKS
$(document).ready(function(){
			
	$('.toggle_container2').hide(); //Hide/close all containers
	//$('.trigger2:third').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
	
	//On Click
	$('.trigger2').click(function(){
		if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.trigger2').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
			$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
		}
		return false; //Prevent the browser jump to the link anchor
	});

});
