/*************************************************************************************************\
|* @author Unknown                                                                               *|
|* @version 1.0                                                                                  *|
\*************************************************************************************************/

/*************************************************************************************************\
|* @module SimpleRating                                                                          *|
|*                                                                                               *|
|* @description This class contains everything needed for the SimpleRating with ajax.            *|
|*                                                                                               *|
|* @version 1.0                                                                                  *|
\*************************************************************************************************/
if (!CLUBNICK.Modules) {
	CLUBNICK.Modules = {};
}

CLUBNICK.Modules.SimpleRating = (new function () {

	/*********************************************************************************************\
	|* @method init                                                                              *|
	|*                                                                                           *|
	|* @description Initializes all SimpleRatings, which are not disabled and not on a site      *|
	|* which's bods contains one of the classes .game, .videos or .search.                       *|
	\*********************************************************************************************/
	this.init = function () {
        var $ratings = $$('body:not(.games):not(.videos):not(.search) div.rating_cont .rating:not(.disable)');

        if ($ratings.empty()) {
            return;
        }

        $ratings.each(createSimpleRatingForElement);
	};
	
	/*********************************************************************************************\
	|* @method createSimpleRatingForElement                                                      *|
	|*                                                                                           *|
	|* @description Creates a new SimpleRating for the given element.                            *|
	\*********************************************************************************************/
	function createSimpleRatingForElement (element) {
        new SimpleRating(element);
	}
});