function nPopup(l,h,url) {
	hauteur=Math.round((screen.availHeight-h)/2);
	largeur=Math.round((screen.availWidth-l)/2);
	window.open(url, "site", "toolbar=no, scrollbars=yes, location=no, statusbar=no, menubar=no, resizable=no, top="+hauteur+",left="+largeur+",width="+l+",height="+h);
}
function popupCentre(url,nom,largeur,hauteur)
{
	var haut=(screen.height-hauteur)/2;
	var gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur+",resizable=no, scrollbar=no, menubar=no, status=no, toolbar=no, location=no");
}

function validateTell(oDoc)
{
	var errors = new Array;
	
	if(!VerifEmail('emailSelf')) {errors.push("Please insert your valid email adress");}
	if(document.getElementById("nameSelf").value==""){errors.push("Please insert your name");}
	if(!VerifEmail('emailFriend')) {errors.push("Please insert your valid friend's email adress");}
	if(document.getElementById("nameFriend").value==""){errors.push("Please insert your friend's name");}	
		
	if(errors.length>0){
		var message="";
		for (i=0; i<errors.length; i++){
			message += errors[i] + "\n";
		}
		alert(message);
		return false;
	}else{
		return true;	
	}
}
function validateTellFr(oDoc)
{
	var errors = new Array;
	
	if(!VerifEmail('emailSelf')) {errors.push("Veuillez inscrire votre adresse courriel");}
	if(document.getElementById("nameSelf").value==""){errors.push("Veuillez inscrire votre nom");}
	if(!VerifEmail('emailFriend')) {errors.push("Veuillez inscrire l'adresse courriel de votre ami(e)");}
	if(document.getElementById("nameFriend").value==""){errors.push("Veuillez inscrire le nom de votre ami(e)");}	
		
	if(errors.length>0){
		var message="";
		for (i=0; i<errors.length; i++){
			message += errors[i] + "\n";
		}
		alert(message);
		return false;
	}else{
		return true;	
	}
}

function VerifEmail(cible)
{
	adresse = document.getElementById(cible).value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
	{
		//alert("mail bon");
		return(true);
	}
	else
	{
		//alert('Entrez une adresse e-mail valide!!');
		return(false);
	}
}