function fader(object_name) {
    this.previous = null;
    this.current = 0;
    this.next = null;
    this.elements = new Array();
    this.box = null;
    this.box_opacity = 100;
    this.current_timeout = null;
    this.direction = 'next';
    
    this.object_name = object_name;
    
    var configuration = function() {
        this.box_class = null;
        this.box_height = '150px';
        this.box_id = 'fader';
        this.box_width = '200px';
        
        this.transition_time = 1;
        this.transition_pause = 10;
    }
    
    this.options = new configuration();
    
    this.draw_box = function() {
        var output = new Array();
        output.push('<div');
        if(this.options.box_class != null) {
            output.push('class="' + this.options.box_class + '"');
        }
        output.push('id="' + this.options.box_id + '" style="height: ' + this.options.box_height + '; position: relative; overflow: hidden; width: ' + this.options.box_width + ';">');
        output.push('</div>');
        document.write(output.join(' '));
        this.box = document.getElementById(this.options.box_id);
    }
    
    this.setup_transition = function() {
        if(this.elements.length < 1) {
            this.elements[0] = 'No Elements Assigned';
        }
        this.box.innerHTML = this.elements[this.current];
        this.previous = this.elements.length - 1;
        if(this.elements.length > 1) {
            this.next = 1;
        } else {
            this.next = 0;
        }
    }
    
    this.move_next = function() {
        window.clearTimeout(this.current_timeout);
        this.direction = 'next';
        this.fade_out();
    }
    
    this.move_previous = function() {
        window.clearTimeout(this.current_timeout);
        this.direction = 'previous';
        this.fade_out();
    }
    
    this.increment_current = function() {
        if((this.current + 1) >= this.elements.length) {
            this.previous = this.elements.length - 1;
            this.current = 0;
            if(this.elements.length > 1) {
                this.next = 1;
            }
        } else {
            this.previous = this.current;
            this.current++;
            if((this.current + 1) >= this.elements.length) {
                this.next = 0;
            } else {
                this.next = this.current + 1;
            }
        }
    }
    
    this.decrement_current = function() {
        if((this.current - 1) < 0) {
            if(this.elements.length <= 1) {
                this.previous = 0;
            } else {
                this.previous = this.elements.length - 2;
            }
            this.current = this.elements.length - 1;
            this.next = 0;
        } else {
            if((this.current - 2) < 0) {
                this.previous = this.elements.length - 1;
            } else {
                this.previous = this.current - 2;
            }
            this.current--;
            this.next = this.current + 1;
        }
    }
    
    this.start_transistion = function() {
        this.current_timeout = window.setTimeout(this.object_name + '.move_next();', this.options.transition_pause * 1000);
    }
    
    this.fade_in = function() {
        if(this.box_opacity < 100) {
            var increment = 100.0 / (((this.options.transition_time * 1000) / 2) / 50);
            this.box_opacity = Math.round(this.box_opacity + increment);
            this.box.style.opacity = String(this.box_opacity / 100); // CSS3
            this.box.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + this.box_opacity + ');'; // IE fix
            window.setTimeout(this.object_name + '.fade_in();', 50);
        } else {
            this.start_transistion();
        }
    }
    
    this.fade_out = function() {
        if(this.box_opacity > 0) {
            var increment = 100.0 / (((this.options.transition_time * 1000) / 2) / 50);
            this.box_opacity = Math.round(this.box_opacity - increment);
            this.box.style.opacity = String(this.box_opacity / 100); // CSS3
            this.box.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + this.box_opacity + ');'; // IE fix
            window.setTimeout(this.object_name + '.fade_out();', 50);
        } else {
            switch(this.direction) {
                case 'next':
                    this.box.innerHTML = this.elements[this.next];
                    this.increment_current();
                    this.fade_in();
                    break;
                case 'previous':
                    this.box.innerHTML = this.elements[this.previous];
                    this.decrement_current();
                    this.fade_in();
                    break;
            }
        }
    }
    
    this.update = function() {
        document.getElementById('previous').innerHTML = this.previous;
        document.getElementById('current').innerHTML = this.current;
        document.getElementById('next').innerHTML = this.next;
    }
    
    this.init = function() {
        this.draw_box();
        this.setup_transition();
        this.start_transistion();
    }
}

