function Blog() {

	this.disabled = false;

	this.timer;
	
	this.start = function() {
		
		var self = this;
	
		if($('#posts .post').length > 3) {
			
			this.timer = setInterval(function() {
			
				if(!self.disabled) {
				
					self.disabled = true;
				
					$('#posts').animate({
						left: parseInt($('#posts').css('left')) - (282 + 40) + 'px'
					}, 1400, 'easeInOutQuart', function() {
					
						var first = $(this).find('.post:first');
						
						first.clone().appendTo($(this));
						
						$(this).css({
							left: parseInt($('#posts').css('left')) + (282 + 40) + 'px'
						})
						
						first.remove();
						
						self.disabled = false;
						
					});
				
				}
				
			}, 5000);
	
		}
		
	};
	
	this.stop = function() {
		window.clearInterval(this.timer);
	};

}

$(document).ready(function() {

	if($('#posts').length > 0) {
		blog = new Blog;
		blog.start();
	}
	
	$('a[class=modal]').fancybox();

});

$(window).load(function() {
	if($('#signup-success').length > 0) {
		$('a[href=#signup-success]').trigger('click');
	}
});
