function addslashes( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ates Goral (http://magnetiq.com)
    // +   improved by: marrtins
    // +   improved by: Nate
    // +   improved by: Onno Marsman
    // *     example 1: addslashes("kevin's birthday");
    // *     returns 1: 'kevin\'s birthday'
 
    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}

function showMeteoBox(theLanguage,theLocation){
	encodedLocation = theLocation.replace(/ /g,'-');
	encodedLocation = encodeURI(encodedLocation);
	meteoContent = '';
	jQuery.ajax({
			type: "GET",
			url: "/weather.php?lang="+theLanguage+'&location='+encodedLocation,
			dataType: "xml",
			cache: false,
			success: function(xml) {
				jQuery(xml).find('forecast_information').each(function(){
					jQuery(this).children().each(function(){
						eval('weather_fi_'+this.tagName+'=\''+addslashes(jQuery(this).attr('data'))+'\';');
					});
				});

				iteration = 1;
				jQuery(xml).find('forecast_conditions').each(function(){
					jQuery(this).children().each(function(){
						eval('weather_fc'+iteration+'_'+this.tagName+'=\''+addslashes(jQuery(this).attr('data'))+'\';');
					});
					iteration++;
				});
				
				meteoContent = '<table class="meteoTable"><tr><td>'+weather_fc1_day_of_week+'</td><td style="width:3px">&nbsp</td><td>'+weather_fc2_day_of_week+'</td><td style="width:3px">&nbsp</td><td>'+weather_fc3_day_of_week+'</td></tr>';
				meteoContent += '<tr><td><img src="http://www.google.com/'+weather_fc1_icon+'" /></td><td style="width:3px">&nbsp</td><td><img src="http://www.google.com/'+weather_fc2_icon+'" /></td><td style="width:3px">&nbsp</td><td><img src="http://www.google.com/'+weather_fc3_icon+'" /></td></tr>';
				meteoContent += '<tr><td>'+weather_fc1_low+'&deg; | '+weather_fc1_high+'&deg;</td><td style="width:3px">&nbsp</td><td>'+weather_fc2_low+'&deg; | '+weather_fc2_high+'&deg;</td><td style="width:3px">&nbsp</td><td>'+weather_fc3_low+'&deg; | '+weather_fc3_high+'&deg;</td></tr></table>';
				jQuery('#meteoBox').html(meteoContent);
				jQuery('#meteoLocation').html(theLocation);
			}});
}