function Magnifier(container, dflt, sizes) {
    this.container = jQuery(container)[0];
    if (sizes && sizes.length) {
        this.SIZES = sizes;
    }
    var stored_state = jQuery.cookie('Magnifier_size');
    this.set(stored_state || dflt);
    var magnifier = this;
    jQuery('.down_btn', container).click(function() {
        magnifier.decrease();
    });
    jQuery('.up_btn', container).click(function() {
        magnifier.increase();
    });
}
Magnifier.prototype = {
    increase: function() {
        var l = this.SIZES.length;
        for (var c=l; c=c-1; c>=0) {
            if (this.SIZES[c] == this._current) {
                break;
            }
        }
        c = c+1;
        if (c > 0  && c < l) {
            this.set(this.SIZES[c]);
        }
    },
    decrease: function() {
        var l = this.SIZES.length;
        for (var c=l; c=c-1; c>=0) {
            if (this.SIZES[c] == this._current) {
                break;
            }
        }
        c = c-1;
        if (c >= 0  && c < l) {
            this.set(this.SIZES[c]);
        }
    },
    set: function(size) {
        jQuery(this.container).css('font-size', size);
        this._current = size;
        jQuery.cookie('Magnifier_size', size, {path:'/'});
    },
    SIZES: ["xx-small", "x-small", "small", "medium", "large", "x-large",
            "xx-large"]
};


