var XApp_likes = function(xobj, options) {
	
	var plugin_name = 'likes';
	
	var plugin = function(xobj, options){
		// __construct();
		
		XApp_plugin.apply(this, arguments);
	};
	
	plugin.prototype = $.extend(new XApp_plugin.fn.onload(plugin_name), xobj, {
		
		options: {
			ui: true,
			can_rate: false,
			id: ''
		},
			
		init: function()
		{
			XApp_plugin.fn.init.apply(this, arguments);
			
			var self = this;
			
			self.initControl();
		},
		
		initControl: function()
		{
			var self = this;
			
			if( this.options.can_rate && this.options.id ) {
				
				this.$el.find('a.likeCtrl').hover(function(){
					$(this).addClass($(this).attr('rel')+'-act');
				}, function(){
					$(this).removeClass($(this).attr('rel')+'-act');
				}).click(function(){
					XApp().ajax({
						url : ___siteUrl('rating/'+$(this).attr('rel')+'/'+self.options.id),
						type : 'GET',
						autoeval: true,
						target : self.$el, 
						block : self.$el
					});
				});
			}
			
		}
	});
	
	
	return new plugin(xobj, options);	
};
