(function($){
	$.fn.getWeather = function(options) {
		var defaults = {};
		
		var options = $.extend(defaults, options);
		
		return this.each(function() {
			var $obj = $(this);
			$.ajax({
				type: "GET",
				url: "/script/weather.asp",
				dataType: "xml",
				complete: function(xml) {
				    
				    var json = $.xmlToJSON(xml.responseXML);
				    var code = json.channel[0].item[0].condition[0].code;
				    var tempf = json.channel[0].item[0].condition[0].temp;
				    var tempc = parseInt((tempf-32)* 5/9);

					var $weather = $(document.createElement("div"))
									.html("<div><img src='/images/home/"+code+".png' border='0' width='22' height='18' /></div><div><a href='http://weather.yahooapis.com/forecastrss?p=93023' target='_blank'>" + tempf+"&deg; F ("+tempc+"&deg; C)</a></div>");
									
					$obj.append($weather); 				    
				},
				error: function(request,tStatus,eThrown){
					$.log("Error loading XML: "+eThrown);
				}
			});
			
			

		});
	};
})(jQuery);
