$(document).ready(function () {
    
	    
	/*  
	  
    function showMenu() {
	 $(".menu_body").stop().animate({opacity: "100%", height: '100%'}, 300); 
	 }
	
	function hideMenu() { 
	 $(".menu_body").stop().animate({opacity: 0, height: 0}, 300, function(){
	 	$(".menu_body").hide().css("z-index","99");
	 }).css("z-index","-1"); 
	}
   
    $(".menu").hoverIntent({
     sensitivity: 1, 	// number = sensitivity threshold (must be 1 or higher)
     interval: 10,   	// number = milliseconds for onMouseOver polling interval
     over: showMenu,    // function = onMouseOver callback (required)
     timeout: 50,   	// number = milliseconds delay before onMouseOut
     out: hideMenu      // function = onMouseOut callback (required)
   });
   
   */
   
   
   	/*
	$(".module").mouseover(function(){
	     $(".menu_body").stop().animate({opacity: "100%", height: 260}, 300); 
 		$(".menu_body").css("z-index","99");
 		$(".inside-menu").stop().animate({top: 50}, 300); 
 		$('.menu_head').css('backgroundPosition', "0px -16px");
	    
	});
	
	$(".module").mouseout(function(){
	     $(".menu_body").stop().animate({opacity: 0, height: 0}, 300); 
 		$(".inside-menu").stop().animate({top: 100}, 300); 
 		$('.menu_head').css('backgroundPosition', "0px 0px");
	});	
	*/	

if ( $(".scrollable").length > 0) {

	var scrollableAPI = $(".scrollable").scrollable({ circular: true, mousewheel: false, api: true });
		$(".scrollable").navigator({

		// select #flowtabs to be used as navigator
		navi: ".navi",

		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',

		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current',

	});
	
	var allScrollables = scrollableAPI.getItems();

	scrollableAPI.onSeek(function(event) {
		$('.scrollable').animate({ height : $(allScrollables[this.getIndex()]).height() });
	}); 
	
	scrollableAPI.begin();

}

if($('.image > div').length) {
		
		var imageContainerWidth = 0;
		$('.image > div').each(function(index) {
			imageContainerWidth += $(this).outerWidth(true) + 100;
			
			$(this).delay(200*index).fadeIn(300);
			
			/*
			$(this).children().load(function() { 
				$(this).parent().delay(400*index).fadeIn(300);
			});
			*/
			
	    }); 	
		
		$('.image-container').css('width', imageContainerWidth + 150);
	}



});

$(window).load(function () {

		

	if($('#module-container').length) {
		
		var moduleContainerWidth = 0;
		$('.module').each(function(index) {
			moduleContainerWidth += $(this).outerWidth(true);
			
			$(this).delay(400*index).fadeIn(300);
			
			/*
			$(this).children().load(function() { 
				$(this).parent().delay(400*index).fadeIn(300);
			});
			*/
			
	    }); 	
		
		$('#module-container').css('width', moduleContainerWidth);
	}	
	

});
