axpTag_load = function(tagboardAjaxUrl, page) {
	$('tagboard-loading').style.visibility = "visible";
	var param = 'p='+page;
	new Ajax.Request(tagboardAjaxUrl, {
		method: 'get',   
		parameters: param,
		onSuccess: function(transport) {     
			$('tagboard-content').update(transport.responseText);
			$('tagboard-loading').style.visibility = "hidden";
		},
		onFailure: function(){ 
			$('tagboard-loading').style.visibility = "hidden";
		}
	});	
}

axpTag_save = function(tagboardAjaxUrl) {
	el = document.getElementById('loader');
	
	$('submit-tagboard').blur();
	
	if($F('nama').blank()) { alert('Field Name is required'); return false; }
	if($F('url').blank()) { alert('Field URL or Email is required'); return false; }
	if($F('pesan').blank()) { alert('Field Message is required'); return false; }
	
	var param = $('tagboard-form').serialize();
	$('tagboard-form').disable();
	el.style.visibility = 'visible';
	var ajaxContentRequest = new Ajax.Request(tagboardAjaxUrl,
	{
		 method: 'post', 
		 parameters: param,
		 onComplete : function(req) 
		 {
			if(req.responseText != '1') {
				alert(req.responseText);
			} else {
				axpTag_load(tagboardAjaxUrl, 1);
				p = 1;
				count++;
				if( (count/show) > 1 ) {
					$('tagboard-prev').style.visibility = "visible";
				}
				else $('tagboard-prev').style.visibility = 'hidden';	
				$('tagboard-next').style.visibility = 'hidden';														
			}
			$('tagboard-form').enable();
		 }
	
	});	
	
	el.style.visibility = 'hidden';
	return false;
}

axpTag_next = function(tagboardAjaxUrl, p) {
	if(p > 1) {
		p--;
		axpTag_load(tagboardAjaxUrl, p);
		$('tagboard-next').style.visibility = 'visible';
		$('tagboard-prev').style.visibility = 'visible';
		if( p==1 ) $('tagboard-next').style.visibility = 'hidden';
	} 
	return p;
}

axpTag_prev = function(tagboardAjaxUrl, p, maxp) {
	if(p < maxp) {
		p++;
		axpTag_load(tagboardAjaxUrl, p);
		$('tagboard-next').style.visibility = 'visible';
		$('tagboard-prev').style.visibility = 'visible';	
		if( p == maxp ) $('tagboard-prev').style.visibility = 'hidden';
	}
	return p;
}