function launchCheatsWizard(a,c){if(c>0){var b="/cheats/add-cheat/?cheat_id="+c}else{var b="/cheats/add-cheat/?game_id="+a}new LaunchPad.Base({titleTextStr:"Add a New Cheat",url:b}).open()}function deleteCheat(c,b){var a=confirm("Are you positive you want to delete this cheat? This cannot be undone");if(a){$(b).effects().start({opacity:[1,0]});params=Object.toQueryString({cheat_id:c});new VinesAjax("/cheats/delete-cheat/",{method:"POST",update:b,data:params,onComplete:function(){$(b).effects().start({opacity:[0,1]})}}).request()}}function launchNewReleaseDetail(b,a){lp=new LaunchPad.Base({titleTextStr:"New Releases for "+a,url:b}).open()}function filterGames(b,a){filter=$(a)[$(a).selectedIndex].value;location.replace(b+"filter_type=platform&filter_value="+filter)}function filterNewReleasesByRegion(a,b){region_filter=$(b)[$(b).selectedIndex].value;location.replace(a+"?selected_region="+region_filter)}function deleteContentObject(b,c,d){var a=confirm("Are you positive you want to delete this dlc? This cannot be undone.");if(a){params=Object.toQueryString({dlc_id:c});new VinesAjax(b,{method:"POST",data:params,evalScripts:true,onComplete:function(e){$(d).addClass("dn")}}).request()}}function launchGameReviewForm(c,a,d,b){if(b){lp=new LaunchPad.Base({titleTextStr:"Review "+d,url:c+"/?game_id="+a+"&dlc=true"}).open()}else{lp=new LaunchPad.Base({titleTextStr:"Review "+d,url:c+"/?game_id="+a}).open()}}function renderGameReviewForm(d,b,a,c){url="/user_review/render_form/";$("review_link_div").addClass("dn");if(c){params=Object.toQueryString({dlc_id:c})}else{params=Object.toQueryString({platform_id:b,game_id:a})}new VinesAjax(url,{method:"POST",update:d,data:params,evalScripts:true,onComplete:function(){$(d).effects().start({opacity:[0,1]})}}).request()}function launchDLCReviewForm(b,a){lp=new LaunchPad.Base({titleTextStr:"Review "+b,url:"/user_review/render_form/?dlc_id="+a}).open()}function releaseDateShowToggle(e){var d=$("releaseDate"+e);var c=$("releaseExpectedDate"+e);if(!d.hasClass("dn")){$("toggleReleaseDate"+e).removeClass("dn")}else{$("toggleReleaseExpectedDate"+e).removeClass("dn")}}function releaseDateToggle(d){var j=$("releaseDate"+d);var i=$("releaseExpectedDate"+d);var g=$("toggleReleaseDate"+d);var f=$("toggleReleaseExpectedDate"+d);var e=$(j).getElement(".js-calendar");var c=$(i).getElement("#id_expected_release_month");var k=$(i).getElement("#id_expected_release_quarter");var h=$(i).getElement("#id_expected_release_year");if(j.hasClass("dn")){j.removeClass("dn");g.removeClass("dn");i.addClass("dn");f.addClass("dn");c.value="";k.value="";h.value=""}else{j.addClass("dn");g.addClass("dn");i.removeClass("dn");f.removeClass("dn");e.value=""}}function getFDEdContent(e,d,b){$("js-fc-ed-container").getElements(".fd-ec").each(function(f){f.removeClass("on")});var c=new Element("div").setHTML('<img src="'+MEDIA_URL+'vine/img/icons/loading.gif" />').addClass("w-100").addClass("ta-c");$(b).innerHTML=c.innerHTML;$(d).addClass("on");var a="/ajax-get-content-pod/?content_pod=get_ed_content";params=Object.toQueryString({tab_title:e});new VinesAjax(a,{method:"POST",update:b,data:params}).request()}var _ct_stat_cache=new Hash();function frontdoorCTStatResponse(a){a=JSON.decode(a);if(a.error){clog(a.error);return}_ct_stat_cache.set(a.type,a.content);frontdoorCTStatInjectResponse(a.type)}function frontdoorCTStatInjectResponse(b){var a=$("js-ct-stats");a.innerHTML=_ct_stat_cache.get(b);$$(".js-ct-stat").each(function(c){if(c.getProperty("ct_type")==b){c.addClass("active")}else{c.removeClass("active")}})}function getFrontdoorCTStats(c){var b=$("js-ct-stats");if(!b){clog("No element with ID: 'js-ct-stats'");return}if(_ct_stat_cache.hasKey(c)){frontdoorCTStatInjectResponse(c);return}var a="/fd-stats/"+c+"/";new VinesAjax(a,{method:"get",onComplete:frontdoorCTStatResponse}).request()}function wireupCTStatLinks(){var b=$("js-ct-stats");if(!b){return}$$(".js-ct-stat").each(function(c){c.addEvent("mouseover",function(e){var d=c.getProperty("ct_type");if(!d){clog("no ct_type found for "+c);return}getFrontdoorCTStats(d)})});var a=b.getProperty("initial_ct");if(!a){return}getFrontdoorCTStats(a)}var k_code=["up","up","down","down","left","right","left","right","b","a","enter"];var k_place=0;document.addEvent("keydown",function(a){var a=new Event(a);if(a.key==k_code[k_place]){k_place++;if(k_place==k_code.length){window.location.href="/contra/61-4350/"}}else{k_place=0}});var imageCarousel=new Class({options:{images:[],start_index:0,wrap:true},initialize:function(a){this.setOptions(a);this.prev_div=$("js-carousel-prev");this.current_div=$("js-carousel-current");this.next_div=$("js-carousel-next");if(this.prev_div&&this.current_div&&this.next_div){this.addImages(this.options.images);if(this.images.length){this.showImages(this.options.start_index)}this.prev_div.addEvent("click",this.cycleForward.bind(this));this.next_div.addEvent("click",this.cycleBack.bind(this));this.prev_div.setStyle("cursor","pointer");this.next_div.setStyle("cursor","pointer")}},images:[],addImages:function(a){$$(a).each(function(b){this.images.include($(b))},this)},cycleForward:function(){if($chk(this.now)&&this.now<this.images.length-1){this.showImages(this.now+1)}else{if((this.now)&&this.options.wrap){this.showImages(0)}}},cycleBack:function(){if(this.now>0){this.showImages(this.now-1)}else{if(this.options.wrap){this.showImages(this.images.length-1)}}},showImages:function(a){if(this.images[a]){this.current_div.innerHTML=this.images[a].innerHTML;if(a+1>this.images.length-1){this.next_div.innerHTML=this.images[0].innerHTML}else{this.next_div.innerHTML=this.images[a+1].innerHTML}if(a-1<0){this.prev_div.innerHTML=this.images[this.images.length-1].innerHTML}else{this.prev_div.innerHTML=this.images[a-1].innerHTML}this.now=a}}});imageCarousel.implement(new Events);imageCarousel.implement(new Options);window.addEvent("domready",function(){new imageCarousel({images:$$("div.js-release-image")})});window.addEvent("domready",function(){(function(){more_text="show all";less_text="show first row";$$("ul.release > li").each(function(a){wrap=a.getElement(".wrap");count=a.getElements(".release").length;if(count===0){return}if(Math.floor(wrap.getSize().x/wrap.getElement(".release").getSize().x)>=count){return}toggle=new Element("a",{href:"#","class":"more",html:more_text+" "+count});arrow=new Element("span",{"class":"arrow"});toggle.grab(arrow);toggle.store("count",count);toggle.store("wrap",wrap);toggle.store("original_wrap_height",wrap.getSize().y);toggle.addEvent("click",function(){original_wrap_height=$(this).retrieve("original_wrap_height");wrap=$(this).retrieve("wrap");count=$(this).retrieve("count");if(original_wrap_height<wrap.getSize().y){wrap.setStyle("height",wrap.getSize().y).tween("height",original_wrap_height);$(this).set("text",more_text+" "+count).grab(new Element("span",{"class":"arrow"}))}else{count_per_row=Math.floor(wrap.getSize().x/wrap.getElement(".release").getSize().x);rows=Math.ceil(count/count_per_row);wrap_size=wrap.getSize();wrap.get("tween").chain(function(){wrap.setStyle("height","auto")}).start("height",wrap_size.y,rows*wrap_size.y);$(this).set("text",less_text).grab(new Element("span",{"class":"arrow up"}))}return false});a.getElement(".hd").grab(toggle,"top")})})()});