var contentobject_id = 0;
var contentobject_attribute_id = 0;
function onAjaxSuccess_count(data)
{
	$( '#nxc_likes_result_'+contentobject_id+'_'+contentobject_attribute_id ).text( data );
}
function onAjaxSuccess_add(data)
{
	$.post(
		url_count,
		{
			'type': "count",
			'contentobject_id': contentobject_id,
			'contentobject_attribute_id': contentobject_attribute_id
		},
		onAjaxSuccess_count
	);
}

var AddLikeThisEvents = function(current_el )
{
	var linkID = $( current_el ).attr( "id" );
	$( current_el ).text( "You like it!" );
	$( current_el ).addClass( "liked" );
	if( typeof linkID != 'undefined' )
	{
		var arrayID = linkID.split('_');
		contentobject_id = arrayID[3];
		contentobject_attribute_id = arrayID[4];
		$.post(
			url_add,
			{
				'type': "add",
				'async': false,
				'contentobject_id': contentobject_id,
				'contentobject_attribute_id': contentobject_attribute_id
			},
			onAjaxSuccess_add
		);
	}
	return false;
}
$( document ).ready(
	function()
	{
		//$( "a.like" ).bind( 'click', AddLikeThisEvents );
	}
);

