/* *** Fix IE6 background image flicker *** */
if(/MSIE (6)/.test(navigator.userAgent)) {
	try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) { }
}

// Validation formulaires
function verifemail(email) {
	var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
  return pattern.test(email);
}

function verifheure(heure) {
	var pattern = /^((([01][0-9])|(2[0-3]))[:]([0-5][0-9]))$/;
  return pattern.test(heure);
}

function verifjour(jour) { // Format jj/mm/aaaa
	var reponse = /^((0[1-9])|([12][0-9])|(3[0-1]))[/]((0[1-9])|(1[0-2]))[/]((200[1-9])|(201[0-9]))$/;
	if(!reponse.test(jour)){
		alert("Format incorrect pour la date !\nVous devez respecter le format suivant : 'jj/mm/aaaa'");
		return false;
	} else {
		return true;
	}
}

function verifperiod(period) { // Format mm/aaaa
	var pattern = /^((0[1-9])|(1[0-2]))[/]((200[1-9])|(201[0-9]))$/;
	return pattern.test(period);
}

// TODO: supprimer quand la fonction enlarge_picture() aura été remaniée à la sauce Mootools... !!!!!!!!!!
function getClientHeight() {
	var hauteur = 0;
	if(typeof(window.innerWidth) == 'number' ) {
  	hauteur = window.innerHeight;
  } else if(document.documentElement && document.documentElement.clientHeight) {
  	hauteur = document.documentElement.clientHeight;
  } else if(document.body && document.body.clientHeight) {
  	hauteur = document.body.clientHeight;
  }
  return hauteur;
}

function chatPopup(login, pwd) {
	var w_width		= 700;
	var w_height 	= 500;
	
	var w_left 	= (screen.width - w_width)/2;
	var w_top 	= (screen.height - w_height)/2;
	
	var props = 'toolbar=no, location=no, status=no, scrollbars=no, menubar=no, resizable=yes, copyhistory=no, width=' + w_width + ', height=' + w_height + ', left='+ w_left +', top='+ w_top;
	
	var chat_url = "../chat/index.php?userName=" + login + "&password=" + pwd;
	
	popupWin = window.open(chat_url, 'IACCCA Chat', props);
	popupWin.focus();
}