
// fonction ajouter photo...

function OpenCenterPopUp(file){
var Left=window.screen.width/2-175;
var Top=window.screen.height/2-175;
//Videment faut modifier la config!!
var Configuration="'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=400, height=350, left=" + Left + ", top=" + Top;
window.open(file,'NomDeMaPopUp',Configuration);
} 

// fonction afficher la photo...

 
function NoModif() { 
  clearInterval(rcv1);
  alert('Champ photo !!!! Vous ne devez ni modifier ni écrire. Pour ajouter une photo cliquez sur l\'icone à droite'); 
  }

function refreshImg(nom,fich,id2,id3){
     document.getElementById(nom).src = 'upload/'+ document.getElementById(fich).value;
            document.getElementById(id2).innerHTML ="<strong>Photo ajoutée : </strong>";
            document.getElementById(id3).innerHTML ="<strong>Réussi : </strong>";
            setTimeout(function() { document.getElementById(id2).click(); }, 500);
   }

  
  
function demarrer(id1) {
   if (id1 != "") {
        rcv1 = setInterval(function () {
        document.getElementById(id1).select();
        }, 3000);
    }  }
  
  // VERIFICATION DU FORMULAIRE
  

function couleur(obj) {
obj.style.backgroundColor = "#FFFFFF";
}

function check() {
var msg = "";


if (document.post.id_sous_categories.value == "") {
msg += "Veuillez indiquer votre village\n";
document.post.id_sous_categories.style.backgroundColor = "#F3C200";
}
else
    {
document.post.id_sous_categories.style.backgroundColor = "#FEEB90";
    }
    
if (document.post.id_rubriques.value == "") {
msg += "Veuillez choisir une rubrique\n";
document.post.id_rubriques.style.backgroundColor = "#F3C200";
}
else
    {
document.post.id_rubriques.style.backgroundColor = "#FEEB90";
    }
    
if (document.post.nom.value != "") {
Mot1 = document.post.nom.value.indexOf('donne');
Mot2 = document.post.nom.value.indexOf('Donne');
Mot3 = document.post.nom.value.indexOf('don');
Mot4 = document.post.nom.value.indexOf('Don');
Mot5 = document.post.nom.value.indexOf('Offre');
Mot6 = document.post.nom.value.indexOf('Offres');
Mot7 = document.post.nom.value.indexOf('argent');
Mot8 = document.post.nom.value.indexOf('Argent');
Mot9 = document.post.nom.value.indexOf('medium');
Mot10 = document.post.nom.value.indexOf('Medium');
Mot11 = document.post.nom.value.indexOf('médium');
Mot12 = document.post.nom.value.indexOf('Médium');
Mot13 = document.post.nom.value.indexOf('pret');
Mot14 = document.post.nom.value.indexOf('Pret');
Mot15 = document.post.nom.value.indexOf('prêt');
Mot16 = document.post.nom.value.indexOf('Prêt');
Mot17 = document.post.nom.value.indexOf('gratuit');
Mot18 = document.post.nom.value.indexOf('d\'argent');
Mot19 = document.post.nom.value.indexOf('financier');
if ((Mot1 < 0) && (Mot2 < 0) && (Mot3 < 0) && (Mot4 < 0) && (Mot5 < 0) && (Mot6 < 0) && (Mot7 < 0) && (Mot8 < 0) && (Mot9 < 0) && (Mot10 < 0) && (Mot11 < 0) && (Mot12 < 0) && (Mot13 < 0) && (Mot14 < 0) && (Mot15 < 0) && (Mot16 < 0) && (Mot17 < 0) && (Mot18 < 0) && (Mot19 < 0)) {
document.post.nom.style.border='1px solid #29cf48';
}
else
    { 
document.post.nom.style.border='1px solid #FF3300';
msg += "Il y a des mots interdits dans le titre de votre annonce.\n";
document.post.nom.value = "";
document.post.nom.focus();

    }
}
    
if (document.post.nom.value == "") {
msg += "Veuillez saisir un titre pour votre annonce\n";
document.post.nom.style.border='1px solid #FF3300';
document.post.nom.focus();
}
else
    {
document.post.nom.style.border='1px solid #29cf48';
    }
    
if (document.post.description.value != "") {
Mot1 = document.post.description.value.indexOf('@');
if ((Mot1 < 0) ) {
document.post.description.style.border='1px solid #29cf48';
}
else
{ 
document.post.description.style.border='1px solid #FF3300';
msg += "Pour votre sécurité il n'est pas autorisé de publier votre adresse email, Effacez la avant de re-valider votre annonce. \n";
document.post.description.focus();
}
}
    
if (document.post.description.value != "") {
Mot1 = document.post.description.value.indexOf('donne');
Mot2 = document.post.description.value.indexOf('Donne');
Mot3 = document.post.description.value.indexOf('don');
Mot4 = document.post.description.value.indexOf('Don');
Mot5 = document.post.description.value.indexOf('Offre');
Mot6 = document.post.description.value.indexOf('Offres');
Mot7 = document.post.description.value.indexOf('argent');
Mot8 = document.post.description.value.indexOf('Argent');
Mot9 = document.post.description.value.indexOf('medium');
Mot10 = document.post.description.value.indexOf('Medium');
Mot11 = document.post.description.value.indexOf('médium');
Mot12 = document.post.description.value.indexOf('Médium');
Mot13 = document.post.description.value.indexOf('pret');
Mot14 = document.post.description.value.indexOf('Pret');
Mot15 = document.post.description.value.indexOf('prêt');
Mot16 = document.post.description.value.indexOf('Prêt');
Mot17 = document.post.description.value.indexOf('gratuit');
Mot18 = document.post.description.value.indexOf('d\'argent');
Mot19 = document.post.description.value.indexOf('financier');
if ((Mot1 < 0) && (Mot2 < 0) && (Mot3 < 0) && (Mot4 < 0) && (Mot5 < 0) && (Mot6 < 0) && (Mot7 < 0) && (Mot8 < 0) && (Mot9 < 0) && (Mot10 < 0) && (Mot11 < 0) && (Mot12 < 0) && (Mot13 < 0) && (Mot14 < 0) && (Mot15 < 0) && (Mot16 < 0) && (Mot17 < 0) && (Mot18 < 0) && (Mot19 < 0)) {
document.post.description.style.border='1px solid #29cf48';
}
else
    { 
document.post.description.style.border='1px solid #FF3300';
msg += "Il y a des mots interdits dans le texte de votre annonce.\n";
document.post.description.value = "";
document.post.description.focus();

    }
}
    
if (document.post.description.value == "") {
msg += "Veuillez saisir le texte de votre annonce\n";
document.post.description.style.border='1px solid #FF3300';
document.post.description.focus();
}
else
    {
document.post.description.style.border='1px solid #29cf48';
    }

if (document.post.auteur.value == "") {
msg += "Veuillez saisir votre nom\n";
document.post.auteur.style.border='1px solid #FF3300';
document.post.auteur.focus();
}
else
    {
document.post.auteur.style.border='1px solid #29cf48';
    }
    
if (document.post.email2.value != "") {
indexAroba = document.post.email2.value.indexOf('@');
indexPoint = document.post.email2.value.indexOf('.');
if ((indexAroba < 0) || (indexPoint < 0)) {
document.post.email2.style.border='1px solid #FF3300';
msg += "Adresse email incorrecte\n";
document.post.email2.focus();
}
else
    {
document.post.email2.style.border='1px solid #29cf48';
    }
}
else {
document.post.email2.style.border='1px solid #FF3300';
msg += "Veuillez saisir votre adresse email.\n";
document.post.email2.focus();
}

if (document.post.code_postal.value == "") {
msg += "Veuillez saisir votre code postal\n";
document.post.code_postal.style.border='1px solid #FF3300';
document.post.code_postal.focus();
}
else
    {
document.post.code_postal.style.border='1px solid #29cf48';
    }
    
if(document.post.telephone2.value == "") {
alert("Veuillez saisir votre numéro de téléphone!");
document.post.telephone2.style.border='1px solid #FF3300';
document.post.telephone2.focus();
return false;
}
var chkZ = 1;
for(i=0;i<document.post.telephone2.value.length;++i)
if(document.post.telephone2.value.charAt(i) < "0"
|| document.post.telephone2.value.charAt(i) > "9")
if(document.post.telephone2.value.charAt(i) > " ")
if(document.post.telephone2.value.charAt(i) > ".")
if(document.post.telephone2.value.charAt(i) > "/")
chkZ = -1;
if(chkZ == -1) {
alert("Votre numéro de téléphone est invalide!");
document.post.telephone2.style.border='1px solid #FF3300';
document.post.telephone2.value = "";
document.post.telephone2.focus();
return false;
}
else
    {
document.post.telephone2.style.border='1px solid #29cf48';
    }
    

if (msg == "") return(true);
else {
alert(msg);
return(false);
}
}

// INTERDIT DE COPIER COLLER

function ejs_nodroit()
{
alert('Copier/Coller interdit');
return(false);
}
document.oncontextmenu = ejs_nodroit;


