$(document).ready(function() {

    $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };

	
		$(document).pngFix();
	
		$("#iphone").wait(2300).effect("shake", { times:2, distance: 5 }, 70);
		$("h1 a").wait(10300).effect("shake", { times:1, distance: 20 }, 100);

    $("li.switch1").hover(function(){
    $("#switcher #pill").stop(true, true);
		$("#switcher #pill").animate( { left: "0px" }, 250);
		$(".scroll").animate( { left: "0px" }, 350);
		$("#steps li.step1").fadeIn("slow");
		$("#steps li.step2").fadeOut("fast");
		$("#steps li.step3").fadeOut("fast");
		$("#steps li.step4").fadeOut("fast");
	},
		function(){$(this).addClass("done");
	});

	$("li.switch2").hover(function(){
		$("#switcher #pill").stop(true, true);
		$("#switcher #pill").animate( { left: "120px" }, 250);
		$(".scroll").animate( { left: "-332px" }, 350);
		$("#steps li.step1").fadeOut("fast");
		$("#steps li.step2").fadeIn("slow");
		$("#steps li.step3").fadeOut("fast");
		$("#steps li.step4").fadeOut("fast");
	},
		function(){$(this).addClass("done");
	});
	
	$("li.switch3").hover(function(){
		$("#switcher #pill").stop(true, true);
		$("#switcher #pill").animate( { left: "240px" }, 250);
		$(".scroll").animate( { left: "-664px" }, 350);
		$("#steps li.step1").fadeOut("fast");
		$("#steps li.step2").fadeOut("fast");
		$("#steps li.step3").fadeIn("slow");
		$("#steps li.step4").fadeOut("fast");
	},
		function(){$(this).addClass("done");
	});
	

 $("#screenshots a.fancy").fancybox({
 	'zoomSpeedIn': 300,
 	'zoomSpeedOut': 300,
 	'overlayShow': true,
 	'overlayOpacity': 0.7
 }); 

 $("a.video-fancy").fancybox({
 	'zoomSpeedIn': 300,
 	'zoomSpeedOut': 300,
 	'overlayShow': true,
 	'overlayOpacity': 0.7,
 	'frameWidth': 480,
 	'frameHeight': 365
 }); 
	
		
});