

/*
 *
 * Livestreaming für die Startseite
 *
 */



var livestream = {
    
	seconds:1,

	getNext: function(){
	  setTimeout(
	    function() {  
		  if(livestream.seconds<300){
		    
			
			
			 
			 
			   $.ajax({
				  url: 'includes/livestream/ajaxhandler_new_entry.php',
				  type: 'POST',
				  data: 'lid='+livestream.seconds,
				  success: function( d ) { 

					$("#livestream_first").after(d);
					
					
					$("#lsid_"+livestream.seconds).slideDown("slow", 
					  function(){
						if(livestream.seconds>8){
						  $(".lsclass:last").slideUp("slow", function ()
							{
							  $(".lsclass:last").remove();
							  livestream.seconds++;
							  
							}
						  );
						}
						else{
						  livestream.seconds++;
						}
					  }
					);
					
					
					
				  },
				  complete: function(){
					  livestream.getNext();
				  }
				});

			
			
		  }
		}
		, 3000
	   );
	}
	

}


$(document).ready(function(){
  livestream.getNext();
});


