
function trim(s)
{
 return (""+s=="") ? "" : s.replace(/^\s+/, "").replace(/\s+$/, "");
}

function email_valid(s)
{
	var er = /^[a-z0-9._\-]+[@][a-z0-9._\-]+[.][a-z0-9._\-]+$/i
	return (""+s=="") ? false : er.test(s);
}

function word_valid(s)
{
	var er = /^([zrtpqsdfghjklmwxcvbnç0-9 ]+)|(([aeiouyéèàù0-9 ]+))$/i
	return (""+s=="") ? true : er.test(s);
}

function set_class(obj,cls)
{
	if(obj!=undefined && ""+cls!="") obj.className = cls;
}

function zelflink(uld, cib)
{
	var l = "";
	var rg = new RegExp("\\|","g");
	var rgd = new RegExp("@","g");
	l = uld.replace(rg,"/").replace(rgd,".");
	if (l.charAt(0)=="#")
	{
		l = l.substring(1,l.length);
	}
	if (cib == "target=_blank" || cib == "_blank" )
	{
		window.open(l);
	}
	else
	{
		window.location.href=l;
	}
}

function popup_perdu()
{
	var whlost = window.open ('', "popuplost", "width=300,height=200,resizable=0,scrollbars=0,top=100,left=100");
	whlost.focus();
}

function popup (url)
{
	var popup = window.open (url, 'popup', 'width=300,height=200,resizable=1,scrollbars=auto,top=100,left=100');
}