/** * @author Paul Chan / KF Software House  * http://www.kfsoft.info * * Version 0.5 * Copyright (c) 2010 KF Software House * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * */	(function($) {    var _options = null;	jQuery.fn.MyGoogleWeather = function(options) {		_options = $.extend({}, $.fn.MyGoogleWeather.defaults, options);		return this.each(function()		{			//load webfont			$("head").append("<link>"); 			css = $("head").children(":last");			css.attr({  				rel: "stylesheet", 				type: "text/css", 				href: "http://fonts.googleapis.com/css?family=" + getFontName(_options.GoogleFontFamily)			});						var o = $(this);			$.ajax({			  url: "weatherProxy.php",			  success: function(data){					var doc = $.parseXML(data);					var $xml = $(doc);					var $current = $xml.find("current_conditions");					var location = $xml.find("forecast_information").find("city").attr("data");										var currentCondition = $current.find("condition").attr("data");					var currentC = $current.find("temp_c").attr("data");					var currentF = $current.find("temp_f").attr("data");					var icon = $current.find("icon").attr("data");					icon = "http://www.google.com/"+ icon;										var template = _options.template;					template = template.replace(/{icon}/g, "<img src=" +icon +" />");										if (_options.bCelsius)						template = template.replace(/{temp}/g, "<span class=temperature>"+ currentC +"&deg;C"+ "</span>");					else						template = template.replace(/{temp}/g, "<span class=temperature>"+ currentF +"&deg;F"+ "</span>");					template = template.replace(/{location}/g, "<span class=location>"+ location + "</span>");					template = template.replace(/{condition}/g, "<span class=condition>"+ currentCondition+ "</span>");										$(o).append(template);					$(o).css("fontFamily", _options.GoogleFontFamily + ",arial, serif");			  },			  error: function(){			  },			  cache:false			  			});		});	}	//default values	jQuery.fn.MyGoogleWeather.defaults = {		GoogleFontFamily: "Oswald",		Location:"Hong Kong",		bCelsius: false,		template: "<TABLE><TR><TD>{location}<BR>{condition}<TD>{icon} <TD>{temp} </TABLE>"	};		function getFontName(str){		return str.replace(/ /g, '+');	}})(jQuery);
