/*
 Copyright (c) 2011 mau2.com
*/
var e=null;function p(a){this.b=a;this.a={};this.bound=!1}p.prototype.set=function(a,b){this.b!=e&&this.b.setItem(a,window.JSON.stringify(b))};p.prototype.get=function(a){if(this.b==e)return e;try{var b=this.b.getItem(a);return q(b)}catch(i){return e}};function q(a){try{return a==e?e:window.JSON.parse(a.toString())}catch(b){return e}}
function v(a,b){if(!a.bound)$(window).bind("storage",function(b){if(b.key==e)for(var d in a.a)x(b,a.a[d]);else(d=a.a[b.key])&&x(b,d)}),a.bound=!0;a.a.clip||(a.a.clip=[]);a.a.clip.push(b)}function x(a,b){for(var i=b.length,d=q(a.oldValue),j=q(a.newValue),o=0;o<i;o++)b[o](a.key,d,j)};(function(){function a(){m=$('<div id="clipBox" class="exdingbats"><div id="clipButton"><span id="clipButtonIcon" class="popupIcon spicon vegaIcon vegaIcon-attach">クリップ</span></div><ul id="clipList"/></div>');m.appendTo(document.body);w=m.find("#clipButton");k=w.find("#clipButtonIcon");k.click(function(){n&&h?j(!0):(d(!0),i(),l.show(),h=!0)});m.hover(function(){i();l.show();h=!0},function(){j()});l=m.find("#clipList").click(function(){d(!1)})}function b(a){a||(a=[]);r=a;s=!0;h&&i()}function i(){if(s){s=
!1;var a=0,b=r.length;b>20&&(a=b-20);l.empty();var y=$('<li><div></div><ul class="clipItems itemRemovable"/></li>'),d={};$.each(t,function(a){var b=d[a]={},c=b.list=y.clone();c.find("div:first").text(t[a]);b.d=c.find("ul:first")});for(var g=f&&f.type=="anime",i=$('<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 h=r[b];if(typeof h=="object"){var j=d[h.type],k=i.clone();(function(a){k.find("a:first").attr("href","/"+a.type+"/"+a.value).text(a.title);var b=k.find("span:first"),c=b.next("span"),d=c.next("span");g&&a.type=="anime"&&!u(a,f)?(b.click(function(){window.location.href="/compare/"+f.type+"/"+f.value+";"+a.value}),c.click(function(){window.location.href="/compare/"+f.type+"/"+f.value+";"+a.value+"?by=actor"})):(b.hide(),c.hide());d.click(function(){z(a)})})(h);j.d.append(k);j.c=!0}}var n=!1;
f&&(a=$('<li id="clipListAdd">'+("この"+t[f.type]+"をクリップする")+"</li>").click(o),l.append(a));$.each(d,function(a,b){b.c&&(b.list.appendTo(l),n=!0)});!f&&!n&&m.hide()}}function d(a){n=a;k[a?"addClass":"removeClass"]("locked")}function j(a){if(a||!n)l.hide(),d(!1),h=!1}function o(){var a=f,c=g.get("clip");c||(c=[]);c=$.map(c,function(b){return u(b,a)?e:b});c.push(a);g.set("clip",c);b(c)}function u(a,b){return a.value==b.value&&a.type==b.type}function z(a){var c=g.get("clip"),c=$.map(c,function(b){return typeof b!=
"object"?e:u(b,a)?e:b});g.set("clip",c);b(c)}var f=window.clipInfo,t={anime:"番組",voice:"声優"};if((!$.browser.msie||$.browser.version>=9)&&window.localStorage)var g=new p(window.localStorage);var m,w,k,l,n,r,s=!0,h=!1;$(function(){g&&g.b!=e&&(v(g,function(a,c,d){b(d)}),a(),b(g.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})});

