$(function() { loadADImages(); nextAd(); theTimer = setInterval(function() { nextAd() }, 5000) }); var _news_links; function loadADImages() { $("a[adImagePath]").each(function(A) { cpAD[cpAD.length] = $(this).attr("adImagePath"); cpADlink[cpADlink.length] = $(this).attr("title"); cpADmsg[cpADmsg.length] = $(this).attr("title"); $(this).attr("indexNum", A); $(this).mouseover(function() { if (theTimer) { clearInterval(theTimer); theTimer = null } if (adNum != parseInt($(this).attr("indexNum"))) { adNum = parseInt($(this).attr("indexNum")) - 1; nextAd() } }); $(this).mouseout(function() { theTimer = setInterval(function() { nextAd() }, 5000) }) }); _news_links = $("a[adImagePath]") } var preloadedimages = new Array(); var ImageBox = null; var theTimer = null; var cpAD = new Array(); var cpADlink = new Array(); var cpADmsg = new Array(); var adNum = 5; var coll = 0; function nextAd() { ImageBox = document.getElementById("ADImageBox"); if (!ImageBox) { clearInterval(theTimer); return } coll++; if (adNum < cpAD.length - 1) { ImageBox.src = cpAD[adNum]; adNum++ } else { adNum = 0; ImageBox.src = cpAD[adNum] } setTransition(); ImageBox.src = cpAD[adNum]; setLinkStyle(adNum); playTransition(); displayStatusMsg() } function setLinkStyle(A) { $("a[adImagePath]").removeClass("selected"); $("#ADLink" + A).addClass("selected"); move_arrow(_news_links[A]) } var ARROW_OFFSET = 2; function move_arrow(A) { $("#adArrow").animate({ top: A.offsetTop + ARROW_OFFSET + "px" }, 300) } function setTransition() { if (document.all) { ImageBox.filters.revealTrans.Transition = 23; ImageBox.filters.revealTrans.apply() } } function playTransition() { if (document.all) { ImageBox.filters.revealTrans.play() } } function displayStatusMsg() { status = cpADmsg[adNum]; document.returnValue = true };