(function($){var counter=0;var imgRotator=function(element,option){counter++;var o=option,that=this;this.element=element;this.$element=$(element);this.width=this.$element.outerWidth();this.height=this.$element.outerHeight();this.dim=this.$element.offset();this.detect=element.tagName=='IMG';this.arr=o.img.slice();this.$help=$('<div class="imgRorator'+counter+'"></div>').css({'position':'absolute','top':this.dim.top+'px','left':this.dim.left+'px','width':this.width+'px','height':this.height+'px'});this.rotate=function(i){var $img=$('<img />'),index=i;$img.bind('load',function(){that.$help.hide().css({'background':'url('+that.arr[index]+') 0 0 no-repeat'}).fadeIn(o.speed,function(){that.change(index);setTimeout(function(){that.rotate((++index)%that.length)},o.delay)})}).attr({'src':this.arr[index]})};if(this.detect){this.change=function(index){this.element.src=this.arr[index]}}else{this.change=function(index){this.$element.css('background-image','url('+this.arr[index]+')')}}this.length=this.arr.length;this.init=function(){$('body').append(this.$help);setTimeout(function(){that.rotate(o.start)},o.delay)};return this};$.fn.imgRotator=function(option){this.each(function(){var obj=new imgRotator(this,option);obj.init()});return this}})(jQuery);

$(document).ready(function(){
    $('#motive .l').imgRotator({
        img: ['/img/motive.jpg', '/img/motive-1.jpg', '/img/motive-2.jpg', '/img/motive-3.jpg', '/img/motive-4.jpg', '/img/motive-5.jpg', '/img/motive-6.jpg']
        ,delay: 5000
        ,speed: 1000
        ,start: 1 
    });
    
    // Thickbox
    var thickbox = new sk.widgets.Thickbox();
    thickbox.control($('.thickbox'));
    thickbox.autoWidth=true;
});

