(function($){
     $.fn.extend({
	 
        putWeather: function(options) {
			
		   var defaults = { 
				url:"php/get_weather.php",
				location:"",
				lang:"en",
				temp:"c",
				text_today:"",
				text_weather_in:"",
				dir:""
		   };		   
		   
		   var final_options = {};
		   
			$.each(defaults, function(key, value) { 
				final_options[key] = (options[key])?options[key]:value;
			});		   
		   //-----------------------------------
			
            this.each(function(){
				var t = this;
				
				//call ajax to get weather
				$(document).ready(function() {
					$.ajax({
					      url: final_options["url"],
					      global: false,
					      type: "POST",
					      data:(final_options),
					      dataType: "html",
					      async:true,
					      success: function(response){							
					         $(t).html(response);
					      }
					   }
					);
				 });
            });
        }
     });
})(jQuery); 		

