var mfRadio = function (id,formData) {

    /*
        inherit from base-class
    */
    var baseClass = new mariaForm_fieldBase(id,formData);
    
    for (var i in baseClass) {
        if (typeof(baseClass[i]) == "function") {
            this[i] = baseClass[i];
        }
    }
    
    /*
        overwrite the getter and setter
    */
    this.getValue = function () {
        return $('input:radio[name='+id+']:checked').val();
    };
    
    this.setValue = function (newVal) {
        $("#"+id+"_"+newVal).attr("checked",true);
    };
    
    this.setValues = function(newVals) {
        
        //delete all radiobuttons
        $('#'+id).html("");
        
        //add new radiobuttons
        var html = "";
        
        $.each(newVals, function(key, value){
        
            html+= "<li><input type='radio' value='" + newVals[key] + "' name='" + id + "' id='" + id + "_" + newVals[key] + "'";
            if (i == 0) {
                 html+= "checked='true'";
            }
            html+= "><label for='" + id + "_" + newVals[key] + "'>" + newVals[key] + "</label></li>";
            
        });
        
        
        /*for(var i = 0; i < newVals.length; i++)
        {                                             
            html+= "<li><input type='radio' value='" + newVals[i] + "' name='" + id + "' id='" + id + "_" + newVals[i] + "'";
            if (i == 0) {
                 html+= "checked='true'";
            }
             html+= "><label for='" + id + "_" + newVals[i] + "'>" + newVals[i] + "</label></li>";             
        }*/
        
        $('#'+id).html(html);
    };
    
}


