var page=1;
var how_many;

function init(){
	how_many=jQuery("#how_many").get(0).innerHTML;
	get_data(how_many,page);
}

function get_data(p,n){
	nn=n+1;
	jQuery.ajax({
		type: "GET",
		url: "/wp-content/plugins/widgets/last-cats-script.php",
		dataType: "html",
		data: "p="+p+"&n="+n,
		success: function(html) {
			data=html;
			jQuery("#wid_content").empty();
			jQuery("#wid_content").append(html);
		}
	}); //close ajax(

	if (page==1) jQuery("#Previous").hide();
	else jQuery("#Previous").show();
	
	jQuery.ajax({
		type: "GET",
		url: "/wp-content/plugins/widgets/last-cats-script.php",
		dataType: "html",
		data: "p="+p+"&n="+nn,
		success: function(html) {
			if (html.search('wid_title')==-1) jQuery("#Next").hide();
			else jQuery("#Next").show();
		}
	}); //close ajax(

}

function prev(){
	page=page-1;
	get_data(how_many,page);
	if (page=='1') jQuery("#Previous").hide();
}

function next(){
	page=page+1;
	get_data(how_many,page);
}