$(function(){ $(".flashBanner1").each(function(){ var timer; $(".flashBanner1 .mask1 img").click(function(){ var index = $(".flashBanner1 .mask1 img").index($(this)); changeImg(index); }).eq(0).click(); $(this).find(".mask1").animate({ "bottom":"0" },700); $(".flashBanner1").hover(function(){ clearInterval(timer); },function(){ timer = setInterval(function(){ var show = $(".flashBanner1 .mask1 img.show").index(); if (show >= $(".flashBanner1 .mask1 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); function changeImg (index) { $(".flashBanner1 .mask1 img").removeClass("show").eq(index).addClass("show"); $(".flashBanner1 .bigImg1").parents("a").attr("href",$(".flashBanner1 .mask1 img").eq(index).attr("link")); $(".flashBanner1 .bigImg1").hide().attr("src",$(".flashBanner1 .mask1 img").eq(index).attr("uri")).fadeIn("slow"); } timer = setInterval(function(){ var show = $(".flashBanner1 .mask1 img.show").index(); if (show >= $(".flashBanner1 .mask1 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); }); $(function(){ $(".flashBanner2").each(function(){ var timer; $(".flashBanner2 .mask2 img").click(function(){ var index = $(".flashBanner2 .mask2 img").index($(this)); changeImg(index); }).eq(0).click(); $(this).find(".mask2").animate({ "bottom":"0" },700); $(".flashBanner2").hover(function(){ clearInterval(timer); },function(){ timer = setInterval(function(){ var show = $(".flashBanner2 .mask2 img.show").index(); if (show >= $(".flashBanner2 .mask2 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); function changeImg (index) { $(".flashBanner2 .mask2 img").removeClass("show").eq(index).addClass("show"); $(".flashBanner2 .bigImg2").parents("a").attr("href",$(".flashBanner2 .mask2 img").eq(index).attr("link")); $(".flashBanner2 .bigImg2").hide().attr("src",$(".flashBanner2 .mask2 img").eq(index).attr("uri")).fadeIn("slow"); } timer = setInterval(function(){ var show = $(".flashBanner2 .mask2 img.show").index(); if (show >= $(".flashBanner2 .mask2 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); }); $(function(){ $(".flashBanner3").each(function(){ var timer; $(".flashBanner3 .mask3 img").click(function(){ var index = $(".flashBanner3 .mask3 img").index($(this)); changeImg(index); }).eq(0).click(); $(this).find(".mask3").animate({ "bottom":"0" },700); $(".flashBanner3").hover(function(){ clearInterval(timer); },function(){ timer = setInterval(function(){ var show = $(".flashBanner3 .mask3 img.show").index(); if (show >= $(".flashBanner3 .mask3 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); function changeImg (index) { $(".flashBanner3 .mask3 img").removeClass("show").eq(index).addClass("show"); $(".flashBanner3 .bigImg3").parents("a").attr("href",$(".flashBanner3 .mask3 img").eq(index).attr("link")); $(".flashBanner3 .bigImg3").hide().attr("src",$(".flashBanner3 .mask3 img").eq(index).attr("uri")).fadeIn("slow"); } timer = setInterval(function(){ var show = $(".flashBanner3 .mask3 img.show").index(); if (show >= $(".flashBanner3 .mask3 img").length-1) show = 0; else show ++; changeImg(show); },5000); }); });