
/**
 * @deprecated
function initPostSlider()
{
	
	$.ajax({
		type: "POST",
		url:"wp-content/plugins/post-slider/post-viewer.php",
		data:"",
		success:function(msg){
			$("#post-ajax").html(msg);
		}
		
	});
	
}
**/

$(document).ready (function(){
	rotate(0);	
});


function rotate(num)
{
	var categories;
	$.ajax({
		type:"POST",
		url:"wp-content/plugins/post-ajax-slider/list-category.php",
		data:"",
		success: function(msg){
			if(num >= 12)
			{
				num = 0;
			}
			//categories = msg.split("[n]");
			var msgx = "1[n]3[n]4[n]5[n]6[n]7[n]8[n]9[n]10[n]11[n]12[n]13[n]14";
			categories = msgx.split("[n]");
			
			$.ajax({
				type: "POST",
				url: "wp-content/plugins/post-ajax-slider/post-query.php",
				data: "cat="+categories[num],
				beforeSend: function() {
					$("#post-Ajax").fadeOut(1000);
					$("#thumbnail-post").hide();
				},
				success: function(msg){
					var message = msg.split("[SEPARATOR]");
					$("#text-post-ajax").html(message[0]+ " <a class='button-click' href='"+message[2]+"'>อ่านต่อ</a>" );	
					$("#post-Ajax").fadeIn(2500);
				}
		
			});
			setTimeout("rotate("+(++num)+")",10000);			
		}
	});
	
	
}