(function($){$.template=function(html,options){return new $.template.instance(html,options)};$.template.instance=function(html,options){if(options&&options.regx){options.regx=this.regx[options.regx]}this.options=$.extend({compile:false,regx:this.regx.standard},options||{});this.html=html;if(this.options.compile){this.compile()}this.isTemplate=true};$.template.regx=$.template.instance.prototype.regx={jsp:/\$\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,ext:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,jtemplates:/\{\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}\}/g};$.template.regx.standard=$.template.regx.jsp;$.template.helpers=$.template.instance.prototype.helpers={substr:function(value,start,length){return String(value).substr(start,length)}};$.extend($.template.instance.prototype,{apply:function(values){if(this.options.compile){return this.compiled(values)}else{var tpl=this;var fm=this.helpers;var fn=function(m,name,format,args){if(format){if(format.substr(0,5)=="this."){return tpl.call(format.substr(5),values[name],values)}else{if(args){var re=/^\s*['"](.*)["']\s*$/;args=args.split(",");for(var i=0,len=args.length;i<len;i++){args[i]=args[i].replace(re,"$1")}args=[values[name]].concat(args)}else{args=[values[name]]}return fm[format].apply(fm,args)}}else{return values[name]!==undefined?values[name]:""}};return this.html.replace(this.options.regx,fn)}},compile:function(){var sep=$.browser.mozilla?"+":",";var fm=this.helpers;var fn=function(m,name,format,args){if(format){args=args?","+args:"";if(format.substr(0,5)!="this."){format="fm."+format+"("}else{format='this.call("'+format.substr(5)+'", ';args=", values"}}else{args="";format="(values['"+name+"'] == undefined ? '' : "}return"'"+sep+format+"values['"+name+"']"+args+")"+sep+"'"};var body;if($.browser.mozilla){body="this.compiled = function(values){ return '"+this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.options.regx,fn)+"';};"}else{body=["this.compiled = function(values){ return ['"];body.push(this.html.replace(/\\/g,"\\\\").replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.options.regx,fn));body.push("'].join('');};");body=body.join("")}eval(body);return this}});var $_old={domManip:$.fn.domManip,text:$.fn.text,html:$.fn.html};$.fn.domManip=function(args,table,reverse,callback){if(args[0].isTemplate){args[0]=args[0].apply(args[1]);delete args[1]}var r=$_old.domManip.apply(this,arguments);return r};$.fn.html=function(value,o){if(value&&value.isTemplate){var value=value.apply(o)}var r=$_old.html.apply(this,[value]);return r};$.fn.text=function(value,o){if(value&&value.isTemplate){var value=value.apply(o)}var r=$_old.text.apply(this,[value]);return r}})(jQuery);(function(A){A.fn.weather=function(D){var E=[];E[0]="tornado.gif";E[1]="storm.gif";E[2]="storm.gif";E[3]="rain.gif";E[4]="thunderstorms.gif";E[37]="thunderstorms.gif";E[38]="thunderstorms.gif";E[39]="thunderstorms.gif";E[5]="rain_snow.gif";E[6]="rain_sleet.gif";E[7]="snow_sleet.gif";E[8]="cold.gif";E[9]="rain.gif";E[10]="cold.gif";E[11]="rain.gif";E[12]="rain.gif";E[40]="rain.gif";E[13]="snow.gif";E[14]="snow.gif";E[15]="snow.gif";E[16]="snow.gif";E[17]="hail.gif";E[18]="sleet.gif";E[19]="dust.gif";E[20]="foggy.gif";E[21]="haze.gif";E[22]="smoky.gif";E[23]="windy.gif";E[24]="windy.gif";E[25]="cold.gif";E[26]="cloudy.gif";E[3200]="cloudy.gif";E[27]="mostly_cloudy_night.gif";E[28]="mostly_cloudy_day.gif";E[29]="partly_cloudy_night.gif";E[30]="partly_cloudy_day.gif";E[31]="clear_night.gif";E[32]="clear_day.gif";E[33]="clear_night.gif";E[34]="clear_day.gif";E[35]="rain_hail.gif";E[36]="clear_day.gif";E[41]="heavy_snow.gif";E[43]="heavy_snow.gif";E[42]="medium_snow.gif";E[44]="cloudy.gif";E[45]="storm.gif";E[47]="storm.gif";E[46]="medium_snow.gif";var C="http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D{{++zip++}}&format=json&diagnostics=false&callback=?";var B={zip:"94939",format:A.template('<div class="weather-results"><img class="weathericon" width="25" height="25" alt="${text}" src="${img}"/> ${text} <span class="temp">${deg}&deg;F</span></div>'),imagepath:"/images/offices/weather/"};if(D){A.extend(B,D)}this.each(function(){var F=A(this);A.ajax({type:"GET",url:C.replace("{{++zip++}}",B.zip),dataType:"jsonp",success:function(H,G){F.hide().append(B.format,{text:H.query.results.channel.item.condition.text,deg:H.query.results.channel.item.condition.temp,img:B.imagepath+E[H.query.results.channel.item.condition.code]}).fadeIn()}})});return this}})(jQuery);