var loc=window.location.toString();var pattern="^http://.*.taobao.com/go/.*";var mallPattern="^http://mall.taobao.com/go/.*";var msnPattern="^http://msn.mall.taobao.com/go/.*";var htmlCode;htmlCode=document.body.innerHTML.toString();if(htmlCode!=null){var rgnFlag=htmlCode.match(/<!-- Rgn.*?-->/g);var tmsFlag=htmlCode.match(/<!--TMS pageId=.*?-->/g);if(rgnFlag!=null&&rgnFlag.length>0){var div=document.createElement("ul");div.id="tms_edit_link";var msgStyle="padding:5px;border:1px solid #ccc;-moz-border-radius:5px;background-color:#fff;line-height:18px;top:10px; right:10px; vertical-align:middle; z-index:99999999; POSITION:absolute;";div.style.cssText=msgStyle;for(var i=0;i<rgnFlag.length;i++){var li=document.createElement("li");var fileName=rgnFlag[i].match(/file_name=\".*?\"/g).toString().replace("file_name=","").replace(/\"/g,"");var siteId=rgnFlag[i].match(/site_id=\".*?\"/g).toString().replace("site_id=","").replace(/\"/g,"");var a=document.createElement("a");a.href="http://tms.taobao.com/page/CreateOrEdit.htm?fileName="+fileName+"&siteId="+siteId;a.target="blank";var img=document.createElement("img");img.src="http://tms.taobao.com/img/edit.png";img.alt=fileName;img.border="0px";a.appendChild(img);li.appendChild(a);var a=document.createElement("a");if(loc.split("?").length>1){a.href=loc+"&tms_preview=true"}else{a.href=loc+"?tms_preview=true"}a.target="blank";var img=document.createElement("img");img.src="http://tms.taobao.com/img/edit.png";img.alt=" Preview";img.border="0px";a.appendChild(img);li.appendChild(a);div.appendChild(li)}document.body.appendChild(div)}else{if(tmsFlag!=null&&tmsFlag.length>0){var div=document.createElement("ul");div.id="tms_edit_link";var msgStyle="padding:5px;border:1px solid #ccc;-moz-border-radius:5px;background-color:#fff;line-height:18px;top:10px; right:10px; vertical-align:middle; z-index:60; POSITION:absolute;";div.style.cssText=msgStyle;var li=document.createElement("li");var pageId=tmsFlag[0].match(/pageId=\".*?\"/g).toString().replace("pageId=","").replace(/\"/g,"");var a=document.createElement("a");a.href="http://tms.taobao.com/page/maintain.htm?id="+pageId;a.target="blank";var img=document.createElement("img");img.src="http://tms.taobao.com/img/edit.png";img.alt="Edit TMS Page";img.border="0px";a.appendChild(img);li.appendChild(a);div.appendChild(li);document.body.appendChild(div)}else{if(loc.match(pattern)){var href=loc.split("?");var div=document.createElement("div");div.id="tms_edit_link";var msgStyle="padding:5px;border:1px solid #ccc;-moz-border-radius:5px;background-color:#fff;line-height:18px;top:10px; right:10px; vertical-align:middle; z-index:60; POSITION:absolute;";div.style.cssText=msgStyle;var a=document.createElement("a");var pathUrl;if(loc.match(mallPattern)){pathUrl=loc.replace("mall.taobao.com","www.mall.taobao.com")}else{if(loc.match(msnPattern)){pathUrl=loc.replace("msn.mall.taobao.com","www.mall.taobao.com")}else{pathUrl=href[0]}}a.href="http://tms.taobao.com/page/maintain.htm?path="+encodeURIComponent(pathUrl);a.target="blank";var img=document.createElement("img");img.src="http://tms.taobao.com/img/edit.png";img.alt="Edit TMS Page";img.border="0px";a.appendChild(img);div.appendChild(a);document.body.appendChild(div)}}}if(loc.indexOf("preview.htm")!==-1){document.getElementById("preview-in-ie").style.display=""}var tmsEditLinkObj=document.getElementById("tms_edit_link");if(tmsEditLinkObj){var closeObj=document.getElementById("close_edit_link");if(!closeObj&&window==window.top.window){var closeObj;if(tmsEditLinkObj.nodeName==="DIV"){closeObj=document.createElement("span")}if(tmsEditLinkObj.nodeName==="UL"){closeObj=document.createElement("li")}closeObj.appendChild(document.createTextNode("\u9690\u85cf"));closeObj.style.cssText="position:absolute;left:-3.3em;top:46%;background:#ff6600;padding:.5em;width:2em;height:2em;-moz-border-radius:2em;cursor:pointer;line-height:2em;border:solid 2px #f20;-moz-box-shadow:.1em .2em .2em #000;color:#fff;";closeObj.onclick=function(){if(this.style.position==="absolute"){this.style.position="fixed";this.style.right=".3em";this.style.left="auto";this.style.top="40%";this.innerHTML="\u663e\u793a";this.parentNode.style.top="-9999em"}else{this.style.position="absolute";this.style.right="auto";this.style.left="-3.3em";this.style.top="46%";this.parentNode.style.height="auto";this.innerHTML="\u9690\u85cf";this.parentNode.style.top="10px";window.scrollTo(0,0)}};closeObj.onmouseover=function(){this.style.background="#f50"};closeObj.onmouseout=function(){this.style.background="#f60"};tmsEditLinkObj.appendChild(closeObj)}}};

