$(document).ready(function() {

	$('#nav').stop().delay(2000).animate({'marginLeft':'-90px'},1000);

    $('#nav').hover(
        function () {
            $(this).stop().animate({'marginLeft':'0'},200);
        },
        function () {
            $(this).stop().animate({'marginLeft':'-90px'},200);
        }
    );
    
    $('#nextslide').stop().delay(2000).animate({'marginLeft':'+40px'},1000);

    $('#nextslide').hover(
        function () {
            $(this).stop().animate({'marginLeft':'0'},200);
        },
        function () {
            $(this).stop().animate({'marginLeft':'+40px'},200);
        }
    );
    
    $('#next-project').stop().delay(2000).animate({'marginLeft':'+40px'},1000);

    $('#next-project').hover(
        function () {
            $(this).stop().animate({'marginLeft':'0'},200);
        },
        function () {
            $(this).stop().animate({'marginLeft':'+40px'},200);
        }
    );
    
    $('.scrollable-wrap .prev').stop().animate({'marginLeft':'-37px'},1000);

    $('.scrollable-wrap .prev').hover(
        function () {
            $(this).stop().animate({'marginLeft':'0'},200);
        },
        function () {
            $(this).stop().animate({'marginLeft':'-37px'},200);
        }
    );
    
    $('.scrollable-wrap .next').stop().animate({'marginLeft':'+37px'},1000);

    $('.scrollable-wrap .next').hover(
        function () {
            $(this).stop().animate({'marginLeft':'0'},200);
        },
        function () {
            $(this).stop().animate({'marginLeft':'+37px'},200);
        }
    );

	$(".scrollable").scrollable({circular: true, mousewheel: false}).navigator().autoscroll({
		interval: 6000,
		autopause: true	
	});
	
	$(".scroll").scrollable({ circular: true }).click(function() {
		$(this).data("scrollable").next();		
	});	
	
	$(".project").preloadImages({
        showSpeed: 500,
        easing: 'easeOutQuad'
    });
    
    $(".full-project").preloadImages({
        showSpeed: 500,
        easing: 'easeOutQuad'
    });
	
	$('.project').hover(function(){
		$(".caption", this).stop().animate({top:'0'},{queue:false,duration:160});
	}, function() {
		$(".caption", this).stop().animate({top:'192px'},{queue:false,duration:160});
	});	
	
	$('.description-trigger').hover(function(){
		$(".text").stop().animate({top:'0'},{queue:false,duration:260});
	}, function() {
		$(".text").stop().animate({top:'468px'},{queue:false,duration:260});
	});	
	
	$('.description-trigger-two').hover(function(){
		$(".text-two").stop().animate({top:'0'},{queue:false,duration:260});
	}, function() {
		$(".text-two").stop().animate({top:'468px'},{queue:false,duration:260});
	});	
	
	$('.description-grouped .description-trigger').hover(function(){
		$(".text").stop().animate({top:'0'},{queue:false,duration:260});
	}, function() {
		$(".text").stop().animate({top:'402px'},{queue:false,duration:260});
	});	
			
	$(".overlay-trigger[rel]").overlay({mask: '#5E696B'});		
	
	$(".tooltip-trigger-architecture").tooltip({
	    relative: true,
	    offset: [10, 0],
		effect: 'slide'
	});
		
	$(".tooltip-trigger-interiors").tooltip({
	    relative: true,
	    offset: [50, -20],
		effect: 'slide'
	});	
		
	$(".tooltip-trigger-planning").tooltip({
	    relative: true,
	    offset: [30, 3],
		effect: 'slide'
	});	
		
	$(".tooltip-trigger-furniture").tooltip({
	    relative: true,
	    offset: [60, 10],
		effect: 'slide'
	});	
		
	$(".tooltip-trigger-project").tooltip({
	    relative: true,
	    offset: [30, 3],
		effect: 'slide'
	});				
		
	$(".before").hover(
	function() {
		$('.before').animate({"opacity": "0"}, "slow");
	},
	function() {
		$('.before').animate({"opacity": "1"}, "slow");
	});
	
	if (navigator.platform == "iPad") return;
    $(".lazy").find("img").lazyload({
		effect:"fadeIn",
	    placeholder: "http://designblitzsf.com/wp-content/themes/blitz/images/grey.gif",
	    failurelimit : 99
	});
	
});
 
$(function(){
	$.fn.supersized.options = {  
		startwidth: 1500,  
		startheight: 875,
		vertical_center: 1,
		slideshow: 1,
		navigation: 1,
		transition: 1,
		pause_hover: 1,
		slide_counter: 0,
		slide_captions: 0,
		slide_interval: 8000  
	};
    $('#supersize').supersized(); 
});
