if(!window.iwin)var iwin={};iwin.HomePage={};
iwin.HomePage.init=function(){iwin.AuthUI.forceDetachedMode();var a,b,e;iwin.Util.isInArcade()&&window.external.UpdateOpalsInfo();if(iwin.Util.isInArcade()&&document.viewport.getDimensions().width<990){$$(".sideBarImage")[0].style.display="none";$$(".sideA")[0].style.paddingLeft="0";$$(".sideB")[0].style.paddingLeft="5px";$$(".sideB")[0].style.paddingRight="0"}$$("ul.tabs li a").each(function(c){$(c).observe("click",function(d){var f=this.up().className;this.up().up().className="tabs "+f;$$("#billboard div").invoke("hide");
$$("#billboard div."+f)[0].show();Event.stop(d)})});i$("topTodayTab").observe("click",function(c){iwin.Util.hideObj("topMonthList");iwin.Util.showObj("topTodayList");iwin.Util.createCookie("TopList","TopMonth");Event.stop(c)});i$("topMonthTab").observe("click",function(c){iwin.Util.hideObj("topTodayList");iwin.Util.showObj("topMonthList");iwin.Util.createCookie("TopList","TopToday");Event.stop(c)});if(iwin.Util.readCookie("TopList"))if(iwin.Util.readCookie("TopList")==="TopMonth"){iwin.Util.hideObj("topTodayList");
iwin.Util.showObj("topMonthList")}a='<ul class="sortBy" style="display: none;">';a+='  <li class="first"><a href="/categories/games/hidden">Hidden Object</a></li>';a+='  <li><a href="/categories/games/time">Time Management</a></li>';a+='  <li><a href="/categories/games/action">Action</a></li>';a+='  <li><a href="/categories/games/action/adventure">Adventure</a></li>';a+='  <li><a href="/categories/games/puzzle/match3">Match 3</a></li>';a+='  <li><a href="/categories/games/puzzle">Puzzle</a></li>';
a+='  <li><a href="/categories/games/card">Board/Card</a></li>';a+='  <li><a href="/categories/games/word">Word</a></li>';a+='  <li><a href="/categories/games/kids">Kids</a></li>';a+='  <li><a href="/categories/games/online-party">Online Party</a></li>';a+="</ul>";b='<ul class="sortBy" style="display: none;">';b+='  <li class="first"><a href="/categories/games/new" rel="nofollow" class="new">Newest First</a></li>';b+='  <li><a href="/categories/games" rel="nofollow" class="rank">Most Popular</a></li>';
b+='  <li><a href="/categories/games/terries-picks" rel="nofollow" class="rank">Terrie\'s Picks </a></li>';b+="</ul>";e='<ul class="sortBy" style="display: none;">';e+='  <li class="first"><a href="javascript:void(0);" rel="nofollow" class="new">Newest First</a></li>';e+='  <li><a href="javascript:void(0);" rel="nofollow" class="rank">Most Popular</a></li>';e+="</ul>";$$("div.category h2").each(function(c){if($(c).up().id==="newGames")$(c).insert({before:b});else $(c).up().id==="genreGames"?$(c).insert({before:a}):
$(c).insert({before:e})});iwin.Util.readCookie("gamesInGenreCategoryUrl")&&iwin.Util.readCookie("gamesInGenreCategoryName")&&iwin.HomePage.sortGamesInGenreCategory(iwin.Util.readCookie("gamesInGenreCategoryUrl"),iwin.Util.readCookie("gamesInGenreCategoryName"));$$("div.category a.sortBy").each(function(c){$(c).observe("click",function(d){$(c).up().select("ul.sortBy")[0].show();Event.stop(d)})});$$("div.category").each(function(c){$(c).id==="genreGames"?$(c).select("ul.sortBy li a").each(function(d){$(d).observe("click",
function(f){iwin.HomePage.sortGamesInGenreCategory(d.href,d.innerHTML);iwin.HomePage.hideDropDownMenus();Event.stop(f)})}):$(c).select("ul.sortBy li a").each(function(d){$(d).observe("click",function(f){iwin.HomePage.sortGames($(d));iwin.HomePage.hideDropDownMenus();Event.stop(f)})})});Event.observe(document,"click",function(){$$("ul.sortBy").invoke("hide")});iwin.HomePage.billboardPoppable();iwin.HomePage.allAccessPod();iwin.HomePage.buzz.init();iwin.HomePage.clubPod.init();iwin.HomePage.tournament.init();
iwin.HomePage.tracking.init()};iwin.HomePage.billboardPoppable=function(){var a,b,e;a=new Date(2010,4,21,0,0,0,0);b=new Date(2010,4,28,0,0,0,0);e=new Date;e>=a&&e<=b&&$J("#billboard div ul.games li a, #billboard div a.promoBanner").each(function(c,d){make_poppable(d,750)})};iwin.HomePage.tracking={};iwin.HomePage.tracking.trackGameEvent=function(a,b,e){var c;c=a.getAttribute("href");c=c.substr(c.lastIndexOf("/")+1);iwin.tracking.trackPageEvent(a,"click",b,e,c)};
iwin.HomePage.tracking.trackGamesEvent=function(a,b,e){$J(a).each(function(c,d){iwin.HomePage.tracking.trackGameEvent(d,b,e)})};iwin.HomePage.tracking.category=iwin.tracking.domain+"/homepage";
iwin.HomePage.tracking.top=function(){var a=$J("#topGames #topTodayList"),b=$J("#topGames #topMonthList");iwin.HomePage.tracking.trackGamesEvent($J("table td a",a),iwin.HomePage.tracking.category,"clicked to ddp top games");iwin.tracking.trackPageEvent($J("div.moreTopGames",a),"click",iwin.HomePage.tracking.category,"clicked to all games by rank","see all games");iwin.HomePage.tracking.trackGamesEvent($J("table td a",b),iwin.HomePage.tracking.category,"clicked to ddp topmonth games");iwin.tracking.trackPageEvent($J("div.moreTopGames",
b),"click",iwin.HomePage.tracking.category,"clicked to all games by rank","see all games")};
iwin.HomePage.tracking.billboard=function(){var a=$J("#billboard");iwin.HomePage.tracking.trackGamesEvent($J(".todaysPick .games li a, .todaysPick a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp main billboard");iwin.HomePage.tracking.trackGamesEvent($J(".todaysPick a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp main billboard #1");iwin.HomePage.tracking.trackGamesEvent($J(".todaysPick .games li:first a",a),iwin.HomePage.tracking.category,"clicked to ddp main billboard #2");
iwin.HomePage.tracking.trackGamesEvent($J(".todaysPick .games li:last a",a),iwin.HomePage.tracking.category,"clicked to ddp main billboard #3");iwin.HomePage.tracking.trackGamesEvent($J(".onSale .games li a, .onSale a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp steals and deals billboard");iwin.HomePage.tracking.trackGamesEvent($J(".onSale a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp steals and deals billboard #1");iwin.HomePage.tracking.trackGamesEvent($J(".onSale .games li:first a",
a),iwin.HomePage.tracking.category,"clicked to ddp steals and deals billboard #2");iwin.HomePage.tracking.trackGamesEvent($J(".onSale .games li:last a",a),iwin.HomePage.tracking.category,"clicked to ddp steals and deals billboard #3");iwin.HomePage.tracking.trackGamesEvent($J(".free .games li a, .free a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp free billboard");iwin.HomePage.tracking.trackGamesEvent($J(".free a.promoBanner",a),iwin.HomePage.tracking.category,"clicked to ddp free billboard #1");
iwin.HomePage.tracking.trackGamesEvent($J(".free .games li:first a",a),iwin.HomePage.tracking.category,"clicked to ddp free billboard #2");iwin.HomePage.tracking.trackGamesEvent($J(".free .games li:last a",a),iwin.HomePage.tracking.category,"clicked to ddp free billboard #3")};
iwin.HomePage.tracking.newGames=function(){var a=$J("#newGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a.todayRelease",a),iwin.HomePage.tracking.category,"clicked to ddp todays release");iwin.HomePage.tracking.trackGamesEvent($J(".games li:not(.todayRelease) a",a),iwin.HomePage.tracking.category,"clicked to ddp new release");iwin.tracking.trackPageEvent($J("div a",a),"click",iwin.HomePage.tracking.category,"clicked to all games by release","see all games")};
iwin.HomePage.tracking.allAccessGames=function(){iwin.HomePage.tracking.trackGamesEvent($J("#allAccessGamesList a"),iwin.HomePage.tracking.category,"clicked to ddp all access");iwin.tracking.trackPageEvent($J("#allAccessGames a.joinNow, #allAccessPopup a.allAccessPopupJoinNow"),"click",iwin.HomePage.tracking.category,"clicked to all access page main pod","all access");iwin.tracking.trackPageEvent($J("#homepage div.sideB div.smallPromoBanner a"),"click",iwin.HomePage.tracking.category,"clicked to all access page top right",
"all access")};iwin.HomePage.tracking.premiumGames=function(){var a=$J("#premiumGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a",a),iwin.HomePage.tracking.category,"clicked to ddp premium games");iwin.tracking.trackPageEvent($J('div a[rel="nofollow"]',a),"click",iwin.HomePage.tracking.category,"clicked to all premium games","see all games")};
iwin.HomePage.tracking.genreGames=function(){var a=$J("#genreGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a",a),iwin.HomePage.tracking.category,"clicked to ddp games by category");iwin.tracking.trackPageEvent($J('div a[rel="nofollow"]',a),"click",iwin.HomePage.tracking.category,"clicked to all games by category","see all games")};
iwin.HomePage.tracking.dealsGames=function(){var a=$J("#dealsGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a",a),iwin.HomePage.tracking.category,"clicked to ddp steals and deals games");iwin.tracking.trackPageEvent($J('div a[rel="nofollow"]',a),"click",iwin.HomePage.tracking.category,"clicked to all steals and deals games","see all games")};
iwin.HomePage.tracking.freeGames=function(){var a=$J("#freeGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a",a),iwin.HomePage.tracking.category,"clicked to ddp free games");iwin.tracking.trackPageEvent($J('div a[rel="nofollow"]',a),"click",iwin.HomePage.tracking.category,"clicked to all free games","see all games")};
iwin.HomePage.tracking.classicGames=function(){var a=$J("#classicGames");iwin.HomePage.tracking.trackGamesEvent($J(".games a",a),iwin.HomePage.tracking.category,"clicked to ddp classic games");iwin.tracking.trackPageEvent($J('div a[rel="nofollow"]',a),"click",iwin.HomePage.tracking.category,"clicked to all classic games","see all games")};
iwin.HomePage.tracking.init=function(){iwin.HomePage.tracking.top();iwin.HomePage.tracking.billboard();iwin.HomePage.tracking.newGames();iwin.HomePage.tracking.allAccessGames();iwin.HomePage.tracking.premiumGames();iwin.HomePage.tracking.genreGames();iwin.HomePage.tracking.dealsGames();iwin.HomePage.tracking.freeGames();iwin.HomePage.tracking.classicGames()};iwin.HomePage.hideDropDownMenus=function(){$$("ul.sortBy").invoke("hide")};
iwin.HomePage.sortGamesInGenreCategory=function(a,b){var e,c,d,f,g,h,i,m,j,n,l;iwin.Util.createCookie("gamesInGenreCategoryUrl",a);iwin.Util.createCookie("gamesInGenreCategoryName",b);a+=".xml?s=release_date&d=desc&p=0&";a+=document.domain==="gm.iwin.com"?"m=4":"m=5";new Ajax.Request(a,{method:"get",contentType:"application/xml",requestHeaders:{Accept:"application/xml"},onSuccess:function(k){try{n=k.responseXML.getElementsByTagName("category-listing")[0];l=n.getElementsByTagName("featured-games")[0];
n.removeChild(l);e=n.getElementsByTagName("game");c="";iwin.Util.createCookie("showTopGames","FreeGames");for(f=0;f<e.length;f+=1){d=e[f];g=d.getAttribute("self");h=d.getElementsByTagName("title")[0].firstChild.data;i=d.getElementsByTagName("images-url")[0].firstChild.data;m='<li><a href="'+g+'" class="poppable"><img alt="'+h+'" src="'+i+'/fea_3.jpg" /></a><a href="'+g+'" class="poppable">'+h+"</a></li>";c+=m}$$("#genreGames ul.games")[0].innerHTML=c;$$("#genreGames a.sortBy")[0].innerHTML=b;$$("#genreGames .poppable").each(function(q){make_poppable(q,
750)});j=k.responseXML.getElementsByTagName("category-listing")[0];$$("#genreGames div a")[0].innerHTML="See All "+j.getAttribute("total-size")+" Games";$$("#genreGames div a")[0].href=j.getAttribute("canonical-url")+"?m=25&p=0&s=release_date&d=desc";$$("#genreGames h2 a")[0].href=j.getAttribute("canonical-url");iwin.HomePage.tracking.genreGames()}catch(p){console.error(p)}},onFailure:function(k){console.error(k.status)}})};
iwin.HomePage.sortGames=function(a){var b,e,c,d,f,g,h,i,m,j,n,l,k,p,q;b=$(a).up().up().up();e=b.select("h2 a")[0];c=$(a).innerHTML;a=document.domain==="gm.iwin.com"?true:false;a=b.id==="premiumGames"||b.id==="newGames"?a?"m=3":"m=4":a?"m=4":"m=5";if(c==="Newest First")e+=".xml?p=0&s=release_date&d=desc&"+a;else if(c==="Most Popular")e+=".xml?p=0&s=rank&d=asc&"+a;else e="/categories/games/terries-picks.xml?p=0&s=release_date&d=desc&"+a;new Ajax.Request(e,{method:"get",contentType:"application/xml",
requestHeaders:{Accept:"application/xml"},onSuccess:function(o){try{p=o.responseXML.getElementsByTagName("category-listing")[0];q=p.getElementsByTagName("featured-games")[0];p.removeChild(q);d=p.getElementsByTagName("game");f="";g=d.length;for(h=0;h<g;h+=1){i=d[h];m=i.getAttribute("self");j=i.getElementsByTagName("title")[0].firstChild.data;n=i.getElementsByTagName("images-url")[0].firstChild.data;l='<li><a href="'+m+'" class="poppable"><img alt="'+j+'" src="'+n+"/";l+=b.id==="newGames"?'feat_4-103x103.jpg"':
b.id==="premiumGames"?'fea_3-150x125.jpg"':'fea_3.jpg"';l+=' /></a><a href="'+m+'" class="poppable">'+j+"</a></li>";if(b.id==="newGames"&&h===0)f+='<li class="todayRelease">'+$$("#newGames ul.games li.todayRelease")[0].innerHTML+"</li>";if(!(b.id==="newGames"&&c==="Newest First"&&h===0)&&!(b.id==="newGames"&&c!=="Newest First"&&h===g-1))f+=l}b.select("ul.games")[0].innerHTML=f;b.select("a.sortBy")[0].innerHTML=c;$$("#"+b.id+" .poppable").each(function(s){make_poppable(s,750)});k=$$("#"+b.id+" h2 a")[0].href;
if(b.id!=="newGames"){if(c==="Newest First")k+="?m=25&p=0&s=release_date&d=desc";else if(c==="Most Popular")k+="?m=25&p=0&s=rank&d=asc";$$("#"+b.id+" div a")[0].href=k}iwin.HomePage.tracking[b.id]&&typeof iwin.HomePage.tracking[b.id]==="function"&&iwin.HomePage.tracking[b.id]()}catch(t){console.error(t)}},onFailure:function(o){console.error(o.status)}})};
iwin.HomePage.checkMembership=function(){var a=false;iwin.Util.hasSession()&&new Ajax.Request("/subscriptions/features/club/current.json",{method:"GET",asynchronous:false,contentType:"application/json",onSuccess:function(b){var e,c,d,f;try{e=b.responseText.evalJSON();c=e.state;d=e.features;if(c==="ACTIVE"){for(f in d)if(d[f].keyword==="IACCESS")a="IACCESS";a||(a="OWNERSHIP")}}catch(g){}},onException:iwin.Util.problemHandler.bind("iwin.HomePage.checkMembership(checking_state)"),onFailure:iwin.Util.problemHandler.bind("iwin.HomePage.checkMembership(checking_state)")});
return a};
iwin.HomePage.allAccessPod=function(){var a,b,e,c,d,f,g,h,i,m,j,n,l,k,p,q,o,t,s;a=i$("allAccessGames");b=i$("allAccessGamesList");e=i$("allAccessGamesList");c=a.hasClassName("iwgm")?4:5;new Ajax.Request("/categories/games/allaccess.xml?sc&m="+c,{method:"get",onSuccess:function(u){var v=0,w=0;d=u.responseXML.getElementsByTagName("category-listing")[0];f=d.getElementsByTagName("featured-games")[0];d.removeChild(f);g=d.getElementsByTagName("game");i=g.length;if(i>0){if(i<c)c=i;for(;c>w;){h=g[v];m=h.getAttribute("self");
j=h.getElementsByTagName("title")[0].firstChild.data;n=h.getElementsByTagName("images-url")[0].firstChild.data+"/fea_3.jpg";l=new Element("li");k=new Element("a",{href:m,"class":"poppable"});l.insert(k);p=new Element("img",{src:n,alt:"Download "+j+" Game"});k.insert(p);q=new Element("a",{href:m,"class":"poppable"});q.update(j);l.insert(q);b.insert(l);w+=1;v+=1}$$("#allAccessGames .poppable").each(function(r){make_poppable(r,750)});t=new Element("div",{id:"allAccessOverlay","class":"auth-ui-overlay hideObj"});
document.body.appendChild(t);i$("allAccessOverlay").observe("click",function(r){iwin.Util.hideObj("allAccessOverlay");iwin.Util.hideObj("allAccessPopup");Event.stop(r)});i$("allAccessLearnMore").observe("click",function(r){iwin.Util.showPopup("allAccessOverlay",true);iwin.Util.showPopup("allAccessPopup");$J("#allAccessPopup").center();Event.stop(r)});i$("allAccessPopupClose").observe("click",function(r){iwin.Util.hideObj("allAccessOverlay");iwin.Util.hideObj("allAccessPopup");Event.stop(r)});Event.observe(document,
"iwin:auth:login:success",function(){o=iwin.HomePage.checkMembership();if(o==="IACCESS"){a.addClassName("member");e.addClassName("member")}o!=="OWNERSHIP"?a.removeClassName("hideObj"):a.addClassName("hideObj")});Event.observe(document,"iwin:auth:logout:success",function(){a.removeClassName("member");e.removeClassName("member");a.removeClassName("hideObj")});o=iwin.HomePage.checkMembership();if(o==="IACCESS"){a.addClassName("member");e.addClassName("member")}o!=="OWNERSHIP"&&a.removeClassName("hideObj");
s={tl:{radius:16},tr:{radius:16},bl:{radius:16},br:{radius:16},antiAlias:true};curvyCorners(s,"#allAccessPopup");iwin.HomePage.tracking.allAccessGames()}},onFailure:function(u){console.error("Failed to populate all access pod: %s %s",u.status,u.statusText)}})};iwin.HomePage.buzz={};
iwin.HomePage.buzz.track=function(){var a,b;a=iwin.tracking.domain+"/homepage";b=$J("#buzzContainer");iwin.tracking.trackPageEvent($J("li.facebook a",b),"click",a,"facebook","marketing");iwin.tracking.trackPageEvent($J("li.twitter a",b),"click",a,"twitter","marketing");iwin.tracking.trackPageEvent($J("li.blog a",b),"click",a,"blog","marketing");iwin.tracking.trackPageEvent($J("li.forums a",b),"click",a,"forums","marketing");iwin.tracking.trackPageEvent($J("li.toolbar a",b),"click",a,"toolbar","marketing");
iwin.tracking.trackPageEvent($J("li.newsletter a",b),"click",a,"subscribe to newsletter","marketing");iwin.tracking.trackPageEvent($J("a.buzzVideo",b),"click",a,"play video","marketing")};
iwin.HomePage.buzz.init=function(){var a,b;iwin.HomePage.buzz.track();b="";if(!iwin.Util.isReturningVisitor()&&iwin.Auth.getCurrentUsername()===null){a=$J("#buzzContainer .buzzVideo");b=a.attr("href");b=b.indexOf("//")===0?window.location.protocol+b:b;new iwin.Util.PopupVideo({title:a.attr("title"),id:"siteDemoPopup",klass:"siteDemoPopup",openElement:a,useOverlay:true,isModal:false,closeAnywhere:false},{videoUrl:b,height:429,width:750});iwin.HomePage.buzz.showFirstVisit()}else iwin.HomePage.buzz.update();
iwin.Util.isInArcade()&&$J('#arcade_container #buzzContainer .buzzSocial a[target="_blank"]').not('a[href="#"]').each(function(e,c){c=$J(c);c.bind("click",function(d){try{window.external.BrowserNavigate(c.attr("href"));d.preventDefault()}catch(f){try{window.external.ArcadePopupShow(c.attr("href"),c.attr("href"),800,600,true);d.preventDefault()}catch(g){}}})})};
iwin.HomePage.buzz.getCampaignFeedLink=function(a,b){var e,c,d;d="?";a=$J.trim(a);e={utm_source:"HPBuzz",utm_medium:"textpromo",utm_campaign:"evergreen"};if(b)e.utm_campaign=b.replace(/[^a-zA-Z0-9]+/g,"").substr(0,10);else console.error("[iwin.HomePage.buzz.getCampaignFeedLink] link(%o) title not specified, using default campaign.",a);b=iwin.Util.getUrlVars(a);for(c in b)if(c.match("^utm_")!==null)e[c]=b[c];for(c in e)if(c.match("^utm_")!==null)d+=c+"="+e[c]+"&";return a.substring(0,a.indexOf("?")>
0?a.indexOf("?"):a.length)+window.encodeURI(d.replace(/\&$/,""))};iwin.HomePage.buzz.showFirstVisit=function(){$J("#buzzContainer .buzzVideo").showObj();$J("#buzzContainer .buzzHeader, #buzzContainer .buzzContent").hideObj()};
iwin.HomePage.buzz.update=function(){$J.ajax({type:"GET",url:"/iwinbuzz/feed.xml",dataType:"xml",success:function(a){var b,e,c,d,f;b=$J(".buzzContent");a=$J("item",a);if(a.length>0){b.empty().removeClass("error");a.slice(0,2).each(function(g,h){d=$J("title",h).text();f=$J("description",h).text();f=iwin.HomePage.buzz.getCampaignFeedLink(f,d);e=$J(document.createElement("li")).addClass("buzzEntry");c=$J(document.createElement("a")).attr("href",f).text(d).attr("rel","nofollow");if(f.match(/^\//)===null&&
(f.match(/^(http|https):\/\/([\w\-]+)\.iwin\.com/)===null||f.match(/^(http|https):\/\/p\.iwin\.com/)!==null)){c.attr("target","_blank");iwin.Util.isInArcade()&&c.bind("click",function(i){try{window.external.BrowserNavigate(this.href);i.preventDefault()}catch(m){try{window.external.ArcadePopupShow(this.href,this.href,800,600,true,this.innerHTML);i.preventDefault()}catch(j){}}})}e.append(c);b.append(e)})}},error:function(){$J(".buzzContent").html("Temporarily Unavailable").addClass("error")}})};
iwin.HomePage.tournament={};iwin.HomePage.tournament.init=function(){iwin.HomePage.tournament.update()};
iwin.HomePage.tournament.update=function(){$J.ajax({type:"GET",url:"/tournament/feed.xml",dataType:"xml",success:function(a){var b,e,c,d;d=[];$J("game",a).slice(0,6).each(function(f,g){e=$J(g);c=$J('image[format="40x40_round"]:first',e);b={gameUrl:e.attr("link"),imageUrl:c.attr("url"),imageUrlLarge:c.attr("url").replace("40x40","80x80"),title:e.attr("name"),jackpot:$J("jackpot",e).text()};d.push(b)});$J(".tournamentContainer li.game").each(function(f,g){$J("a",g).attr("href",d[f].gameUrl).attr("title",
d[f].title);if(f<2){$J(".title",g).html(d[f].title);$J("img",g).attr("src",d[f].imageUrlLarge);$J(".jackpot",g).html(d[f].jackpot===""?"Play Now":"JACKPOT "+d[f].jackpot)}else{$J("img",g).attr("src",d[f].imageUrl);$J(".jackpot",g).html(d[f].jackpot===""?"Play Now":d[f].jackpot)}})}})};iwin.HomePage.clubPod={};
iwin.HomePage.clubPod.init=function(){$J("#offerwallPod,#clubPod").hide();$J("#buzzContainer").show();iwin.Auth.getCurrentUsername()&&iwin.Util.getUserSubscription(iwin.HomePage.clubPod.success);$J("#offerwallPod .offerwallLink a").unbind("click").click(function(){iwin.Auth.getCurrentUsername()&&iwin.Util.getUserSubscription(iwin.trialpay.showOfferwall);return false});$$(".clubContent .free .poppable").each(function(a){$(a).observe("click",function(b){iwin.HomePage.clubPod.freeGamePurchase(this.id);
Event.stop(b)})})};iwin.HomePage.clubPod.success=function(a){var b,e,c=false,d=false;if(a){e=a.state;a=a.features;for(b in a)if(a[b].keyword==="IACCESS")c=true;if(e==="ACTIVE")d=true}iwin.HomePage.clubPod.track();if(c||d){b=Math.round(Math.random());if(b==0){b=Math.round(Math.random());if(c)$J("#clubPod").show();else b==0?$J("#offerwallPod").show():$J("#clubPod").show();$J("#buzzContainer").hide()}}};
iwin.HomePage.clubPod.track=function(){var a,b;a=iwin.tracking.domain+"/homepage";freeGame=$J("#clubPod .free .pic a")[0];saleGame=$J("#clubPod .sale .pic a")[0];offerWall=$J("#offerwallPod a")[0];b=$J(freeGame).attr("id");iwin.tracking.trackPageEvent(freeGame,"click",a,"Clicked on Free game",b);b=$J(saleGame).attr("id");iwin.tracking.trackPageEvent(saleGame,"click",a,"Clicked on Steals and Deals",b);iwin.tracking.trackPageEvent(offerWall,"click",a,"Clicked on Trial Pay offerwall POD","marketing")};
iwin.HomePage.clubPod.freeGamePurchase=function(a){$J.ajax({type:"POST",url:"/commerce/orders/current",dataType:"json",contentType:"application/json; charset=UTF-8",data:Object.toJSON({lineItems:[{game:{canonicalName:a},quantity:1}],excludeCustomCD:true}),success:function(b){window.location.href=b.self},error:function(b){if(b.status===500||b.status===503)try{var e=JSON.parse(b.responseText);if(e&&e.self)window.location.href=e.self}catch(c){}}})};Event.observe(document,"iwin:auth:login:success",iwin.HomePage.clubPod.init);
Event.observe(document,"dom:loaded",iwin.HomePage.init);

