(function(a){function c(a){return typeof a=="object"?a:{top:a,left:a}}var b=a.scrollTo=function(b,c,e){a(window).scrollTo(b,c,e)};b.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1};b.window=function(){return a(window)._scrollable()};a.fn._scrollable=function(){return this.map(function(){if(this.nodeName&&a.inArray(this.nodeName.toLowerCase(),["iframe","#document","html","body"])==-1)return this;var b=(this.contentWindow||this).document||this.ownerDocument||this;return a.browser.safari|| b.compatMode=="BackCompat"?b.body:b.documentElement})};a.fn.scrollTo=function(d,f,e){typeof f=="object"&&(e=f,f=0);typeof e=="function"&&(e={onAfter:e});d=="max"&&(d=9E9);e=a.extend({},b.defaults,e);f=f||e.speed||e.duration;e.queue=e.queue&&e.axis.length>1;e.queue&&(f/=2);e.offset=c(e.offset);e.over=c(e.over);return this._scrollable().each(function(){function i(a){g.animate(l,f,e.easing,a&&function(){a.call(this,d,e)})}var j=this,g=a(j),k=d,h,l={},p=g.is("html,body");switch(typeof k){case "number":case "string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)){k= c(k);break}k=a(k,this);case "object":if(k.is||k.style)h=(k=a(k)).offset()}a.each(e.axis.split(""),function(a,d){var c=d=="x"?"Left":"Top",f=c.toLowerCase(),m="scroll"+c,n=j[m],o=b.max(j,d);h?(l[m]=h[f]+(p?0:n-g.offset()[f]),e.margin&&(l[m]-=parseInt(k.css("margin"+c))||0,l[m]-=parseInt(k.css("border"+c+"Width"))||0),l[m]+=e.offset[f]||0,e.over[f]&&(l[m]+=k[d=="x"?"width":"height"]()*e.over[f])):(c=k[f],l[m]=c.slice&&c.slice(-1)=="%"?parseFloat(c)/100*o:c);/^\d+$/.test(l[m])&&(l[m]=l[m]<=0?0:Math.min(l[m], o));!a&&e.queue&&(n!=l[m]&&i(e.onAfterFirst),delete l[m])});i(e.onAfter)}).end()};b.max=function(b,c){var e=c=="x"?"Width":"Height",i="scroll"+e;if(!a(b).is("html,body"))return b[i]-a(b)[e.toLowerCase()]();var e="client"+e,j=b.ownerDocument.documentElement,g=b.ownerDocument.body;return Math.max(j[i],g[i])-Math.min(j[e],g[e])}})(jQuery); (function(a){a.fn.autoEllipsis=function(c){a.extend({},c);this.each(function(b){var c,f="WingooliAutoEllipsisScroller_"+b;if(!document.getElementById(f))c=document.createElement("div"),c.id=f+"_Container",c.innerHTML='<span id="'+f+'" style="overflow: visible; position: absolute; top: -2000px; color: orange"></span>',document.body.appendChild(c);c=document.getElementById(f);saeScroller=a(c);sthis=a(this);saeScroller.text(sthis.text());for(var f=sthis.html(),e={width:this.offsetWidth,height:this.offsetHeight}, i=a(c),j=a(this),g=["font-size","font-weight","font-family","font-style","padding"],b=0;b<g.length;b++)try{i.css(g[b],j.css(g[b]))}catch(k){}j.css("overflow","visible");i.width(j.width());for(var g=i.width(),h=i.height(),b=saeScroller.text();h>e.height&&b!="";)b=b.substr(0,b.length-2),h=b+"&hellip;",saeScroller.html(h),h=i.height();b==""&&(b=f,saeScroller.html(b),j.css("whiteSpace","nowrap"),i.width(""),g=i.width());for(;g>e.width&&b!="";)b=b.substr(0,b.length-2),h=b+"&hellip;",saeScroller.html(h), g=i.width();h=c.offsetHeight;c=Math.ceil(e.height/h)-1;c+=c==0?1:0;c=b.length*c+(c+1);this.title="";if(f==null||f=="")f=this.innerHTML;f.length-c>0?(this.title=f,this.innerHTML=f.substr(0,c-2)+"&hellip;"):this.innerHTML=f})}})(jQuery);if(typeof console=="undefined")var console=function(){var a=function(){};return{log:a,debug:a,info:a,warn:a,error:a,assert:a,dir:a,dirxml:a,trace:a,group:a,groupEnd:a,time:a,timeEnd:a,profile:a,profileEnd:a,count:a}}();var isIE6=/MSIE 6/i.test(navigator.userAgent); function displayError(a){$j("#"+a).show()}function closeError(a){$j("#"+a).hide()}function popAtomWindow(a){var c=30,b=30;a.centered==1&&(c=window.screen.width/2-(a.width/2+10),b=window.screen.height/2-(a.height/2+50));window.open(a.url,a.name,"status=no,height="+a.height+",width="+a.width+",resizable=yes,left="+c+",top="+b+",screenX="+c+",screenY="+b+",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no").focus()} function sendToLogin(){fluxKillEnabled||Flux.createWidget("Authentication",{},function(a){a.showSignInForm()})} jQuery.cookie=function(a,c,b){if(typeof c!="undefined"){b=b||{};if(c===null)c="",b=$.extend({},b),b.expires=-1;var d="";if(b.expires&&(typeof b.expires=="number"||b.expires.toUTCString))typeof b.expires=="number"?(d=new Date,d.setTime(d.getTime()+b.expires*864E5)):d=b.expires,d="; expires="+d.toUTCString();var f=b.path?"; path="+b.path:"",e=b.domain?"; domain="+b.domain:"",b=b.secure?"; secure":"";document.cookie=[a,"=",encodeURIComponent(c),d,f,e,b].join("")}else{c=null;if(document.cookie&&document.cookie!= ""){b=document.cookie.split(";");for(d=0;d<b.length;d++)if(f=jQuery.trim(b[d]),f.substring(0,a.length+1)==a+"="){c=decodeURIComponent(f.substring(a.length+1));break}}return c}};(function(a){a.fn.smarttrunc=function(a,b){var d=this.text();d.length>a&&(d=d.substr(0,a),/( |\t)/.test(this.text().substr(a-1,2))||(d=d.split(" ").reverse().slice(1).reverse().join(" ")),d+=b&&b.delimiter?b.delimiter:"...");return this.text(d)}})(jQuery);window.loaded=!1; var atom={relatedVideosScroller:function(){var a=$j(".relatedThumbs li").length%3;if(a>0)for(var c=0;c<3-a;c++)$j(".relatedThumbs ul li:last").after("<li></li>");$j(".relatedThumbs").jCarouselLite({btnNext:".relatedNext",btnPrev:".relatedPrev",circular:!1,scroll:3});$j(".video-related li[id]").mouseenter(function(){atom.navZIndexReduce();var a=77*(parseInt(this.id.split("-").pop())%3)-30;$j("#video-related-tooltip").css("left",a+"px").stop(!1,!0).hide().find(".std-tooltip-content").html($j(".std-tooltip-content", this).html());$j("#video-related-tooltip").stop(!1,!0).fadeIn(300)}).mouseleave(function(){atom.navZIndexRestore();$j("#video-related-tooltip").stop(!1,!0).hide()})},loadNav:function(){if(!window.loaded){$j(document.getElementsByTagName("esi:include")).each(function(){var a=$j(this);console.log("esi: "+a.attr("src"));$j.get(a.attr("src"),function(b){console.log(b);a.replaceWith(b)})});$j("#navsearch-form").submit(function(){return document.getElementById("mainSearch").value!=""?!0:!1});$j("#footer-search-form").submit(function(){return document.getElementById("footer-mainSearch").value!= ""?!0:!1});$j("#searchAtom").click(function(){document.getElementById("mainSearch").value!="SEARCH"&&$j("#navsearch-form").submit();return!1});$j("#searchWeb").click(function(){var a="http://search.live.com/results.aspx?q="+escape($j("#mainSearch").attr("value"))+"&mkt=en-us&FORM=VCM013";document.getElementById("mainSearch").value!="SEARCH"&&window.open(a);return!1});$j("#footer-searchAtom").click(function(){document.getElementById("footer-mainSearch").value!="SEARCH"&&$j("#footer-search-form").submit(); return!1});$j("#footer-searchWeb").click(function(){var a="http://search.live.com/results.aspx?q="+escape($j("#footer-mainSearch").attr("value"))+"&mkt=en-us&FORM=VCM013";document.getElementById("footer-mainSearch").value!="SEARCH"&&window.open(a);return!1});$j("#mainSearch, #footer-mainSearch").focus(function(){var a=$j(this).addClass("search-entered");a.attr("value")==a.attr("defaultValue")&&a.attr("value","")});$j("#mainSearch, #footer-mainSearch").blur(function(){var a=$j(this);a.attr("value")== ""&&a.attr("value",a.attr("defaultValue")).removeClass("search-entered")});$j("#topnav-email,#footie-email").click(function(){$j("#newsPopOverlayBackground").show();var a=$j("#newsPopOverForm");a.find("iframe").size()<1&&a.append('<iframe id="email-form-iframe" src="http://exodus.atom.com/site/signup" marginheight="0" marginwidth="0" scrolling="no" frameborder="0"></iframe>');a.show();return!1});$j("#newsPopCloseWindowLink").click(function(){$j("#newsPopOverlayBackground").hide();$j("#newsPopOverForm").hide(); return!1});var a=$j("#nav-funny-videos");if(a.size()>0){var c=$j(".nav-dropdown").remove().removeClass("hide");c&&c.size()>0&&!/^\/channels?\//.test(location.pathname)&&c.find(".nav-dropdown-column").size()>0?a.append(c):$j.get("/navigation_channels/",function(b){b=$j(b);b.size()>0&&b.hasClass("nav-dropdown")&&a.append(b.removeClass("hide"))})}$j("#nav-funny-videos span.arrow-down").size()<1&&$j("#nav-funny-videos a").append('<span class="arrow-down"></span>').wrapInner("<b/>");var b=$j("#socialmedia a div.tooltip-hover").bind("mouseleave", function(){$j(this).stop(!1,!0).fadeOut(300)});$j("#socialmedia div").hide().removeClass("hide");$j("#socialmedia a").bind("mouseenter",function(){b.stop(!1,!0).fadeOut(0);$j(this).find("div.tooltip-hover").stop(!1,!0).fadeIn(300)}).bind("mouseleave",function(){$j(this).find("div.tooltip-hover").stop(!1,!0).fadeOut(300)});$j("#navsearch").bind("mouseenter",function(){b.stop(!1,!0).fadeOut(300)});$j("#socialmedia a:not(#topnav-facebook) div.tooltip-hover").each(function(){$j(this).css("left",106-parseInt($j(this).width(), 10)+"px")});var d,f={"topnav-bookmark":"nav_bookmark","topnav-email":"nav_email","topnav-rss":"nav_rss","topnav-twitter":"nav_twitter","topnav-facebook":"nav_facebook","topnav-cc":"nav_comedy","footie-logo":"footie_home","footie-facebook":"footie_facebook","footie-twitter":"footie_twitter","footie-tumblr":"footie_tumblr","footie-email":"footie_email","footie-close":"footie_close"};for(d in f)$j("#"+d).click(function(){com.mtvi.reporting.Controller.sendLinkEvent({linkName:f[this.id],linkType:"o"})}); $j.cookie("displayFootie")!="false"&&!isIE6&&($j("#footie-close").click(function(){$j("#footie").slideUp(300);$j.cookie("displayFootie","false");return!1}),setTimeout(function(){$j("#footie").css("display","none").removeClass("hide").slideDown(300)},1E3));window.loaded=!0}},navZIndexReduce:function(){$j(".siteheader").css("z-index",1);$j(".columncontainer").css("z-index",1E4)},navZIndexRestore:function(){$j(".siteheader").css("z-index",9E3);$j(".columncontainer").css("z-index",1)},sharethis:function(a, c,b){var d={funny_videos:"Video: ",fun_games:"Game: ","funny-stuff":"Funny Stuff: ",blog:"Blog: ",atomtv:"Atom TV: ",tournament:"Tournament: ",channel:"Channel: "},d=typeof d[location.pathname.split("/")[1]]!="undefined"?d[location.pathname.split("/")[1]]:"",c=typeof c!="undefined"?c:location.href,b=typeof b!="undefined"?b:document.title,c="http://wd.sharethis.com/api/sharer.php?destination="+a+"&url="+escape(c)+"&title="+escape(b)+"&publisher="+SHARETHIS.fpc+"&sessionID="+SHARETHIS.sessionID+"&source=button"; mtvn.btg.Controller.sendLinkEvent({linkName:b,linkType:"o",eVar19:"share "+a,eVar9:d+b,events:"event9"});window.open(c,"sharethis")},__messageTimer:null,message:function(a,c){if(!c||c<0)c=1E4;if($j("#site-messaging:visible").size()<=0&&a&&(clearTimeout(this.__messageTimer),$j("#site-messaging p").html(a),$j("#site-messaging").slideDown(300),c>0))this.__messageTimer=setTimeout(this.messageClose,1E4)},messageClose:function(){clearTimeout(this.__messageTimer);$j("#site-messaging").slideUp(300);return!1}, bookmark:function(a){a=!a?"http://www.atom.com":"http://www.atom.com"+a;document.all?window.external.AddFavorite(a,"Atom.com | Funny Videos, Comedy, Humor, Animations, Flash Games, Tournament & Blogs"):window.sidebar&&window.sidebar.addPanel("Atom.com | Funny Videos, Comedy, Humor, Animations, Flash Games, Tournament & Blogs",a,"")},getParam:function(a){if(/\?&#=/.test(a))return!1;a=RegExp("[?&]"+escape(a)+"=([^&#]*)");return a.test(location.href)?a.exec(location.href)[1]:!1},scroller:function(a){var c= !isNaN(a.duration)?a.duration:200,b=a.pageSize,d=$j(a.down),f=$j(a.up),e=$j(a.els),i=$j(a.container),j=Math.ceil(e.size()/b),g=0;j>1&&(a=function(){var a=this,h=0;d.each(function(){a==this&&(h=1)});f.each(function(){a==this&&(h=-1)});if(h<0&&g<=0||h>0&&g>=j-1)h=0;h!=0&&(g+=h,i.scrollTo(e.filter(":nth-child("+(g*b+1)+")"),c));g==0?f.addClass("disabled"):f.removeClass("disabled");g==j-1?d.addClass("disabled"):d.removeClass("disabled");return!1},f.click(a),d.removeClass("disabled").click(a))},gameShare:function(a, c,b){atom.__share.url=typeof a=="string"&&a!=""?a:location.href;if(!/^http/.test(a))atom.__share.url=a=location.protocol+"//"+location.host+(location.port?":"+location.port:"")+a;atom.__share.title=typeof c=="string"&&c!=""?c:document.title;atom.__share.icon=typeof b=="string"&&b!=""?b:atom.__share.icon!=""?atom.__share.icon:$j("meta[property='og:image']").attr("content");if(!atom.__share.el)atom.__share.el=$j('<div id="game-share" class="leftfield"><h2>SHARE</h2><a id="game-share-facebook" class="st_facebook">facebook</a><a id="game-share-twitter" class="st_twitter">twitter</a><a id="game-share-stumbleupon" class="st_stumbleupon">stumble</a><a id="game-share-reddit" class="st_reddit">reddit</a><a id="game-share-tumblr" class="st_tumblr">tumblr</a><a id="game-share-digg" class="st_digg">digg</a><a id="game-share-link" class="no-share-this" onclick="return false;" href="'+ location.pathname+'">Copy Link</a><a id="game-share-close" class="no-share-this" href="#">Close</a></div>').appendTo("body"),/^\/(fun_games|channel)\//.test(location.pathname)&&atom.__share.el.addClass("shifted"),atom.__share.st=SHARETHIS.addEntry({title:atom.__share.title,url:atom.__share.url,icon:atom.__share.icon},{button:!1}),atom.__share.st.attachChicklet("facebook",document.getElementById("game-share-facebook")),atom.__share.st.attachChicklet("twitter",document.getElementById("game-share-twitter")), atom.__share.st.attachChicklet("digg",document.getElementById("game-share-digg")),$j("#game-share-stumbleupon,#game-share-reddit,#game-share-tumblr").click(function(){atom.sharethis(this.id.split("-").pop(),atom.__share.url,atom.__share.title);return!1}),$j("#game-share-close").click(function(){$j("#newsPopOverlayBackground").hide();$j("#game-share").hide();return!1}),atom.clip("game-share-link",atom.__share.url,"game-share"),$j("#game-share").removeClass("leftfield").hide(),$j("#game-share a:not(.no-share-this)").click(function(){this.id.indexOf("game-share-")>= 0&&mtvn.btg.Controller.sendLinkEvent({linkName:atom.__share.title,linkType:"e",eVar19:this.id.substring(11)})});$j("#newsPopOverlayBackground").show();$j("#game-share").show();atom.__share.st.properties.title=atom.__share.title;atom.__share.st.properties.url=atom.__share.url;atom.__share.st.properties.icon=atom.__share.icon;return!0},__share:{el:null,st:null,title:"",url:location.href,icon:""},clip:function(a,c,b){if($j.browser.msie&&$j.browser.version<7)$j("#"+a).click(function(){window.clipboardData.setData("Text", c)});else{var d=new ZeroClipboard.Client;d.glue(a,b);d.setText(c)}}}; $j(document).ready(atom.loadNav).ready(function(){$j("#site-messaging-close").click(atom.messageClose);$j("#site-messaging").mouseenter(function(){clearTimeout(atom.__messageTimer)}).mouseleave(function(){atom.__messageTimer=setTimeout(atom.messageClose,1E4)});FB&&FB.Event&&FB.Event.subscribe&&FB.Event.subscribe("edge.create",function(a){var a=a.replace("http://"+location.hostname+"/",""),a={linkName:a,linkType:"o",eVar19:"share_fblike",eVar9:a,events:"event9",pev2:"share"},c=$j("link[rel=video_src]").attr("href"), b=/scenic-.\.mtvi\.com/.test(location.hostname)?"&staging=true":"";if($j("#playvideobody").size()>0&&c)a.eVar33=$j("meta[name=title]").attr("content")+"_"+c.split("atom.com:")[1];mtvn.btg.Controller.sendLinkEvent(a);$j.get("/blog/wp-content/themes/atom_com/fluxdaapi.php?feed=Action/FacebookLike%3Fcontenturi%3D"+escape(contentUri)+"&skipCache=true"+b)})}); $j(document).ready(function(){$j(".tournament-contender").size()>0&&$j(".tournament-contender").mouseenter(function(){atom.navZIndexReduce();$j(".leftcolumn").css("z-index",1E4);$j("#tournament-contender-tooltip").stop(!1,!0).fadeIn(300)}).mouseleave(function(){$j(".leftcolumn").css("z-index",1);$j("#tournament-contender-tooltip").stop(!1,!0).fadeOut(300,atom.navZIndexRestore)})});/^\/tournament/.test(location.pathname)&&$j.cookie("tournamentIntro","true",{expires:5E3}); function pubPlayerPause(){try{mtvn.btg.reporting.player.MediaPlayer.execute("pause")}catch(a){}}function pubPlayerResume(){try{mtvn.btg.reporting.player.MediaPlayer.execute("unpause")}catch(a){}};
