var Weather={id:"Weather",title:"Weather",image:"weather16.gif",allowItems:true,allowFolders:true,itemName:"weather location",allowDrag:true,FindDialog:"finddialog/103398699.js",UpdateDialog:"updatedialog/103398711.js",renderEmpty:function(w,s){Section.renderEmpty(w,s,null,"<div>Get the latest weather information of your favorite places.  Click the 'Add weather location' link to get started.</div>")},addItems:function(id,beforeId){if(!beforeId)beforeId=-1;var src=Dom.getByNodeId(id);Module.showDialog(Weather,"FindDialog",{src:src,parentId:id,beforeId:beforeId})},insertItem:function(parentId,beforeId,item){C.beginExec("weather/add",{parent:parentId,beforeId:beforeId,location:item.location,title:item.title})},insertItem2:function(parentId,beforeId,id,title,text){C.beginExec("weather/add",{parent:parentId,beforeId:beforeId,location:id,title:title})},updateItem:function(i){if(i){Module.showDialog(Weather,"UpdateDialog",{item:page.nodes[i]})}},deleteItem:function(id){ContentItem.deleteItem(id,true)},defaultLayout:"List",detailLayout:"ItemDetail",renderStyle:function(w){w(".weatherImage {width: 33px; height: 35px;}",".weatherTemp {font-size: 120%;}",".weatherCondition {",FontSize.s,"}")},layouts:{List:{itemTagName:"TR",renderItemsHeader:function(w,s,items){w("<table class='wide' cellspacing=0><col><col xalign=right>")},renderItemsFooter:function(w,s,items){w("</table>")},renderItemDivider:function(w){w("<tr style='height:8px;'><td></td></tr>")},renderItemContent:function(w,item){if(item.dataBinding)item.dataBinding.dispose();var title=item.title;var uri=item.dataId;var id=Dom.getElementId(item);var dataValue=DataManager.getValue(uri);var b=new DataBinding(Weather,dataValue,id,item);item.dataBinding=b;item.section.contentDispose.push(b);item.dataValue=dataValue;var observation=dataValue.value||{};title=title||observation.location;var units=U.temperatureUnits;var temp=(units=="c"?observation.temperatureCelsius:observation.temperature);b.temp=new ElementBinding(temp,Weather.formatTemp,Weather.onChange);b.condition=new ElementBinding(observation.condition,null,Weather.onChange);b.image=new ElementBinding(observation.iconName,Weather.formatImage);b.image.property="src";w("<td>",Weather._0(observation),"</td><td>");w("<a href='http://weather.yahoo.com/forecast/",item.location,"_"+"f.html' target='",A.targetWindowName,"' tip='item:",item.nodeId,"'>",title,"</a>","<br/>","<span class=weatherCondition>",b.condition.text,"</span>","</span></td>","<td><span class=weatherTemp>",b.temp.text,"</span></td>")}},ItemDetail:{kind:1,renderItemContent:function(w,item,index){var t=Weather;var dataValue=DataManager.getValue(item.dataId);var o=dataValue.value||{};var title=item.title||o.location;var units=U.temperatureUnits;var temp=t.formatTemp((units=="c"?o.temperatureCelsius:o.temperature));var image=t.formatImage(o.iconName);var dewPoint=t.formatTemp((units=="c"?o.dewPointCelsius:o.dewPoint));var p=new ItemPanel(w,item);p.property("City",item.title);p.property("Temperature",temp);p.property("Conditions",o.condition);p.property("","<img src='"+image+"' />",{"vertical-align":"top"});p.property("Dew Point",dewPoint);p.property("Pressure",o.pressure);p.property("Relative Humidity",(o.relativeHumidity?o.relativeHumidity+"%":null));p.created();p.modified();p.close()}}},formatTemp:function(temp){if(temp)return temp+"&deg;";return""},_0:function(observation){return"<img class=weatherImage src='"+Weather.formatImage(observation.iconName)+"'"+Html.attribute("alt",observation.condition)+" />"},formatImage:function(code){if(code)return A.imageUrl("weather/"+code);return ImgSrc.blank},onChange:function(eb){Animation.fadeBackground(eb.element,Style.changedBackColor)},onDataChanged:function(b){if(b){var v=b.value;if(v){var eb=b.temp;if(eb.element==null)eb.element=Dom.getChildByClass(b.element,"weatherTemp");var units=U.temperatureUnits;var temp=(units=="c"?v.temperatureCelsius:v.temperature);eb.setValue(temp);eb=b.condition;if(eb.element==null)eb.element=Dom.getChildByClass(b.element,"weatherCondition");eb.setValue(v.condition);eb=b.image;if(eb.element==null)eb.element=Dom.getChildByClass(b.element,"weatherImage");eb.setValue(v.iconName);eb.element.alt=v.condition}}},_1:function(label,value,suffix){if(value)return"<tr><td align=right><span class='output-label color-light'>"+label+":&nbsp;</span></td><td>"+value+((suffix)?suffix:"")+"<tr>";return""},onItemTip:function(evt,item){var f=Weather._1;var d=item.dataValue.value;if(d){var units=U.temperatureUnits;var temp=(units=="c"?d.temperatureCelsius:d.temperature);var dewPoint=(units=="c"?d.dewPointCelsius:d.dewPoint);var od=Date.fromSeconds(d.observationTime);var ov=(od?od.toString2():null);evt.tip="<table>"+"<tr><td align=center>"+Weather._0(d)+"</td><td class=h1 align=center>"+item.title+(temp?" "+temp+"&deg;":"")+"</td></tr>"+f("Condition",d.condition)+f("Dew Point",dewPoint,"&deg;")+f("Heat Index",d.heatIndex)+f("Wind",d.windDescription)+f("Visibility",d.visibility," miles")+f("Pressure",d.pressure,"&quot;")+f("Humidity",d.relativeHumidity,"%")+f("Observation Time",ov)+"</table>"}}};Module.add(Weather);