jQuery.fn.extend({ 
        disableSelection : function() { 
                this.each(function() { 
                        this.onselectstart = function() { return false; }; 
                        this.unselectable = "on"; 
                        jQuery(this).css('-moz-user-select', 'none');
			if (jQuery(this).children().length) jQuery(this).children().disableSelection();
                });
        } 
});
(function($){$.fn.tinycarousel=function(options){var defaults={start:1,display:1,axis:'x',controls:true,pager:false,interval:false,intervaltime:25,rewind:false,animation:true,duration:1000,callback:null};var options=$.extend(defaults,options);var oSlider=$(this);var oViewport=$('.viewport:first',oSlider);var oContent=$('.overview:first',oSlider);var oPages=oContent.children();var oBtnNext=$('.next:first',oSlider);var oBtnPrev=$('.prev:first',oSlider);var oPager=$('.pager:first',oSlider);var x=0,y=0;var mouson=false;var px=0;var iPageSize,iSteps,iCurrent,oTimer,bPause,bForward=true,bAxis=options.axis=='x';return this.each(function(){initialize();});function initialize(){$(oSlider).disableSelection();iPageSize=bAxis?$(oPages[0]).outerWidth(true):$(oPages[0]).outerHeight(true);var iLeftover=Math.ceil(((bAxis?oViewport.outerWidth():oViewport.outerHeight())/(iPageSize*options.display))-1);iSteps=Math.max(1,Math.ceil(oPages.length/options.display)-iLeftover);iCurrent=Math.min(iSteps,Math.max(1,options.start))-2;var x=0;var y=0;oContent.css(bAxis?'width':'height',(iPageSize*oPages.length));move(-1);setButtons();setEvents();}
function setEvents(){$(document).mouseup(function(){mouson=false;});$(document).mousemove(function(e){if (mouson) x+=1+e.pageX-px;px=e.pageX;});oViewport.mousedown(function(e){if (!e) e = window.event;setTimer();mouson=true;if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; if (e.preventDefault) e.preventDefault(); else e.returnValue = true; return false;});if(options.interval){oViewport.hover(function(){clearTimeout(oTimer);bPause=true},function(){bPause=false;setTimer();});}}
function setButtons(){oBtnPrev.attr("href","javascript:void(0);");oBtnNext.attr("href","javascript:void(0);");oBtnPrev.hover(function(){y=-4;},function(){y=0;});oBtnNext.hover(function(){y=5;},function(){y=0;});}
function setPager(oEvent){if($(this).hasClass('pagenum')){iCurrent=parseInt(this.rel)-1;move(1);}return false;}
function setTimer(){clearTimeout(oTimer);oTimer=setTimeout(function(){iCurrent=-1;move(-1);},options.intervaltime);}
function move(iDirection){
if (!mouson)
x+=iDirection+y;
while (x<(0-iPageSize)) {x+=parseInt(iPageSize); a=$(".overview li:first",oSlider).clone(); $(".overview li:first",oSlider).remove(); oContent.append(a);}
while (x>0) {x-=parseInt(iPageSize); a=$(".overview li:last",oSlider).clone(); $(".overview li:last",oSlider).remove(); oContent.prepend(a);}
oContent.css('marginLeft',x+"px");
setTimer();
}
};
})(jQuery);
