function show_notifications()
{
	if ($("#notification_board").is(":hidden")) {
		$("#notification_board").slideDown("slow");	
	}
}


$(document.body).click(function(){
									if ($("#notification_board").is(":visible")) {
										$("#notification_board").hide();	
									}
								});


function start_ajax(){
	setInterval(get_last_events, 5 * 60 * 1000, null);
}

function get_last_events(){
	$.getJSON("http://www.photolife.ws/forum/index.php?automodule=gallery&cmd=event&op=last_events&timecode=" + g_timecode,
			  function (json){
				  		for (index in json["li_array"])
				  			add_new_image_last5(json["li_array"][index]);
							
						if (json["last_recommended"] != null)
							change_last_recommended(json["last_recommended"]);
						g_timecode = json['timecode'];
				  }
			  );
}


function add_new_image_last5(li_item){
	//$(".last5div > ul > li:last").remove();
	setTimeout('remove_last_li', 1000);
	newli = $(li_item);
	ul = $(".last5div > ul");
	newli.children('img').ready( function() { newli.animate({ width: "190px" }, 1000).animate({ marginRight: li_margin + "px", marginLeft: li_margin + "px" }, 400); });
	ul.prepend(newli);
	newli.animate({ width: "180px" }, 1000).animate({ marginRight: li_margin + "px", marginLeft: li_margin + "px" }, 400);
	$(newli).mouseenter(on_li_mouseover);
	$(newli).mouseleave(on_li_mouseout);
	$(newli).click(on_li_click);

}

function remove_last_li(){
	$(".last5div > ul > li:last").remove();
}

function change_last_recommended(img)
{
	var hidden_li = $("#alliance_last_img > li:hidden");
	hidden_li.css('background', 'url(' + img['src'] + ') no-repeat center');
	hidden_li.find("input").val(img['url']); 
	
	$("#alliance_last_img > li:visible").fadeOut(1000, function() {
						$(this).css('position', 'absolute');
						hidden_li.css('position', '');
						hidden_li.fadeIn(1000);
					});
					

}

$(document).ready(start_ajax);
//http://www.photolife.ws/forum/index.php?automodule=gallery&cmd=event&op=last_events&timecode=1258715307 1258730539