if(typeof window.IGN==="undefined"||!window.IGN){IGN={}}IGN.HeroUnit=function(){var G=3000,x=4000,j=109,a=61,g=80,A=45,e=4,r=4,t=400,m=400,C,o,i,l,n="fade-overlay";var I=function(P,L,O){var M=L-P,N=M%O;if(M===0){return 0}else{if(N!==0){return N}else{return(M>0)?O:O*-1}}};var k=function(M){var P=$j(M).height(),O,L=g/A,N=parseInt($j(M).parent().css("margin-top"),10);clearInterval(M.shrinkInterval);clearInterval(i);if(C&&C!==M){J(C)}C=M;i=setInterval(function(){O=I(P,a,r);if(!O){clearInterval(i)}else{height=P+O;P=height;width=height*L;N=N-O;$j(M).height(height);$j(M).width(width);$j(M).parent().css("margin-top",N+"px").next().css("width",width+"px")}},10)};var J=function(M){var P=$j(M).height(),O,L=g/A,N=parseInt($j(M).parent().css("margin-top"),10);C=M;M.shrinkInterval=setInterval(function(){O=I(P,A,e);if(!O){clearInterval(M.shrinkInterval)}else{height=P+O;P=height;width=height*L;N=N-O;$j(M).height(height);$j(M).width(width);$j(M).parent().css("margin-top",N+"px").next().css("width",width+"px")}},10)};var K=function(M){var L=parseInt($j(M).height(),10);L+=parseInt($j(M).css("padding-top"),10);L+=parseInt($j(M).css("padding-bottom"),10);return L};var u=function(N,M){var L=K(N);$j(N).animate({marginBottom:"-"+L+"px"},t,"linear",M)};var q=function(M){var L=K(M);$j(M).css("margin-bottom","-"+L+"px")};var c=function(L){$j(L).animate({marginBottom:0},m,"linear")};var H=function(L){$j(L).css("margin-bottom","0px")};var y=function(M,L){$j(M).show();if(L){$j("."+n).css("display","block").css("opacity",0.9).fadeOut(m);c($j(".text-related",M))}else{H($j(".text-related",M))}o=M};var E=function(L,N,M){if(N){if(M){$j("."+n).css("display","block").css("opacity","0.1").fadeTo(t,1);u($j(".text-related",N),function(){$j(N).hide();y(L,M)})}else{$j("."+n).hide();q($j(".text-related",N));$j(N).hide();y(L,M)}}else{$j("."+n).hide();y(L,M)}};var f=function(L,N,M){if(!N||L.attr("id")!==N.attr("id")){E(L,N,M)}};var b=function(L){$j(L).css("visibility","hidden").show();q($j(".text-related",L));$j(L).css("visibility","visible");$j(L).hide()};var v={intervalId:null,resumeLast:0,_list:$j("#top-stories > .wrapper-thumbs > .thumbs > li"),start:function(M,L){M=(M&&M<v.length())?M:0;var O=v._list,N=v.length();var P=function(){if(N>0){M=M%N;d($j("a > img",$j(O[M])),true);M++;v.resumeLast=M}};if(!v.intervalId){if(L){P()}v.intervalId=setInterval(P,x)}},stop:function(){clearInterval(v.intervalId);v.intervalId=null},pause:function(){v.stop()},resume:function(){v.start(v.resumeLast||0)},reset:function(){v.stop();v.start()},length:function(){return this._list.length}};var B=function(L){if(!C||$j(L).attr("id")!==$j(C).attr("id")){$j(C).parent().parent().removeClass("selected");k(L);$j(L).parent().parent().addClass("selected")}};var d=function(N,M){B(N);var L=$j("#hul"+s($j(N).parent("a").attr("id")));f(L,o,M)};var s=function(O){if(O){var L=/^(?:hus|hul)(\d*)/;var N=O.match(L);if(N){var M=O.match(L)[1]}return M||null}};var D=function(){var L=document.createElement("div");L.className=n;$j(L).appendTo($j("#top-stories > .content"))};function h(){if(typeof($f())!="undefined"&&typeof($f().pause())!="undefined"){$f().pause()}$j("#hul-video, #hul-video-age, #hul-video-back").hide();$j(".wrapper-thumbs, #hul"+l).show()}function w(M,N,L){l=M;userAge=p("VPage");if(L==0||(userAge!=null&&userAge>=L)){$j("#hul-video").html("");IGN.HeroUnit.pause();$j("#hul"+M).hide();$j("#hul-video-age").hide();$j(".wrapper-thumbs").hide();$j.getJSON("http://api.ign.com/tt/global_embed_config.t?"+N+"&pagetype=mediavideo_embed_channel&content-type=application%2Fx-javascript&callback=?",function(O){$f("hul-video",{src:"http://media.ign.com/ev/embed.swf",wmode:"transparent"},O)});$j("#hul-video,#hul-video-back").show()}else{$j("#agFormAgeGate").attr("value",L);$j("#agFormvidNum").attr("value",M);$j("#agFormparams").attr("value",N);$j("#hul"+M).hide();$j(".wrapper-thumbs").hide();$j("#hul-video-age,#hul-video-back").show();if(userAge!=null&&userAge<L){$j("#ageGateText").attr("style","color: red").html("You have entered a restricted birth date.<br/><br/>");$j("#ageGateOptions").attr("style","display:none;")}}}function F(P){var N=new Date(P);var M=new Date();var L=M.getFullYear()-N.getFullYear();var Q=M.getMonth()-N.getMonth();var O=M.getDate()-N.getDate();if(L<0){return -1}if(Q<0){return L-=1}else{if((Q==0)&&(O<0)){L-=1}}return L}function p(L){var N=L+"=";var O=document.cookie.split(";");for(var M=0;M<O.length;M++){var P=O[M];while(P.charAt(0)==" "){P=P.substring(1,P.length)}if(P.indexOf(N)==0){return parseInt(P.substring(N.length,P.length))}}return null}function z(N,O,P){var M=O;var L=new Date();L.setDate(L.getDate()+P);if(P!=null){document.cookie=N+"="+escape(M)+"; expires="+L.toGMTString()+"; domain=ign.com; path=/"}else{document.cookie=N+"="+escape(M)+"; domain=ign.com; path=/"}}$j(document).ready(function(){$j("#vidSubmitAge").click(function(){var N=/^\d+$/;var P=$j(".agemm").val();var M=$j(".agedd").val();var Q=$j(".ageyyyy").val();var O=F(P+"/"+M+"/"+Q);var L=$j("#agFormAgeGate").val();if(P>12||M>31||Q<1910||P==""||M==""||Q==""||!N.test(P)||!N.test(M)||!N.test(Q)){$j("#ageGateText").attr("style","color: red").html("Please enter a valid birth date (MM-DD-YYYY).<br/><br/>")}else{z("VPage",O,null);if(O<L){$j("#ageGateText").attr("style","color: red").html("You have entered a restricted birth date.<br/><br/>");$j("#ageGateOptions").attr("style","display:none;")}else{IGN.HeroUnit.showPlayer($j("#agFormvidNum").val(),$j("#agFormparams").val(),0)}}})});return{autoScroll:v,pause:v.pause,resume:v.resume,reset:v.reset,showPlayer:w,hidePlayer:h,init:function(R){if(!$j("#top-stories").length){return false}D();var M=R||0;var P=$j("#top-stories > .wrapper-thumbs > .thumbs > li > a");for(var O=0,L=$j(P).length;O<L;O++){var Q="hul"+s($j(P[O]).attr("id"));var N=$j("#"+Q);b(N)}IGN.HeroUnit.autoScroll.start(M,true);$j("#top-stories > .wrapper-thumbs > .thumbs > li").mouseover(function(S){v.stop();d($j("a > img",this),false)})}}}();IGN.HeroUnit.init();