﻿var collections = new Class({
    Implements: Options,
    _call: function (e) {
        switch (e.a) {
            case "try":
                this._tryGlass(e);
                break;
        }
    },
    options: {
        width: 228
    },
    initialize: function (options) {
        this.setOptions(options);
        /******* quick fix for FitPhotoBug default glassID on creation ********/
                var startupGlassId = this.options.glassID;
                if(startupGlassId)
                    this.options.onLoad = function() {
                        FitPhoto.tryOn(startupGlassId);
                    };
        /******* end quick fix for FitPhotoBug default glassID on creation ********/


        FitPhoto.create("fitPhotoBox", this.options);
        site.addEvent("glasses", function (e) { this._call(e); } .bind(this));
    },
    _tryGlass: function (e) {
        FitPhoto.tryOn(e.id);
    }
});
