// JavaScript Document

var coche=0;
	
function getXMLHTTP(){
  var xhr=null;
  if(window.XMLHttpRequest) // Firefox et autres
  xhr = new XMLHttpRequest();
  else if(window.ActiveXObject){ // Internet Explorer
    try {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e1) {
        xhr = null;
      }
    }
  }
  else { // XMLHttpRequest non supporté par le navigateur
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
  }
  return xhr;
}

function convertFromHTML(the_string) {
    createTextField("converter_txt", getNextHighestDepth(), 0, 0, 0, 0);
    converter_txt.html = true;
    converter_txt.htmlText = the_string;
 
    // store the text so it doesn't get lost when we remove the
    // text field
    var txt = converter_txt.text; 
    converter_txt.removeTextField(); // clean up
    return txt;
}

function errMsg(lay,err)
	{
		var c = document.getElementById(lay);
                	if (c)
                	{	
                	//var txt = document.createTextNode(err);
                	//c.firstChild.deleteData(0,txt.nodeValue.length);
                	//var nouveau = document.createElement("p");
                	//var p = document.createAttribute("display");
                	//disp.nodeValue = "block";
                	if (document.getElementById || document.all)
                	{
                		c.style.display="block";
                	}else{
                		alert('Votre navigateur est trop ancien pour utiliser certaines fonctionnalités du site...');
                	}
                	//c.firstChild.appendData(txt.nodeValue);
                	//c.firstChild.nodeValue = err;
                	
		document.getElementById(lay).innerHTML=err;
		//document.getElementById(lay).style.display='block';
                	}
	}
	
function inMsg(lay,err)
	{
		var c = document.getElementById(lay);
                		
                	if (document.getElementById)
                	{
                		c.innerHTML=err;
                	}else{
                		alert('Votre navigateur est trop ancien pour utiliser certaines fonctionnalités du site...');
                	}
 	}
	
function razMsg(t,nbc) 
	{
		
		for (i=0;i<=nbc;i++){
		
               	if (document.all)
                	document.getElementById(t+i).style.display="none"; else document.getElementById(t+i).setAttribute("style","display:none");

                	//document.getElementById(t+i).firstChild.nodeValue='';
		document.getElementById(t+i).innerHTML='';
		//document.getElementById(t+i).style.display='none';


		}
	}
	
function Traz(t) 
	{
		if (c=document.getElementById(t))
		{
               	if (document.all)
                	c.style.display="none"; else c.setAttribute("style","display:none");
		}
	}
	
function Tactive(t) 
	{
		
		if (c=document.getElementById(t))
		{
               	if (document.all)
                	c.style.display="block"; else c.setAttribute("style","display:block");
		}
		if (t=='MessTchat') document.getElementById('FenChat').scrollTop=100000;
		if (t=='Messages') document.getElementById('FenChat').scrollTop=100000;
	}
function Tinactive(t,nbc) 
	{
		
		for (i=0;i<=nbc;i++){
		
               	if (document.all)
                	document.getElementById(t+i).style.display="none"; else document.getElementById(t+i).setAttribute("style","display:none");



		}
	}
	
function raz(t) 
	{
		
		if (c=document.getElementById(t))
		{
               	if (document.all)
                	c.style.display="none"; else c.setAttribute("style","display:none");

                	//document.getElementById(t+i).firstChild.nodeValue='';
		c.innerHTML='';
		//document.getElementById(t+i).style.display='none';
		}
	}
	
function razDOM(lay,cpt,lay2) 
	{
		for (i=0;i<cpt;i++)
		{
			if (c=document.getElementById(lay+i))
			{
			
				if(l=document.getElementById(lay2+i))
			        c.removeChild(l);
			}
		}
	}
function razDOM2(lay) 
	{
			if (c=document.getElementById(lay))
			{
			        document.body.removeChild(c);
			}
		
	}

    function valid_mess(evenement)
         {
             var touche = window.event ? evenement.keyCode : evenement.which;
             return touche;
             
         }
    function PmessTo (p) {
    	var area = document.getElementById('fgm');
    	if (area.value=="")
    	{
    	area.value="[à "+p+" > ] ";
    	area.focus();
    	}
    }
// cochage ou decochage des checkbox pour impression d'affaires
function checkall(){
var i;
coche++;
if (coche%2!=0){

f=document.forms.f_mail;

 for (i=0;i<f.elements.length;i++)
 								{
     if(f.elements[i].type=='checkbox') f.elements[i].checked=true ;				
										
								}


}else{

 for (i=0;i<f.elements.length;i++)
 								{
     if(f.elements[i].type=='checkbox') f.elements[i].checked=false ;				
										
								}
								}
}

function swap_bg (id,classN){
     document.getElementById(id).className=classN;  
}

function swap_img (id,file_bg){
     document.getElementById(id).src='./images/'+file_bg+'.gif';  
}


function control_check(){
f=document.getElementById('f_modif');

if (f.o_pub.checked==true) f.o_pub.value=1; else f.o_pub.value=0;
  

}
function printFiche(dir,ets){

  print=window.open(dir+"./print_fiche.php?r="+ets,"fiche","top=0,left=0,resizable=yes,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=810,height=600");
}

function printPromo(dir,ets){  print=window.open(dir+"./print_promo.php?r="+ets,"promo","top="+((screen.height)/2-125)+",left="+((screen.width)/2-225)+",resizable=yes,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=450,height=250");
}

function choixScat(f,sc){
c=document.getElementById(f);
idv=c.elements[sc].options[c.elements[sc].selectedIndex].value;
document.getElementById('scat').value=idv;

}
function infoContact(v)
{
	
	c=document.getElementById('f_contact');
	
	if (v=='')
	{	
		s=c.elements['ctc_sujet'].options[c.elements['ctc_sujet'].selectedIndex].text;
		if (s=="[Choisissez le sujet de votre demande]"){s=0;}
		if (s=="Demande de partenariat"){s=1;}
		if (s=="J'ai un problème de navigation sur le site"){s=2;}
		if (s=="Je souhaite recevoir mes identifiants annonceur"){s=3;}
		if (s=="J'ai repéré un bug"){s=4;}
		if (s=="J'ai identifié une erreur sur une fiche restaurant"){s=5;}
		if (s=="J'ai constaté un abus sur un avis"){s=6;}
		if (s=="Je suggère un marché alimentaire"){s=7;}
		if (s=="Je souhaite donner mon avis sur le site"){s=8;}
		if (s=="Autre demande"){s=9;}
		c.elements['ctc_info'].value=s;
		document.getElementById('C'+s).style.display='block';
		for (i=0;i<9;i++)
		{
		if (i!=s) document.getElementById('C'+i).style.display='none';
		}
	}else{
		c.elements['ctc_info'].value=v;
		document.getElementById('C0').style.display='none';
		document.getElementById('C'+v).style.display='block';
	}
}

function choixCat(f){

c=document.getElementById(f);
idv=c.elements['o_cat'].options[c.elements['o_cat'].selectedIndex].value;

                
    for (j=10;j<28;j++){
   document.getElementById('sc'+j).style.visibility="hidden";
  }               
 
  if (idv!=''){
  
   document.getElementById('sc'+idv).style.visibility="visible";

  }else{
   document.getElementById('scat').value='';
         }             
}
  
function diap(file){

    lay = document.getElementById("visio");
    lay.innerHTML ="";
    lay.style.width='650px';
    lay.style.height='400px';
    lay.style.display='block'; 
    tab = file.split('/');
    lay.innerHTML = "<img src='../getsnapHL.php?w=400&p=" + file + "' class='bdr' /><br />" + tab[1];
}

function diapOn(file){

    lay = document.getElementById('visio');
    lay.style.display='none';    
    
     wt  = document.getElementById('wait');
     
     wt.innerHTML='Chargement de l\'image en cours...';
    
    
    lay.style.display='block';  
    
    lay.innerHTML ="<img onload=\"wt.innerHTML='';\"  src='../getsnapLH.php?w=500&pic=" + file + "' class='bdr' />"; 
    
 

}
function initEtat(etat){
 var ASupp = document.getElementById('box');
 document.body.removeChild(ASupp);
 ASupp = document.getElementById('hid');
 document.body.removeChild(ASupp);
 return etat;
 }

function AlertAction(action,membre,color,dir){

                	var bt1 = "NON";    var bt2 = "OUI"; // creation des boutons pour confrimer
                	switch (action) {
                		// ###### methodes connexion ok ################
                		case "flash": // flasher pour un membre
                		// texte de la boite
                		txt = "Vous avez remarqu&eacute; et appr&eacute;ci&eacute; le profil de<br /><strong>" + membre + " !</strong><br />Envoyez lui un wink pour le lui faire savoir !<br /><br/>Il ou elle sera prévenu(e) par mail de votre attention.<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";  			
                		break;
                 		case "bloc": // bloquer un membre
                		// texte de la boite
                		txt = "Vous allez bloquer <br /><strong>" + membre + "</strong> !<br /><br/>Vous ne pourrez plus avoir de contacts<br />par MAIL ou par TCHAT !<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";
                		break;
                 		case "Dbloc": // débloquer un membre
                		// texte de la boite
                		txt = "Vous allez débloquer <br /><strong>" + membre + "</strong> !<br /><br/>Vous pourrez à nouveau avoir des contacts<br />par MAIL ou par TCHAT !<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";
                		break;
                		
                 		case "pote": // ajouter un membre à mes contacts
                		// texte de la boite
                		txt = "Vous souhaitez ajouter <br /><strong>" + membre + "</strong><br />à votre communaut&eacute;.<br />Un mail va lui &ecirc;tre adress&eacute; pour l'informer de votre demande.<br />Libre &agrave; lui ou elle de l'accepter ou de la refuser...<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
                 		case "Apote": // supprime un membre à mes contacts
                		// texte de la boite
                		txt = "Vous allez ajouter<br /><strong>" + membre + "</strong><br />&agrave; votre communaut&eacute; !<br /><br />Vous ferez &eacute;galement partie de la sienne...<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;                		
                 		case "Dpote": // supprime un membre à mes contacts
                		// texte de la boite
                		txt = "Vous allez supprimer <br /><strong>" + membre + "</strong><br />de votre communaut&eacute; !<br /><br />Vous ne ferez &eacute;galement plus partie de la sienne...<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
                 		case "delpicpro": // ote photo profil
                		// texte de la boite
                		txt = "Vous allez supprimer la photo<br />représentant votre profil !<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
                 		case "valpicpro": // valide photo profil
                		// texte de la boite
                		txt = "Vous allez valider la photo<br />représentant le profil de <strong>" + membre + "</strong> !<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
                		
                 		case "delpic": // supprime une photo de l'album
                		// texte de la boite
                		txt = "Vous allez supprimer cette photo de votre album !<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
                		case "propic": //  photo de l'album en profil
                		// texte de la boite
                		txt = "Vous allez ajouter cette photo comme photo représentant votre profil ! <br /><br />Elle devra être validée par notre équipe<br />avant d'être visible...<br /><br />Confirmez-vous ce choix ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";		
                		break;
               		
                		// ###### methodes hors ligne ################
                		case "nophoto": // retour inscription
                		// texte de la boite
                		txt = "<strong>Vous devez &ecirc;tre inscrit(e) pour<br />consulter l'album photos de <br />"  + membre + " !</strong><br /><br/>Voulez-vous vous inscrire maintenant ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";        			               		break;
                		case "nophoto": // retour inscription
                		// texte de la boite
                		txt = "<strong>Vous devez &ecirc;tre inscrit(e) pour<br />consulter l'album photos de <br />"  + membre + " !</strong><br /><br/>Voulez-vous vous inscrire maintenant ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";        			               		break;
                		case "noaction": // retour inscription
                		// texte de la boite
                		txt = "<strong>Vous devez être inscrit(e) pour<br />effectuer cette action avec <br />"  + membre + " !</strong><br /><br/>Voulez-vous vous inscrire maintenant ?<br />";
                		// fonction ajax
                		AJXA = "ActionON('"+membre+"','"+action+"','"+dir+"')";        			               		break;
                		
                		default :
                		AJXA = "ActionON(0,0,'"+dir+"')";
                	}
                	
                	txt += "<a href='javascript:void(0);' style='color:#FF0000' onclick='initEtat(1);'><strong>"+ bt1 +"</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)'; style='color:#009900' onclick=\""+ AJXA +";return false;\"><strong>"+ bt2 +"</strong></a>";
                	
                	//var q = document.createElement('span');
                	
                	var h = document.createElement('div');
                	h.setAttribute("id","hid");
                	var c = document.createElement('div');
                	c.setAttribute("id","box");
		c.innerHTML= txt;
                	
                //D6C3F0 
                 	h.setAttribute("style","width:"+(document.body.clientWidth)+"px;height:"+(document.body.clientHeight)+"px;position:absolute;top:0px;left:0px;z-index:5000;background:#FFFFFF;opacity:0.7;");
c.setAttribute("style","color:#333333;text-align:center;padding:5px 10px 0px 0px;width:300px;height:160px;position:absolute;top:"+((screen.height/2)-300+document.documentElement.scrollTop)+"px;left:"+((document.body.clientWidth/2)-150)+"px;background:url('"+dir+"./images/"+color+".gif') no-repeat;z-index:10000"); 


               	if (document.all){
                 	
h.style.setAttribute("cssText","width:"+(document.body.clientWidth)+"px;height:"+(document.body.clientHeight)+"px;position:absolute;top:0px;left:0px;z-index:5000;background:#FFFFFF;filter: alpha(opacity=70);");
c.style.setAttribute("cssText","color:#333333;text-align:center;padding:5px 10px 0px 0px;width:300px;height:160px;position:absolute;top:"+((screen.height/2)-300+document.documentElement.scrollTop)+"px;left:"+((document.body.clientWidth/2)-150)+"px;background:url('"+dir+"./images/"+color+".gif') no-repeat;z-index:10000;");                  	
               	}
                		
                	if (!document.getElementById) {
                		 
                		alert('Votre navigateur est trop ancien pour utiliser certaines fonctionnalités du site...');
                	}
                	
		document.body.appendChild(h);
		document.body.appendChild(c);
		//c.appendChild(q);

 

}
function AlertInfo(pseudo,age,photo,sexe){
	
                 	var c = document.createElement('div');
                	c.setAttribute("id","AlertInfo");
                	if (sexe=="f") sex="Fille"; else sex="Mec";
                	if (photo=="")
                	{
                	  pic = "../images/def_"+sexe+".gif"; 
                         }else{
                    pic = "../getsnapLH.php?pic=membres/"+pseudo+"/album/"+photo+"&w=90";
                  }
 
		c.innerHTML= "<div class='BoxFullAMI_"+sexe+"'><a href='./fiche,"+pseudo+".html'><div style='margin:5px 5px;float:left;width:80px;height:80px;border:1px solid #CCCCCC;background:url("+pic+") no-repeat center center'>	</div></a><div style='float:left;width:132px;height:80px'><a href='./fiche,"+pseudo+".html' class='PseudO"+sexe+"'>"+pseudo+"</a><br />"+sex+", "+age+" ans<br /><br /><strong>Visite votre fiche<br />en ce moment !</strong></div><a href='./fiche,"+pseudo+".html' class='PseudO"+sexe+"'><img src='../images/ButFiche_"+sexe+".gif' align='left' alt='Voir sa fiche' style='margin-left:3px' /></a><div class='clr'></div></div>";
                	
                 	c.setAttribute("style","width:230px;height:120px;position:absolute;top:"+((document.documentElement.clientHeight)-145+document.documentElement.scrollTop)+"px;left:"+((document.body.clientWidth)-245)+"px;z-index:10000"); 


               	if (document.all){
                 	
c.style.setAttribute("cssText","width:230px;height:120px;position:absolute;top:"+((document.documentElement.clientHeight)-145+document.documentElement.scrollTop)+"px;left:"+((document.documentElement.clientWidth)-245)+"px;z-index:10000;");                  	
               	}
                		
                	if (!document.getElementById) {
                		 
                		alert('Votre navigateur est trop ancien pour utiliser certaines fonctionnalités du site...');
                	}
                	
		
		document.body.appendChild(c);
		//c.appendChild(q);
	
}
function secure_session(t){
  
   setTimeout("window.location.href='?timeout';",t);  
}


function isNum(f,c){
  
   v=document.getElementById(f).elements[c].value;
   
   
   if (isNaN(v)) 
    {
      alert('Le prix doit être de type numérique !') ;
      return false;
    }else{
     return true;
     }
}


function photomx(dir,p) {
photo=window.open(dir+"./getsnapLH.php?p="+p,"photo","top="+((screen.height)/2-300)+",left="+((screen.width)/2-300)+",resizable=yes,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=600,height=600");
}
function marcheMap(ville) {
map=window.open("./map_marche.php?ville="+ville,"marche","top="+((screen.height)/2-250)+",left="+((screen.width)/2-250)+",resizable=yes,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=540,height=540");
}
function OpenGmap() {
Gmap=window.open("./Gplan.php","Gmap","top=0,left=0,resizable=yes,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=580,height=600");
}
function openAccessVIP() {
vip=window.open("./getPassVIP_audio.php","vip","top=0,left=0,resizable=no,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=480,height=480");
}
function openAccessDATAS() {
vip=window.open("./get_DATA_MEMBER.php","vip","top=0,left=0,resizable=no,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=480,height=480");
}
function killobjet(n,o){
var input=confirm('Vous êtes sur le point de supprimer '+n+' : '+o+' !\nVoulez-vous vraiment effectuer cette action ?');
if (input==true)
	{
		return true;
	}
else {
		return false;
	}
    }

function delart(p){
var input=confirm('Tu es sur le point de supprimer cet article !\nEs-tu sur ?\n\n Si oui clique sur OK sinon Annule...');
if (input==true)
	{
		document.location.href='?del=1&id='+p;
	}
else {
		return(false);
	}
    }
function checkF(f){
val=trim(f.titre.value);
if (val==""){
alert('Le titre de ton article doit être renseigné !');return false;
}

Nom = navigator.appName;
if (Nom == 'Microsoft Internet Explorer') {
t=window.frames['iarea'].document.body.innerHTML;
}else{
t=document.getElementById('iarea').contentWindow.document.body.innerHTML;
}
f.texte.value=t;



}
function opentchat(p){
tchat=window.open("./messenger.php?pseudo="+p,"chat","resizable=no,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=550,height=475");
tchat.focus();
}
function ReductMode(){
window.open("winreduct.php","WR","top=0,left="+((screen.width)-345)+",resizable=no,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=345,height=650");
window.close();
document.location='index.php';


}
/*function opentchatall(){
chatall=window.open("tchatall.php?a=tchat","tchatall","resizable=no,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=670,height=600");

}*/
function opentchatall(){
chatall=window.open("../tchatbox/","tchatall","resizable=1,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=900,height=760");

}
function emptymess(f){
if (f.elements['message'].value==''){ alert('Aucun message à envoyer');
return false;}
else if (f.message.value.length>500){alert('Votre message contient trop de caractères !\n(500 maximum)');
return false;}
else{f.elements['mess'].value=f.elements['message'].value;
					f.elements['message'].value='';}
}
    function valid_mess(evenement)
         {
             var touche = window.event ? evenement.keyCode : evenement.which;
             return touche;
             
         }

function trim(val) {
     var retour = ""
     for(i=0;i < val.length;i++)
         if(val.charAt(i) != " ") {
             retour += val.charAt(i)
         }
     return retour
}

function emptych(f){
c=document.getElementById(f);
longueur=trim(c.qs.value).length;
if (longueur==0){ alert('Vous n\'avez tapé aucun mot !\n\nN\'hésitez pas à consulter l\'aide pour affiner votre recherche...');
return false;}
}


function enabledep(f,p,d){
//c=document.forms[f];
c = document.getElementById(f);
	if (c.elements[p].options[c.elements[p].selectedIndex].text=='France')
	{
		c.elements[d].disabled=false; 
	} else { 
		c.elements[d].disabled=true;c.elements[d].selectedIndex=0;
	}

}
function choixdep(f){
c=document.getElementById(f);
if (c.elements['departement'].options[c.elements['departement'].selectedIndex].value==''){
   alert("Choisissez un département svp !");
   return false;
   }else{
   return true;
   }
}

function abortimg(numim){
document.images['im'+numim].src='images/pixel.gif';
//document.images['im'+numim].width=0;
//document.images['im'+numim].height=0;
return true;
}

function chgim1(numim){
document.images[numim].src='images/med2.gif';
return false;
}
function chgim2(numim){
document.images[numim].src='images/med.gif';
return false;
}
function charteok(f){
c=document.getElementById(f);
if (c.cgu.checked){return true;}else{alert('Vous devez avoir lu et accepté les conditions d\'utilisation pour valider l\'inscription !');return false;}

}
function voircharte(){
use=window.open("charte.html","charte","top="+((screen.height)/2-125)+",left="+((screen.width)/2-250)+",toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=500,height=250");

}
function openblog(){
window.open("espaceperso/myblog.php","myblog","top="+((screen.height)/2-300)+",left="+((screen.width)/2-345)+",toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=690,height=600");

}
function viewblog(p){
window.open("espaceperso/blog.php?p="+p,"blog","top="+((screen.height)/2-300)+",left="+((screen.width)/2-345)+",toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=690,height=600");

}

function putinto(){
f=document.getElementById('f_mail');

if (f.who.options[f.who.selectedIndex].value!=-2){
f.mail_pseudo.value=f.who.options[f.who.selectedIndex].text;
}else{
f.mail_pseudo.value='';
}
}
function ChFlag(f){
var fg="";
f=document.getElementById(f);
if ((f.elements['o_pays'].options[f.elements['o_pays'].selectedIndex].text=="Choisissez dans la liste")||(f.elements['o_pays'].options[f.elements['o_pays'].selectedIndex].text=="Autre")){
fg="images/flag/no_flag.gif";
document.getElementById('flag').src=fg;
}else {
var fg="images/flag/"+f.o_pays.options[f.o_pays.selectedIndex].text.toLowerCase()+".gif";
document.getElementById('flag').src=fg;
}
}
function control_acc(n)
{
var nb=7;
	for(i = 1; i <= nb; i++)
        {
        	if((document.getElementById(i).style.visibility = 'visible')&&(i != n))
                {
                document.getElementById(i).style.visibility = 'hidden';
                }
        }
}
function control_artistes(n)
{
var nb=26;
	for(i = 1; i <= nb; i++)
        {
        	if((document.getElementById(i).style.visibility = 'visible')&&(i != n))
                {
                document.getElementById(i).style.visibility = 'hidden';
                }
        }
}

function montre(n)
{
	
		document.getElementById(n).style.visibility = 'visible';
		document.getElementById(n).style.width = '435px';
		document.getElementById(n).style.height = '200px';
		document.getElementById(n).style.left = '178px';	
		document.getElementById(n).style.top = '300';	
   	document.getElementById(n).src='_flashtchat.php';

}
function montre2(n,w,h)
{

		document.getElementById(n).style.visibility = 'visible';
		document.getElementById(n).style.width = w+'em';
		document.getElementById(n).style.height = h+'em';
		
}
function Hide2(n)
{
    document.getElementById(n).src='';
		document.getElementById(n).style.visibility = 'hidden';
		document.getElementById(n).style.width = '0px';
		document.getElementById(n).style.height = '0px';
		
}

function confirmation(){
var input=confirm('Vous allez annuler votre saisie !');
if (input==true)
	{
		return(true);
	}
else {
		return(false);
	}
    }
function killcompte(){
var input=confirm('Vous êtes sur le point de supprimer votre compte !\nCeci aura pour effet de supprimer également tous les mails que avez envoyé aux autres membres...\nAinsi que votre blog et toutes les photos qu\'il contient...\nAprès la suppression vous serez automatiquement redirigé vers la page d accueil\nVoulez-vous vraiment fermer votre compte ?');
if (input==true)
	{
		return(true);
	}
else {
		return(false);
	}
    }

// verification d'un formulaire pour des champs text, vides, débutant par un espace
// et caractères speciaux
function verifannonce(f)

{
 var ex=/[0-9A-Za-z]/;
 var exmail=/\s/;
 var exmail2=/[.]/;
 var dep=/[^0-9]/;
 var errmail='Une erreur est survenue dans votre adresse mail !\nElle doit être du type : \nvotrenom@votrefournisseur.xxx';
 var mail=f.elements['email'].value;
 var tabmail=mail.split(/@/);
 	
  		if (dep.test(f.elements['departement'].value)){
							alert('Le champs Département ne doit contenir que des chiffres !\nVeuillez vérifier SVP...');return false;											
										}
																																									
if ((tabmail.length!=2)||(exmail.test(mail))||(exmail2.test(tabmail[1])==false)){alert(errmail);return false ;}
        if
				(f.elements['choix'].options[f.elements['choix'].selectedIndex].value=="vide" ){	
				  alert('Vous n\'avez pas renseigné le champs : Type d\'annonce !');
							 return false;
							 						}
						
 /*        if
			(f.elements['contact'].options[f.elements['contact'].selectedIndex].value==0){
                             alert('Vous n\'avez pas renseigné le champs '+f.elements['contact'].name+' !');
							 return false;
						}
        if
			(f.elements['type'].options[f.elements['type'].selectedIndex].value==0){
                             alert('Vous n\'avez pas renseigné le champs '+f.elements['type'].name+' !');
							 return false;
						}
*/
    for (i=0;i<f.elements.length;i++){
		if ( ((f.elements[i].type=='text')||(f.elements[i].type=='password')) && (f.elements[i].value=='') ){
							alert('Le champs '+f.elements[i].name+' est vide !');return false;											
										}
		if 
			( ((f.elements[i].type=='text')||(f.elements[i].type=='password')) && f.elements[i].value.charAt(0)==' '){
							alert('Le champs '+f.elements[i].name+' ne peut commencer par un espace !');return false;	
						}

   }
   
       for (k=2;k<5;k++){

          for (j=0;j<(f.elements[k].value.length);j++){
 if (ex.test(f.elements[k].value.charAt(j))==false){
 alert('Seuls les chiffres et les lettres non accentuées sont autorisés pour les champs :\n - Prénom\n- Pseudo\n- mot de passe');
 return false;}
                          }
						}  
						  

  		if (f.elements['texte'].value=='' || f.elements['texte'].value.charAt(0)==' '){
							alert('Vous n\'avez pas rempli votre annonce ou celle-ci commence par un espace !\nVeuillez vérifier SVP...');return false;											
										}

		if ((f.elements['texte'].value.length)>255){
		alert('Votre annonce dépasse les 255 caractères !\nVeuillez vérifier SVP...');return false;}											

}


function hidepub(r){
if (r!='a1') {
if (location.search!=''){
document.location.href = location.pathname + location.search + "&pl=a1"  ;
}
else
{
document.location.href = location.pathname + "?pl=a1"  ;

}
return true;
//document.write('yiyiyiyiyiyiyiyiyiy');
//r=1;
}

}
