/* ouverture de fenêtre */
function openWindow(url, name, w, h, r, s, m, left, top) {
	popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ',resizable=' + r + s + ',menubar=' + m + ',left=' + left + ',top=' + top);
}
// parameters available:
//      resizable (r),  location (l), directories (d), menubar (m)
//      status (st), toolbar (t), scrollbars (s), copyhistory (c)
/* fin de : ouverture de fenêtre */

/* swap menus */
if (document.images){
	var menu1 = new Image();
	menu1.src = "/images/index/";
	var menu1_over = new Image();
	menu1_over.src = "/images/index/";
}

/* pour tous les swap 
attendue : nom de l image && nom de l image par defaut (qui restera OVER) */
function swapOver(imgName, defautImgName){
	if (document.images && defautImgName != imgName){
		document.images[imgIndex].src = eval(imgName + '_over.src');
	}
}
function swapOut(imgName, defautImgName){
	if (document.images && defautImgName != imgName){
		document.images[imgIndex].src = eval(imgName + '.src');
	}
}

/* champs date des formulaires */
function customDateInput (inputName) {
	var inputElement = $$('input[name=' + inputName + ']');
	inputValue = inputElement[0].readAttribute('value');
	if (!inputValue) {
		var oDate = new Date();
		if (oDate.getDate() <= 9) {
			inputValue = '0' + oDate.getDate();
		} else {
			inputValue = oDate.getDate();
		}
		if (oDate.getMonth() <= 9) {
			inputValue += '-0' + oDate.getMonth();
		} else {
			inputValue += '-' + oDate.getMonth();
		}
		inputValue += '-' + oDate.getFullYear();
	}
	inputElement[0].writeAttribute('value', inputValue);
	DateInput(inputName, true, 'DD-MM-YYYY', inputValue);
}
