﻿$(document).ready(function () {


    /*****************************/

    /*  Fade in           
    
    /*****************************/ 

    var heightServices = $("#services").css('height');

    $('#welcome').css({ backgroundColor: '#fff', marginTop: '-55px' }).animate({
        opacity: 1,
        marginTop: "+=55px"
    }, 650, 'easeInOutQuad', function () {


		$("#services section:nth-child(1)").animate({
			height: heightServices,
			opacity: 1
		}, 300, 'easeInOutQuad', function(){
			$('h2, h3, p',this).css({marginLeft: '+=50px'}).animate({
        		opacity: 1,
        		marginLeft: "-=50px"
    		}, 350, 'easeInOutQuad');
		});
		$("#services section:nth-child(2)").delay(200).animate({
			height: heightServices,
			opacity: 1
		}, 300, 'easeInOutQuad', function(){
			$('h2, h3, p',this).css({marginLeft: '+=50px'}).animate({
        		opacity: 1,
        		marginLeft: "-=50px"
    		}, 350, 'easeInOutQuad');
		});
		$("#services section:nth-child(3)").delay(400).animate({
			height: heightServices,
			opacity: 1
		}, 300, 'easeInOutQuad', function(){
			$('h2, h3, p',this).css({marginLeft: '+=50px'}).animate({
        		opacity: 1,
        		marginLeft: "-=50px"
    		}, 350, 'easeInOutQuad');
		});
	

    	//$('#usp, #blog, #twitter').delay(650).animate({ opacity: 1 }, 250);

		$('#usp, #blogTeaser, #twitter, #contactUs').delay(650).animate({ opacity: 1}, 500);



		/*****************************/
	
		/*  USP parallax slideshow           
		
		/*****************************/ 
	
		var shiftSpeed = 1500;
		var items = 3;
	
		var bigSlideWidth = 960;
		var bigSlideHeight = 400;
		var smallSlideWidth = 860;
		var smallSlideHeight = 300;
		var tinySlideWidth = 760;
		var tinySlideHeight = 200;
	
		function shiftBoxes(boxN) {
			var col = ((boxN) % items) * -1;
			$("#panel-image").stop().animate({ left: bigSlideWidth * col }, shiftSpeed, "easeInOutCubic");
			$("#panel-text").stop().animate({ left: smallSlideWidth * col + 50 }, shiftSpeed, "easeInOutCubic");
			$("#panel-background").stop().animate({ left: tinySlideWidth * col + 100 }, shiftSpeed, "easeInOutCubic");
		}
	
		$("ul#nav li a").click(function () {
			navIndex = $("ul#nav li a").index(this);
			shiftBoxes(navIndex);
		});




    });


});
	


