$(document).ready(function(){
	$(".wrapper .sidebar-left .menu li a").mouseenter(function(){
		$(this).parent().animate({width:"190px"},150);
	});
	$(".wrapper .sidebar-left .menu li a").mouseleave(function(){
		$(this).parent().animate({width:"160px"},100);
		$(this).parent(".current").animate({width:"190px"},300);
	});	
		
	if($(window).width() > 1065 ){
			$('.wrapper').width(1280);
			$('.sidebar-right').show();
		}
		else {
			$('.sidebar-right').hide();
			$('.wrapper').width(1026);
		};
	$(window).resize(function(){
		if($(window).width() > 1065 ){
			$('.wrapper').width(1280);
			$('.sidebar-right').show();
		}
		else {
			$('.sidebar-right').hide();
			$('.wrapper').width(1026);
		};		
	});

});

function slideSwitch() {
    var $active = $('.sidebar-right IMG.active');

    if ( $active.length == 0 ) $active = $('.sidebar-right IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.sidebar-right 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}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

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