
document.write('<script type="text/javascript" src="' + getParam('sJsStatic') + 'jscript/jquery/plugin/star/jquery.rating.js?v=' + getParam('sVersion') + '"></script>');
document.write('<link rel="stylesheet" type="text/css" href="' + getParam('sJsStatic') + 'jscript/jquery/plugin/star/jquery.rating.css?v=' + getParam('sVersion') + '" />');

Phpfox.rate =
{
	aParams: {},
	
	bDisable: false,
	
	init: function(aParams)
	{
		this.aParams = aParams;
		
		if (aParams['display'])
		{
			$('.js_rating_star').rating({		
					callback: function(mValue, oLink)
					{
						$($(this).parents('form:first')).ajaxCall('rate.process');
					},
			  		focus: function(mValue, oLink)
			  		{
			   			if (Phpfox.rate.bDisable === false)
			   			{
				  			var aParts = explode('|', $(this).val());
			   				$(this).parents('form:first').find('.js_rating_value:first').html(aParts[1]).show();
				   			$(this).parents('form:first').find('.js_rating_total').hide();
			   			}
			  		},
			  		blur: function(mValue, oLink)
			  		{
			    		if (Phpfox.rate.bDisable === false)
			   			{
				  			$(this).parents('form:first').find('.js_rating_value:first').html('').hide();
				    		$(this).parents('form:first').find('.js_rating_total').show();
			   			}
			  		}
			});
		}
		else
		{		
			$('.js_rating_star').rating({
			  		focus: function(mValue, oLink)
			  		{			   			
			  			$(this).parents('form:first').find('.js_rating_value:first').html(aParams['error_message']).show();
			   			$(this).parents('form:first').find('.js_rating_total').hide();
			  		},
			  		blur: function(mValue, oLink)
			  		{
			    		$(this).parents('form:first').find('.js_rating_value:first').html('').hide();
			    		$(this).parents('form:first').find('.js_rating_total').show();
			  		}
			});
	
			$('.js_rating_star').rating('disable');	
		}
	},
	
	success: function()
	{
		$('.js_rating_value').html('<b>' + oTranslations['rate.thanks_for_rating'] + '</b>').show();
		$('.js_rating_total').hide();
	
		$('.js_rating_star').rating('disable');		
		
		this.bDisable = true;
	}
}