/**
 * created by: Pavel Spacil, licence: LGPL, v. 0.9.18
 * modified by: 
 */ 
function HorizontalScroller(_el, _cl, _h) {
        var ref = this;
        this.el = SJEL.$(_el);
        if (_cl != undefined) {
            this.es = SJEL.$A(this.el, "class", _cl);
        } else {
            this.es = SJEL.$T(this.el, "div");
        }
        this.esl = this.es.length;
        if (this.esl == 0) {
            return;
        }
        var i = 0;
        this.mo = new (SJEL.Morph)("easyboth");
        this.w = parseInt(SJEL.GStyle(this.es[0], "width"));
        this.h = parseInt(SJEL.GStyle(this.es[0], "height"));
        this.ew = parseInt(SJEL.GStyle(this.el, "width"));
        this.eh = parseInt(SJEL.GStyle(this.el, "height"));
        this.c = 0;
        this.pos = 0;
        this.max = this.esl * this.w - this.w;
        this.hButsBar = _h || 30;
        if (this.max < this.ew) {
            return;
        }
        this.wr = SJEL.CE("div");
        SJEL.SStyle(this.wr, {position: "absolute", top: "0px", left: "0px", width: this.max + 1000 + "px"});
        for (i = 0; i < this.esl; i++) {
            SJEL.SStyle(this.es[i], {position: "absolute", left: i * this.w + "px"});
            this.wr.appendChild(this.es[i]);
        }
        this.el.appendChild(this.wr);
        this.dots = new Array;
        var he = this.h;
        he = this.h + this.hButsBar;
        var bar = SJEL.CE("div");
        SJEL.AddClass(bar, "hs_buts_bar");
        var aleft = SJEL.CE("div");
        SJEL.AddClass(aleft, "hs_arrow_left");
        var aright = SJEL.CE("div");
        SJEL.AddClass(aright, "hs_arrow_right");
        SJEL.SStyle(bar, {position: "absolute", top: this.h + "px", width: this.ew + "px"});
        SJEL.AddEvent(aleft, "click", function () {ref.GoTo(ref.pos - 1);});
        SJEL.AddEvent(aright, "click", function () {ref.GoTo(ref.pos + 1);});
        bar.appendChild(aright);
        bar.appendChild(aleft);
        for (i = this.esl - 1; i >= 0; i--) {
            var dot = SJEL.CE("div");
            SJEL.AddClass(dot, "hs_dot");
            if (i == 0) {
                SJEL.AddClass(dot, "hs_dot_active");
            }
            SJEL.AddEvent(dot, "mouseover", function (_e) {var th = SJEL.$ET(_e);SJEL.AddClass(th, "hs_dot_active");});
            SJEL.AddEvent(dot, "mouseout", function (_e) {var th = SJEL.$ET(_e);SJEL.RemoveClass(th, "hs_dot_active");});
            dot.i = i;
            SJEL.AddEvent(dot, "click", function (_e) {var th = SJEL.$ET(_e);ref.GoTo(th.i);});
            this.dots[i] = dot;
            bar.appendChild(dot);
        }
        this.el.appendChild(bar);
        SJEL.SStyle(this.el, {position: "relative", overflow: "hidden", height: he + "px"});
        this.GoTo = function (_p) {if (_p == this.pos) {return;}SJEL.RemoveClass(this.dots[this.pos], "hs_dot_active");var n = Math.abs(_p - this.pos);if (_p < 0) {this.c = - this.max;this.pos = this.esl - 1;} else if (_p > this.esl - 1) {this.c = 0;this.pos = 0;} else if (_p > this.pos) {this.c -= n * this.w;this.pos += n;} else if (_p < this.pos) {this.c += n * this.w;this.pos -= n;}SJEL.AddClass(this.dots[this.pos], "hs_dot_active");this.mo.Init(this.wr, {left: this.c + "px"}, 650);this.mo.Morph();};
    }
