$(document).ready(function(){
	 
	 setTimeout(function(){
    
        $("#uno").animate({"left":"0px"},1000,"easeOutQuart");

    },500);
    setTimeout(function(){
    
        $("#due").animate({"left":"240px"},1500,"easeOutQuart");

    },1500);
    
    setTimeout(function(){
    
        $("#tre").animate({"left":"673px"},2000,"easeOutQuart");
        
    },2000);
    
    setTimeout(function(){
    
        $(".scroll-pane").fadeIn({duration:1200});
    
    },3000);
    
     setTimeout(function(){
        
        $("#zero").fadeIn({duration:1200});
        
    },4000);
    
    setTimeout(function(){
    
    $("#bkgs").hide();
    
    },5000);
	
    $(".pics").width($("#zero").width());
	$(".pics").height($("#zero").height());

	
    var theid = $("#menu a.active");
    var theidx = $("a.be").index(theid);
    var theh = (theidx*32)+94;
       
    $(theid).animate({"height":"359px"},1200,"easeOutQuart");
    
    $("#menu").css({"width":"260px"});
   
    $("#uno,#due,#tre").css({"top":theh+"px"}); 
    $(".scroll-pane").jScrollPane({scrollbarWidth: 8});
    $(".scroll-pane").hide();
    
    $(theid).data("ck","ok");
    $(theid).trigger("mouseover");
    
    	var sh = screen.availHeight; //$(window).height();
	 
		if (sh>900){
		//var smartsize ="large";
		var getme = $("#galleryl");
		$("#gallerym,#gallerys").empty();
		
		}else if (sh>700){
		//var smartsize ="medium";
		var getme = $("#gallerym");
		$("#galleryl,#gallerys").empty();
		
		}else{
		//var smartsize ="small";
		var getme = $("#gallerys");
		$("#gallerym,#galleryl").empty();
		}
		
		
         $(getme).cycle({
                        startingSlide: 0,
                        speed:  1200, 
    				    timeout: 7000, 
    				    next:   '#next', 
    				    prev:   '#prev',
    				    fx:     'fade',
    				    before:    function(currSlideElement, nextSlideElement, options, forwardFlag) {
    				        
    				     var source = $(nextSlideElement).attr("src");
    				     var target = $("#zero .pics");  
    				       $(target).css({opacity:0});
			               $(target).css({'background-image':'url('+source+')'});
			               $(target).stop().animate({opacity:1},800);
    				    
    				    }
         });    
         
         
         $(".pics").toggle(function(){
         	
         	$("#tre").animate({left:"255px"},2500,"easeOutQuart");
         	
         	setTimeout(function(){
         	$("#due").animate({left:"-178px"},1500,"easeOutQuart");
         	},1000);
         	
         	         
         },function(){
         
         	$("#due").animate({"left":"240px"},1500,"easeOutQuart");
			
			setTimeout(function(){
			$("#tre").animate({"left":"673px"},2000,"easeOutQuart");
			},500);
        
    	 
         });
         
         
          $("ul.selector a:eq(0),#close").click(function(){
                $(".pics").trigger("click");
         
            });
     
});


