
/**
 * check if the url has the correct form
 * val		: url
 **/
function check_url(val) {
	return (val.length>14 && val.indexOf("http://")!=-1);
	}	

/**
 * check if the email has the correct form
 * val		: email
 **/
function check_email(val) {
 	reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)(\\@)([a-zA-Z0-9\\-\\.]+)(\\.)([a-zA-Z]{2,4})$');
	return reg.test(val);
	}

/**
 * check if the date has the correct form
 * val		: date
 **/
function check_date(val) {
 	reg = new RegExp('^([0-9]{2})(\\.)([0-9]{2})(\\.)([0-9]{4})$');
	return reg.test(val);
	}

/**
 * confirm deletion box
 * id		: id of the row to delete
 **/
function del(id) {
	if(confirm("Etes-vous sûr de vouloir supprimer cette entrée ?"))
		location.href = '?cmd=del&id='+id;
	}

/**
 * show a pop up windows
 * pg		: page name
 * w		: width
 * h		: height
 **/
function show(pg,w,h,s) {
	s = (s!=null ? 1 : 0);
	r=window.open(pg,"pop","width="+w+",height="+h+",menubar=0,status=0,location=0,scrollbars="+s);
	r.focus();
	}

/**
 * show a pop up windows for link
 * pg		: page name
 **/
function showlink(pg) {
	r=window.open(pg,"out");
	r.focus();
	}
/**
 * show a pop up windows for link and trace it for top3
 * pg		: page name
 **/
function showlinktop(pg) {
	r=window.open("redirect.php?url="+escape(pg),"out");
	r.focus();
	}