
(function(){function B(a){var b=k.ord;return[f.keywords[a],"u=",f.u[a],"tile=",f.tiles[a],";sz=",(f.sizes[a]||[]).join(","),";ord=",b].join("")}function C(a){var b=l.createElement("img");b.src=a;t.push(b)}function u(a,b){var c,d=a.length,g={};for(c=0;c<d;c++)g[a[c]]=b(a[c]);return g}function v(a,b){e.onParseConfig.fire();if(b.positions&&b.sequence){k.site=n.Cookie.get("adstest")?b.testSite:b.site;k.zone=b.zone;k.ord=b.ord||D();f.keywords=R(a);f.sizes=S(b);f.tiles=T(b.sequence);f.u=U(a,b);f.set(b.sequence);
e.pageState=V;f.each(function(c){!f.exists(c)&&f.states[c]!=o&&f.setState(c,E)});e.onParseFinished.fire()}else e.fireErrorBeacon("badTagServerData")}function S(a){var b=a.positions;return u(a.sequence,function(c){return b[c].sizes})}function U(a,b){var c=a.config.loc,d=k.zone.split("/"),g=["dma-",c.dma||"nl","*st-",c.state||"nl","*cid-",a.config.user.claritas||c.claritas||"nl","*ord-",k.ord||"nl","*cat-",d[0]||"nl","*fam-",d[1]||"nl","*ch-",d[2]||"nl"].join(""),i=b.positions;return u(b.sequence,function(h){return[g,
"*tile-",f.tiles[h],"*pos-",W(i[h].keywords,"pos")||"nl",";"].join("")})}function W(a,b){var c,d=a.length,g=RegExp(b+"=");for(c=0;c<d;c++)if(g.test(a[c]))return a[c].split("=")[1];return"nl"}function T(a){var b={},c=a.length,d=0;for(d=0;d<c;d++)b[a[d]]=d+1;return b}function R(a){var b=X(a.config.ad.sequence,a.config.ad.positions),c=a.config.ad.keywords.join(";");c=c?c+";":"";var d,g=a.config.wx,i={tmp:"temp",tmpr:"tempR",plln:"pollen",wind:"wind",uv:"uv",hmid:"hum",sev:"severe",cnd:"cond"};if(g){i=
F(i,g);g=g.fcast;var h="",j={fhi:"tempH",fli:"tempL",fhr:"tempHR",flr:"tempLR",fc1:"cond",fc2:"cond",fc3:"cond"};if(g)for(d in j)if(j.hasOwnProperty(d))switch(d){case "fc1":h+=[d,"=",g[j[d]][0]||"nl",";"].join("");break;case "fc2":h+=[d,"=",g[j[d]][1]||"nl",";"].join("");break;case "fc3":h+=[d,"=",g[j[d]][2]||"nl",";"].join("");break;default:h+=[d,"=",g[j[d]]||"nl",";"].join("");break}d=i+h}else d=G(i);d=d;i=a.config.loc;g={zip:"zip",dma:"dma",st:"state",cc:"country"};i=i?F(g,i):G(g);c=c+(d+i+Y(a.config.user));
a=a.config.ad.layout?(/lo=/.test(a.config.ad.layout)?a.config.ad.layout:"lo="+a.config.ad.layout)+";":"";d=n.Cookie.get("adstest")?"adstest="+n.Cookie.get("adstest")+";":"";for(var m in b)if(b.hasOwnProperty(m))b[m]=b[m]+";"+c+a+d;return b}function w(a){e.pageState=H;x(a.getMaster())}function x(a){n.Event.onContentReady(a,function(){var b=(p.indexOf("?")<0?p+"?pos="+a:p+"&pos="+a)+"&key="+f.key[a];l.getElementById(a).innerHTML='<iframe id="'+a+'_frame" frameBorder="0" scrolling="no" allowtransparency="true" class="OASAdFrame" style="width: 1px; height: 1px" width="1" height="1"></iframe>';
l.getElementById(a+"_frame").contentWindow.location.replace(b)})}function I(a,b,c){var d=n.Dom;d.setStyle([a+"_frame",a],"height",c+"px");d.setStyle([a+"_frame",a],"width",b+"px")}function J(){e.onStart.fire();n.Event.addListener(y,"load",function(){for(var a=f.names,b=a.length,c=l.body,d=0;d<b;d++)if(!l.getElementById(a[d])){e.fireErrorBeacon("missingPositions",a[d],"where=IA");break}for(d=0;d<t.length;d++)c.appendChild(t[d])})}function D(){var a=e.start,b=(new Date).getTime();return(String(a)+String(Math.floor(b*
(b-a)*Math.random()))+String(b).split("").reverse().join("")).substring(0,19)}function Z(a){function b(d,g){for(var i={},h,j=0;j<d.length;j++){h=d[j];i[h]={};i[h].sizes=typeof g[h].size==="array"?g[h].size:[g[h].size];i[h].keywords=g[h].keywords}return i}var c;if(wx&&wx.config&&wx.config.ad){c=wx.config.ad;c.testSite=a.test_keyword;c.site=a.prod_keyword;c.zone=a.zone;c.keywords=$(a.keywords,a.LAYOUT.keywords);c.sequence=a.LAYOUT.sequence;c.positions=b(wx.config.ad.sequence,a.LAYOUT);c.ord=D()}return c}
function $(a,b){var c,d=b.length;if(a.length==1&&a[0].length<1)a=[];for(c=0;c<d;c++)a.push(b[c]);return a}function X(a,b){return u(a,function(c){return b[c].keywords.join(";")})}function Y(a){function b(i,h){var j=a[i[h]];if(typeof j=="string")return h+"="+(j||"nl")+";";return j&&j.length>0?h+"="+j.join(";"+h+"=")+";":h+"=nl;"}var c={age:"age",gender:"gender",asi:"asi"},d="";if(a)for(var g in c)if(c.hasOwnProperty(g))d+=g=="asi"||g=="age"?b(c,g):[g,"=",a[c[g]]||"nl",";"].join("");return d}function G(a){var b=
"";for(var c in a)if(a.hasOwnProperty(c))b+=c+"=nl;";return b}function F(a,b){var c="";for(var d in a)if(a.hasOwnProperty(d))c+=[d,"=",b[a[d]]||"nl",";"].join("");return c}function z(a){if(f.empty())q.push(a);else if(f.exists(a))if(f.isMaster(a))w(f);else e.pageState==K?x(a):A.push(a);else l.getElementById(a).style.display="none"}function L(a){var b;a=a||window.wx;e.start=(new Date).getTime();if(a&&a.config&&a.config.page&&a.config.ad){b=a.config.page.pageId||0;a=a.config.ad.mode||"default";J();if(typeof b==
"string")b=b.replace(/\s/g,"");M.script(N.replace("%pageid%",b).replace("%modeid%",a))}else e.fireErrorBeacon("noPageConfigObject")}function aa(a){a=a||window.wx;e.start=(new Date).getTime();if(a&&a.config&&a.config.ad&&typeof a.config.ad==="object"){J();v(a,a.config.ad)}else e.fireErrorBeacon("noPageConfigObject")}function O(){f.resetStates();w(f);e.onParseFinished.unsubscribe(O)}var y=window,n=YAHOO.util,M=n.Get,l=y.document,r=n.CustomEvent,V=2,H=3,K=4,E=6,o=7,p="/common/a21/makeRequest.html",N=
"http://wxdata.weather.com/wxdata/ts/cfg/%pageid%.js?modeid=%modeid%&cb=A21.gotCR",P=false,k={zone:"",ord:0,site:""},Q=true,q=[],A=[],t=[],f={index:0,names:[],bodyHTML:{},clickUrl:{},states:{},keywords:{},sizes:{},u:{},tiles:{},key:{},init:function(a){f.names=a||[]},resetIndex:function(){this.index=0},next:function(){this.index++},empty:function(){return this.index>=this.names.length},getCurrent:function(){return this.names[this.index]},setSlaveIndex:function(){this.index=1},getMaster:function(){this.setSlaveIndex();
return this.names[0]},isMaster:function(a){return this.names[0]==a},set:function(a){this.names=a},getLength:function(){return this.names.length},exists:function(a){var b=this.names,c=b.length,d;for(d=0;d<c;d++)if(a==b[d])return true;return false},getState:function(a){return this.states[a]},setState:function(a,b){this.states[a]=b},resetStates:function(){for(var a in this.states)if(this.states.hasOwnProperty(a))this.states[a]=o},determineIf:function(a,b){var c=this.getLength(),d;for(d=0;d<c;d++)if(!b.call(a,
this.names[d]))return false;return true},areAllReady:function(){return this.determineIf(this,function(a){return this.states[a]>=o})},each:function(a){var b=this.names,c=b.length,d;for(d=0;d<c;d++)a.call(this,b[d],d,b)}},e=y.A21={};e.adSize={};e.pageState=0;e.start=0;e.setDomain=function(a){document.domain=a};e.setPath=function(a){p=a+(/\/$/.test(a)?"":"/")+"makeRequest.html"};e.notifyDone=function(a){e.pageState=5;var b,c;if(l.getElementById(a+"_frame").contentWindow.document.body&&e.adSize[a]){b=
e.adSize[a].width;c=e.adSize[a].height;f.setState(a,10);if(b==1||c==1||b==0||c==0){l.getElementById(a).style.display="none";I(a,0,0)}else{l.getElementById(a).style.display="block";I(a,b,c)}e.onFinish.fire({position:a,Positions:f,adVariables:k})}else e.fireErrorBeacon("missingPositions",a,"where=SS")};e.scriptTag=function(a){return['<script  type="text/javascript" src="',a,'?"><\/script>'].join("")};e.onStart=new r("start");e.onParseConfig=new r("parseConfig");e.onParseFinished=new r("parseFinished");
e.onFinish=new r("finish");e.notifyMasterDone=function(a){e.notifyDone(a);if(e.isMaster(a)){f.setSlaveIndex();if(P){a=f;if(a.areAllReady())for(;!a.empty();){x(a.getCurrent());a.next()}}}};e.isMaster=function(a){return f.isMaster(a)};e.notifyProcessing=function(a){if(e.pageState==H)for(e.pageState=K;A.length>0;)z(A.pop());f.setState(a,9)};e.notifyNotRegistered=function(a){f.setState(a,E)};e.notifyRegistered=function(a){var b=wx.config.ad;f.key[a]=(new Date).getTime();f.setState(a,o);if(Q){Q=false;
q.push(a);e.onParseFinished.subscribe(function(){for(;q.length>0;)z(q.pop())});b&&b.sequence&&b.sequence.length>0?aa(wx):L(wx)}else z(a)};e.notifyRegisteredNoLoad=function(a){P=true;f.setState(a,o)};e.storeBody=function(a,b){f.bodyHTML[a]=b};e.storeClickURL=function(a,b){f.clickUrl[a]=b};e.storeSize=function(a,b){var c;if(b){c=b.split("/");e.adSize[a]={width:c[0],height:c[1]}}else if(f&&f.sizes&&f.sizes[a]&&f.sizes[a][0]){c=e.adSize;var d,g=f.sizes[a][0].split(","),i=g.length,h=-1,j,m,s;for(d=0;d<
i;d++){j=g[d].split("x");m=j[0]*j[1];if(m>h){s={width:j[0],height:j[1]};h=m}}c[a]=s}};e.getTSSizes=function(a){return f.sizes[a]};e.gotCR=function(a){a&&a["class"]!=="error"?v(window.wx,Z(a)):e.fireErrorBeacon("noTagServerData")};e.refresh=function(a,b){var c=k;if(typeof a!="string"){b=a;a=false}if(a)M.script(N.replace("%%pageid%%",c.pageid).replace("%%modeid%%",c.modeid));else{f.resetIndex();if(b){wx.config.ad.sequence=b;v(wx,wx.config.ad)}else w(f)}};e.refreshNew=function(){e.onParseFinished.subscribe(O);
L()};e.areCorrectLengths=function(a,b){if(a.length>2048){e.fireErrorBeacon("UrlLengthExceeded",b);return false}return true};e.truncate=function(a){var b;if(a.length>2048){a=a.substring(0,2048);b=a.lastIndexOf(";");a=a.substring(0,b)}return a};e.getBeaconKeywords=function(a,b,c,d,g,i,h){var j=f.keywords[a],m=f.sizes[a],s=k.ord,ba=k.site;a=f.tiles[a];var ca=k.zone;g=g?"&dfa_adid="+g:"";g+=i?"&dfa_adsize="+i:"";g+=h?"&dfa_creativeid="+h:"";return[j.replace(/;/g,"&"),"site=",ba,"&zone=",ca,"&adid=",b,
"&adsize=",c,"&creativeid=",d,"&tile=",a,"&pageid=",wx.config.page.pageId,"&sz=",m.join(","),g,"&ord=",s].join("")};e.getDFPUrl=function(a){return["http://ad.doubleclick.net/adj/",k.site,"/",k.zone?k.zone+";":";",B(a)].join("")};e.keysMatch=function(a,b){return b?f.key[a]==b:true};e.fireErrorBeacon=function(a,b,c){var d=k.zone,g=k.site,i=escape(window.location.href);c=c?"&"+c:"";if(b){b=["pageid=",wx.config.page.pageId,"&position=",b,"&zone=",d,"&site=",g,"&",B(b)].join("");b=b.replace(/;/g,"&")}else b=
"";C(["http://b.imwx.com/b/error?type=ad&subtype=",a,c,"&rmid=",wx.config.user.rmid,"&page=",i,"&",b].join(""))};e.fireTrackingBeacon=function(a){C(["http://b.imwx.com/b/impression?",a,"&rmid=",wx.config.user.rmid].join(""))};e.initDynamic=e.initStatic=function(){}})();


