﻿
function CG_AllItems() {
    var instance = [];
    this.singletonInstance = null;

    var getInstance = function () {
        if (!this.singletonInstance) {
            this.singletonInstance = createInstance();
        }
        return this.singletonInstance;
    }

    var createInstance = function () {
        return {
            add: function (moduleId) {
                var obj = new Object
                obj.moduleId = moduleId;
                obj.ReBindModal = function () {
                    //jQuery("input[id$='btnRefreshContent']").each(function(){if(jQuery(this).attr("value")==this.moduleId){__doPostBack(jQuery(this).attr("name"), 'OnClick');}});

                }
                obj.Init = function () {
                    jQuery(document).ready(function () {
                        if (jQuery("#dnn_ctr" + this.moduleId + "_ModuleContent a[rel*='lightbox']").size() > 0) { try { jQuery("#dnn_ctr" + this.moduleId + "_ModuleContent a[rel*='lightbox']").lightBox(lightBoxSettings); } catch (e) { } }
                    });
                }
                instance.push(obj);
                return instance;
            },
            instance: function (id) {
                for (i = 0; i < instance.length; i++) {
                    if (instance[i].moduleId == id) {
                        return instance[i];
                    }
                }
            },
            instances: function () {
                return instance;
            }
        }
    }
    return getInstance();
}

