var galleryButtons; var interval; var frameDuration; this.currentImage = 0; var t; var captionHeight = "190px"; var opacity = 0.85; $(document).ready(function () { slideShow() }); function slideShow() { galleryImages = $("#slideshowAd div.container"); $("#slideshowAd div.container").css({ opacity: 0 }); $(galleryImages[0]).css({ opacity: 1 }); $("#captionUp").css({ opacity: opacity }); $("#captionDown").css({ opacity: 0 }); $("#captionUp").html($(galleryImages[0]).children(".content").html()); $("#captionDown").html($(galleryImages[0]).children(".content").html()); frameDuration = 8000; interval = setInterval("gallery()", frameDuration); for (var a = 0; a < galleryImages.length; a++) { $("#slideshowAd div.buttons").append("<a href='javascript:switchImage(" + a + ", true)'></a>") } galleryButtons = $("#slideshowAd div.buttons a"); $(galleryButtons[0]).addClass("selected") } function gallery() { switchImage(this.currentImage + 1, false) } function switchImage(c, f) { if (c != this.currentImage) { var e = $(galleryImages[this.currentImage]); if (c >= galleryImages.length) { c = 0 } var d = $(galleryImages[c]); var b = d.children(".content").html(); this.currentImage = c; var a = "190px"; d.animate({ opacity: 1 }, 1000); e.animate({ opacity: 0 }, 1000); $("#captionDown").html($("#captionUp").html()); $("#captionDown").css({ height: a }); $("#captionDown").css({ opacity: opacity }); $("#captionDown").animate({ opacity: 0 }, { queue: false, duration: 450 }).animate({ height: "1px" }, { queue: true, duration: 500 }); $("#captionUp").css({ opacity: 0 }); $("#captionUp").css({ height: "1px" }); $("#captionUp").animate({ opacity: opacity }, { queue: false, duration: 450 }).animate({ height: a }, 700).html(b); $("#slideshowAd div.buttons a").removeClass("selected"); $(galleryButtons[c]).addClass("selected") } if (f) { clearInterval(interval); interval = setInterval("gallery()", frameDuration) } };
