if(typeof SD=="undefined"||!SD)var SD={};
SD.config={pmhost:"http://xml.tw.overture.com/d/search/p/standard/js/flat/tw/rlb/",bcmhost:"http://xml.tw.yahoo.overture.com/d/search/p/knowledge/js/flat/tw/kk/bc/",cmhost:"http://cmh.tw.yahoo.overture.com/js_flat_1_0/",pm:{partner:"tw_syndication_sitetag_adj_pm",charset:"utf-8"},bcm:{partner:"tw_syndication_sitetag_adj_bcm",charset:"utf-8"},cm:{config:"20618435762",ctxtid:"tw_syndication_sitetag_photo",partner:"tw_syndication_sitetag_adj_cm"},dr:{source:"ADJ"},hosthash:"e4ccd986ae0d",stop:false,
statichost:"http://ad.sitemaji.com/",sitename:"adj"};
(function(){SD.util=SD.util||{};S=SD.util;SD.util.Dom={_reClassNameCache:{},_getClassRegEx:function(a){var b=S.Dom._reClassNameCache[a];b||(b=RegExp("(?:^|\\s+)"+a+"(?:\\s+|$)"),S.Dom._reClassNameCache[a]=b);return b},getElementsByClassName:function(a,b,c,d){for(var e=[],b=(c||document).getElementsByTagName(b||"*"),a=S.Dom._getClassRegEx(a),c=0,h=b.length;c<h;c++)a.test(b[c].className)&&(e[e.length]=b[c],d&&d.call(b[c],b[c]));return e},getAncestorByTagName:function(a,b){for(;a=a.parentNode;)if(a.tagName.toLowerCase()==
b)return a;return null}};SD.util.Event={getTarget:function(a){return this.resolveTextNode(a.target||a.srcElement)},resolveTextNode:function(a){try{if(a&&3==a.nodeType)return a.parentNode}catch(b){}return a},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=false}}})();
(function(){SD.util.createEl={dom:function(a,b,c){var a=document.createElement(a),d;for(d in b)a[d]=b[d];if(c)a.innerHTML=c;return a},get:function(a,b,c){var a=document.createElement(a),d;for(d in b)a[d]=b[d];if(c)a.innerHTML=c;this.append(a);return a},append:function(a){(document.getElementsByTagName("head")[0]||document.body).appendChild(a)},remove:function(a){setTimeout(function(){a.parentNode.removeChild(a);a=null},0)},js:function(a,b){var c=this.get("script",{src:a,type:"text/javascript"},null);
b&&c.setAttribute("charset",b);return c},css:function(a,b){b||(b="all");return this.get("link",{href:a,rel:"stylesheet",type:"text/css",media:b},null,"head")}}})();(function(){SD.tool={getUrlArgument:function(a,b){var a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),c=RegExp("[\\?&]"+a+"=([^&#]*)");return!c.exec(b)?"":c.exec(b)[1]},log:function(a){if(document.images)(new Image).src=a+""},debug:function(a){window.console&&window.console.firebug&&console.log(a)}}})();
(function(){SD.params={initPm:function(a,b){return["?Partner="+encodeURIComponent(SD.config.pm.partner),"Keywords="+encodeURIComponent(b),"mkt=tw","maxCount="+a,"outputCharEnc="+SD.config.pm.charset].join("&")},initBcm:function(a,b){return["?Partner="+encodeURIComponent(SD.config.bcm.partner),"Keywords="+encodeURIComponent(b),"mkt=tw","maxCount="+a,"outputCharEnc="+SD.config.bcm.charset].join("&")},initCm:function(a,b){return["?config="+SD.config.cm.config,"mkt=tw","source="+encodeURIComponent(SD.config.cm.partner),
"maxCount="+parseInt(a),"outputCharEnc=utf-8","ctxtId="+encodeURIComponent(b),"ctxtUrl="+encodeURIComponent(document.location)].join("&")}}})();(function(){SD.manage={queue:[],feed:null,stop:function(){SD.config.stop=true;SD.manage.execute()},execute:function(){if(this.feed&&SD.config.stop||!this.feed){this.queue.length==0&&SD.ysm.genHtml();if(!this.queue.length)return this.feed=null,false;var a=this.feed=this.queue.shift();setTimeout(function(){SD.ysm.overture(a)},5)}}}})();
(function(){var a=SD.util.Dom,b=SD.util.Event,c,d=0,e=a.getElementsByClassName("sitemajiad"),h=a.getElementsByClassName("sitemajidr");SD.ysm={adHTML:[],arrange:function(a){for(var b=[],c=6,l=a.length;c<l;c+=6)b.push({desc:a[c],tmp:a[c+1],link:a[c+2],title:a[c+3],url:a[c+4]});return b},structure:function(a){a=SD.ysm.arrange(a);if(sKw!="")var b=RegExp(function(a){a=a.replace(/\\/g,"\\\\");a=a.replace(/\//g,"\\/");a=a.replace(/\[/g,"\\[");a=a.replace(/\]/g,"\\]");a=a.replace(/\(/g,"\\(");a=a.replace(/\)/g,
"\\)");a=a.replace(/\{/g,"\\{");a=a.replace(/\}/g,"\\}");a=a.replace(/\</g,"\\<");a=a.replace(/\>/g,"\\>");a=a.replace(/\|/g,"\\|");a=a.replace(/\*/g,"\\*");a=a.replace(/\?/g,"\\?");a=a.replace(/\+/g,"\\+");a=a.replace(/\^/g,"\\^");return a=a.replace(/\$/g,"\\$")}(sKw),"ig"),c=function(a){return a=a.replace(b,function(a){return"<strong>"+a+"</strong>"})};else c=function(a){return a};if(a.length>0)for(i=0,j=a.length;i<j;i++){if(!sKw)a[i].title=a[i].title.replace("\u904a\u6232","<strong>\u904a\u6232</strong>"),
a[i].title=a[i].title.replace("\u96fb\u73a9","<strong>\u96fb\u73a9</strong>"),a[i].title=a[i].title.replace("\u4ea4\u6613","<strong>\u4ea4\u6613</strong>"),a[i].title=a[i].title.replace("\u514d\u8cbb","<strong>\u514d\u8cbb</strong>"),a[i].title=a[i].title.replace("\u7dda\u4e0a","<strong>\u7dda\u4e0a</strong>"),a[i].title=a[i].title.replace("\u597d\u73a9","<strong>\u597d\u73a9</strong>"),a[i].title=a[i].title.replace("\u9ebb\u5c07","<strong>\u9ebb\u5c07</strong>");SD.ysm.adHTML[d]='<dl><dt><a target="_blank" href="'+
a[i].link+'">'+c(a[i].title)+"</a></dt><dd>"+a[i].desc+"</dd><address>"+a[i].url+"</address></dl>";d++}},genHtml:function(){for(var a=0,c=e.length;a<c;a++){for(var k=e[a],l=k.getAttribute("model"),d="",f=0,g=parseInt(l);f<g;f++)f==0&&(d='<div class="bd">'+d),SD.ysm.adHTML.length>0&&(d+=SD.ysm.adHTML.shift()),f==l-1&&(d+='</div><div class="ft"><cite>Ads by Yahoo!</cite></div>');k.innerHTML=d;k=k.getElementsByTagName("dl");f=0;for(g=k.length;f<g;f++)k[f].onclick=function(a){a=a||window.event;b.preventDefault(a);
a=this.getElementsByTagName("a")[0];window.open(a.href)}}},getData:function(){typeof zSr!=="undefined"?(SD.ysm.structure(zSr),SD.manage.stop(),SD.util.createEl.remove(c)):setTimeout(arguments.callee,30)},overture:function(a){zSr=void 0;c=SD.util.createEl.js(a);SD.ysm.getData()},drHTML:function(a,b,c){return"<IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH="+b+" HEIGHT="+c+' SRC="http://ad.yieldmanager.com/st?ad_type=iframe&ad_size='+b+"x"+c+"&entity=376336&site_code="+a+"&section_code="+
a+"&ytwpartcode="+a+'"></IFRAME>'},swfHTML:function(a,b,c){return sHtml='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+b+'" height="'+c+'" id="sitemajisystem"><param name="movie" value="'+decodeURIComponent(a)+'"><param name="allowScriptAccess" value="always"><embed src="'+decodeURIComponent(a)+'" width="'+b+'" height="'+c+'" allowscriptaccess="always"></embed></object>'},getSitemajiad:function(a){for(var b=0,c=h.length;b<c;b++){var d="",e="",f=h[b],d=f.getAttribute("model")?
f.getAttribute("model"):"300x250";sSize="s"+d;var g=d.split("x"),e=g[0]?g[0]:"300",g=g[1]?g[1]:"250";if(a[sSize].ad_size==d)a[sSize].ad_list[0].ad_type!==""?(d=a[sSize].ad_list[0].ad_type,e=d=="img"?'<a href="'+decodeURIComponent(a[sSize].ad_list[0].ad_url)+'" target="_blank"><img style="margin:0 auto;display:block;width:'+e+"px;height:"+g+'px;" src="'+decodeURIComponent(a[sSize].ad_list[0].ad_img)+'"></a>':SD.ysm.swfHTML(decodeURIComponent(a[sSize].ad_list[0].ad_img),e,g),f.innerHTML=e,a[sSize].ad_list.shift()):
f.innerHTML=SD.ysm.drHTML(SD.config.dr.source,e,g)}},percent:function(a){var b={"300x250":1,"728x90":2,"300x100":3,"240x400":4,"120x120":5,"160x600":6,"425x300":7,"425x600":8,"234x60":9,"120x600":10},c={};if(Math.floor(Math.random()*101)<a){for(var d="",a=0,e=h.length;a<e;a++){var f=h[a],g=f.getAttribute("model")?f.getAttribute("model"):"300x250";c[b[g]]=c[b[g]]==void 0?1:c[b[g]]+1}for(var n in c)d=d+n+"x"+c[n]+",";d=d.replace(RegExp("[,]+$","g"),"");SD.util.createEl.js("http://rd.sitemaji.com/ask.php?size="+
d+"&hosthash="+SD.config.hosthash+"&callback=SD.ysm.getSitemajiad")}else{a=0;for(e=h.length;a<e;a++){f=h[a];b=f.innerHTML;try{d=b.replace(/^\s+|\s+$/g,"")}catch(p){d=b}if(d=="")g=f.getAttribute("model")?f.getAttribute("model"):"300x250",b=g.split("x"),f.innerHTML=SD.ysm.drHTML(SD.config.dr.source,b[0]?b[0]:"300",b[1]?b[1]:"250")}}},drgen:function(){h[0]&&SD.util.createEl.js("http://ad.sitemaji.com/adpercent/sitemajipercent")}}})();
(function(){var a=SD.util.Dom,b=a.getElementsByClassName("sitemajiad");a.getElementsByClassName("sitemajidr")[0]&&SD.ysm.drgen();if(b[0]){for(var c=a=0,d=b.length;c<d;c++){var e=parseInt(b[c].getAttribute("model"));a+=e}sKw="";sKw=SD.tool.getUrlArgument("p",document.referrer);sKw.length||(sKw=SD.tool.getUrlArgument("q",document.referrer));sKw=decodeURIComponent(sKw);c=document.getElementById("nav");b="";if(c){e=c.getElementsByTagName("a");c=0;for(d=e.length;c<d;c++)if(c>0){if(c>3)break;var h;var m=
e[c].innerHTML;try{h=m.replace(/^\s+|\s+$/g,"")}catch(o){h=m}h=h.replace(/\//gi,"|");b=c==1?b+h:b+"|"+h}}SD.manage.queue=[SD.config.bcmhost+SD.params.initBcm(a,sKw==""?b:b+"|"+sKw),SD.config.cmhost+SD.params.initCm(a,SD.config.cm.ctxtid)];SD.manage.execute();SD.util.createEl.css(SD.config.statichost+SD.config.sitename+".css","screen")}})();

