var Radiocsoport = function(id, initobj) {
	var $ = function(id) { return document.getElementById(id); };
	var szulo = ((typeof(id).toLowerCase() == 'string') ? $(id) : id), self = this, initobject = initobj;
	var imgsrc = 'i/s.gif';
	var beallitasok = {
		normal: false,
		bekapcsolt: false,
		over: false
	};

	this.statuszvalt = function(label, hivo) {
		if (label.radio.checked) {
			return false;
		}
		if (hivo === false) {
			label.radio.checked = true;
		}
		var tobbi = szulo.getElementsByTagName('input');
		for (var i = 0; i < tobbi.length; i++) {
			if (tobbi[i].name == label.radio.name) {
				if (hivo === false) {
					tobbi[i].checked = (tobbi[i] == label.radio);
				}
				tobbi[i].label.className = ((tobbi[i].checked) ? beallitasok.bekapcsolt : beallitasok.normal);
			}
		}
		if (beallitasok.over !== undefined) {
			label.className += ' ' + beallitasok.over;
		}
		if (typeof(label.onclck) == 'function') {
			label.onclck();
		}
		return true;
	};

	function ujradio(radio) {
		var img = document.createElement('img');
		img.alt = '';
		img.src = imgsrc;
		radio.style.display = 'none';
		var label = radio.parentNode;
		label.className = ((radio.checked) ? beallitasok.bekapcsolt : beallitasok.normal);
		label.insertBefore(img, radio.nextSibling);
		label.konstruktor = self;
		label.radio = radio;
		label.onclick = function() { this.konstruktor.statuszvalt(this, false); return false; };
		if (beallitasok.over !== false) {
			label.onmouseover = function() { this.className += ' ' + beallitasok.over; };
			label.onmouseout = function() { this.className = ((this.radio.checked) ? beallitasok.bekapcsolt : beallitasok.normal); };
		}
		radio.label = label;
	}

	function konstruktor() {
		var i;

		if (initobject !== undefined) {
			for (i in initobject) {
				beallitasok[i] = initobject[i];
			}
		}
		var radiok = szulo.getElementsByTagName('input');
		for (i = 0; i < radiok.length; i++) {
			if (radiok[i].type == 'radio') {
				ujradio(radiok[i]);
			}
		}
	}

	konstruktor();
};
