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}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 7000 );
});
$(document).ready(function() {
 	var $banner = $('#banner-flash');
	$banner.fadeIn(4000);

$('.person-image').hover(
		function() {
			$(this).addClass('active');
		}, 
  		function () {
    			$(this).removeClass('active');
  		}
	);

	$('.portfolio-item-image').hover(
		function() {
			$(this).addClass('active');
		}, 
  		function () {
    			$(this).removeClass('active');
  		}
	);
 
	$('#snippet-news-articles').cycle({ 
    		fx:    'fade', 
    		timeout: 7000,
    		speed:  500,
    		pause: 1
 	});

	$("a.popup-content-team").colorbox({iframe:true, width:704, height:780, scrolling:false,current:" ", next:" ", previous:" ",close:" ", transition:"fade"});

	$(".sectoritem").hover(
	function() {
		$("img.sectorimage-hover-faded", this).stop().animate({"opacity": "0"}, "fast");
		$(this).css('border','1px solid #F07122');
		$("h3", this).css('color','#F07122');
	},
	function() {
		$("img.sectorimage-hover-faded", this).stop().animate({"opacity": "1"}, "fast");
		$(this).css('border','1px solid #F2F2F2');
		$("h3", this).css('color','#4D4D4F');
	});
});
