var Fe=Fe||{version:"20080809",emptyFn:function(){}};Fe.trim=function(A){return A.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+$)/g,"")};Fe.G=function(){for(var A=[],B=arguments.length-1;B>-1;B--){var C=arguments[B];A[B]=null;if(typeof (C)=="object"&&C&&C.dom){A[B]=C.dom}else{if((typeof (C)=="object"&&C&&C.tagName)||C==window||C==document){A[B]=C}else{if(typeof (C)=="string"&&(C=document.getElementById(C))){A[B]=C}}}}return A.length<2?A[0]:A};Fe.on=function(C,B,A){if(!(C=Fe.G(C))){return C}B=B.replace(/^on/,"");if(C.attachEvent){C[B+A]=function(){A.call(C,window.event)};C.attachEvent("on"+B,C[B+A])}else{C.addEventListener(B,A,false)}return C};Fe.each=function(E,A){if(typeof A!="function"){return E}if(E){if(E.length==undefined){for(var B in E){A.call(E[B],E[B],B)}}else{for(var C=0,D=E.length;C<D;C++){A.call(E[C],E[C],C)}}}return E};Fe.show=function(){Fe.each(arguments,function(A){if(A=Fe.G(A)){A.style.display=""}})};Fe.hide=function(){Fe.each(arguments,function(A){if(A=Fe.G(A)){A.style.display="none"}})};Fe.format=function(H,J){if(arguments.length>1){var E=Fe.format,G=/([.*+?^=!:${}()|[\]\/\\])/g,F=(E.left_delimiter||"{").replace(G,"\\$1"),A=(E.right_delimiter||"}").replace(G,"\\$1");var C=E._r1||(E._r1=new RegExp("#"+F+"([^"+F+A+"]+)"+A,"g")),B=E._r2||(E._r2=new RegExp("#"+F+"(\\d+)"+A,"g"));if(typeof (J)=="object"){return H.replace(C,function(K,M){var L=J[M];if(typeof L=="function"){L=L(M)}return typeof (L)=="undefined"?"":L})}else{if(typeof (J)!="undefined"){var I=Array.prototype.slice.call(arguments,1);var D=I.length;return H.replace(B,function(K,L){L=parseInt(L,10);return(L>=D)?K:I[L]})}}}return H};Fe.format.delimiter=function(C,A){var B=Fe.format;B.left_delimiter=C||"{";B.right_delimiter=A||C||"}";B._r1=B._r2=null};Fe.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=Fe;for(B=(D[0]=="Fe")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]]}}return E};Fe.ns=Fe.namespace;Fe.tracker=function(H,E){if(!H||!E){return false}if(typeof E.host!="function"){return false}if(typeof E.param!="function"){return false}function D(I){var J=E.host(I);var K=E.param(I);Fe.tracker.send(K,J)}var G,A=E.event||"click",C=E.delay||100;for(var F=0,B=H.length;F<B;F++){G=H[F];if(G&&G.nodeName=="A"){Fe.on(G,A,function(J){var K=(this.target=="")&&(this.href.charAt(0)!="#");if(K){if(J.preventDefault){J.preventDefault()}else{window.event.returnValue=false}}Fe.tracker.send(E.param(this),E.host(this));if(K){var I=this;setTimeout(function(){window.location.href=I.href},C)}})}else{Fe.on(G,A,function(){Fe.tracker.send(E.param(this),E.host(this))})}}};Fe.tracker.trackerHost=typeof TRACKER_HOST=="string"?TRACKER_HOST:null;Fe.tracker.setTrackerHost=function(A){this.trackerHost=A};Fe.tracker.stamp=function(){return Math.floor(Math.random()*2147483648).toString(36)+(Math.floor(Math.random()*2147483648)^(new Date).getTime()).toString(36)};Fe.tracker.send=function(C,A){var D=A||Fe.tracker.trackerHost;if(!D){throw new Error("no tracker host found.")}if(D.indexOf("?")==-1){D+="?"}var B=D;if(typeof C=="string"){B+=C+"&.stamp="+Fe.tracker.stamp()}else{var G=[];for(var F in C){G.push(F+"="+(C[F]))}if(false!==C.hasstamp){G.push(".stamp="+Fe.tracker.stamp())}B+=G.join("&")}var H="tracker_image_"+new Date().getTime();var E=new Image();window[H]=E;E.onload=E.onerror=function(){try{window[H]=null;delete window[H]}catch(I){}};E.src=B;E=null};Fe.Cookie={};Fe.Cookie.get=function(B){var A,C=new RegExp("(^| )"+B+"=([^;]*)(;|$)");if(A=document.cookie.match(C)){return unescape(A[2])}return null};Fe.Cookie.config=function(B){var A=null;if(/https?:\/\/[^\/]+([^\?]+)/i.test(location.href)){A=RegExp.$1}B=B||{};B.path=(B.path||A||"/").replace(/(\/)[^\/]*$/,"$1");B.expires=B.expires||1000*60*60*24;B.domain=B.domain||document.domain||"";B.secure=B.secure||"";return B};Fe.Cookie.set=function(C,D,B){var E=Fe.Cookie.config(B);var A=new Date();if(typeof (E.expires)=="number"){A.setTime(A.getTime()+E.expires)}document.cookie=C+"="+escape(D)+";expires="+A.toGMTString()+";path="+E.path+(E.domain==""?"":("; domain="+E.domain))+(E.secure?"; secure":"")};Fe.Cookie.remove=function(B,A){Fe.Cookie.set(B,"",{expires:-1*57005*57005})};Fe.String={};Fe.String.escapeHTML=function(A){return A.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};Fe.isIE=(/MSIE (\d+(\.\d+)?)/.test(navigator.userAgent))?RegExp.$1:0;(function(){var B=Fe.ns("Fe.JP.Video.SearchHistory");var D="BDJPV_HISTORY_LIST";var A="BDJPV_HISTORY_ENABLE";var C={path:"/",domain:document.domain,expires:86400*1000*30};B.add=function(I){var G=Fe.Cookie.get(A);if(G=="0"){return false}var I=Fe.trim(I);if(I.length<=0){return false}var J=Fe.Cookie.get(D);if(J==null){J=[]}else{J=J.split("\uDEAD")}for(var H=0,F=J.length;H<F;H++){if(J[H]==I){J.splice(H,1);break}}J.unshift(I);if(J.length>15){J.length=15}Fe.Cookie.set(D,J.join("\uDEAD"),C)};B.moniter=function(H){for(var F=0,G;G=H[F];F++){if(!document[G[0]]){continue}Fe.on(document[G[0]],"submit",(function(J){var I=document[G[0]],K=I[G[1]];return function(L){B.add(K.value)}})())}};B.clear=function(){Fe.Cookie.set(D,"",{path:C.path,domain:C.domain,expires:-1*57005*57005});Fe.G("history_list").innerHTML=""};B.escape=function(G){var F=G.length>8;if(F){G=G.substring(0,8)}G=Fe.String.escapeHTML(G);if(!Fe.isIE){G=G.replace(/(\S{7})/g,"$1<wbr/>").replace(/&([^;]{0,4})(<wbr\/?>)([^;]{0,4});/g,"&$1$3;")}return G+(F?"...":"")};B.render=function(){var H=Fe.Cookie.get(D);if(H!=null){H=H.split("\uDEAD");var F='<li><a href="http://video.baidu.jp/v?word=#{wordenc}&amp;ct=301989888&amp;pn=0&amp;s=3&amp;wd=0" title="#{query}">#{word}</a></li>';var G=[];Fe.each(H,function(I){G.push(Fe.format(F,{word:I,query:Fe.String.escapeHTML(I),wordenc:encodeURIComponent(I)}))});Fe.G("history_list").innerHTML=G.join("")}else{Fe.G("history_list").innerHTML=""}};function E(G,F){var H=Fe.G("history_toggle");if("ALL_LIST_DATA" in window){if(G){H.innerHTML="非表示"}else{H.innerHTML="表示"}}else{if(G){H.innerHTML='表示&nbsp;|&nbsp;<a href="#" onclick="return Fe.JP.Video.SearchHistory.toggle();">非表示</a>';Fe.G("history").className="on"}else{H.innerHTML='<a href="#" onclick="return Fe.JP.Video.SearchHistory.toggle();">表示</a>&nbsp;|&nbsp;非表示';Fe.G("history").className=""}}if(F!==true){Fe.tracker.send("from=vdtop&m=4&category=search-history&wd="+(G?"1":"0"))}}B.toggle=function(){var F=Fe.Cookie.get(A);if("0"==F){Fe.Cookie.set(A,"1",C);E(true)}else{Fe.Cookie.set(A,"0",C);B.clear();E(false)}return false};B.init=function(){var F=Fe.Cookie.get(A);if(F!="0"){B.render()}else{E(false,true)}if(navigator.cookieEnabled){Fe.show("history")}B.moniter([["f1","word"]])}})();Fe.Adv=function(D,B,C){var A=D.href,E=Fe.trim(B.value),C=C?C:"query";if(E.length<=0){return }E=encodeURIComponent(E);if(A.indexOf(C+"=")!=-1){D.href=A.replace(new RegExp(C+"=[^&$]*"),C+"="+E)}else{var F=((A.indexOf("?")==-1)?"?":"&")+C+"="+E;D.href=A+F}};Fe.ns("Fe.JP.V");Fe.JP.V.q=function(D,B,C,A){Fe.Adv(D,B,C);if(document.images&&typeof QUERY_WORD=="string"){Fe.tracker.send({wd:QUERY_WORD,tab:A},"http://vx.baidu.jp/v.gif?")}return true};Fe.JP.V.c=function(C,D,A){var B=Fe.trim(C[D].value);if(B.length<=0){if(A=="ni"){location.href="/"}return false}return true};Fe.JP.V.s=function(A){Fe.tracker.send(A,"http://vx.baidu.jp/v.gif?")};(function(){var M="player_area";function C(N){var E=(N||$(".ranking li.on")).nextAll("li").filter(function(){return !$(this).hasClass("deadlink")});if(E.size()==0){E=$(".ranking li").filter(function(){return !$(this).hasClass("deadlink")})}E.slice(0,1).click()}function L(E){return encodeURIComponent(E)}function I(N){var E=$(".ranking li.on");var O=N||E;Fe.tracker.send({url:L(O.attr("url")),sign:L(O.attr("sign")),vdid:L(O.attr("vdid")),category:L(CURRENT_CATEGORY),ranking:L(O.attr("id").replace(/\D/g,"")),name:L(O.find("div.title").text()),author:L(O.find("div.author").text())},"/ranking/deadlink");O.removeClass("on").addClass("deadlink");if(O.attr("id")!=E.attr("id")){return }C(O)}var K="BDJPVDAP";var H=Fe.ns("Fe.VideoPlayer");H.toggleAutoPlay=function(){var N=Fe.Cookie.get(K);var E={path:"/",domain:document.domain,expires:86400*1000*30};var O=("0"==N)?"1":"0";Fe.Cookie.set(K,O,E);$("#ap-control").html(("0"==O)?"オフ":"オン");Fe.tracker.send({source:"toggle-auto-play",state:O});return false};var F=/(http:\/\/[^\/]+\/)(.*?)([\x00-\xff]{10})/g;var J=40;function D(P){F.lastIndex=0;var O=$(".ranking li.on");var R=P||O;var Q=R.attr("url");var T=Q;if(Q.length>J){var S=F.exec(Q);if(S){var E=S[1].length;var N=J-(E+3);T=S[1]+"..."+Q.substring(Q.length-N)}}$("#original-links").attr("href",Q).attr("title",Q).html(T);document.title=Fe.format(DOCUMENT_TITLE,{rank:R.attr("id").replace(/\D/g,""),author:R.find("div.author").text(),title:R.find("div.title").text()})}function G(N){var E=$(".ranking li.on");var O=N||E;location.hash="r/"+O.attr("id").replace(/\D/g,"")}function B(S,Q){var P=$f(M);if(P&&typeof (P.close)=="function"){P.close()}if(S.indexOf("http://")!=0){I(Q);return }D(Q);G(Q);if(P&&typeof (P.play)=="function"){P.play({url:S})}else{var O=navigator.userAgent.toLowerCase();var E=O.indexOf("msie")!=-1;var R=(E)?"window":"transparent";P=$f(M,{src:"http://img.baidu.jp/img/misc/flowplayer-3.1.5.swf",wmode:R,version:[9,115],onFail:function(){$("#player_area").hide();$("#alternative-content").show()}},{onError:function(T){if(T==200||T==201){I()}else{Fe.tracker.send({source:"player-error",code:T})}return true},onLoad:function(){Fe.tracker.send({source:"player-loaded"})},clip:{autoPlay:("0"!=Fe.Cookie.get(K)),onStart:function(X){var W=$(".ranking li.on");var U=W.attr("url");var T=W.attr("sign");var V=W.attr("vdid");Fe.tracker.send({source:"play-video",url:L(U),sign:L(T),vdid:L(V)});$.post("/fetcher/feedback",{url:U,sign:T},function(){})},onFinish:function(T){C()}},playlist:[S.replace(/&/g,"%26")]})}var N="/ranking/"+$(".ranking li.on").attr("vdid")+"/query/?.stamp="+Math.random();$.getJSON(N,function(U){if(U.length<=0){$("#relative ul").html("<li>ないこの動画へのクエリをお勧めします</li>")}else{var T=[];$.each(U,function(V,W){T.push('<li><a href="/v?ct=301989888&wd=0&word='+encodeURIComponent(W)+'&sort=popular:30d&source=top-recommend-query">'+W+"</a></li>")});$("#relative ul").html(T.join(""))}})}function A(){var P=1;if(/#r\/(\d+)/.test(location.hash)){var O=parseInt(RegExp.$1,10);var E=$(".ranking ul li").length;if(O>=1&&O<=E){P=O}}$("li#rk"+P).click();var N=Fe.Cookie.get(K);$("#ap-control").html(("0"==N)?"オフ":"オン")}$(document).ready(function(){$(".ranking li").click(function(O){var R=$(this);if(R.hasClass("deadlink")){return false}if(R.hasClass("on")){var P=$f(M);if(!P.isPlaying()){P.play()}return false}$(".ranking li").each(function(){$(this).removeClass("on").removeClass("hover")});R.addClass("on");var Q=$(".ranking li:last");if(!Q.hasClass("on")&&!Q.hasClass("deadlink")){Q.addClass("last")}$.get("/fetcher/flv",{url:R.attr("url"),sign:R.attr("sign"),".stamp":Math.random()},function(T){B(T,R)});var S=("originalEvent" in O)?"top-click-video":"top-click-video-auto";Fe.tracker.send({source:S,position:R.attr("id"),text:L(R.text()),category:L(CURRENT_CATEGORY),week:CURRENT_WEEK},"http://vx.baidu.jp/i.gif?");return false});$("#recommend a").click(function(){var O=$f(M);if(O&&typeof (O.close)=="function"){O.close()}});$(".menu a").click(function(){var O=$f(M);if(O&&typeof (O.close)=="function"){O.close()}});function N(O){return function(){if($(this).hasClass("on")||$(this).hasClass("deadlink")){return }$(this).addClass(O)}}function E(O){return function(){if($(this).hasClass("on")||$(this).hasClass("deadlink")){return }$(this).removeClass(O)}}$(".ranking li:not(:last)").mouseenter(N("hover")).mouseleave(E("hover"));$(".ranking li:last").mouseenter(N("last-hover")).mouseleave(E("last-hover"));Fe.tracker.trackerHost="http://vx.baidu.jp/i.gif?";Fe.JP.Video.SearchHistory.init();if(/q=([^&]+)/.test(location.search)){document.f1.word.value=decodeURIComponent(RegExp.$1)}document.f1.word.focus();A()});$(document).ajaxError(function(E,P,N,O){if(N.url=="/fetcher/flv"){B("error://load")}})})();
