document.domain=TB.bom.pickDocumentDomain();TB.namespace("app.Favorite");TB.app.Favorite.LegacyJoint=TB.app.Favorite.FavoriteJoint=(function(){var E="http://shop."+document.domain+"/favorite/popup/edit_favorite.htm";var H=function(I){return I.toQueryParams()};var C=function(){return false};var B={eventType:"click",width:300,height:205,autoFit:true,position:"top",offset:[-106,-1]};var D=function(J){var N=$D.generateId();var K=document.createElement("div");K.id="__favorite_popup_"+N;$D.setStyle(K,"position","absolute");$D.setStyle(K,"z-index",10000);var M=document.createElement("div");K.appendChild(M);M.style.cssText="left: 0px; margin-left: 0px";$D.addClass(M,"favourite-tip");$D.addClass(M,"detail-favourite-tip");var O=document.createElement("div");K.appendChild(O);$D.addClass(O,"favourite-tip-content");var P=document.createElement("a");O.innerHTML="<a href=\"javascript:void(0)\" onclick=\"window['"+K.id+"'].hide();\" style=\"position: absolute;top: 2px;right: 2px;width:15px;background: url(http://pics.taobao.com/2k7/sys/favorites/close.gif) no-repeat right 0;text-decoration: none;text-indent:-999em;overflow:hidden;\">X</a>";var I;try{I=document.createElement("<iframe name=\"__favorite_popup_iframe_"+N+"\"></iframe>")}catch(L){I=document.createElement("iframe");I.name="__favorite_popup_iframe_"+N}I.setAttribute("src","about:blank");I.setAttribute("frameBorder",0);I.setAttribute("scrolling","no");$D.setStyle(I,"width","300px");$D.setStyle(I,"height","195px");O.appendChild(I);return K};var A=function(L,O){var N=$E.getTarget(L);if(O[0].clazz){while(!$D.hasClass(N,O[0].clazz)){N=N.parentNode}}else{if(O[0].id){if(N.id!=O[0].id){N=N.parentNode}}}var I=G(N,O[0]);var K=I.popup.getElementsByTagName("iframe")[0];var J=E+"?";for(p in O[1]){J+=p+"="+O[1][p]+"&"}J+="t="+new Date().getTime();if(!K.src||K.src=="about:blank"){K.src=J}else{try{J+="t="+new Date().getTime();if(J.replace(/&t=\d+/,"")!=window.frames[K.name].location.href.replace(/&t=\d+/,"")){window.frames[K.name].location=J}}catch(M){}}};var G=function(K,P){if(P.clazz){var O=document.getElementsByTagName("iframe");for(var N=0;N<O.length;N++){var J=O[N].getAttribute("name");if(J&&J.indexOf("__favorite_popup_")==0){var M=J.replace("_iframe","");if(M!=K.getAttribute("favorite:popup")){window[M].hide()}}}}var I=K.getAttribute("favorite:popup");if(!I){var L=D(K);if(document.body){document.body.insertBefore(L,document.body.firstChild)}I=L.id;K.setAttribute("favorite:popup",I);TB.applyIf(P,B);var Q=TB.widget.SimplePopup.decorate(K,L,P);window[I]=Q;Q.show()}return window[I]};var F={popupParams:{},connectById:function(M,L){var I=$(M);if(I&&I.getAttribute("favorite:params")){var K=I.getElementsByTagName("a");if(K[0]){K[0].onclick=C}var J=H(I.getAttribute("favorite:params"));$E.on(I,"click",A,[L||this.popupParams,J])}},connectByClass:function(I,M){var L=$D.getElementsByClassName(I,M["tag"],M["root"]);for(var K=0;K<L.length;K++){if(L[K].getAttribute("favorite:params")){if(L[K].tagName.toLowerCase()=="a"){L[K].onclick=C}var J=H(L[K].getAttribute("favorite:params"));$E.on(L[K],"click",A,[M||this.popupParams,J])}}},init:function(){var M=YAHOO.util;var L=M.Dom;var J="favorite:pickFavorite";var I=L.getElementsByClassName(J);var K={};var N=function(){this.connectByClass(J,K)};$E.onDOMReady(N,this,true)}};F.init();return F})()
