(function(){var yFav=window.yFav=function(id,bcrumb,favlist){return new yFav.fn.init(id,bcrumb,favlist)};yFav.fn=yFav.prototype={init:function(id,bcrumb,favlist){if(typeof id=="number"){id=id.toString()}else{if(typeof id!="string"){return false}}if(id.match(/^[\d]+/)){this.id=id}else{return false}if(!bcrumb){return false}if(navigator.userAgent.match(/MSIE [5-7]/)||(document.documentMode&&document.documentMode!==8)){this.isIE=true}this.bcrumb=bcrumb;this.favlist=favlist},version:"1.0.1",_msxml_progid:["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"],_isIE:false,_transaction_id:0,_polling_interval:50,_poll:{},id:null,bcrumb:null,favlist:null,createXHR:function(transactionId){var obj,http;try{http=new XMLHttpRequest();obj={conn:http,tId:transactionId}}catch(e){var msxml_l=this._msxml_progid.length;for(var i=0;i<msxml_l;++i){try{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break}catch(e){}}}finally{return obj}},getConnectionObject:function(){var o;var tId=this._transaction_id;try{o=this.createXHR(tId);if(o){this._transaction_id++}}catch(e){}finally{return o}},ajax:function(method,uri,callback,postData){var o=this.getConnectionObject();var args=(callback&&callback.argument)?callback.argument:null;if(!o){return null}else{o.conn.open(method,uri,true)}this.xhrReadyState(o,callback);o.conn.send(postData||"");return o},xhrReadyState:function(o,callback){var oConn=this;var args=(callback&&callback.argument)?callback.argument:null;this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback){callback(o.conn)}}},this._polling_interval)},fire:function(m){var self=this;var callback=function(o){var data=eval("("+o.responseText+")");if(data.retval==0){self.success(m)}else{if(data.retval==-6){self.already()}else{if(data.retval==-5){self.over(self.favlist)}}}};var mode=(m)?m:"0";this.ajax("GET","/yFavEdit.php?js=1&mode="+m+"&cfav="+this.id+"&"+this.bcrumb,callback)},cancel:function(){var favPanel=document.getElementById("addToTopFavoriteWindow");setTimeout(function(){favPanel.parentNode.removeChild(favPanel)},100)},success:function(m){if(!m){var button=document.getElementById("addToTopFavoriteTxt");button.className="attfBtnP2";button.title="\u304a\u6c17\u306b\u5165\u308a\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f";button.onclick=""}else{var favPanel=document.getElementById("addToTopFavoriteWindow");var favButton=document.getElementById("addToTopFavoriteTxt");favButton.className="attfBtnP2";favButton.title="\u304a\u6c17\u306b\u5165\u308a\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f";favButton.onclick="";setTimeout(function(){favPanel.parentNode.removeChild(favPanel)},100)}},over:function(favlist){if(favlist&&favlist!="null"){var src="http://ytop.yahooapis.jp/FavoriteService/V1/FavoriteList?appid="+encodeURI("tPwuBcOxg6679mO5vQ4B.y.JnVj91IYesEy7_dV5sy1wdFU9_XX0Xua2_VLYI88tldCB")+"&cfav="+favlist+"&f="+this.id;var dNode=document.createElement("script");dNode.setAttribute("type","text/javascript");dNode.setAttribute("charset","UTF-8");dNode.setAttribute("src",src);var dHead=document.getElementsByTagName("head")[0];dHead.appendChild(dNode);setTimeout(function(){dNode.parentNode.removeChild(dNode)},1000)}else{this.already()}},already:function(){var Top=document.getElementById("addToTopFavorite");Top.removeChild(document.getElementById("addToTopFavoriteBtn"));var alertbox=document.createElement("p");alertbox.setAttribute("id","addToTopFavoriteAlert");var alertFirst=document.createElement("span");var alertLast=document.createElement("span");if(this.isIE){alertFirst.setAttribute("className","attfFirst");alertLast.setAttribute("className","attfLast")}else{alertFirst.setAttribute("class","attfFirst");alertLast.setAttribute("class","attfLast")}alertFirst.appendChild(document.createTextNode("\u73fe\u5728\u3054\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002Cookie\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3059\u308b\u304b\u3001"));alertLast.appendChild(document.createTextNode("\u30da\u30fc\u30b8\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3001\u3082\u3057\u304f\u306fJavaScript\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3057\u3066\u304b\u3089\u3001\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002"));alertbox.appendChild(alertFirst);alertbox.appendChild(alertLast);Top.appendChild(alertbox)},getList:function(list){if(!document.getElementById("addToTopFavoriteWindow")){var Top=document.getElementById("addToTopFavoriteBtn");var div=document.createElement("div");var div2=document.createElement("div");var div3=document.createElement("div");var divTtl=document.createElement("div");var cancel=document.createElement("div");div.setAttribute("id","addToTopFavoriteWindow");div2.setAttribute("id","addToTopFavoriteWindow2");div3.setAttribute("id","addToTopFavoriteWindow3");divTtl.setAttribute("id","addToTopFavoriteWindowTtl");divTtl.innerHTML="<strong>11\u4ef6\u4ee5\u4e0a\u306f\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002</strong>\u5165\u308c\u66ff\u3048\u308b\u30b5\u30fc\u30d3\u30b9\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002";cancel.setAttribute("id","addToTopFavoriteWindowCancel");cancel.innerHTML="<span>\u30ad\u30e3\u30f3\u30bb\u30eb</span>";if(this.isIE){cancel.setAttribute("onclick",new Function("FavoriteManager.cancel();return false;"))}else{cancel.setAttribute("onclick","FavoriteManager.cancel();return false;")}var ul=document.createElement("ul");ul.setAttribute("id","addToTopFavoriteWindowDtl");for(var i in list){var li=document.createElement("li");var a=document.createElement("a");a.style.backgroundImage="url("+list[i].icon+")";a.setAttribute("href","http://rd.yahoo.co.jp/toppage/api/cfapi"+i+"/*"+list[i].url);a.setAttribute("target","new");var name=document.createTextNode(list[i].name);var del=document.createElement("div");var span=document.createElement("span");if(this.isIE){del.setAttribute("className","attfBtn");del.setAttribute("onclick",new Function("FavoriteManager.fire("+i+");return false;"))}else{del.setAttribute("class","attfBtn");del.setAttribute("onclick","FavoriteManager.fire("+i+");return false;")}a.appendChild(name);span.appendChild(document.createTextNode("\u5165\u308c\u66ff\u3048"));del.appendChild(span);li.appendChild(a);li.appendChild(del);ul.appendChild(li)}div3.appendChild(divTtl);div3.appendChild(ul);div3.appendChild(cancel);div2.appendChild(div3);div.appendChild(div2);Top.appendChild(div)}}};yFav.fn.init.prototype=yFav.fn})();