sfHover = function() {
	var oNav = document.getElementById("nav");
	if (!oNav) return;
	var sfEls = oNav.getElementsByTagName("LI");

	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" over";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}
if (window.attachEvent) { window.attachEvent("onload", sfHover); }

function make_links() {
	var liens = document.getElementsByTagName('a');
	for (var i = 0 ; i < liens.length ; ++i)  {
		if (liens[i].className == 'lien_ext')  {
			//liens[i].title = 'S\'ouvre dans une nouvelle fenêtre';
			liens[i].onclick = function()  {
				window.open(this.href);
				return false;
			};
		}
		else if (liens[i].className == 'lien_pop')  {
			liens[i].onclick = function()  {
				window.open(this.href, '', 'width=420, height=600, resizable=yes, scrollbars=yes');
				return false;
			};
		}
		else if (liens[i].className == 'curMonth')  {
			var tmp = liens[i].href.split("/");
			var file = tmp[tmp.length-1];
			if (file == "janvier.html") {
				var newaddr = "";
				newaddr = liens[i].href.replace(file, getCurMon() + ".html");
				liens[i].href = newaddr;
			}
		}
	}
}

function getCurMon() {
	maintenant = new Date();
	moisactuel = maintenant.getMonth();
	var mois = new Array("janvier","fevrier","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","decembre");
	return mois[moisactuel];
}

var isIE = false;
var req;
function loadXMLDoc(url) {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	} else if (window.ActiveXObject) {
		isIE = true;
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChange() {
	if (req.readyState == 4) {
		if (req.status == 200) {
			paris = req.responseXML.getElementsByTagName("paris");
			for (var i = 0; i < paris[0].childNodes.length; i++) {
				if (paris[0].childNodes[i].nodeType == 1) {
					var amodif = document.getElementById(paris[0].childNodes[i].nodeName);
					if (amodif != null) {
						amodif.innerHTML = paris[0].childNodes[i].childNodes[0].nodeValue;
					}
				}
			}
		}
	}
}

function loadDoc(xmldoc) {
	try {
		loadXMLDoc(xmldoc);
	}
	catch(e) {
		return;
	}
}

function initialisation() {
	if (typeof(loadStationData) == 'undefined')
		loadDoc('http://'+ window.location.hostname +'/ile-de-france/station-meteo-paris/station-data.php');
}

// $(document).ready(function(){ initialisation() });
window.onload = function () {
	make_links();
}