var FwpRating = new Class({
	Implements: Options,

	options: {
		container: null,
		amount: 5
	},

	initialize: function(options) {
		this.setOptions(options);

		if (!$defined($(this.options.container))) {
			return false;
		}

		//var container = $(this.options.container).getElements('a');
		var container = $('rating-elements').getElements('a');

		var myFx = new Fx.Morph($('prod-rate'), {
		    onComplete: function(){
		        //alert('complete');
		    }
		});

		if (navigator.appVersion.indexOf('MSIE 6.0') == '-1') {
			$('boxWithoutJs').setStyle('display','none');               /* Js weiche für user ohne JS. */
			$('prod-rating-background').removeClass('none');
			$('rating-elements').removeClass('none'); 	/*			*/
		}
		$('prod-rate').setStyle('width', (productRate*23));


		container.each(function(el, index) {
			el.addEvent('mouseover', function(e) {
				myFx.pause();
				myFx.start({
				    'width': [$('prod-rate').getStyle('width').toInt(), (23 * (index + 1))]
				});
			});

			el.addEvent('mouseout', function(e) {
				myFx.pause();
				myFx.start({
					'width': [$('prod-rate').getStyle('width').toInt(), (productRate*23)]
				});
			});

			el.addEvent('click', function(e) {
				e.stop();
				//$('Product_vote').send();
				//alert('erfolgreich abgestimmt');
				$('Product_vote').getElements('select').set('value', (index + 1));
				document.vote.submit();
			});
		});
	}
});
