/*
 Copyright (c) 2011 mau2.com
*/
var f=null;function q(a){this.d=a;this.b={};this.bound=!1}q.prototype.set=function(a,b){this.d!=f&&this.d.setItem(a,window.JSON.stringify(b))};q.prototype.get=function(a){if(this.d==f)return f;try{var b=this.d.getItem(a);return r(b)}catch(d){return f}};function r(a){try{return a==f?f:window.JSON.parse(a.toString())}catch(b){return f}}
function v(a,b){if(!a.bound)$(window).bind("storage",function(b){if(b.key==f)for(var c in a.b)w(b,a.b[c]);else(c=a.b[b.key])&&w(b,c)}),a.bound=!0;a.b.clip||(a.b.clip=[]);a.b.clip.push(b)}function w(a,b){for(var d=b.length,c=r(a.oldValue),g=r(a.newValue),i=0;i<d;i++)b[i](a.key,c,g)};(function(){function a(a){this.element=a;var d=this.a=$("<img/>");d.css("display","block");a.append(d)}a.prototype.show=function(a,d,c,g,i){var e=this;e.a.attr("src",i);e.c=function(){e.a.unbind("load",e.c);e.c=f;var a=e.a.prop("naturalWidth")||e.a.prop("width"),b=e.a.prop("naturalHeight")||e.a.prop("height"),a=d.offset().left+(d.width()-a)/2;e.element.css({left:a+"px",top:g-(b+6)+"px",display:"block"})};e.a.load(e.c)};a.prototype.hide=function(){this.element.css("display","");this.c!=f&&this.a.unbind("load",
this.c)};$(function(){var b=$("#imagepopup"),d=new a(b);$("a.pop").parent().hover(function(){var a=$(this),c=a.children("a.pop").attr("href");c.indexOf("http://product.mau2.com/asin/")==0&&(c="http://images-jp.amazon.com/images/P/"+c.substr(29)+".09.MZZZZZZZ.jpg",b.detach().appendTo(a),d.show("center",a,"bottom",a.offset().top,c))},function(){d.hide()});var c=$("#series"),g=c.height();if(g>220){var i=function(){c.css({height:g+"px",WebkitTransition:"height 200ms linear",MozTransition:"height 200ms linear"}).removeClass("seriesOmit").one("transitionend",
function(){c.css({height:"",overflowY:"",WebkitTransition:"",MozTransition:""})})};c.css({height:"200px",overflowY:"hidden"}).addClass("seriesOmit").one("mouseenter",i).one("touchstart",i)}})})();(function(){function a(){n=$('<div id="clipBox" class="exdingbats"><div id="clipButton"><span id="clipButtonIcon" class="popupIcon spicon vegaIcon vegaIcon-attach">クリップ</span></div><ul id="clipList"/></div>');n.appendTo(document.body);p=n.find("#clipButton");o=p.find("#clipButtonIcon");o.click(function(){l&&k?g(!0):(c(!0),d(),m.show(),k=!0)});n.hover(function(){d();m.show();k=!0},function(){g()});m=n.find("#clipList").click(function(){c(!1)})}function b(a){a||(a=[]);s=a;t=!0;k&&d()}function d(){if(t){t=
!1;var a=0,b=s.length;b>20&&(a=b-20);m.empty();var c=$('<li><div></div><ul class="clipItems itemRemovable"/></li>'),d={};$.each(u,function(a){var b=d[a]={},e=b.list=c.clone();e.find("div:first").text(u[a]);b.f=e.find("ul:first")});for(var g=h&&h.type=="anime",j=$('<li><a/> <span class="spicon vegaIcon vegaIcon-magnify" title="役の声優をこの番組と比較する">比較</span> <span class="spicon vegaIcon vegaIcon-user" title="声優の役をこの番組と比較する">比較</span> <span class="spicon vegaIcon vegaIcon-trash" title="クリップを外す">削除</span></li>');--b>=
a;){var k=s[b];if(typeof k=="object"){var o=d[k.type],l=j.clone();(function(a){l.find("a:first").attr("href","/"+a.type+"/"+a.value).text(a.title);var b=l.find("span:first"),c=b.next("span"),d=c.next("span");g&&a.type=="anime"&&!e(a,h)?(b.click(function(){window.location.href="/compare/"+h.type+"/"+h.value+";"+a.value}),c.click(function(){window.location.href="/compare/"+h.type+"/"+h.value+";"+a.value+"?by=actor"})):(b.hide(),c.hide());d.click(function(){x(a)})})(k);o.f.append(l);o.e=!0}}var p=!1;
h&&(a=$('<li id="clipListAdd">'+("この"+u[h.type]+"をクリップする")+"</li>").click(i),m.append(a));$.each(d,function(a,b){b.e&&(b.list.appendTo(m),p=!0)});!h&&!p&&n.hide()}}function c(a){l=a;o[a?"addClass":"removeClass"]("locked")}function g(a){if(a||!l)m.hide(),c(!1),k=!1}function i(){var a=h,c=j.get("clip");c||(c=[]);c=$.map(c,function(b){return e(b,a)?f:b});c.push(a);j.set("clip",c);b(c)}function e(a,b){return a.value==b.value&&a.type==b.type}function x(a){var c=j.get("clip"),c=$.map(c,function(b){return typeof b!=
"object"?f:e(b,a)?f:b});j.set("clip",c);b(c)}var h=window.clipInfo,u={anime:"番組",voice:"声優"};if((!$.browser.msie||$.browser.version>=9)&&window.localStorage)var j=new q(window.localStorage);var n,p,o,m,l,s,t=!0,k=!1;$(function(){j&&j.d!=f&&(v(j,function(a,c,d){b(d)}),a(),b(j.get("clip")))})})();(navigator.userAgent.indexOf("MSIE 9.")!=-1||navigator.userAgent.indexOf("Opera")!=-1)&&document.write('<style type="text/css">.exdingbats { font-family: mau2, sans-serif }</style>');$(function(){$("form").submit(function(){var a=$(this).serialize(),b=Date.now();if(a==this.m2lastQuery&&b-this.m2lastQueryTime<2E3)return!1;this.m2lastQuery=a;this.m2lastQueryTime=b})});

