
// show element
function show(id) {
	if (ns4) {
		if (document.layers[id]) {
			document.layers[id].visibility = "show";
			document.layers[id].display = "block";
		}
	} else if (ie4) {
		if (document.all[id]) {
			document.all[id].style.visibility = "visible";
			document.all[id].style.display = "block";
		}
	} else if (dom) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.visibility = "visible";
			document.getElementById(id).style.display = "block";
		}
	}
}

// hide element
function hide(id) {
	if (ns4) {
		if (document.layers[id]) {
			document.layers[id].visibility = "hide";
			document.layers[id].display = "none";
		}
	} else if (ie4) {
		if (document.all[id]) {
			document.all[id].style.visibility = "hidden";
			document.all[id].style.display = "none";
		}
	} else if (dom) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.visibility = "hidden";
			document.getElementById(id).style.display = "none";
		}
	}
}

// hide multiple div, beginning with 'pre' as prefix and a number
function hideMulti(pre, start, end) {
	var s, i;
	for (i=start; i<=end; i++) {
		s = pre+''+i;
		hide(s);
	}
}

// show a div if it is visible, hide it if it is hidden
function toggle(id) {
	if (ns4) {
		if (document.layers[id]) {
			if (document.layers[id].visibility == "hide" || document.layers[id].display == "none")
				show(id);
			else
				hide(id);
		}
	} else if (ie4) {
		if (document.all[id]) {
			if (document.all[id].style.visibility == "hidden" || document.all[id].style.display == "none")
				show(id);
			else
				hide(id);
		}
	} else if (dom) {
		if (document.getElementById(id)) {
			if (document.getElementById(id).style.visibility == "hidden" || document.getElementById(id).style.display == "none")
				show(id);
			else
				hide(id);
		}
	}
}


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;
	}
}

// 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);
}
function openNews(oLink) {
	return openWindow(oLink, 'hdlpPopupNews', 500, 500, 'directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes');
}


