var Landing = {

	init: function(){

		Cufon.replace('#promo h1, #tour h1, #tour ul li a, #customers h1, #signup-or-login, #pricing h1, #error h1, h1.picto, #why .column h2, .b-group h1, .b-group h2, #price .column h2, #text .page h1, #text .page h2, #forms .page h1, #docs h1');

		Landing.oldBrowsers();
	},

	oldBrowsers: function(){

		/* IE 6 or older */
		if ($.browser.msie && $.browser.version <= 6) {
			$('<div id="message" class="error">'
				+ '<p><strong>Seriously, you still use IE 6?</strong> To help improve your life, we recommend taking a look at <a href="http://www.mozilla.com/firefox/">Firefox</a> instead.</p>'
			+ '</div>').prependTo($('body'));
		}

		/* Firefox 3.0 or older */
		if ($.browser.mozilla && parseFloat($.browser.version) < 1.9) {
			$('<div id="message" class="error">'
				+ '<p><strong>Oh, your browser is outdated!</strong> We recommend to get a latest version of <a href="http://www.mozilla.com/firefox/">Firefox</a> instead.</p>'
			+ '</div>').prependTo($('body'));
		}
	},

	inboundAnim: function(){
		function animate() {
			$(mail).css({'top': mailTop, 'left': mailLeft});
			$(json).css({'top': jsonTop, 'left': jsonLeft});
			$(claw).css({'top': clawTop});

			$(mail)
			.animate({top:  '+=139'}, 200)
			.animate({top:  '+=0'},   600) // delay
			.animate({left: '+=272'}, 2000, function() {
				$(json).animate({left: '+=268'}, 2000, function(){
					$(claw).animate({top: '0'}, 600, function() {
						$(json).animate({top: '-=100'}, 1000);
						$(claw).animate({top: '-=100'}, 1000).animate({top: '+=0'}, 600, function() {
							animate()
						});
					});
				});
			});
		}

		if ($('.inbound-scheme').length) {
			var mail = $('.inbound-scheme .b-email');
			var mailTop  = $(mail).css('top');
			var mailLeft = $(mail).css('left');

			var json = $('.inbound-scheme .b-json');
			var jsonTop  = $(json).css('top');
			var jsonLeft = $(json).css('left');

			var claw = $('.inbound-scheme .b-claw');
			var clawTop  = $(claw).css('top');

			animate();
		}
	}

}

$(document).ready(Landing.init);
$(window).load(Landing.inboundAnim);
