addOnload(survolInit);
addOnload(newWinLinks);

function addOnload(newFunction) {
		var oldOnload = window.onload;
		
		if (typeof oldOnload == "function") {
			window.onload = function () {
					if (oldOnload) {
						oldOnload();
					}
					newFunction ();
			}
		}
		else {
			window.onload = newFunction;
		}
	}

/******************************SurvolInit*********************************/

function survolInit() {
	for (var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A") {
			setupSurvol(document.images[i]);
		}
	}
}

function setupSurvol(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = dehors;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/boutons/" + thisImage.id + "_on.jpg";
	thisImage.onmouseover = dessus;	
}

function dessus() {
	this.src = this.overImage.src;
}

function dehors() {
	this.src = this.outImage.src;
}

/**************************************NewWinLinks****************************************/

function newWinLinks () {
	for (var i=0; i<document.links.length; i++) {
		if (document.links[i].className=="newWin"){
			document.links[i].onclick = newWindow;
		}
	}
}

function newWindow(){
	var videoWindow = window.open(this.href, "newWin", "resizable=no,width=680, height=600" );
	videoWindow.focus();
	return false;
}
