/* cover */
function CoverModel()
{
	var handle = this;

	this.controller		=	"cover";
	this.speed			=	500;
	this.cat_id			=	1;
	this.msg			=	language.msg || [];
	var gate			=	conf.base_url + 'rate/gate';

	var log = function(msg, type) {
		state_obj.log(this.controller + "_out", msg, type);
	};

	this.rateholder = function (state) {
		if (state)	$("#rate_wrapper").show()
		else		$("#rate_wrapper").remove();
	}

	this.rateCover = function (id, rate) {
		if (id == undefined || id < 1 || rate == undefined || rate < 0 || rate > 9) return;
		$.post(gate, {act:"rate", id:id, rate:rate}, function (data) {
				if (data.state) {
					handle.voted = true;
					handle.rateholder(false);
				}
				log(data.msg, 2);
				document.location = conf.base_url + 'rate';
			},
			"json"
		);
	};
	this.init = function () {
		
	}
	this.init();
}
