

//lien : http://www.meteofrance.com/FR/mameteo/prevVille.jsp?LIEUID=FR64223

var accuweatherIcons = 
[
	["sun"], 					// 1 Sunny
	["sun"],						// 2 Mostly Sunny
	["partlycloudy"],			// 3 Partly Sunny
	["partlycloudy"],			// 4 Intermittent Clouds
	["sun", "haze"],				// 5 Hazy Sunshine
	["partlycloudy"],			// 6 Mostly Cloudy
	["clouds"],					// 7 Cloudy (am/pm)
	["clouds"],					// 8 Dreary (am/pm)
	null,						// 9 retired
	null,						// 10 retired
	["fog"],						// 11 fog (am/pm)
	["rain"],					// 12 showers (am/pnm)
	["rain&clouds"],				// 13 Mostly Cloudy with Showers
	["rain&sun"],				// 14 Partly Sunny with Showers
	["lightening"],				// 15 Thunderstorms (am/pm)
	["lightening"],				// 16 Mostly Cloudy with Thunder Showers
	["lightening"],				// 17 Partly Sunnty with Thunder Showers
	["rain"],					// 18 Rain (am/pm)
	["flurries"],				// 19 Flurries (am/pm)
	["flurries"],				// 20 Mostly Cloudy with Flurries
	["flurries"],				// 21 Partly Sunny with Flurries
	["snow"],					// 22 Snow (am/pm)
	["snow"],					// 23 Mostly Cloudy with Snow
	["ice"],						// 24 Ice (am/pm)
	["hail"],					// 25 Sleet (am/pm)
	["hail"],					// 26 Freezing Rain (am/pm)
	null,						// 27 retired
	null,						// 28 retired
	["rain&snow"],				// 29 Rain and Snow Mixed (am/pm)
	["sun"],						// 30 Hot (am/pm)
	["sun"],						// 31 Cold (am/pm)
	["wind"],					// 32 Windy (am/pm)
	// Night only Icons
	["moon"],					// 33 Clear
	["moon"],					// 34 Mostly Clear
	["moon", "partlycomboclouds"],// 35 Partly Cloudy
	["moon", "partlycomboclouds"],// 36 Intermittent Clouds
	["moon", "haze"],			// 37 Hazy
	["moon", "partlycomboclouds"],// 38 Mostly Cloudy
	["rain&clouds"],				// 39 Partly Cloudy with Showers
	["rain&clouds"], 			// 40 Mostly Cloudy with Showers
	["lightening"],				// 41 Partly Cloudy with Thunder Showers
	["lightening"],				// 42 Mostly Cloudy with Thunder Showers
	["snow"],					// 43 Mostly Cloudy with Flurries
	["snow"]						// 44 Mostly Cloudy with Flurries
];

var iconTable = new Array;
iconTable['sun'] = {url:'/media/meteo/sun.png', width:135, height:135, voffset:41, hoffset:76};
iconTable['partlycloudy'] = {url:'/media/meteo/partlycloudy.png', width:201, height:135, voffset:41, hoffset:46};
iconTable['haze'] = {url:'/media/meteo/haze.png', width:341, height:123, voffset:50, hoffset:-29};
iconTable['clouds'] = {url:'/media/meteo/cloudy.png', width:138, height:82, voffset:14,hoffset:75};
iconTable['rain'] = {url:'/media/meteo/rain.png', width:115, height:151, voffset:6,hoffset:86};
iconTable['lightening'] = {url:'/media/meteo/lightening.png', width:151, height:110, voffset:28, hoffset:69};
iconTable['snow'] = {url:'/media/meteo/snow.png', width:264, height:139, voffset:84, hoffset:11};
iconTable['hail'] = {url:'/media/meteo/hail.png', width:264, height:166, voffset:146, hoffset:15};
iconTable['moon'] = {url:'/media/meteo/moon.png', moon:true, width:65, height:68, voffset:0,hoffset:110};
iconTable['flurries'] = {url:'/media/meteo/flurries.png', width:227, height:155, voffset:78, hoffset:30};
iconTable['fog'] = {url:'/media/meteo/fog.png', width:352, height:87, voffset:1, hoffset:-31};
iconTable['ice'] = {url:'/media/meteo/ice.png', width:126, height:72, voffset:5, hoffset:77};
iconTable['partlycomboclouds'] = {url:'/media/meteo/partlycomboclouds.png', width:201, height:57, voffset:4, hoffset:50};
iconTable['rain&clouds'] = {url:'/media/meteo/rain&clouds.png', width:201, height:131, voffset:27, hoffset:45};
iconTable['rain&sun'] = {url:'/media/meteo/rain&sun.png', width:134, height:168, voffset:37, hoffset:76};
iconTable['rain&snow'] = {url:'/media/meteo/rain&snow.png', width:227, height:214, voffset:61, hoffset:30};
iconTable['wind'] = {url:'/media/meteo/wind000.png', width:365, height:161, voffset:49, hoffset:-58, animate:true};

var MoonMap=[1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24];

var meteoReq=httpRequest();

function getMeteo(){
	meteoReq.abort();
	meteoReq.onreadystatechange=meteoReady;
	//meteoReq.overrideMimeType("text/xml");
	meteoReq.open("GET", 'xml/meteo_proxy.php?'+Math.random());
	meteoReq.setRequestHeader("Cache-Control", "no-cache");
	meteoReq.send(null);
}

function meteoReady(){
	if(meteoReq.readyState==4)
        if(meteoReq.status==200){
			document.getElementById('meteoTemp').innerHTML=Math.round((meteoReq.responseXML.getElementsByTagName('Temperature')[0].firstChild.data-32)/1.8)+'°';
			var iconNb=parseInt(meteoReq.responseXML.getElementsByTagName('WeatherIcon')[0].firstChild.data);
			if(accuweatherIcons[iconNb-1].length==1){
				document.getElementById('meteoPanel').style.background="url(media/meteo/"+accuweatherIcons[iconNb-1]+".png) no-repeat center";
				document.getElementById('meteoIcon').style.display='none';
			}else{
				document.getElementById('meteoPanel').style.background="url(media/meteo/"+accuweatherIcons[iconNb-1][0]+".png) no-repeat center";
				document.getElementById('meteoIcon').src='media/meteo/'+accuweatherIcons[iconNb-1][1]+'.png';
			}
			setTimeout(getMeteo, 120000);
		}
}
/*        	if(mainReq.responseXML.getElementsByTagName('msg')[0].firstChild.data.length>0){
        		document.title=mainReq.responseXML.getElementsByTagName('msg')[0].firstChild.data;
				document.getElementById('msgBox').innerHTML=mainReq.responseXML.getElementsByTagName('msg')[0].firstChild.data;
				if(mainReq.responseXML.getElementsByTagName('rez')[0].firstChild.data==1){
					document.getElementById('btnSend').href='index.php';
					document.getElementById('btnSend').innerHTML='Merci';
				}else{
					document.getElementById('btnSend').href='javascript:sendThisArticle()';
					document.getElementById('btnSend').innerHTML='Envoyer';
				}
				window.setTimeout( function(){ document.title=document.originalTitle }, 3000);
			}
}*/