var CTopicRights = Class.create(CUbkCheck, {
	setChecked: function(input, state)
	{
		if (input.checked != state) {
			input.checked = state;
			this.imageToggle(input, '');
		}
	},

	read: function(check)
	{
		if (!check.checked) {
			// se non leggo, non faccio nulla
			var f = function() {
				check = check.up().next().down('input');
				this.setChecked(check, false);
			};
			for(i = 0; i < 2; i ++) {
				Ubk.tryThis(f.bind(this));
			}
		}
	},
	
	quote: function(check)
	{
		if (check.checked) {
			// se reply, devo poter leggere
			check = check.up().previous().down('input');
			this.setChecked(check, true);
		} else {
			// se no reply, manco mod
			var f = function() {
				check = check.up().next().down('input');
				this.setChecked(check, false);
			};
			Ubk.tryThis(f.bind(this));
		}
	},

	mod: function(check)
	{
		if (check.checked) {
			// se modero, faccio tutto
			for(i = 0; i < 2; i ++) {
				check = check.up().previous().down('input');
				this.setChecked(check, true);
			}
		}
	}
});

var CRightsFrontEnd = Class.create({
	initialize: function() {
		this.Topic = new CTopicRights();
	}
});
