(function(a){a.fn.newsTicker=a.fn.newsticker=function(b){b=b||4000;initTicker=function(c){stopTicker(c);c.items=a("li",c);c.items.not(":eq(0)").hide().end();c.currentitem=0;startTicker(c)};startTicker=function(c){c.tickfn=setInterval(function(){doTick(c)},b)};stopTicker=function(c){clearInterval(c.tickfn)};pauseTicker=function(c){c.pause=true};resumeTicker=function(c){c.pause=false};doTick=function(c){if(c.pause){return}c.pause=true;a(c.items[c.currentitem]).fadeOut("slow",function(){a(this).hide();c.currentitem=++c.currentitem%(c.items.size());a(c.items[c.currentitem]).fadeIn("slow",function(){c.pause=false})})};this.each(function(){if(this.nodeName.toLowerCase()!="ul"){return}initTicker(this)}).addClass("newsticker").hover(function(){pauseTicker(this)},function(){resumeTicker(this)});return this}})(jQuery);(function(a){a.fn.hoverIntent=function(l,k){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,k?{over:l,out:k}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(r){var q=(r.type=="mouseover"?r.fromElement:r.toElement)||r.relatedTarget;while(q&&q!=this){try{q=q.parentNode}catch(r){q=this}}if(q==this){return false}var g=jQuery.extend({},r);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(r.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);function epExpand(a){return(function(){a.find("div.ep_detail_link").hide();a.find("div.rating_duration").css("display","block");a.find("div.text").slideDown("normal")})}function epCollapse(a){return(function(){a.find("div.rating_duration").css("display","none");a.find("div.ep_detail_link").show();a.find("div.text").slideUp("fast")})}function epCollectionInit(){$("div.episode").removeClass("ep_last");$("div.episode:last").addClass("ep_last");$("div.episode").each(function(){ep=$(this);if(!ep.hasClass("ep_first")){prev=ep.prev();prev.css({"border-bottom":"0px"});prev.find(".episode_inner").css({"border-bottom":"1px dotted #cdcdcd"})}if(!ep.hasClass("ep_last")){ep.css({"border-bottom":"0px"});ep.find(".episode_inner").css({"border-bottom":"1px dotted #cdcdcd"})}});epHoverIntent();$(".episode .ep_type").each(function(){$(this).hover(function(){hoverInSubdub($(this))},function(){hoverDefaultSubdub($(this).parents(".episode"))})})}function epHoverIntent(){var a={sensitivity:3,interval:10,over:function(){ep=$(this);ep.css("background","transparent url('/images/result-bg.jpg') repeat-x bottom");ep.find(".episode_right h1>a").css({color:"#BD0000"});ep.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 0");ep.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 0");hoverDefaultSubdub(ep);ep.find(".episode_img_hover").css("visibility","visible");if(!ep.hasClass("ep_first")){prev=ep.prev();prev.find(".episode_inner").css({"border-bottom":"0px"});prev.css({"border-bottom":"1px solid #cdcdcd"})}if(!ep.hasClass("ep_last")){ep.find(".episode_inner").css({"border-bottom":"0px"});ep.css({"border-bottom":"1px solid #cdcdcd"})}var b=epExpand(ep);document.delayedExpand_t=setTimeout(b,600);return false},timeout:10,out:function(){ep=$(this);ep.css("background","transparent");ep.find(".episode_right h1>a").css({color:"#000"});ep.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 -26px");ep.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 -23px");noHoverSubdub(ep);ep.find(".episode_img_hover").css("visibility","hidden");if(!ep.hasClass("ep_first")){prev=ep.prev();prev.css({"border-bottom":"0px"});prev.find(".episode_inner").css({"border-bottom":"1px dotted #cdcdcd"})}if(!ep.hasClass("ep_last")){ep.css({"border-bottom":"0px"});ep.find(".episode_inner").css({"border-bottom":"1px dotted #cdcdcd"})}if(document.delayedExpand_t){document.delayedExpand_t=clearTimeout(document.delayedExpand_t)}var b=epCollapse(ep);setTimeout(b,300);return false}};$("div.episode").hoverIntent(a)}$(document).ready(function(){epCollectionInit()});function noHoverSubdub(a){a.find(".ep_type").each(function(){if($(this).hasClass("sub")){$(this).find("a").css("background-position","0 0")}else{$(this).find("a").css("background-position","-35px 0")}})}function hoverDefaultSubdub(c){var b=c.find(".ep_type");var a=b.length;b.each(function(){if($(this).hasClass("dub")){if(a==1||document.lang_pref=="en"){$(this).find("a").css("background-position","-35px -27px")}else{$(this).find("a").css("background-position","-35px 0")}}else{if(a==1||document.lang_pref=="ja"){$(this).find("a").css("background-position","0 -27px")}else{$(this).find("a").css("background-position","0 0")}}})}function hoverInSubdub(a){if(a.hasClass("sub")){a.find("a").css("background-position","0 -27px")}else{a.find("a").css("background-position","-35px -27px")}a.siblings(".ep_type").each(function(){if($(this).hasClass("sub")){$(this).find("a").css("background-position","0 0")}else{$(this).find("a").css("background-position","-35px 0")}})}function reload_your_series(){$("#your_shows").html('<div style="padding:12px 10px;"><img src="/images/ajax-loader.gif" /></div>');load_your_series()}function load_your_series(){var b="";var a={};if(typeof(series_id)!=="undefined"){b="?series_id="+series_id}if(typeof(page_type)!=="undefined"){a.page_type=page_type}if(typeof(page_type_id)!=="undefined"){a.page_type_id=page_type_id}$.ajax({url:"/account/get_your_series"+b,data:a,success:function(c){show_your_series_from_data(c)},error:function(c){$("#your_shows").html('<div style="margin:10px 13px;">There was an error loading this section - please refresh the page to try again</div>')}})}function show_your_series_from_data(a){$("#your_shows").html(a);$(".your_shows_serie_container:last").addClass("your_shows_serie_last");$(".your_shows_serie_container:first").addClass("your_shows_serie_first");$(".your_shows_serie_container").each(function(){show=$(this);if(!show.hasClass("your_shows_serie_first")){show.addClass("your_shows_serie_not_first")}if(!show.hasClass("your_shows_serie_last")){show.addClass("your_shows_serie_not_last")}});Cufon.refresh();setUpHoverThumbs();if(page_type=="page"&&page_type_id==1){init_scroller("yourShowsContainer")}}function follow_series(d,a,b){var c=1;if(a==0){showConfirm("Stop Following?","Are you sure you want to stop following this show?",getFollowAjax(d,a,b))}else{getFollowAjax(d,a,b).call()}return false}function getFollowAjax(c,a,b){return function(){$("#your_shows").html('<div style="margin:10px 13px;">'+formatLoadingMessage("Saving and refreshing...")+"</div>");if(isHomePage()||isProfilePage()){$("#all_shows_following_"+c).html('<div style="margin:4px;"><img src="/images/ajax-loader.gif" /></div>')}data={};data.series_id=c;data.follow=a;data.last_ep_version_id=b;if(typeof(page_type)!=="undefined"){data.page_type=page_type}if(typeof(page_type_id)!=="undefined"){data.page_type_id=page_type_id}if(typeof(series_id)!=="undefined"){data.view=series_id}$.ajax({type:"POST",url:"/account/follow",data:data,success:function(d){show_your_series_from_data(d);if(isHomePage()||isProfilePage()){reload_your_shows_following(c)}},error:function(d){$("#your_shows").html("<div style='padding:10px 13px;'>There was an error loading this section - please refresh the page to try again</div>")}})}}function isHomePage(){if(typeof(page_type)!=="undefined"&&page_type=="page"&&typeof(page_type_id)!=="undefined"&&page_type_id==1){return true}return false}function isProfilePage(){if(typeof(page_type)!=="undefined"&&page_type=="page"&&typeof(page_type_id)!=="undefined"&&page_type_id==4){return true}return false}$(document).ready(function(){load_your_series();$(document).bind("post_login",function(){reload_your_series()});$(".your_shows_serie_container .episode_img, .your_shows_serie_container .your_shows_img, .your_shows_serie_container .your_shows_text_line:not(.last_seen)").live("mouseover",function(){var a=$(this).parents(".your_shows_serie_container");$(".episode_img_hover",a).css("visibility","visible");$(".your_shows_text_line:not(.last_seen) a",a).css("color","#bd0000");$(".your_shows_text: a.series_title",a).css("color","#bd0000");$(".vote_icon a, .comment_icon a",a).css("background-position","0 0");$(".rating_activity_number",a).css("color","#000000")});$(".your_shows_serie_container .episode_img, .your_shows_serie_container .your_shows_img, .your_shows_serie_container .your_shows_text_line:not(.last_seen)").live("mouseout",function(){var a=$(this).parents(".your_shows_serie_container");$(".episode_img_hover",a).css("visibility","hidden");$(".your_shows_text_line:not(.last_seen) a",a).css("color","#000");$(".your_shows_text: a.series_title",a).css("color","#000000");$(".your_shows_activity .vote_icon a, .your_shows_activity .comment_icon a",a).css("background-position","0 -23px");$(".your_shows_text_line .vote_icon a, .your_shows_text_line .comment_icon a",a).css("background-position","0 -26px");$(".rating_activity_number",a).css("color","#777")});$("a.follow_link").live("mouseover",function(){$("a.follow_link").css("text-decoration","underline");$("a.follow_btn").css("background-position","0 0")});$("a.follow_link").live("mouseout",function(){$("a.follow_link").css("text-decoration","none");$("a.follow_btn").css("background-position","0 0")})});$(document).ready(function(){$.getJSON("/series/sec_to_next_ep/"+series_id,function(h){if(h&&h[series_id]&&h[series_id].seconds_left>0){var i=null;if(h[series_id].episode_id){if(h[series_id].episode_number){i='<a class="new_ep" href="/ep/'+h[series_id].episode_id+'">Episode '+h[series_id].episode_number+" Now Online!</a>"}else{i='<a class="new_ep" href="/ep/'+h[series_id].episode_id+'">New Episode Available!</a>'}}$("#countdown").countdown({until:h[series_id].seconds_left,onExpiry:function(){if(i){$("#countdown").removeClass("hasCountdown").html(i)}else{$("#time_to_next").slideUp()}}});$("#time_to_next").slideDown()}});var d={sensitivity:3,interval:10,over:function(){ep=$(this);ep.find(".latest_episode_right h1>a").css({color:"#BD0000"});ep.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 0");ep.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 0");hoverDefaultSubdub(ep);ep.find(".episode_img_hover").css("visibility","visible");return false},timeout:10,out:function(){ep=$(this);ep.find(".latest_episode_right h1>a").css({color:"#000"});ep.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 -26px");ep.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 -23px");noHoverSubdub(ep);ep.find(".episode_img_hover").css("visibility","hidden");return false}};$("div#latest_episode").hoverIntent(d);$("#latest_episode .ep_type").each(function(){$(this).hover(function(){hoverInSubdub($(this))},function(){hoverDefaultSubdub($(this).parents("#latest_episode"))})});if($(".ep_range_notes_container").length>0){var b=$(".ep_summary").width(),a=$(".ep_range_notes_title").width(),f=$("div#leftpanel").width()-75-b-a,e=$(".ep_range_notes").html(),g=fitStringToWidth(e,f-5);$(".ep_range_notes, .ep_range_notes_trunc").width(f);$(".ep_range_notes_trunc").html(g);if(g.length<e.length){$(".ep_range_notes_container").append("<div class='ep_range_notes_arrow' style='background-image:url(/images/arrow-dotted-sprite.jpg);background-position:0 0;height:15px;position:absolute;right:-15px;top:-2px;width:14px;'></div>");$(".ep_range_notes_container").hover(function(){var h=$(".ep_range_notes_trunc").is(":visible")?0:-24;$(".ep_range_notes_arrow").css("background-position",h+"px -25px");$(this).css("cursor","pointer")},function(){var h=$(".ep_range_notes_trunc").is(":visible")?0:-24;$(".ep_range_notes_arrow").css("background-position",h+"px 0");$(this).css("cursor","normal")});$(".ep_range_notes_container").click(function(){if($(".ep_range_notes_trunc").is(":visible")){$(".ep_range_notes_trunc").hide();$(".ep_range_notes").slideDown("fast",function(){$(".ep_range_notes_arrow").css("background-position","-24px -25px")})}else{$(".ep_range_notes").slideUp("fast",function(){$(".ep_range_notes_trunc").show();$(".ep_range_notes_arrow").css("background-position","0 -25px")})}})}}var c={sensitivity:3,interval:10,over:function(){mv=$(this);mv.find(".movie_title>a").css({color:"#BD0000"});mv.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 0");mv.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 0");hoverDefaultSubdub(mv);mv.find(".episode_img_hover").css("visibility","visible");return false},timeout:10,out:function(){mv=$(this);mv.find(".movie_title>a").css({color:"#000"});mv.find(".icon_votes_16_wbg, .icon_comments_16_wbg").css("background-position","0 -26px");mv.find(".icon_votes_13_wbg, .icon_comments_13_wbg").css("background-position","0 -23px");noHoverSubdub(mv);mv.find(".episode_img_hover").css("visibility","hidden");return false}};$("div.movie").hoverIntent(c)});$.fn.extend({adCarousel:function(a){var b={transitionSpeed:500,displayTime:10000,imgHeight:100,imgWidth:100,imagesToDisplay:5,hasCategories:0};var a=$.extend(b,a);return this.each(function(){var d=$(this).get(0);var c=$(this).parent();d.numImages=$("img",d).length;d.opts=a;$.extend(d,{anim:function(g,h,e){if($("ul",d).hasClass("animating")){return}var f=e||d.opts.transitionSpeed;if(d.opts.hasCategories){d.removeLeftCategory()}if(g=="next"){if(h>1){$("li:lt(2)",d).clone().insertAfter($("li:last",d));if(d.opts.hasCategories){$(".ad_cat_inner",c).animate({left:-d.opts.imgWidth*(h+1)},f)}$("ul",d).addClass("animating").animate({left:-d.opts.imgWidth*(h+1)},f,function(){$("li:lt(2)",d).remove();for(j=1;j<=h-2;j++){$("li:first",d).clone().insertAfter($("li:last",d));$("li:first",d).remove()}$(this).removeClass("animating").css("left",-d.opts.imgWidth+"px");if(d.opts.hasCategories){$(".ad_cat_inner",c).css("left",-d.opts.imgWidth+"px");d.displayCategories();d.fixLeftCategory()}})}else{$("li:first",d).clone().insertAfter($("li:last",d));if(d.opts.hasCategories){$(".ad_cat_inner",c).animate({left:-d.opts.imgWidth*2},f)}$("ul",d).addClass("animating").animate({left:-d.opts.imgWidth*2},f,function(){$("li:first",d).remove();$(this).removeClass("animating").css("left",-d.opts.imgWidth+"px");if(d.opts.hasCategories){$(".ad_cat_inner",c).css("left",-d.opts.imgWidth+"px");d.displayCategories();d.fixLeftCategory()}})}d.curr=d.curr+h;if(d.curr>d.numImages){d.curr=d.curr-d.numImages}}if(g=="prev"){if(h>1){$("li:gt("+(d.numImages-(h+1))+")",d).clone().insertBefore($("li:first",d));if(d.opts.hasCategories){d.displayCategories();$(".ad_cat_inner",c).css({left:(-d.opts.imgWidth*(h+1))}).animate({left:-d.opts.imgWidth},f)}$("ul",d).addClass("animating").css({left:(-d.opts.imgWidth*(h+1))}).animate({left:-d.opts.imgWidth},f,function(){$("li:gt("+(d.numImages-1)+")",d).remove();$(this).removeClass("animating");if(d.opts.hasCategories){d.fixLeftCategory()}})}else{$("li:last",d).clone().insertBefore($("li:first",d));if(d.opts.hasCategories){d.displayCategories();$(".ad_cat_inner",c).css("left",-d.opts.imgWidth*2+"px").animate({left:-d.opts.imgWidth},f)}$("ul",d).addClass("animating").css("left",-d.opts.imgWidth*2+"px").animate({left:-d.opts.imgWidth},f,function(){$("li:last",d).remove();$(this).removeClass("animating");if(d.opts.hasCategories){d.fixLeftCategory()}})}d.curr=d.curr-h;if(d.curr<=0){d.curr=d.numImages+d.curr}}if(d.opts.animationCallback){setTimeout(d.opts.animationCallback+"("+(d.curr-1)+")",f)}},startScrolling:function(){if(d.numImages>d.opts.imagesToDisplay){if(!d.autopilot){clearInterval(d.clearInt);d.autopilot=1;d.clearInt=setInterval(function(){d.anim("next",d.opts.imagesToDisplay)},d.opts.displayTime+d.opts.transitionSpeed)}}},stopScrolling:function(){if(d.autopilot){clearInterval(d.clearInt);d.autopilot=0}},scrollTo:function(h,g){if(d.numImages>d.opts.imagesToDisplay){if(d.curr!=h){d.stopScrolling();var f=d.curr-h;if(f<0){f=d.numImages+f}var e=h-d.curr;if(e<0){e=d.numImages+e}if(f<e){d.anim("prev",f,g)}else{d.anim("next",e,g)}d.startScrolling()}}},displayCategories:function(){$(".ad_cat_inner",c).html("");var s=$("li",d);var h=s.length;var m=-1;var p,f,r,k;for(var o=0;o<h;o++){f=getAdCategory(s[o]);if(f!=p){r=d.opts.imgWidth*(o-m);$(".cat_start:last div.cat_bg",c).width(r-70);$(".cat_start:last",c).width(r-40);var q=$(".cat_name:last",c);var e=$(".cat_left:last",c).width();var g=q.width();if(g>e){q.html(p.substr(0,Math.floor(p.length*e/g)-3)+"...")}r=(d.numImages+1)*d.opts.imgWidth;k=$(s[o]).position().left;$(".ad_cat_inner",c).append("<div class='cat_start' style='left:"+k+"px;width:"+r+"px;'><div class='cat_left'><div class='cat_name' style='left:20px;top:0;white-space:nowrap;z-index:10'>"+f+"</div><div class='cat_bg' style='width:"+(r-20)+"px;'>&nbsp;</div>&nbsp;</div></div>");p=f;m=o}}if(d.numImages<=d.opts.imagesToDisplay){r=d.opts.imgWidth*(h-m);$(".cat_start:last div.cat_bg",c).width(r-70);$(".cat_start:last",c).width(r-40)}},removeLeftCategory:function(){$(".fixed_cat",c).remove();$(".cat_name",c).show()},fixLeftCategory:function(){var l=$("ul",d).position().left;var o=$("li",d);var k=o.length;var m=-1;var g;var p=false;while(!p){m++;g=getAdCategory(o[m]);if((l+$(o[m]).position().left)==0){p=true}}var e=$(".ad_cat_inner",c).position().left;var f=500;$(".cat_start",c).each(function(){var i=$(this).find(".cat_left").width();if(($(this).position().left+e)<=0){i=i+($(this).position().left+e);if(i>0){f=i}$(this).find(".cat_name").hide()}});$(".ad_cat_inner",c).append("<div class='cat_name fixed_cat' style='left:"+(35-$(".ad_cat_inner",c).position().left)+"px;top:"+$(".cat_start",c).position().top+"px;white-space:nowrap;z-index:5'>"+g+"</div>");var h=$(".fixed_cat",c).width();if(h>f){$(".fixed_cat",c).html(g.substr(0,Math.floor(g.length*f/h)-3)+"...")}if(typeof(categoryChanged)=="function"){categoryChanged(g)}}});$(".btn_rt",d).click(function(){d.stopScrolling();d.anim("next",d.opts.imagesToDisplay);d.startScrolling()});$(".btn_lt",d).click(function(){d.stopScrolling();d.anim("prev",d.opts.imagesToDisplay);d.startScrolling()});$(".content_window ul",d).width(d.opts.imgWidth*(d.numImages+d.opts.imagesToDisplay));$(".content_window",d).width(d.opts.imgWidth*d.opts.imagesToDisplay).height(d.opts.imgHeight);if(d.numImages>d.opts.imagesToDisplay){$("li:last",d).prependTo($("ul",d));$("ul",d).css("left",-d.opts.imgWidth+"px")}if(d.opts.hasCategories){d.displayCategories();if(d.numImages>d.opts.imagesToDisplay){$(".ad_cat_inner",c).css("left",-d.opts.imgWidth+"px")}}d.curr=1;d.startScrolling()})}});$(document).ready(function(){if($(".ad_content img.viz_ad").length>0){var a=$("<div></div>");$(".ad_content img.viz_ad").each(function(){a.append("<img src='"+$(this).attr("src")+"' />")});a.find("img").batchImageLoad({loadingCompleteCallback:function(){$(".ad_content").show();if(typeof(scaleImg)=="function"){scaleImg(".ad_content img.viz_ad",182,191)}$(".ad_content").adCarousel({imgHeight:191,imgWidth:188,imagesToDisplay:5,transitionSpeed:500,displayTime:10000,hasCategories:1});$("div.viz_ad_container").each(function(){initCaption($(this))})}})}$(".viz_ad_container").live("mouseover",function(){$(".cover",this).stop().animate({bottom:"0px"},{queue:false,duration:300});var b=$(this).parents(".ad_content").get(0);if(b){b.stopScrolling()}});$(".viz_ad_container").live("mouseout",function(){$(".cover",this).stop().animate({bottom:"-90px"},{queue:false,duration:300});var b=$(this).parents(".ad_content").get(0);if(b){b.startScrolling()}});$(".ad_row button, .ad_row button").live("click",function(){$(this).removeClass("gray_tab_34_nosel").addClass("gray_tab_34_sel");$(this).siblings(".gray_tab_34").removeClass("gray_tab_34_sel").addClass("gray_tab_34_nosel");var b=$(".ad_content",$(this).parents(".ad_row")).get(0);if(b){b.scrollTo(parseInt($(this).attr("ad_idx")))}});$(".ad_row .btn_rt").live("click",function(){var b=$(".ad_content",$(this).parents(".ad_row")).get(0);if(b){b.stopScrolling();b.anim("next",5);b.startScrolling()}});$(".ad_row .btn_lt").live("click",function(){var b=$(".ad_content",$(this).parents(".ad_row")).get(0);if(b){b.stopScrolling();b.anim("prev",5);b.startScrolling()}})});function categoryChanged(a){$(".ad_row ."+a.replace(/ /g,"_")).each(function(){$(this).removeClass("gray_tab_34_nosel").addClass("gray_tab_34_sel");$(this).siblings(".gray_tab_34").removeClass("gray_tab_34_sel").addClass("gray_tab_34_nosel")})}var adData={};function loadAds(a,b){if(!b){alert("Must provide 'dataVar' arg when calling 'ads.loadAds()'.");return}params={};if(typeof(episode_id)!=="undefined"){params.episode_id=episode_id}if(typeof(series_id)!=="undefined"){params.series_id=series_id}if(typeof(imprint_id)!=="undefined"){params.imprint_id=imprint_id}if(typeof(page_type)!=="undefined"){params.page_type=page_type}if(typeof(page_type_id)!=="undefined"){params.page_type_id=page_type_id}if(a){params.display_format=a}$.ajax({type:"GET",url:"/ad/get_ads",data:params,dataType:"json",success:function(c){adData[b]=c;showAds(adData[b])},error:function(c,d){showErr("An error has occured ("+d+")",c.responseText)}})}function getAdContents(d,g){var f=g||"ad",e=null,c="Viz Media advertisement",b=appendAdCampaign(d.href);if(d.product_name||d.desc||d.price){e='<div class="cover viz_ad_caption"><a class="track ad" path="'+f+'" target="_new" href="'+b+'">';if(d.product_name){e=e+'<span class="ad_title">'+d.product_name+"</span>"}if(d.price){e=e+'<span class="ad_price">'+d.price+"</span>"}e=e+"<a></div>"}if(d.product_name){c=d.product_name}var a='<a class="track ad" path="'+f+'" target="_new" href="'+b+'"><img class="viz_ad" src="'+d.img_url+'" alt="'+c+'" ad_id="'+d.id+'"';if(d.product_type){a=a+' category="'+d.product_type+'"'}a=a+" /></a>"+e;return a}function getAdId(b){var a=null;var c=$(".viz_ad",b);if(c){a=$(c).attr("ad_id")}return a}function getAdCategory(b){var a=null;var c=$(".viz_ad",b);if(c){a=$(c).attr("category")}return a}function initCaption(a,c){var e=c||"center";var k=$("img.viz_ad",a).width();var l=$(".viz_ad_caption",a);if(e=="center"){l.css("left",(a.width()-k)/2)}else{if(e=="right"){l.css("right",0)}else{l.css("left",0)}}l.width(k);var g=$(".ad_title",l);var i=l.height()-32;var b,d;if(g&&g.html()&&g.html()!=""&&g.css("font-size")){d=parseInt(g.css("font-size").replace(/px/,""));while(g.height()>i&&d>8){b=d-1;g.css("font-size",b+"px");d=parseInt(g.css("font-size").replace(/px/,""))}}}function trackAdView(c){if(!c){return}var d="";if(c.constructor.toString().indexOf("Array")==-1){c=(c+"").replace(/ /g,"");if(c){d=c}}else{var b;for(var e=c.length-1;e>=0;--e){if(c[e]){b=(c[e]+"").replace(/ /g,"")}if(b){d=d+b+","}}if(d.length>0){d=d.substr(0,d.length-1)}}if(d&&d!=""){trackVizEvent({type:"viz/asset_view",asset_id:d})}}function appendAdCampaign(a){var b="va-unknown";if(typeof(ad_campaign_name)!=="undefined"&&ad_campaign_name){b=ad_campaign_name}return appendCampaignParams(a,"www.vizanime.com","product_scroller",b)}$(document).ready(function(){$("a.ad").each(function(){var a=$(this).attr("href");$(this).attr("href",appendAdCampaign(a))});$("a.ad").live("click",function(){var a=getAdId(this);if(a){trackVizEvent({type:"viz/asset_click",asset_id:a})}})});