function nxcLikesGenreral(e)
{
	var contentobject_id = 0;
	var contentobject_attribute_id = 0;
	function onAjaxSuccess_count(data)
	{
		var output_likes_result = $( '#nxc_likes_result_'+contentobject_id+'_'+contentobject_attribute_id );
		
		$('<div class="likes_link hh_div_links">You like it!</div>').insertAfter($('#nxc_likes_link_' +contentobject_id+'_'+contentobject_attribute_id));
		$('#nxc_likes_link_' +contentobject_id+'_'+contentobject_attribute_id).remove();
		
		if( output_likes_result.length > 0 )
		{
			output_likes_result.text( data );
		}
		
		alert('Thank You!');
	}
	
	function setCookie(c_name,value,expiredays)
	{
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
	}
	
	function getCookie(c_name)
	{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
	}
	
	function onAjaxSuccess_add(data)
	{
		//365 - days
		setCookie('nxc_likes_link_' + contentobject_id + '_' + contentobject_attribute_id, 1, 365);

		$.post(
			url_count,
			{
				'type': "count",
				'contentobject_id': contentobject_id,
				'contentobject_attribute_id': contentobject_attribute_id
			},
			onAjaxSuccess_count
		);
		
	}
	$( "div a.i_like_this" ).click(
		function(e)
		{
			var omniture_on_for_accommodation = $("#omniture_on_for_accommodation").val();
			if (omniture_on_for_accommodation == 1) {
				omnitureShare('I like');
			}
			e.preventDefault();
			var linkID = $( this ).attr( "id" );
			var arrayID = linkID.split('_');
			contentobject_id = arrayID[3];
			contentobject_attribute_id = arrayID[4];
			$.post(
				url_add,
				{
					'type': "add",
					'contentobject_id': contentobject_id,
					'contentobject_attribute_id': contentobject_attribute_id
				},
				onAjaxSuccess_add
			);
		}
	);
}

$( document ).ready( nxcLikesGenreral );
