        ZONTIK.Class.create("ZONTIK.Controls.SliceGallery", ZONTIK.Controls.Control, 
                function(config) {
                    var thisContext = this;
                    this.config = config;
                    this.items = config.items;
                    this.target = config.target;
                    $(document).ready(function(){
                      thisContext.initialize();
                    });
                }, 
                {
                    animSpeed: 500,
                    config: {},
                    i: 0,
                    j: 0,
                    sliceWidth: 0,
                
                    appendSlice: function(i) {
                        $("#" + this.target + " #Gallery").append(this.getSliceHtml(i));
                        $("#GallerySlice" + i).css("width", this.sliceWidth);
                    },

                    getExtraIeClass: function() {
                        if ($.browser.msie) {
                            return " class='GalleryIe'";
                        }
                    },
                
                    getHtml: function() {
                        var html = "<div id='Gallery'" + this.getExtraIeClass() + ">";
                        for (var i=0; i < this.items.length; i++) {
                            html += this.getSliceHtml(i);
                        }
                        html += "</div>";
                        return html;
                    },
                    
                    getSliceHtml: function(i) {
                        var html =  "<div id='GallerySlice" + i + "' class='GallerySlice'>";
                        html +=     "<img src='" + this.items[i].src + "' onClick='" + this.items[i].link + "'>";
                        html +=     "</div>";
                        return html;
                    },

                    getSliceWidth: function() {
                       return this.config.maxwidth/this.config.maxlength;
                    },
                    
                    initialize: function() {
                        $("#" + this.target).html(this.getHtml());
                        this.setSliceWidths();
                        this.setFlippers();
                    },
                    
                    nextPage: function() {
                        if (this.i < this.items.length) {
                            this.removeSlice(this.i, ZONTIK.Delegate.create(this, this.appendSlice, this.i));
                            this.i++;
                        } else {
                            this.i = 0;
                            this.nextPage();
                        }
                    },

                    prependSlice: function(i) {
                        $("#" + this.target + " #Gallery").prepend(this.getSliceHtml(i));
                        $("#GallerySlice" + i).css("width", 0);
                        $("#GallerySlice" + i).animate({width: this.sliceWidth}, this.animSpeed)
                    },

                    prevPage: function() {
                        if (this.i > 0) {;
                            this.removeSlice((this.i-1), ZONTIK.Delegate.create(this, this.prependSlice, (this.i-1)));
                            this.i--;
                        } else {
                            this.i = this.items.length;
                            this.prevPage();
                        }
                    },
                    
                    removeSlice: function(i, func) {
                        $("#GallerySlice" + i).attr("id", "GallerySlice" + i + "x");
                        func();
                        $("#GallerySlice" + i + "x").animate({width: 0}, this.animSpeed, function(){
                            $(this).remove();
                        });
                    },
                    
                    setFlippers: function() {
                        if (this.items.length > this.config.maxlength) {
                            $("#" + this.target).prepend("<a onClick='" + ZONTIK.Delegate.createAsString(this, this.nextPage) + "'><img src='/images/gallery.next.gif' id='GalleryNext'></a>");
                            $("#" + this.target).prepend("<a onClick='" + ZONTIK.Delegate.createAsString(this, this.prevPage) + "'><img src='/images/gallery.previous.gif' id='GalleryPrevious'></a>");
                        }
                    },
                    
                    setSliceWidths: function() {
                        this.sliceWidth = this.getSliceWidth();
                        $(".GallerySlice").css("width", this.sliceWidth);
                    }
                }
            );