  // Popup Photo
  function PopPreview(Title, FirstName, LastName, Country, IdGroupe, Message)
  {
    // On verifie que les champs obligatoires sont bien remplis
	if(Title!=0 && FirstName!="" && LastName!="" && Country!=0 && IdGroupe!=0 && Message!="")
	{
		var haut=(screen.height-300)/2;
    	var gauche=(screen.width-620)/2;
		
		Message = Message.replace("\r\n","<br>"); 
		Message = Message.replace("\n","<br>"); 
		Message = Message.replace("\r","<br>");
		
    	poppreview=window.open('messages-preview.php?Title='+Title+'&FirstName='+FirstName+'&LastName='+LastName+'&Country='+Country+'&IdGroupe='+IdGroupe+'&Message='+Message+'','poppreview','top='+haut+',left='+gauche+',toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width=638, height=300');
    	if (poppreview.blur) poppreview.focus();
	}
	else
	{
		alert('All field labelled * are mandatory');
	}
  }
  
  // Maximum mot annonce
  function Compter(Target, max, nomchamp)
  {
    StrLen = Target.value.length
    if (StrLen > max )
    {
      Target.value = Target.value.substring(0,max);
      CharsLeft = max;		
	  
	  alert('Your ad has more than 1000 characters. You must abbreviate it and add an attachment if you want');
    }
    else
    {
      CharsLeft = StrLen;
    }	
    nomchamp.innerHTML = "Write your ad (Fill-in the form below, "+CharsLeft+"/"+max+" characters allowed)";
  }
  
  // Rafraichis l'affichage des log d'envois du mailing
  function GetLogContent(fichier)
  {
	setTimeout('getLog.window.location = ("'+fichier+'");',1000);
  }

