
function isEmpty(str) {
	return (str == null) || (str.length == 0);
}

function isemail(str) {
	if (isEmpty(str)) return false;
	var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
	return re.test(str);
}

function Confirmer(message) {
	// pose une question au visiteur
	if (confirm(message)) {
		return true;
	} else {	
		return false;
	}
} 
function confirmer_Suppression(chemin,message) {
	// pose une question au visiteur
	if (confirm(message)) {
		document.location=chemin;
	}
}

// detect browser type
var dom = (document.getElementById) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;

// submit the form
function submitForm(theformname, theaction) {
	if (document.forms[theformname]) {
		document.forms[theformname].act.value = theaction;
		document.forms[theformname].submit();
	}
}

// open the link in a new window
// return false if the popup is shown, true otherwise
function openWindow(oLink, name, width, height, params) {
	var all_params = '';
	all_params += 'width=' + width + ',height=' + height;
	if (params && params!='') all_params += ','+params;
	// all is ready, open the popup and focus on it
	var oPopup = window.open(oLink, (name && name!='' ? name : 'hdlpPopup'), all_params);
	if (oPopup) oPopup.focus();
	return (oPopup?false:true);
}

// open the link in a new window
function openNews(oLink) {
	return openWindow(oLink, 'hdlpPopupNews', 500, 500, 'directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes');
}