jQuery(document).ready(function() {

	var sel = ".appLeftMenu, .appRightMenu, .appContentPanel";
	var al = 0.7;
	slideSwitch(); var t=setInterval( "slideSwitch()", 10000 );

	jQuery(".app-panel").hover( 
		function() { clearInterval(t); 
			jQuery(".app-panel-active").removeClass("app-panel-active").stop().fadeTo("slow", 0.4); 
			jQuery(this).addClass("app-panel-active").stop().fadeTo("slow", 1);
			var s = jQuery(this).index();
    		var $active = jQuery('.slideshow .app-slide.active');
    		if ( $active.length == 0 ) $active = jQuery('.slideshow .app-slide:last');
    		var $next = jQuery('.slideshow .app-slide:eq('+s+')');
			$active.addClass('last-active');
		
			$next.css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 2000, function() {
					$active.removeClass('active last-active');
				});
			
		}, 
		function() { t=setInterval( "slideSwitch()", 10000 ); }
	);
	
	jQuery(".appTab img").fadeTo("slow",al).hover(
		function() { jQuery(this).stop().fadeTo("slow", 1); }, 
		function() { jQuery(this).stop().fadeTo("slow",al); }
	);
	var interval = setInterval(nextAlert, 5000);
	
	$(".app-panel, .slideshow .app-slide").click( function() {
		var p = $(this).find(".app-permalink").html();
		if (p !== "") { window.location = p; }
	});
	
});

