var ALWAYS_OPEN = true; var carouseling = false; var carouseling2 = false; function leftCarousel() { if (carouseling) { return; } carouseling = true; var active = $('#BANNER_WRAP .carousel_inner .item.active'); var last = $('#BANNER_WRAP .carousel_inner .item').last(); active.before(last); var width = last.width(); $('#BANNER_WRAP .carousel_inner').css('left', '-'+width+'px'); $('#BANNER_WRAP .carousel_inner').animate({ 'left': 0 }, 500, function() { active.removeClass('active').prev().addClass('active'); carouseling = false; }); }; function rightCarousel() { if (carouseling) { return; } carouseling = true; var active = $('#BANNER_WRAP .carousel_inner .item.active'); var width = active.width(); $('#BANNER_WRAP .carousel_inner').animate({ 'left': '-=' + width }, 500, function() { active.removeClass('active').next().addClass('active'); $('#BANNER_WRAP .carousel_inner').css('left', '0').append(active); carouseling = false; }); }; function autoCarousel() { setTimeout(function() { rightCarousel(); autoCarousel(); }, 3000); }; function initCarousel() { $('#BANNER_WRAP .carousel-control.left').click(function(event) { event.preventDefault(); leftCarousel(); return false; }); $('#BANNER_WRAP .carousel-control.right').click(function(event) { event.preventDefault(); rightCarousel(); return false; }); autoCarousel(); }; $(document).ready(function() { initCarousel(); if (!ALWAYS_OPEN) { if (REMEMBER_CLOSE && '1' == $.cookie('TODAY_BANNER_CLOSE')) { hideBanner(false); } else { setTimeout(function() { showBanner(); }, 1000); } } else { $('#BANNER_WRAP').css('margin', 0); } }); function leftCarousel2() { if (carouseling2) { return; } carouseling2 = true; var active = $('#BANNER_WRAP2 .carousel_inner .item.active'); var last = $('#BANNER_WRAP2 .carousel_inner .item').last(); active.before(last); var width = last.width(); $('#BANNER_WRAP2 .carousel_inner').css('left', '-'+width+'px'); $('#BANNER_WRAP2 .carousel_inner').animate({ 'left': 0 }, 500, function() { active.removeClass('active').prev().addClass('active'); carouseling2 = false; }); }; function rightCarousel2() { if (carouseling2) { return; } carouseling2 = true; var active = $('#BANNER_WRAP2 .carousel_inner .item.active'); var width = active.width(); $('#BANNER_WRAP2 .carousel_inner').animate({ 'left': '-=' + width }, 500, function() { active.removeClass('active').next().addClass('active'); $('#BANNER_WRAP2 .carousel_inner').css('left', '0').append(active); carouseling2 = false; }); }; function autoCarousel2() { setTimeout(function() { rightCarousel2(); autoCarousel2(); }, 3000); }; function initCarousel2() { $('#BANNER_WRAP2 .carousel-control.left').click(function(event) { event.preventDefault(); leftCarousel2(); return false; }); $('#BANNER_WRAP2 .carousel-control.right').click(function(event) { event.preventDefault(); rightCarousel2(); return false; }); autoCarousel2(); }; $(document).ready(function() { initCarousel2(); if (!ALWAYS_OPEN) { if (REMEMBER_CLOSE && '1' == $.cookie('TODAY_BANNER_CLOSE')) { hideBanner(false); } else { setTimeout(function() { showBanner(); }, 1000); } } else { $('#BANNER_WRAP2').css('margin', 0); } });