function RuleTypePositiveWidgetType(id, value, positiveOnly)
{
    this.value        = null;
    this.positiveOnly = false;
    this.widgetid     = '';

    if (typeof positiveOnly !== 'undefined' && positiveOnly !== null) {
        this.positiveOnly = positiveOnly;
    }

    if (typeof value !== 'undefined' && value !== null) {
        this.value = value;
    }

}

RuleTypePositiveWidgetType.prototype = {
    reset: function()
    {
        this.simpleResult = false;
        this.widget       = null;
        this.value        = null;
        this.server       = true;
        this.client       = true;
        this.errors       = [];

    },

    setWidgetid: function(wid)
    {
        this.widgetid = wid;

    },

    setValue: function(val)
    {
        this.value = val;

    },

    validate: function()
    {
        // Check negative value, must already pass numeric test.
        if (this.positiveOnly === true) {
            var val = Number(this.value);
            if (val < 0) {
                return false;
            }
        }

        return true;

    }

};
