jQuery.fn.mailme = function(test) {
    var at = / at /;
    var dot = / dot /g;
    this.each( function() {
        var addr = jQuery(this).text().replace(at,"@").replace(dot,".");
        var title = jQuery(this).attr('title')
        $(this)
            .after('<a href="mailto:'+addr+'" title="'+title+'" class="'+test+'">'+ addr +'</a>')
            .remove();
    });
};
jQuery.fn.contains = function(txt) { return jQuery(this).indexOf(txt) >= 0; }
//
$(document).ready(function(){

	var taal = $('html').attr('lang');
	var wachten = "Even geduld a.u.b.";
	if(taal=="en"){
		wachten = "Please wait ...";
	}	

	// FOOTER NIEUWSBRIEF FORMULIER
	var divform = $('section[id^="footer"] .column3 .form');
	divform.after('<p class="boodschap"></p>');
	$('section[id^="footer"] .column3 .boodschap').hide();
	divform.find('form').submit(function(){
		if($(this).data('formstatus') !== 'submitting'){
			var form = $(this),
				formData = form.serialize(),
				formUrl = form.attr('action')+"&js=test&taal="+taal,
				formMethod = form.attr('method'),
				responseMsg = $('section[id^="footer"] .column3 .boodschap');					
			form.data('formstatus','submitting');
			$.ajax({
				url: formUrl,
				type: formMethod,
				data: formData,
				success:function(data){
					var responseData = jQuery.parseJSON(data);
					divform.slideUp('fast',function(){
				   		if(responseData.status=="success"){
					   		form.find('.input').val('').focus().blur();
					   	}
					   	form.data('formstatus','idle');
						responseMsg.html(responseData.message).fadeIn(400,function(){
							setTimeout(function(){
								responseMsg.fadeOut(200,function(){
									divform.slideDown('slow');
								});
							},3000);
						});						   	
					})
				}
			});
		}
		return false;
	});	
	
	// QUOTE FORMULIER
	$.ajax({
	  url: "/inc/stappen.inc.php",
	  type: "GET",
	  data: "js=test&taal="+taal,
	  success: function(data) {	  
	    $('body').append(data);	    
	    zetStappen();
	  }
	});
	function zetStappen(){
		var stappen = [];
		var aantal = $('#bgquotesbox .staps li').length;
		$('#bgquotesbox div[class^="stap"] input[type=hidden]').remove();
		$('#bgquotesbox .submit').replaceWith(function(){
			return '<div class="button"><a href="#">'+$(this).val()+'</a></div>';
		});
		$('#bgquotesbox').css('top','-635px').show();
		$('a[href*="?stap=stap1"]').click(function(){
			$('html, body').animate({scrollTop:0}, 'fast');
			$('#bgquotesbox').css('top','-635px').animate({top:0}, 1000, "easeInOutExpo");
			return false;
		});	
		$('#bgquotesbox .sluiten a').click(function(){
			$('#bgquotesbox').animate({top:-635}, 1000, "easeInOutExpo");
			return false;
		});
		
		// STAP 1
		$('#bgquotesbox .staps li#stap1').addClass('active').addClass('clickable');
		$('#bgquotesbox .staps li#stap1').bind('click', function(){
			$('#bgquotesbox div[class^="stap"]').hide();
			$('#bgquotesbox .staps li').removeClass('active');
			$('#bgquotesbox .staps li#stap3').removeClass('clickable').unbind();			
			$('#bgquotesbox .staps li#stap2').removeClass('clickable').unbind();
			$('#bgquotesbox .staps li#stap1').addClass('active');
			$('#bgquotesbox .staps').show();
			$('#bgquotesbox .stap1').show();			
		});
		$('#bgquotesbox .staps').show();
		$('#bgquotesbox .stap1').show();	
				
		$('#bgquotesbox .stap1 .button').click(function(){
			var form1 = $('#bgquotesbox .stap1 form');
			if(form1.data('formstatus') !== 'submitting'){
				var formData = form1.serialize(),
				formUrl = form1.attr('action')+"&js=test&taal="+taal,
				formMethod = form1.attr('method'), 
				responseMsg = form1.find('.boodschap');
				form1.data('formstatus','submitting');
				responseMsg.hide().addClass('response-waiting').html(wachten).fadeIn(1000);
				$.ajax({
					url: formUrl,
					type: formMethod,
					data: formData,
					success:function(data){
						var responseData = jQuery.parseJSON(data);
						responseMsg.fadeOut(200,function(){
							$(this).removeClass('response-waiting').html('');
							if(responseData.status=="success"){
								form1.data('formstatus','idle');
								$('#bgquotesbox div[class^="stap"]').hide();
								$('#bgquotesbox .staps li').removeClass('active');
								$('#bgquotesbox .staps li#stap2').addClass('active').addClass('clickable');
								$('#bgquotesbox .staps li#stap2').bind('click', function(){
									$('#bgquotesbox div[class^="stap"]').hide();
									$('#bgquotesbox .staps li').removeClass('active');
									$('#bgquotesbox .staps li#stap3').removeClass('clickable').unbind();										
									$('#bgquotesbox .staps li#stap2').addClass('active');
									$('#bgquotesbox .staps').show();
									$('#bgquotesbox .stap2').show();			
								});								
								$('#bgquotesbox .staps').show();
								$('#bgquotesbox .stap2').show();
							}else{
								form1.data('formstatus','idle');
								$(this).addClass(responseData.klass).html(responseData.message).fadeIn(400,function(){
									setTimeout(function(){
										responseMsg.fadeOut(200,function(){
											$(this).removeClass(responseData.klass);
										});
									},3000)
								});
							}
						});
					}
				});
			}
			return false;
		});			
		
		// STAP 2
		$('#bgquotesbox .stap2 .button').click(function(){
			var form1 = $('#bgquotesbox .stap1 form');
			var form2 = $('#bgquotesbox .stap2 form');
			if(form2.data('formstatus') !== 'submitting'){
				var formData = form1.serialize()+"&"+form2.serialize(),
				formUrl = form2.attr('action')+"&js=test&taal="+taal,
				formMethod = form2.attr('method'), 
				responseMsg = form2.find('.boodschap');
				form2.data('formstatus','submitting');
				responseMsg.hide().addClass('response-waiting').html(wachten).fadeIn(1000);
				$.ajax({
					url: formUrl,
					type: formMethod,
					data: formData,
					success:function(data){
						var responseData = jQuery.parseJSON(data);
						responseMsg.fadeOut(200,function(){
							$(this).removeClass('response-waiting').html('');
							if(responseData.status=="success"){
								form2.data('formstatus','idle');
								$('#bgquotesbox div[class^="stap"]').hide();
								$('#bgquotesbox .staps li').removeClass('active');
								$('#bgquotesbox .staps li#stap3').addClass('active').addClass('clickable');
								$('#bgquotesbox .staps li#stap3').bind('click', function(){
									$('#bgquotesbox div[class^="stap"]').hide();
									$('#bgquotesbox .staps li').removeClass('active');
									$('#bgquotesbox .staps li#stap3').addClass('active');
									$('#bgquotesbox .staps').show();
									$('#bgquotesbox .stap3').show();			
								});								
								$('#bgquotesbox .staps').show();
								$('#bgquotesbox .stap3').show();
							}else{
								form2.data('formstatus','idle');							
								$(this).addClass(responseData.klass).html(responseData.message).fadeIn(400,function(){
									setTimeout(function(){
										responseMsg.fadeOut(200,function(){
											$(this).removeClass(responseData.klass);
										});
									},3000)
								});
							}
						});
					}
				});
			}
			return false;
		});	
		
		// STAP 3
		$('#bgquotesbox .stap3 .button').click(function(){
			var form1 = $('#bgquotesbox .stap1 form');
			var form2 = $('#bgquotesbox .stap2 form');
			var form3 = $('#bgquotesbox .stap3 form');
			var voornaam = $('#bgquotesbox .stap1 form input[name="voornaam"]').val();
			if(form3.data('formstatus') !== 'submitting'){
				var formData = form1.serialize()+"&"+form2.serialize()+"&"+form3.serialize(),
				formUrl = form3.attr('action')+"&js=test&taal="+taal,
				formMethod = form3.attr('method'), 
				responseMsg = form3.find('.boodschap');
				form3.data('formstatus','submitting');
				responseMsg.hide().addClass('response-waiting').html(wachten).fadeIn(1000);
				$.ajax({
					url: formUrl,
					type: formMethod,
					data: formData,
					success:function(data){
						var responseData = jQuery.parseJSON(data);
						responseMsg.fadeOut(200,function(){
							$(this).removeClass('response-waiting').html('');
							if(responseData.status=="success"){
								form3.data('formstatus','idle');
								$('#bgquotesbox .stap4 h3 span').text(voornaam);
								$('#bgquotesbox div[class^="stap"]').hide();
								$('#bgquotesbox .staps li').removeClass('active').removeClass('clickable');
								$('#bgquotesbox .stap4').show();
							}else{
								form3.data('formstatus','idle');							
								$(this).addClass(responseData.klass).html(responseData.message).fadeIn(400,function(){
									setTimeout(function(){
										responseMsg.fadeOut(200,function(){
											$(this).removeClass(responseData.klass);
										});
									},3000)
								});
							}
						});
					}
				});
			}
			return false;
		});	
		
		// STAP 4
		$('#bgquotesbox .stap4 .button').click(function(){
			var form4 = $('#bgquotesbox .stap4 form');
			if(form4.data('formstatus') !== 'submitting'){
				var formData = form4.serialize(),
				formUrl = form4.attr('action')+"&js=test&taal="+taal,
				formMethod = form4.attr('method'), 
				responseMsg = form4.find('.boodschap');
				form4.data('formstatus','submitting');
				responseMsg.hide().addClass('response-waiting').html(wachten).fadeIn(1000);
				$.ajax({
					url: formUrl,
					type: formMethod,
					data: formData,
					success:function(data){
						var responseData = jQuery.parseJSON(data);
						responseMsg.fadeOut(200,function(){
							$(this).removeClass('response-waiting').html('');
							if(responseData.status=="success"){
								form4.data('formstatus','idle');
								$('#bgquotesbox .staps li').unbind();
								$('#bgquotesbox').animate({top:-635}, 1000, "easeInOutExpo",function(){
									$('#bgquotesbox div[class^="stap"] .input').val('').focus().blur();
									$('#bgquotesbox div[class^="stap"] .textarea').text('');
									$('#bgquotesbox div[class^="stap"] .checkbox').attr('checked',false);									
									$('#bgquotesbox div[class^="stap"] .droplist option:first').attr('selected','selected');
									$('#bgquotesbox div[class^="stap"]').hide();	
									$('#bgquotesbox .staps li#stap1').addClass('active').addClass('clickable');
									$('#bgquotesbox .staps li#stap1').bind('click', function(){
										$('#bgquotesbox div[class^="stap"]').hide();
										$('#bgquotesbox .staps li').removeClass('active');
										$('#bgquotesbox .staps li#stap3').removeClass('clickable').unbind();			
										$('#bgquotesbox .staps li#stap2').removeClass('clickable').unbind();
										$('#bgquotesbox .staps li#stap1').addClass('active');
										$('#bgquotesbox .staps').show();
										$('#bgquotesbox .stap1').show();			
									});									
									$('#bgquotesbox .staps').show();
									$('#bgquotesbox .stap1').show();								
								});																	

							}else{
								form4.data('formstatus','idle');
								$(this).addClass(responseData.klass).html(responseData.message).fadeIn(400,function(){
									setTimeout(function(){
										responseMsg.fadeOut(200,function(){
											$(this).removeClass(responseData.klass);
										});
									},3000)
								});
							}
						});
					}
				});
			}
			return false;
		});	
	}	

	// CLIENTS - AWARDS - LINKS
	if($('#whoweworkfor').length>0){
		$('#whoweworkfor').hide().delay(500).slideDown('slow');
	}

	// WEBDESIGN_DETAILS
	if($('#container_webdesigndetails header > p').length>0){
		$('#container_webdesigndetails header > p').wrapInner('<span />');
	}

	// SAY HELLO - CONTACTFORMULIER
	if($('#sayhello').length>0){
		$('#sayhello .getintouch').css('display','block');
		$('#sayhello .getintouch').append('<p class="boodschap"></p>');
		$('#sayhello .getintouch .boodschap').hide();		
		$('#sayhello .getintouch .button').click(function(){
			var form = $('#sayhello .getintouch form');		
			if(form.data('formstatus') !== 'submitting'){
				var formData = form.serialize(),
					formUrl = form.attr('action')+"&js=test",
					formMethod = form.attr('method'),
					responseMsg = $('#sayhello .getintouch .boodschap');				
				form.data('formstatus','submitting');
				$.ajax({
					url: formUrl,
					type: formMethod,
					data: formData,
					success:function(data){
						var responseData = jQuery.parseJSON(data);
				   		if(responseData.status=="success"){
							form.slideUp('fast',function(){
						   		$(this).find('.input').val('').focus().blur();
							   	$(this).data('formstatus','idle');
								responseMsg.html(responseData.message).fadeIn(400,function(){
									setTimeout(function(){
										responseMsg.fadeOut(200,function(){
											form.slideDown('slow');
										});
									},3000);
								});							   		
							});
					   	}else{
					   		form.data('formstatus','idle');
							responseMsg.html(responseData.message).fadeIn(400,function(){
								setTimeout(function(){
									responseMsg.fadeOut(200);
								},3000);
							});					   	
					   	}					   	
					}
				});
			}			
			return false;
		});
	}

	// EMAILADRESSEN AANMAKEN
	$('span.mailme').mailme();		

	// MASTERMINDS (ANYTHINGSLIDER)
	if($('#masterminds .slides .slide').length>1){
		$('#masterminds .slides > .slide').show();
		$('#masterminds .slides').anythingSlider({
			width               : 956,      // Override the default CSS width
			height              : 233,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			tooltipClass        : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : false,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : false,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : '',      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : false,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : false,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : false,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 5000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 1000,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
		});		
		$("#masterminds .previous a").click(function(){
			$('#masterminds .slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#masterminds .next a").click(function(){
			$('#masterminds .slides').data('AnythingSlider').goForward(true);
			return false;
		});	
	}

	
	// WEB DESIGN DETAILS (ANYTHINGSLIDER)
	if($('#webdesigndetails .slides figure').length>1){
		$('#webdesigndetails .bullet ul').remove();	
		$('#webdesigndetails .slides > figure').show();
		$('#webdesigndetails .slides').anythingSlider({
			width               : 1039,      // Override the default CSS width
			height              : 490,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			tooltipClass        : 'tooltip', // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : true,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : true,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : $('#webdesigndetails .bullet'),      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : true,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 5000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 1000,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
		});		
		$("#webdesigndetails .previous a").click(function(){
			$('#webdesigndetails .slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#webdesigndetails .next a").click(function(){
			$('#webdesigndetails .slides').data('AnythingSlider').goForward(true);
			return false;
		});	
	}
			
	// INDEX (ANYTHINGSLIDER)
	if($('#banner #slides aside').length>0){
		$('#banner .dots ul').remove();	
		$('#banner #slides > aside').show();
		$('#banner #slides').anythingSlider({
			width               : 1231,      //1454// Override the default CSS width
			height              : 328,      // Override the default CSS height
			expand              : false,     // If true, the entire slider will expand to fit the parent element
			resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
			showMultiple        : false,     // Set this value to a number and it will show that many slides at once
			theme               : 'default', // Theme name - adds a class name to the base element "anythingSlider-{theme}" so the loaded theme will work.
			startPanel          : 1,         // This sets the initial panel
			changeBy            : 1,         // Amount to go forward or back when changing panels.
			hashTags            : false,      // Should links change the hashtag in the URL?
			infiniteSlides      : true,      // if false, the slider will not wrap
			enableKeyboard      : false,      // if false, keyboard arrow keys will not work for the current panel.
			buildArrows         : false,      // If true, builds the forwards and backwards buttons
			buildNavigation     : true,      // If true, builds a list of anchor links to link to each panel
			enableNavigation    : true,      // if false, navigation links will still be visible, but not clickable.
			toggleControls      : false,     // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
			appendControlsTo    : $('#banner .dots'),      // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
			enablePlay          : false,      // if false, the play/stop button will still be visible, but not clickable.
			autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
			autoPlayLocked      : false,     // If true, user changing slides will not stop the slideshow
			startStopped        : false,     // If autoPlay is on, this can force it to start stopped
			pauseOnHover        : true,      // If true & the slideshow is active, the slideshow will pause on hover
			stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
			playRtl             : false,     // If true, the slideshow will move right-to-left
			delay               : 10000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
			resumeDelay         : 0,     // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			animationTime       : 1000,       // How long the slideshow transition takes (in milliseconds)
			easing              : "easeInOutExpo",   // Anything other than "linear" or "swing" requires the easing plugin
			maxOverallWidth     : 32766,     // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera			
			onSlideBegin        : function(event, slider){
				if(slider.$targetPage.text().indexOf("Site does matter")!= -1){
					$('#banner #boy').delay(1000).show().animate({left:346,opacity:1}, 1000, "easeOutExpo");
				}else if(slider.$currentPage.text().indexOf("Site does matter")!= -1){
					$('#banner #boy').animate({left:600,opacity:0}, 1000, "easeOutExpo", function(){
						$(this).hide();
					});
				}
			}
		});
		$('#banner #slides').anythingSliderFx({
			inFx : {
				'.slide1 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide1 h3' : { left : '0px', duration: 1200, easing : 'easeOutExpo' },
				'.slide2 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide2 h3' : { left : '0px', duration: 1000, easing : 'easeOutExpo' },
				'.slide2 figure' : { top : '0px', duration: 1200, easing : 'easeOutExpo' },
				'.slide3 h2' : { left : '0px', duration: 800, easing : 'easeOutExpo' },
				'.slide3 figure' : { top : '0px', duration: 1000, easing : 'easeOutExpo' },
				'.slide3 h3' : { top : '0px', duration: 1200, easing : 'easeOutExpo' }
			},
			outFx : {
				'.slide1 h2' : { left : '1231px', duration: 1200, easing : 'easeOutExpo' },
				'.slide1 h3' : { left : '1231px', duration: 800, easing : 'easeOutExpo' },
				'.slide2 h2' : { left : '1231px', duration: 1200, easing : 'easeOutExpo' },
				'.slide2 h3' : { left : '1231px', duration: 1000, easing : 'easeOutExpo' },
				'.slide2 figure' : { top : '328px', duration: 800, easing : 'easeOutExpo' },
				'.slide3 h2' : { left : '1231px', duration: 1200, easing : 'easeOutExpo' },
				'.slide3 figure' : { top : '328px', duration: 1000, easing : 'easeOutExpo' },
				'.slide3 h3' : { top : '328px', duration: 800, easing : 'easeOutExpo' }
			}
		});
		$("#banner .previous a").click(function(){
			$('#banner #slides').data('AnythingSlider').goBack(true);
			return false;
		});
		$("#banner .next a").click(function(){
			$('#banner #slides').data('AnythingSlider').goForward(true);
			return false;
		});
	}
	
	// INDEX (NEWS)
	$('.news h3').css('opacity','0');	
	$('.new:first h4').css('margin-left','50px').css('opacity','0').delay(1200).animate({marginLeft:0,top:0,opacity:1}, 800, "easeOutExpo");
	$('.new:first figure').css('left','10px').css('top','20px').css('opacity','0').delay(1000).animate({left:0,top:0,opacity:1}, 800, "easeOutExpo", function(){
		$('.news h3').animate({opacity:1}, 150);
		if($('.new').length>1){
		    setInterval(function(){
				$('.new:eq(1) h4').css('margin-left','50px').css('opacity','0').delay(200).animate({marginLeft:0,top:0,opacity:1}, 800, "easeOutExpo");
				$('.new:eq(1) figure').css('left','10px').css('top','20px').css('opacity','0').animate({left:0,top:0,opacity:1}, 800, "easeOutExpo");		    
				$('.new:first').hide().next('.new').fadeIn('slow').end().appendTo('.news');
		    },6000);
	    }
	});		
	
	// INDEX (FEATURES)
	if($('#features article').length>2){
		setInterval(function(){
			$('#features .articles article:first').hide().appendTo('.articles');
			$('#features .articles article:first').hide().removeClass('feature2').appendTo('.articles');
			$('#features .articles article:eq(0)').fadeIn('slow');
			$('#features .articles article:eq(1)').addClass('feature2').delay(200).fadeIn('slow');
			
		},6000);		
	}
	
	// INDEX (TESTIMONIALS)	
	if($('.testimonial').length>1){
		setInterval(function(){
			$('.testimonial:first').hide().next('.testimonial').fadeIn('slow').end().appendTo('.testimonials');
		},10000);		
	}
	
	// WEB DESIGN (QUICKSAND)
	if($('#webdesign .articles').length>0){
		var $types = $('.filter li a');
		var $articles = $('.articles');
		var $data = $articles.clone();
		$types.click(function(){
			$types.removeClass('active');
			$(this).addClass('active');
			if ($(this).attr('id')=='all'){
				var $filteredData = $data.find('li');
			}else{
				var $filteredData = $data.find('li[data-type*="'+$(this).attr('id')+'"]');
			}
			$articles.quicksand($filteredData, {
	          	    duration: 400,
	          	    adjustHeight: 'auto', // auto, dynamic of false
	          	    easing: 'swing'
			});	
			return false;
		});
	}
	
	// SERVICES (IPAD)
	if($('#services').length>0){
		$('.ipad .note').css('opacity','0');
		$('.ipad').css('top','251px').delay(1300).animate({top:0}, 800, "easeInOutExpo", function(){
			$(this).find('.note').animate({opacity:1}, 150);
			$(this).find('#screenshots').cycle({
				fx: 'scrollHorz',
				easing: 'easeInOutExpo',
			    speed:    1000, 
			    timeout:  3000 				
			});
		});
		$('.process aside').hover(
			function(){
				$(this).find('.popup').css('display','block').css('z-index','100');
				$(this).find('.popup a').click(function(){
					$(this).parent().parent().css('display','none').css('z-index','0');
				});
			},
			function(){
				$(this).find('.popup').css('display','none').css('z-index','0');				
			}
		);				
	}
	
	// MASTERMIND (PHOTOS)
	if($('#masterminds').length>0){
		$('.designer1 .photo').css('left','-200px').css('top','30px').css('opacity','0').delay(1000).animate({left:0,top:0,opacity:1}, 600, "easeOutExpo");
		$('.designer1 .pencil h3').css('opacity','0');
		$('.designer1 .pencil').css('left','-250px').css('top','50px').css('opacity','0').delay(1100).animate({left:0,top:0,opacity:1}, 600, "easeOutExpo", function(){
			$(this).find('h3').animate({opacity:1}, 150);
		});
		$('.designer2 h2').css('opacity','0');
		$('.designer2 .photo').css('top','201px').delay(1300).animate({top:0}, 800, "easeInOutExpo", function(){
			$(this).parent().find('h2').animate({opacity:1}, 150);
		});
	}
	
});
