if (window.jQuery && window.RVTS) (function($){ $('.navigationBar').hide(); RVTS = $.fn.extend( RVTS, { loading: 0, adjust: 0, doAutoScroll: function() { if (RVTS.loading || RVTS.start >= RVTS.total) return; var url = RVTS.ajaxUrlModel.replace('%start%', RVTS.start).replace('%per%', RVTS.perPage); if (RVTS.adjust) { url += '&adj=' + RVTS.adjust; RVTS.adjust=0; } $('#ajaxLoader').show(); RVTS.loading = 1; $.ajax({ type:'GET', dataType:'html', 'url': url, success: function(htm) { RVTS.start+=RVTS.perPage; RVTS.$thumbs.append(htm); if (RVTS.start>500 && RVTS.total>550) { RVTS.$thumbs.after( '
' +RVTS.moreMsg.replace('%d', RVTS.total-RVTS.start) +'
'); RVTS.total = 0; } }, complete: function() { RVTS.loading = 0; $('#ajaxLoader').hide(); } }); }, checkAutoScroll: function(evt) { var tBot=RVTS.$thumbs.position().top+RVTS.$thumbs.outerHeight() ,wBot=$(window).scrollTop()+$(window).height(); tBot -= !evt ? 0:40; //begin 40 pixels before end return tBot <= wBot ? (RVTS.doAutoScroll(),1) : 0; }, engage: function() { var $w = $(window); RVTS.$thumbs = $('#thumbnails'); RVTS.$thumbs.append(''); $w.scrollTop(0); if ( RVTS.$thumbs.outerHeight() < $w.height() ) RVTS.adjust = 1; else if ( RVTS.$thumbs.height() > 2*$w.height() ) RVTS.adjust = -1; $w.bind('scroll resize', RVTS.checkAutoScroll); if (RVTS.checkAutoScroll()) window.setTimeout(RVTS.checkAutoScroll,1500); } } );//end extend $(document).ready( function() { window.setTimeout(RVTS.engage,250); }); })(jQuery);