
var jQuerylang = "FR";

var jQueryxmlFile = [];
jQueryxmlFile["FR"] = "/map-xml.php?file=http://www.skiplan.com/php/genererXml.php?station=crans-montana,region=alpes,pays=suisse,lang=fr";
jQueryxmlFile["DE"] = "/map-xml.php?file=http://www.skiplan.com/php/genererXml.php?station=crans-montana,region=alpes,pays=suisse,lang=de";
jQueryxmlFile["IT"] = "/map-xml.php?file=http://www.skiplan.com/php/genererXml.php?station=crans-montana,region=alpes,pays=suisse,lang=it";


jQuery(document).ready(function(){
	jQuery.ajax({
		type: "GET",
		url: jQueryxmlFile[jQuerylang],
		dataType: "xml",
		success: function(xml){
			
			var station = "station";
			
			jQuery(xml).find("METEO ZONE").each(function(){
		
				if( jQuery(this).attr("nom").toLowerCase()  == station.toLowerCase() ){

					// DEFINITION DU TEMPLATE
					var content  = jQuery(".meteo").html();
						
						// REMPLACEMENT DES VALEURS
						content = content.replace("#nom#", jQuery(this).attr("nom"));
						content = content.replace("#altitude#", jQuery(this).attr("altitude"));
						content = content.replace("#CIEL#", jQuery(this).find("CIEL").contents().empty().end().text().toLowerCase());
						content = content.replace("#CIEL_ID#", jQuery(this).find("CIEL_ID").contents().empty().end().text());
						content = content.replace("#TEMPERATURE#", jQuery(this).find("TEMPERATURE").contents().empty().end().text());
						content = content.replace("#TEMPERATURE_APM#", jQuery(this).find("TEMPERATURE_APM").contents().empty().end().text());	
											
						jQuery(".meteo").html(content);
						
						return true;
						
					}
					
			});	
		}
	});
});
