var Details = {
	init: function (){
		this.starbox = new Starbox(
		  "starbox",                                // the id of your element
		  Details.average,                                // average rating to start with
		  {
		    buttons: 10,                          // amount of clickable areas
		    className : 'pointy',                // default class
		    color: false,                         // overwrites the css style to set color on the stars
		    duration: 0.6,                        // duration of revert effect, when effects are used
		    effect: {
		      mouseover: false,                   // use effects on mouseover, default false
		      mouseout: true                      // use effects on mouseout, default when available
		    },
		    hoverColor: false,                    // overwrites the css hover color
		    hoverClass: 'hover',                  // the css hover class color
		    ghostColor: false,                    // the color of the ghost stars, if used
		    ghosting: false,                      // ghosts the previous vote
		    identity: false,                      // a unique value you can give each starbox
		    indicator: false,                     // use an indicator, default false
		    inverse: false,                       // inverse the stars, right to left
		    locked: (Details.is_rate ? true : false),                        // lock the starbox to prevent voting
		    max: 5,                               // the maximum rating of the starbox
		    onRate: this.rate.bind(this),                        // or function(element, memo) {}
		    ratedClass: 'rated',                  // class when rated
		    overlay: 'pointy.png',               // default star overlay image
		    stars: 5,                             // the amount of stars
		    total: 1                              // amount of votes cast
		  }
		);
		if(Details.is_rate){
			var a = $("raiting-results");
			if(a){
				a.update("Вы уже проголосовали. Ваша оценка <b>"+Details.is_rate+"</b>");
				a.show();
			}
		}
	},
	rate: function(el, ev){
		if(ev.rated){
			Main.request("ajax_general.php", {
				parameters: {"cmd": "rate", "name_id": Details.name_id, "rate": ev.rated},
				onSuccess: function(json){
					if(json.is_error == false && json.rate){
						var a = $("raiting-results");
						if(a){
							a.update("Вы оценили в <b>"+ev.rated+"</b> баллов. Средняя оценка <b>"+json.rate+" баллов</b>");
							a.show();
							this.starbox.updateAverage(json.rate);
							this.starbox.disable();
						}

					}
				},
				scope: this
			});
		}
	}
};
