carouselObject = false; ;(function($){ var slideContainer = '#announcements ul'; var slidePagination = '#announcements .pagination'; var slideCarousel; var carouselSlides = new Array(); var csI = 0; carouselSlides[csI++] = { 'class': ' at first-item', 'innerHtml': '

Do You Luv FMB? Let us know!

' + '

' + '' }; carouselSlides[csI++] = { 'class': '', 'innerHtml': '

Share Your Experience With Us!

' + '
Do you or your business have an experience with FMB that you would like to share? Now you can click here to tell us about it!
' + '' }; carouselSlides[csI++] = { 'class': '', 'innerHtml': '

Tired of hidden bank fees?

' + '
Tired of all the hidden fees at your bank? FMB would like to help you avoid fees. Check out our FMB Options Checking Account! Click here to learn more!
' + '' }; carouselSlides[csI++] = { 'class': '', 'innerHtml': '

Internet Banking Security

' + '
Farmers & Merchants Bank wants to help you keep your information secure.
Click here for some security guidelines.
' + '' }; function init() { $(slideContainer).jcarousel({ scroll : 1, wrap : 'last', auto : 5, initCallback: carouselInitCallback, itemLoadCallback: itemLoadCallbackFunction, itemVisibleInCallback: { onBeforeAnimation: itemVisibleInCallbackBeforeAnimation, onAfterAnimation: itemVisibleInCallbackAfterAnimation } }); } carouselIdxHTML = ''; function carouselInitCallback(carousel) { // set the final size of the carousel carousel.size(carouselSlides.length); // set carousel for external use window.carouselObject = carousel; // pause autoscrolling if the user moves with the cursor over the clip carousel.clip.hover( function() { carousel.stopAuto(); carouselIdxHTML = $(slidePagination).html(); $(slidePagination).html('Paused...') ; }, function() { if(window.Shadowbox && window.Shadowbox.isActive()) return; carousel.startAuto(); $(slidePagination).html(carouselIdxHTML); } ); } function itemLoadCallbackFunction(carousel, state) { // if(state == 'prev') return; if(state == 'init') { carousel.options.scroll = carousel.last; // add the initial slide(s) for (var i=1; i<=carousel.last; i++) addSlide(carousel, i); } if(carousel.size() > carousel.last) { // preload next slide(s) for(var i=carousel.last; i 1 && slides_started) nextSlide(); // the overflow-y:auto setting screws up the animation so we disable it before and re-enable it after disableOverflow(); } function itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) { // the overflow-y:auto setting screws up the animation so we disable it before and re-enable it after enableOverflow(); $(slidePagination).html(idx+' of '+carousel.size()); } function disableOverflow() { $('#announcements .list .item .content').css('overflow','hidden'); } function enableOverflow() { $('#announcements .list .item .content').css('overflow-y','auto'); } function addSlide(carousel, idx) { if(idx==0) idx=1; var slide = carouselSlides[idx-1]; // check if the slide exists or is already added if(!slide || carousel.has(idx)) return; var slideHTML = document.createElement('li'); var $slideHTML = $(slideHTML); $slideHTML.addClass('item'); if(slide['class']) $slideHTML.addClass( slide['class'] ); // if(idx == 1) $slideHTML.addClass('first-item'); // if(idx == carouselSlides.length) $slideHTML.addClass('last-item'); $slideHTML.html( slide.innerHtml ); $('a', $slideHTML).each( function() { if(!$(this).attr('rel').match(/safe(-|_)exit/i)) setExit(this); } ); carousel.add(idx, slideHTML); } $(init); })(jQuery);