var _msgboxtmout;
function DisplayMessage(item, className, message) {
    item.html(message).addClass(className).fadeIn('slow');
    if (this._messageBoxTimeout != null) {
        clearTimeout(_msgboxtmout);
    }
    _msgboxtmout = setTimeout(function () { HideMessage(item, className) }, 5000);
}

function HideMessage(item, className) {
    item.delay(3000).html('').removeClass(className);
    _msgboxtmout = null;
}

/**
 * Allowing you to select on or multiple items
 */
function CustomTickList(identifier) {
    this._identifier = identifier;
}

CustomTickList.prototype._identifier = null;

CustomTickList.prototype.All = function (index) {
    return $(this).hasClass("all");
}
CustomTickList.prototype.NotAll = function (index) {
    return !$(this).hasClass("all");
}

CustomTickList.prototype.Constructor = function () {

    $('li', this._identifier).filter(this.NotAll).click(this, function (event) {

        if ($(this).hasClass("selected")) {
            $(this).removeClass("selected");
            $('li.all', $(this).parent()).removeClass("selected");
        }
        else {
            $(this).addClass("selected");
            var allSelected = true;
            $('li', $(this).parent()).each(function (index) {
                if (!$(this).hasClass("all")) {
                    allSelected = allSelected && $(this).hasClass("selected");
                }
            });
            if (allSelected) {
                $('li.all', $(this).parent()).addClass("selected");
            }
        }

        event.data.OnClickItem(this);
    });

    $('li', this._identifier).filter(this.All).click(this, function (event) {
        if ($(this).hasClass("selected")) {
            $('li', $(this).parent()).removeClass("selected");
        }
        else {
            $('li', $(this).parent()).addClass("selected");
        }
        event.data.OnClickAll(this);
    });
};


CustomTickList.prototype.OnClickItem = function (obj) {
    
};

CustomTickList.prototype.OnClickAll = function (obj) {
    
};

