(function($) 
{
	var twitterloader;
	
	function initializeTwitter(action) {
		$(".twitter-element").each(function() {
			var $this = $(this);
			$this.parent().css("background", "url(../img/layout/ajax-loader.gif) center center no-repeat");
		});
		loadTwitter(0);
	}
	
	function loadTwitter(index)
	{
		$this = $(".twitter-element").eq(index);
		
		if($this.length > 0)
		{	
			var id = $this.attr("id");
			id = id.replace("twitter-", "");
			
			$.get("/twitter/element/"+id, function(html) {
				$this.html(html).parent().css("background", "none");
				loadTwitter(index+1);
			});
		}
	}
	
	$.monsterTwitter = initializeTwitter;
	
})(jQuery);
