function ActionRatingController(oElement) {

	this.oElementShow = null;
	this.oElementScores = null;
	this.aElementsShowDesc = null;
	this.aElementsDesc = null;
	this.oElementPlus = null;

	this.init(oElement);

}

ActionRatingController.CLASS_NAME_INVISIBLE = 'invisible';

ActionRatingController.prototype = {

	init : function(oElement) {

		var oThis = this;

		this.oElementScores = Common.Dom.getElementsByClassName(oElement, 'scores', 'div')[0];
		this.oElementShow = Common.Dom.getElementsByClassName(oElement, 'this', 'span')[0];
		this.oElementPlus = oElement.getElementsByTagName('img')[1];
		this.aElementsShowDesc = Common.Dom.getElementsByClassName(this.oElementScores, 'this', 'span');
		this.aElementsDesc = Common.Dom.getElementsByClassName(this.oElementScores, 'description', 'div');

		Common.Event.add(
			this.oElementShow,
			'click',
			function() {

				oThis.toggle();

			}
			);

		for(var i = 0; i < this.aElementsShowDesc.length; i++) {
			Common.Event.add(
				this.aElementsShowDesc[i],
				'click',
				function(iIndex) {

					return function() {

						oThis.toggleDescriptionByIndex(iIndex);

					}

				}(i)
				);
		}

	},

	toggle : function() {

		if(Common.Class.match(this.oElementScores, ActionRatingController.CLASS_NAME_INVISIBLE)) {

			Common.Class.add(this.oElementPlus, ActionRatingController.CLASS_NAME_INVISIBLE);
			Common.Class.remove(this.oElementScores, ActionRatingController.CLASS_NAME_INVISIBLE);

		}
		else {

			Common.Class.add(this.oElementScores, ActionRatingController.CLASS_NAME_INVISIBLE);
			Common.Class.remove(this.oElementPlus, ActionRatingController.CLASS_NAME_INVISIBLE);

		}

	},

	toggleDescriptionByIndex : function(iIndex) {

		if(!this.aElementsDesc[iIndex]) {
			return;
		}

		if(Common.Class.match(this.aElementsDesc[iIndex], ActionRatingController.CLASS_NAME_INVISIBLE)) {
			Common.Class.remove(this.aElementsDesc[iIndex], ActionRatingController.CLASS_NAME_INVISIBLE);
		}
		else {
			Common.Class.add(this.aElementsDesc[iIndex], ActionRatingController.CLASS_NAME_INVISIBLE);
		}

	}

};