// <![CDATA[

// LOADER
function loader() {
	//ajaxGetContent();
}

// AJAX
function ajaxGetContent(conteudo) {
	var SpostBody = {
			'accao': 'getContent',
			'conteudo': conteudo
		};
	new Ajax.Request( 
		"ajax_service.php",
		{
			method: "post",
			postBody: 'data=' + Object.toJSON(SpostBody),
			onSuccess: function(t) {ajaxShowContent(t); },
	  		on404: function(t) { alert('Erro 404: ' + t.statusText); },
	 		onFailure: function(t) { alert('Erro ' + t.status + ' -- ' + t.statusText); }
		}
	);
}
		
// ACTIONS
function ajaxShowContent(originalRequest) {
  var response = originalRequest.responseText.evalJSON();
  $('scrollable3').update();
  new Insertion.Bottom('scrollable3', response.response);
  startSlider3();
}

Ajax.Responders.register({
	onComplete: function() {

	}
});

function getFullComment( oid, img ){
	var postinfo = {
			'accao': 'getFullComment',
			'oid': oid
		};
	new Ajax.Request(
		"ajax_service.php",
		{
			method: "post",
			postBody: 'data=' + Object.toJSON(postinfo),
			onSuccess: function(t) {
				var comment = t.responseText.evalJSON();
  				$('comment_' + oid).update();
  				new Insertion.Bottom('comment_' + oid, comment.response);
				startSlider3();
			},
			onLoading: function(t) {
				$('comment_' + oid).innerHTML = '<img src="' + img + '" />';
			},
			on404: function(t) { alert('Erro 404: ' + t.statusText); },
	 		onFailure: function(t) { alert('Erro ' + t.status + ' -- ' + t.statusText); }
		}
	);
}

// ]]>

