/**
* @author FinnD
* AjaxLoad v1.0
*/
$(document).ready(function() {
	var text=$("#loadmore").text();
	var posts=$("#ajax").children().length, offset=posts;
	$("#loadmore").click(function(){
			var getData = "posts="+posts+"&offset="+offset;
			$("#loadmore").html('<img src="http://habbonews.eu/wp-content/themes/HabboNewsV4/images/progress_bubbles.gif">');  
			// Bug - Offset nur einmalalig x addieren.
			offset+=posts;
			 $.ajax({
				xhr:  (window.ActiveXObject) ?
				function() {
				try {
				return new window.ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {}
				} :
				function() {
				return new window.XMLHttpRequest();
				},
				method:"get",
				url:"http://habbonews.eu/wp-content/themes/HabboNewsV4/getPosts.php",
				data:getData,
				success:function(data){
						$("#ajax").fadeIn("slow").append(data).end();
						// Hier ist eine Schleife	
							if (offset>=AllPosts) {
								$("#loadmore").fadeOut("fast");
							}
						$("#loadmore").html(text);  
					        }
						
			});
	});
});

