Slideshow = function () {
    this.options = {
        speed: arguments[1] ? arguments[1].speed : 8,
        delay: arguments[1] ? arguments[1].delay : 1000
    }
    this.slideGroupList = document.getElementById(arguments[0]);
    this.slideGroupList_ELEMENTs = this.slideGroupList.getElementsByTagName("li");
    this.current = this.slideGroupList_ELEMENTs[0];
    this.current.style.left = "0px";
    this.next = this.slideGroupList_ELEMENTs[1];
    var self = this;
    this.onComplete = function () {
        self.slideGroupList.removeChild(self.current);
        setTimeout(function () {
            self.slideGroupList.appendChild(self.current);
            self.current.style.left = "-988px";
            self.current = self.next;
            self.next = self.slideGroupList_ELEMENTs[1];
            self.start();
        }, self.options.delay);
    }
}
    Slideshow.prototype.start = function () {
        //var self = this;
        //this.timer = setInterval(function () { self.sliding(); }, 0);
        this.sliding();
    }
    
    Slideshow.prototype.sliding = function () {
        //this.originalPos = this.next.offsetLeft;
        //slide(this.next, this.originalPos, 0, this.options.speed, this.timer, this.onComplete);
        $(this.next).animate( { left: 0 } , 800, "swing", this.onComplete);
    }
    
    //functions
//    function slide (obj, originalPos, targetPos, offset, timer, callback) {
//        var direction = (targetPos - originalPos)/Math.abs(targetPos - originalPos);
//        if (offset > Math.abs(targetPos - originalPos)) {
//            offset = Math.abs(targetPos - originalPos);
//        }
//        if (originalPos != targetPos) {
//            obj.style.left = obj.offsetLeft + direction*offset + "px";
//        }
//        else {
//            clearInterval(timer);
//            if (callback) {
//                 callback();
//            }
//        }
//    }