function slideSwitch() {
    var $active = $('div.slideshow #slides img.active');

    if ( $active.length == 0 ) $active = $('div.slideshow #slides img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('div.slideshow #slides img:first');

    $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()", 5000 );
});

function doCloudAnimation() {
	
	var cloudSpeedMS = 80000;
	var pw = $('#site').width();
	var cw = 1200;
			
	$('div.site').css({'background-position': (((pw-cw)/2)+1200) + 'px 0'});
	$('div.site').animate({'background-position': ((pw-cw)/2) + 'px 0'}, cloudSpeedMS, 'linear', function(){$(this).css({'background-position': '50% 0'});});
}

$(function() {

    $('#featured-tabs').tabs({ fxAutoHeight: true, fxSlide: true, fxFade: true, fxSpeed: 'normal' });
    
});

$(document).ready(function(){

	$('body').addClass('hasJS');
	doCloudAnimation();
	$('#xfadeThis').innerfade({
		speed: 1000,
		timeout: 5000,
		type: 'sequence',
		containerheight: '272px'
	});
	
	$('ul.sf-menu').superfish();
	$(".hasJS #client_list div:nth-child(3n)").addClass("last_client");
	$(".hasJS #testimonials_list div:even").addClass("first_row");
	
});



