$(document).ready(function(){setTimeout("setUpAds()",999)});var enmJSON=null;function setUpAds(){var ifhtm=($("iframe",$('[id^="gsholder"]')).contents().find("body").html()),iNumRslt=0,iCurrentAd=0,yellTimer,yellChange=30000,yellReAppear=15000;if(ifhtm==null){setTimeout("setUpAds()",999)}else{if($('#gsadwrapper div[id^="ad"]',$("iframe",$('[id^="gsholder"]')).contents().find("body")).length<1){setTimeout("setUpAds()",999)}else{var jsonStr="";$('#gsadwrapper div[id^="ad"]',$("iframe",$('[id^="gsholder"]')).contents().find("body")).each(function(){var ad=$(".ad",$(this));var title=($(".title",ad).html()),description=($(".description",ad).html()),redir=($(".line3",ad).attr("href")),display=($(".line3",ad).attr("title")),beacon=$("div:first",$(this)).html().replace(/\&amp;/g,"&");jsonStr+=',{"title":"'+title+'","description":"'+description+'","display":"'+display+'","redir":"'+redir+'","beacon":"'+beacon+'"}'});enmJSON=eval('({"results":['+jsonStr.substring(1)+"]})");emboxLoaded()}}function emboxLoaded(){if(enmJSON!=null){iNumRslt=enmJSON.results.length;emboxDisplayAd(0);$("#enm_adv").fadeIn(1300)}}$("#enm_adv").click(function(){resetTimer()});$(".enm_adv_mx").click(function(){$("#enm_adv_clmn").attr("class","enm_adv_min");$("#enm_adv").height(110);$("#enm_yell").show();$("#enm_adv_pre,#enm_adv_nxt").css("cursor","pointer")});$("#enm_adv_pre").click(function(){emboxPrevAd()});$("#enm_adv_nxt").click(function(){emboxNextAd()});function udAr(){$("#enm_adv_pre,#enm_adv_nxt").removeClass("enm_adv_hid");$("#enm_adv_pre").addClass(iCurrentAd==0?"enm_adv_hid":"enm_adv_pre");$("#enm_adv_nxt").addClass(iCurrentAd==(iNumRslt-1)?"enm_adv_hid":"enm_adv_nxt")}$("#enm_adv_clmn").click(function(){if($(this).attr("class")=="enm_adv_cls"){$("#enm_adv").fadeOut(1300)}else{$("#enm_adv").height(18);$(this).attr("class","enm_adv_cls");$("#enm_yell").hide()}});function emboxNextAd(){if(iCurrentAd+1<enmJSON.results.length){iCurrentAd+=1;emboxDisplayAd(iCurrentAd);udAr()}}function emboxPrevAd(){if(iCurrentAd>0){iCurrentAd-=1;emboxDisplayAd(iCurrentAd);udAr()}}function emboxDisplayAd(i){var rslt=enmJSON.results[i];if(rslt!=null){$("#ylTrk").attr("src",rslt.beacon);if(rslt.description.length>80){rslt.description=rslt.description.substring(0,80)+"..."}var aStart="<a href="+enmJSON.results[i].redir+' target="_blank">',aEnd="</a>";$("#enm_adv_dsc").html(aStart+rslt.description+aEnd);$("#enm_adv_ttl").html(aStart+rslt.title+aEnd);$("#enm_adv_url").html(aStart+rslt.display+aEnd);$("#enm_adv_pg").html(i+1+" / "+iNumRslt)}}startTimer();function resetTimer(){clearTimeout(yellTimer);yellTimer=setTimeout(showTime,yellChange)}function startTimer(){yellTimer=setTimeout(showTime,yellChange)}function showTime(){iCurrentAd+=1;if(iCurrentAd==iNumRslt){iCurrentAd=0}$("#enm_adv").fadeOut(1300);yellTimer=setTimeout(reDisplay,yellReAppear)}function reDisplay(){emboxDisplayAd(iCurrentAd);udAr();$("#enm_adv").fadeIn(1300);yellTimer=setTimeout(showTime,yellChange)}};
