
	var Likes = new Object();
	
	Likes.prepare = (function(){
	
		$(".pg_UILike").click(function(){
			var button = this;

			if (userlogin) {
				$("#pg_likes_status").html("Sending your favour... please wait").hide().fadeIn();
				$.post(CFG.urlpath+"/plugins/likes/post.php", {action:"add",lid:$(button).attr("lid"), status:$(button).attr("val")},function(data) {
					//alert(data);
					if (typeof(data) == "object") {
						if (data.success == true) {
							$("#pg_likes_status").html(data.message).show();
							$(".pg_UILike > .count_like").text(data.count_like).hide().fadeIn();
							$(".pg_UILike > .count_unlike").text(data.count_unlike).hide().fadeIn();
						} else {
							$("#pg_likes_status").html("Try again").show();
						}
					} else {
						// not an object
						//alert(data);
					}
				}, 'json');
				return false;
			} else {
				$("#pg_likes_status").hide().fadeIn();
			}
		});
	});


$(document).ready(function(){
	Likes.prepare();
});