function Radio( sCode )
{
	this._code = sCode;
	this._radio = document.getElementById( this._code );
	this._label = document.getElementById( "label_" + this._code );
	
	this._height = 20;
	
	this._radio._parent = this;
	this._label._parent = this;
	this._fieldset = this._radio.parentNode;
	
	this.addImage();
	
	this._button._parent = this;
	this._sibling = this._fieldset.getElementsByTagName( "input" );
	
	//this._label.onmouseover = this._onmouseover;
	this._label.onmouseout = this._onmouseout;
	this._label.onclick = this._onclick;
	
	this._radio.className += " hidden";
	
	if ( this._radio.checked )
		this._button.style.backgroundPosition = "0px -" + (this._height * 2) + "px";
};

Radio.prototype.addImage = function()
{
	var eImage = new Image();
	eImage.src = "/media/image/clear.gif";
	eImage.id = "button_" + this._code;
	eImage.className = "button";
	eImage.alt = "button";
	
	this._label.appendChild( eImage );
	this._button = eImage;
}

Radio.prototype._onmouseover = function( e )
{
	if ( !this._parent._radio.checked )
	{
		this._parent._button.style.backgroundPosition = "0px -" + this._parent._height + "px";
	}
};

Radio.prototype._onmouseout = function( e )
{
	if ( !this._parent._radio.checked )
	{
		this._parent._button.style.backgroundPosition = "0px 0px";
	}
};

Radio.prototype._onclick = function( e )
{	
	for ( var i = 0; i < this._parent._sibling.length; ++i )
	{
		this._parent._sibling[ i ]._parent._button.style.backgroundPosition = "0px 0px";
	}
	
	this._parent._radio.checked = true;
	this._parent._button.style.backgroundPosition = "0px -" + (this._parent._height * 2) + "px";
};
