(function($) {
$.fn.jHotelFoto = function(o) {
    o = $.extend({
        btnPrev: null,
        btnNext: null,
        start:0
    }, o || {});

    return this.each(function() {

        var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;

        var li = $("li", ul), itemLength = li.size(), curr = o.start;
        div.css("display", "block");
        ul.css({margin: "0", padding: "0", "list-style-type": "none"});
        li.css({'display':'none'});

        if(o.btnPrev)
            $(o.btnPrev).click(function() {
                return go(-1);
            });

        if(o.btnNext)
            $(o.btnNext).click(function() {
                return go(+1);
            });

        function go(to) 
        {
          last=curr;
          curr+=to;
          if (curr<0) curr=tl-1;
          else if (curr>=tl) curr=0;
          
          $('li',ul).slice(last,last+1).fadeOut("fast",function() {
            $('li',ul).slice(curr,curr+1).fadeIn("slow");
          });
        };

        go(0);
    });
};

})(jQuery);


(function($) {
$.fn.jHotelFoto2 = function(o) {
    o = $.extend({
        btnPrev: null,
        btnNext: null,
        start:0
    }, o || {});

    return this.each(function() {

        var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;

        var li = $("li", ul), itemLength = li.size(), curr = o.start;
        div.css("display", "block");
        ul.css({margin: "0", padding: "0", "list-style-type": "none"});
        li.css({'display':'none'});

        if(o.btnPrev)
            $(o.btnPrev).click(function() {
                return go(-1);
            });

        if(o.btnNext)
            $(o.btnNext).click(function() {
                return go(+1);
            });

        function go(to) 
        {
          last=curr;
          curr+=to;
          if (curr<0) curr=tl-1;
          else if (curr>=tl) curr=0;
          
          $('li',ul).slice(last,last+1).fadeOut("fast",function() {
            $('li',ul).slice(curr,curr+1).fadeIn("slow", function () {
              $("#hotel_foto_num").html((curr+1));
            });
          });
        };

        go(0);
    });
};

})(jQuery);