if(typeof SD=="undefined"||!SD)var SD={};
SD.config={pmhost:"http://xml.tw.overture.com/d/search/p/standard/js/flat/tw/rlb/",cmhost:"http://cmh.tw.yahoo.overture.com/js_flat_1_0/",pm:{partner:"tw_syndication_sitetag_armscool_pm",charset:"utf-8"},cmarray:["tw_syndication_sitetag_3c_001","tw_syndication_sitetag_food_001","tw_syndication_sitetag_moto_001","tw_syndication_sitetag_leisure","tw_syndication_sitetag_travel_001"],cm:{config:"20618435762",ctxtid:"tw_syndication_sitetag_travel_001",partner:"tw_syndication_sitetag_armscool_cm"},dr:{source:"armscool"},
hosthash:"1aea74dec0fd",stop:false,statichost:"http://ad.sitemaji.com/",sitename:"armscool"};
(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,e){for(var l=[],b=(c||document).getElementsByTagName(b||"*"),a=S.Dom._getClassRegEx(a),c=0,m=b.length;c<m;c++)a.test(b[c].className)&&(l[l.length]=b[c],e&&e.call(b[c],b[c]));return l},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),e;for(e in b)a[e]=b[e];if(c)a.innerHTML=c;return a},get:function(a,b,c){var a=document.createElement(a),e;for(e in b)a[e]=b[e];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.config.cm.ctxtid=SD.config.cmarray[Math.floor(Math.random()*SD.config.cmarray.length)];SD.params={initPm:function(a,b){return["?Partner="+encodeURIComponent(SD.config.pm.partner),"Keywords="+encodeURIComponent(b),"mkt=tw&adultFilter=any","maxCount="+a,"outputCharEnc="+SD.config.pm.charset].join("&")},initCm:function(a){return["?config="+SD.config.cm.config,"mkt=tw","source="+encodeURIComponent(SD.config.cm.partner),"maxCount="+parseInt(a),"outputCharEnc=utf-8","ctxtId="+encodeURIComponent(SD.config.cm.ctxtid),
"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,e=0,l=a.getElementsByClassName("sitemajiad"),m=a.getElementsByClassName("sitemajidr");SD.ysm={adHTML:[],arrange:function(a){for(var b=[],k=6,c=a.length;k<c;k+=6)b.push({desc:a[k],tmp:a[k+1],link:a[k+2],title:a[k+3],url:a[k+4]});return b},structure:function(a){a=SD.ysm.arrange(a);if(a.length>0)for(i=0,j=a.length;i<j;i++)SD.ysm.adHTML[e]='<dl><dt><a target="_blank" href="'+a[i].link+'">'+a[i].title+"</a></dt><dd>"+a[i].desc+"</dd><address>"+a[i].url+"</address></dl>",
e++},genHtml:function(){for(var a=0,c=l.length;a<c;a++){for(var k=l[a],f=k.getAttribute("model"),h="",d=0,g=parseInt(f);d<g;d++)d==0&&(h='<div class="bd">'+h),SD.ysm.adHTML.length>0&&(h+=SD.ysm.adHTML.shift()),d==f-1&&(h+="</div>");k.innerHTML=h;k=k.getElementsByTagName("dl");d=0;for(g=k.length;d<g;d++)k[d].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=m.length;b<c;b++){var f="",h="",d=m[b],f=d.getAttribute("model")?d.getAttribute("model"):"300x250";sSize="s"+f;var g=f.split("x"),h=g[0]?g[0]:"300",g=g[1]?g[1]:"250";if(a[sSize].ad_size==f)a[sSize].ad_list[0].ad_type!==
""?(f=a[sSize].ad_list[0].ad_type,h=f=="img"?'<a href="'+decodeURIComponent(a[sSize].ad_list[0].ad_url)+'" target="_blank"><img style="margin:0 auto;display:block;width:'+h+"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),h,g),d.innerHTML=h,a[sSize].ad_list.shift()):d.innerHTML=SD.ysm.drHTML(SD.config.dr.source,h,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 f="",a=0,h=m.length;a<h;a++){var d=m[a],g=d.getAttribute("model")?d.getAttribute("model"):"300x250";c[b[g]]=c[b[g]]==void 0?1:c[b[g]]+1}for(var e in c)f=f+e+"x"+c[e]+",";f=f.replace(RegExp("[,]+$","g"),"");SD.util.createEl.js("http://rd.sitemaji.com/ask.php?size="+f+"&hosthash="+SD.config.hosthash+"&callback=SD.ysm.getSitemajiad")}else{a=0;for(h=m.length;a<h;a++){d=m[a];b=d.innerHTML;try{f=
b.replace(/^\s+|\s+$/g,"")}catch(l){f=b}if(f=="")g=d.getAttribute("model")?d.getAttribute("model"):"300x250",b=g.split("x"),d.innerHTML=SD.ysm.drHTML(SD.config.dr.source,b[0]?b[0]:"300",b[1]?b[1]:"250")}}},drgen:function(){m[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,e=b.length;c<e;c++){var l=parseInt(b[c].getAttribute("model"));a+=l}b="";b=SD.tool.getUrlArgument("p",document.referrer);b.length||(b=SD.tool.getUrlArgument("q",document.referrer));b=decodeURIComponent(b);SD.manage.queue=b!=""?[SD.config.pmhost+SD.params.initPm(a,b),SD.config.cmhost+SD.params.initCm(a)]:[SD.config.cmhost+SD.params.initCm(a)];SD.manage.execute();
SD.util.createEl.css(SD.config.statichost+SD.config.sitename+".css","screen")}})();

