function RuleTypeIntegerWidgetType(id, value, intOnly)
{
    this.value    = null;
    this.intOnly  = false;
    this.widgetid = '';

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

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

}

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

    },

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

    },

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

    },

    validate: function()
    {
        // Check if this is an integer.
        if (this.intOnly === true) {
            // Make sure it does not end with '.0' or '.000' etc..
            var checkVal     = this.value;
            var val          = Number(this.value);
            var decimalCheck = (/\.0+$|\.$/.test(checkVal));
            checkVal         = parseInt(val, 10);
            if (val !== checkVal || decimalCheck === true) {
                return false;
            }
        }

        return true;

    }

};
