$(document).ready(function() {
	
	$('#ipadslider').nivoSlider({
		effect:'fade',
		controlNav: false,
		directionNav: false,
		pauseTime: 3000
	});
    //move the image in pixel
    var move = -15;
    
    //zoom percentage, 1.2 =120%
    var zoom = 1.2;
    
    //On mouse over those thumbnail
    $('.fadebox').hover(function() {
        
        //Set the width and height according to the zoom percentage
        width = $(this).width() * zoom;
        height = $(this).height() * zoom;

        
        //Move and zoom the image
        $(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:400});
        
        //Display the caption
        $(this).find('div.caption').stop(false,true).fadeIn(400);
    },
    function() {
        //Reset the image
        $(this).find('img').stop(false,true).animate({'width':$(this).width(), 'height':$(this).height(), 'top':'0', 'left':'0'}, {duration:100});    

        //Hide the caption
        $(this).find('div.caption').stop(false,true).fadeOut(400);
    });	
    
    //slider
	$("#slider").easySlider({
		auto: true,
		controlsShow: false,
		speed: 2000,
		pause: 8000,
		continuous: true,
		prevText: 'x',
		nextText: 'x'
	});
	
	// focus fields
	$(function(){ $("label").inFieldLabels(); });		
    
    // highlight logo
	$('.changebackground')
			.css( {backgroundPosition: "0px 0px"} )
			.mouseover(function(){
				$(this).stop().animate({backgroundPosition:"(0px -30px)"}, {duration:200})
			})
			.mouseout(function(){
				$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:800, complete:function(){
					$(this).css({backgroundPosition: "0px 0px"})
				}})
			})			    
	// quote slider
    $('.slideshow').cycle({
		fx: 'scrollUp', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		pager: '#quotepager',
		timeout: 6500,
		pause: true,
		pauseOnPagerHover: true
	});
	
	// submit
	$('#submit').click(function() {
		//$('form:first').submit();
		$.post($('form:first').action, $('form:first').serialize(), function(data) {
			var feedback = '<div id="feedback">'+data+'</feedback>';
			if($('#feedback').length == 0) {
				$('form:first').append(feedback);
			} else {
				$('#feedback').replaceWith(feedback);
			}	
			$('#feedback').hide().fadeIn();		
	    });  		
		return false;
	});	
	
	
	$('#promowebdesign').hide().delay(1000).fadeIn('slow');
	$('#promoontwikkeling').hide().delay(2000).fadeIn();
	$('#promohosting').hide().delay(3000).fadeIn();
	$('#fullscreen').delay(5000).fadeOut('slow');
	//$('#promowebdesign').css('position', 'relative');
	//$('#promoontwikkeling').css('position', 'relative');
	//$('#promohosting').css('position', 'relative');
	
	timer = setTimeout(testing, 0);
	function testing() {
		$('.logofade').fadeIn(1000).fadeOut(2000).delay(2000);
		timer = setTimeout(testing, 0);
		
	}
	
	
	$('.beschikbaar').delay(1000).slideDown();
});	
