function show()
{
    var $html;
    var $img_element    = document.getElementById(this.img_name);
    $html = '<input type="hidden" name="'+this.name+'" id="'+this.name+'" value="'+this.value+'" ';
    if (this.checked == false) {
        $html += ' disabled="1" ';
    }
    $html += '/>';
    $html += '<a href="#" onClick="changeStateCheckBox(\''+this.name+'\',\''+this.img_name+'\', \''+this.imgArray['act'].src+'\', \''+this.imgArray['na'].src+'\');return false;">';
    $html += '<img border="0" alt="" style="display:inline" id="'+this.img_name+'" ';
    if (this.checked == true) {
        $html += ' src="'+this.imgArray['act'].src+'" ';
    } else {
        $html += ' src="'+this.imgArray['na'].src+'" ';
    }
    $html += '/></a>';
    document.write($html);    
}

function CheckBox($_name, $_value, $_checked, $_path)
{
    // properties
    this.name                    = $_name;
    this.value                    = $_value;
    this.checked                = $_checked    ||    false;
    this.path                    = $_path    ||    '_d/';
    this.img_name                = 'img'+this.name;
    this.imgArray                = new Array(2);
    this.imgArray['act']        = new Image();
    this.imgArray['na']            = new Image();
    // preload image
    this.imgArray['act'].src    = this.path + 'radio_on.gif';
    this.imgArray['na'].src        = this.path + 'radio_off.gif';
    // methods
    this.changeState            = changeState;
    this.show                     = show;
}

function changeState()
{
    changeStateCheckBox(this.name, this.img_name, this.imgArray['act'].src, this.imgArray['na'].src)
}


/********************************************************************/
function changeStateCheckBox($_name, $_img_name, $_act, $_no)
{    
    var $hidden_element    = document.getElementById($_name); 
    var $img_element    = document.getElementById($_img_name);
    
    if ($hidden_element.disabled == true) {
        $hidden_element.disabled    = false;
        $img_element.src            = $_act;
    } else {
        $hidden_element.disabled    = true;
        $img_element.src            = $_no;    
    }
    
}


