$(document).ready(function() {

    if (navigator.appName != 'Microsoft Internet Explorer') {
		$.backstretch("assets/img/back.jpg");
	}
	
	
            $('#toleft').hide();
            $('#toright').hide();

    $('#top').hide();
    $('#box').hide();

    jQuery.fn.fadeToggle = function(speed, easing, callback) {
        return this.animate({
            opacity: 'toggle'
        }, speed, easing, callback);

    };

    $('img#logo2').hover(function() {
	$(this).attr("src","assets/img/logoklein.png");
		}, function() {
	$(this).attr("src","assets/img/logokleinhover.png");
    });


    $('#top img').hover(function() {
	$(this).attr("src","assets/img/backtotophover.png");
		}, function() {
	$(this).attr("src","assets/img/backtotop.png");
    });


    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

    
    $('#slideshow img.projectimg').click(function(event) {
        $('#top').show();
        $('#oldmen').hide();
        $('#work').load('http://ontwerpaandewinkel.nl/welcome/work/'+event.target.id);
	$('#container').removeClass('firstPage');
    });

    $('#logo2').toggle(function() {
        $('#about').animate({'top': '-400px'},'slow');
	$("#box").fadeIn();
    }, function() {
        $('#about').animate({'top': '0px'},'slow');
	$("#box").fadeOut();
	});

    $("#box").hover(
        function () {
            $('#box-content').animate({opacity: 1},200);
            $('#toleft').show();
            $('#toright').show();
            // $('#box-content').fadeIn(300);
        },
        function () {
            $('#box-content').animate({opacity: 0},200);
            $('#toleft').hide();
            $('#toright').hide();
            // $('#box-content').fadeOut(300);
        });
    
    jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
        return -c * ((t=t/d-1)*t*t*t - 1) + b;
    };

    jQuery(function( $ ){
        $('#slideshow').serialScroll({
            items:'li',
            prev:'a.prev',
            next:'a.next',
            start:0,
            duration:1200,
            force:false,
            stop:true,
            lock:false,
            cycle:false,
            easing:'easeOutQuart',
            jump: false
        });

    });
    
});

