function cocher(thisfield,valeur,choixform) {
	radioSet=eval("document."+choixform+"."+thisfield);
	for (i=0;i<radioSet.length;i++) if (radioSet[i].value==valeur) radioSet[i].checked=true;
}

function cocher2(thisfield,choixform) {
	checkSet=eval("document."+choixform+"."+thisfield);
	checkSet.checked=!(checkSet.checked)
}

function cocher3(thisfield,valeur,choixform) {
	checkSet=eval("document."+choixform+"."+thisfield);
	for (i=0;i<checkSet.length;i++) if(checkSet[i].value==valeur) checkSet[i].checked=!(checkSet[i].checked);
}

function check(objet,choix) {
	checkSet=eval(objet);
	for (i=0;i<checkSet.length;i++) checkSet[i].checked=(checkSet[i].value==choix) ? true : false;
}

function efface_selection_checkbox(thisfield,choixform) {
	checkSet=eval("document."+choixform+"."+thisfield);
	for (i=0;i<checkSet.length;i++){checkSet[i].checked=false}
}

function depart(valeur,objet){
if (valeur!="")
	{valeur=valeur.substr(0,2);
	objet.value=valeur;
	}
}

function effaceOption(objet) {
	var j;
	for (j=objet.length-1; j>=0; j--) objet.options[j] = null;
}

function depot_select_ville(code,ville) {
	depart=code.substr(0,2);
	document.getElementById('ville').value=ville;
	document.getElementById('codepostal').value=code;
	document.getElementsByName("choixdepart")[0].value=depart;
}

function ajoutPhoto2()
{
document.getElementById('upload').style.display='block';
document.getElementById('ajout').style.display='none';
document.getElementById('sup').style.display='none';
document.ajout.submit();
}

function ajoutPhoto_new(formulaire)
{
displayStaticMessage('<p style=\'margin-top:10px;\'><strong>Merci de patienter, enregistrement en cours...</strong><br /><img src=\'http://web-petitesannonces.fr/images/loading_new.gif\' style=\'margin-bottom:18px;margin-top:10px;\'></p>',false,300,120);
formulaire.submit();
}

var xhr = null;

function getXhr()
 {
  if(window.XMLHttpRequest) xhr = new XMLHttpRequest(); 
  else if(window.ActiveXObject)
   {  
    try
     {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
     }
    catch (e)
     {
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
     }
   }
  else 
   { 
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour"); 
    xhr = false; 
   } 
 }
 
 function getXhr2() {
  var xhr2 = null;

  if(window.XMLHttpRequest) xhr2 = new XMLHttpRequest(); 
  else if(window.ActiveXObject)
   {  
    try
     {
      xhr2 = new ActiveXObject("Msxml2.XMLHTTP");
     }
    catch (e)
     {
      xhr2 = new ActiveXObject("Microsoft.XMLHTTP");
     }
   }
  else 
   { 
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour"); 
    xhr2 = false; 
   } 
   return xhr2;
 }

 function Selection_annonce(rubrique,num,type)
 {
 if (type=="sup") {resultat=confirm("Etes vous sûr(e) de vouloir supprimer l'annonce "+rubrique+"-"+num+" de votre sélection ?");}
 if ( type=="ajout") resultat="1";
  if (resultat=="1"){
  getXhr();
  xhr.onreadystatechange = function()
   {
    if(xhr.readyState == 4 && xhr.status == 200)
     {
	  var response = xhr.responseText;
      var response = response.split('&&');
      var selection = response[0];
      var type = response[1];
	  
	  if (type=="Ajout") {document.getElementById('selection_sup'+num).style.display='block';document.getElementById('selection_ajout'+num).style.display='none';}
      if (type=="Sup") {document.getElementById('selection_sup'+num).style.display='none';document.getElementById('selection_ajout'+num).style.display='block';}
	  if (selection=="1") document.getElementById('affiche_selection').style.display='block'; else document.getElementById('affiche_selection').style.display='none';
     }
   }
  // On envoie la requete a "ajax/verifnserie.php"
  xhr.open("POST",'http://web-petitesannonces.fr/ajax/selection_annonce.php',true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send("id="+rubrique+"&num="+num+"&type="+type);
  }
 }

function valide_recup_identifiants()
{
  var param;
  var page;
	page='http://web-petitesannonces.fr/ajax/identifiants.php';
	param="mail="+document.form.mail.value;
    
  document.getElementById('formulaire_modalbox').style.display='none';
  document.getElementById('loading').style.display='block';
  getXhr();
  xhr.onreadystatechange = function()
   {
    if(xhr.readyState == 4 && xhr.status == 200)
     {
	  var response = xhr.responseText;
      var response = response.split('&&');
      var status = response[0];
	  document.getElementById('loading').style.display='none';
      if (status.replace(/^\s*|\s*$/,"")=="ok") {document.getElementById('message').innerHTML=response[1];document.getElementById('ok').style.display='block';document.getElementById('formulaire_modalbox').style.display='none';}
	  else {document.getElementById('formulaire_modalbox').style.display='block';document.getElementById('erreur').innerHTML=response[1];}
	  Modalbox.resizeToContent();
     }
   }
  // On envoie la requete
  xhr.open("POST",page,true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send(param);
}

function envoie(choix)
 {
  var param;
  var page;
  
  switch(choix){
	case'identifiants':
	page='http://web-petitesannonces.fr/ajax/identifiants.php';
	param="mail="+document.form.mail.value;
	break;
	case'abus':
	page='http://web-petitesannonces.fr/ajax/abus.php';
	param="url="+document.form.url.value+"&num="+document.form.num.value+"&mail="+document.form.mail.value+"&message="+document.form.message.value;
	break;
	case'rubrique':
	page='http://web-petitesannonces.fr/ajax/rubrique.php';
	param="code="+document.form.code.value+"&mail="+document.form.mail.value+"&message="+document.form.message.value+"&rubrique="+document.form.rubrique.value;
	break;
	case'contact':
	page='http://web-petitesannonces.fr/ajax/contact.php';
	param="code="+document.form.code.value+"&mail="+document.form.mail.value+"&objet="+document.form.objet.value+"&message="+document.form.message.value;
	break;
	case'contact_annonceur':
	page='http://web-petitesannonces.fr/ajax/contact_annonceur.php';
	param="code="+document.form.code.value+"&mail="+document.form.mail.value+"&objet="+document.form.objet.value+"&message="+document.form.message.value;
	break;
	case'contact_ami':
	page='http://web-petitesannonces.fr/ajax/contact_ami.php';
	param="code="+document.form.code.value+"&mail="+document.form.mail.value+"&mail2="+document.form.mail2.value+"&message="+document.form.message.value;
	break;
  }
  
  document.getElementById('formulaire_modalbox').style.display='none';
  document.getElementById('loading').style.display='block';
  getXhr();
  xhr.onreadystatechange = function()
   {
    if(xhr.readyState == 4 && xhr.status == 200)
     {
	  var response = xhr.responseText;
      var response = response.split('&&');
      var status = response[0];
	  document.getElementById('loading').style.display='none';
      if (status.replace(/^\s*|\s*$/,"")=="ok") {document.getElementById('ok').style.display='block';document.getElementById('formulaire_modalbox').style.display='none';}
	  else {document.getElementById('formulaire_modalbox').style.display='block';document.getElementById('erreur').innerHTML=response[1];}
	  Modalbox.resizeToContent();
     }
   }
  // On envoie la requete
  xhr.open("POST",page,true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send(param);
 }

  function recherche_villes(id)
 {
  var param;
  var page;
	page='http://web-petitesannonces.fr/ajax/select_villes.php?id='+id;
	param="code="+document.recherche_ville.choix_code.value+"&ville="+document.recherche_ville.choix_ville.value;
    
  document.getElementById('resultat').style.display='none';
  document.getElementById('recherche').style.display='none';
  document.getElementById('loading').style.display='block';
  getXhr();
  xhr.onreadystatechange = function()
   {
    if(xhr.readyState == 4 && xhr.status == 200)
     {
	  var response = xhr.responseText;
      var response = response.split('&&');
      var status = response[0];
	  var selection = response[2];
	  document.getElementById('loading').style.display='none';
      if (status.replace(/^\s*|\s*$/,"")=="ok") {document.getElementById('resultat').style.display='block';document.getElementById('selection_villes').innerHTML=selection;}
	  else {document.getElementById('recherche').style.display='block';document.getElementById('erreur').innerHTML=response[1];}
	  Modalbox.resizeToContent();
     }
   }
  // On envoie la requete
  xhr.open("POST",page,true);
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr.send(param);
 }

function recup_selection_villes(id)
{
radioSet=eval(document.selection_ville.choix);
var selection="";
var message="Sélectionnez une ou plusieurs villes avant de valider !";
for (i=0;i<radioSet.length;i++){
if(radioSet[i].checked==true) if (selection=="") selection=radioSet[i].value; else selection=selection+","+radioSet[i].value;
}
if (id=="ville2") message="Sélectionnez une ville avant de valider !";
if (selection=="") alert (message);
else {
	if (id=="ville2") {
		selection = selection.split(',');
		var code=selection[0];
		var ville=selection[1];
		depart=code.substr(0,2);
		document.getElementById('ville').value=ville;
		document.getElementById('codepostal').value=code;
		document.getElementsByName("choixdepart")[0].value=depart;
		Modalbox.hide();
	} else {
		if (document.getElementById('choixdepart').value=="") {document.getElementById('choixdepart').value=selection;Modalbox.hide();}
		else {document.getElementById('resultat').style.display='none';document.getElementById('maj_selection').style.display='block';document.selection_ville.selection.value=selection;
		Modalbox.resizeToContent();}
	}
}
}

function valide_select_carte(selection)
{
document.selection_ville.selection.value=selection;
recup_selection_depart_carte(selection);
}

function remplace_selection_villes()
{
document.getElementById('choixdepart').value=document.selection_ville.selection.value;
Modalbox.hide();
}

function ajout_selection_villes()
{
document.getElementById('choixdepart').value=document.getElementById('choixdepart').value+","+document.selection_ville.selection.value;
Modalbox.hide();
}

function recup_selection_depart()
{
checkSet=eval(document.selection_ville.region);
var selection="";
var message="Sélectionnez un ou plusieurs départements avant de valider !";
for (i=0;i<checkSet.length;i++){
	if(checkSet[i].checked==true) if (selection=="") selection=checkSet[i].value; else selection=selection+","+checkSet[i].value;
}
if (selection=="") alert (message);
else {
	if (document.getElementById('choixdepart').value=="") {document.getElementById('choixdepart').value=selection;Modalbox.hide();}
	else {document.getElementById('selection_ville').style.display='none';document.getElementById('maj_selection').style.display='block';document.selection_ville.selection.value=	selection;Modalbox.resizeToContent();}
}
}

function recup_selection_depart_carte(selection)
{
document.getElementById('selection_depart_carte').style.display='none';
window.focus();
if (document.getElementById('choixdepart').value=="") {document.getElementById('choixdepart').value=selection;Modalbox.hide();}
else {document.getElementById('maj_selection').style.display='block';Modalbox.resizeToContent();}
}

function reinit_select_depart()
{
checkSet=eval('document.selection_ville.region');
for (i=0;i<checkSet.length;i++) checkSet[i].checked=false;
}

function majDepart(field)
{
Tdepart=new Array();
Tdepart[0]="";
for (a=1;a<96;a++) {if (a<10) {Tdepart[a]="0" + a;}
   					   else {Tdepart[a]=a;}
					  }				
for (a=1;a<Tdepart.length;a++) {field.options[a]=new Option(Tdepart[a],Tdepart[a]);}
for (b=971;b<977;b++) {field.options[a]=new Option(b,b);
a++;}
}

function majJour(field)
{
Tnum=new Array();
Tnum[0]="";
for (a=1;a<32;a++) {if (a<10) {Tnum[a]="0" + a;}
else {Tnum[a]=a;}
}
for (a=1;a<Tnum.length;a++) {field.options[a]=new Option(Tnum[a],Tnum[a]);}
field.options[0].selected=true;
}

function majMois(field)
{
Tnum=new Array();
Tnum[0]="";
for (a=1;a<13;a++) {if (a<10) {Tnum[a]="0" + a;}
else {Tnum[a]=a;}
}
for (a=1;a<Tnum.length;a++) {field.options[a]=new Option(Tnum[a],Tnum[a]);}
field.options[0].selected=true;
}

function majDate(field,date)
{
i=1;
for (a=date;a>=1940;a--) {field.options[i]=new Option(a,a);
i++;}
field.options[0].selected=true;
}

function majDate2(field,date1,date2)
{
i=1;
for (a=date1;a<=date2;a++) {field.options[i]=new Option(a,a);
i++;}
field.options[0].selected=true;
}

function majChiffre(field,debut,nbre,pas)
{
Tnum=new Array();
for (a=0;a<=nbre;a++) {Tnum[a]=debut;debut=debut+pas;}
for (a=1;a<Tnum.length;a++) {field.options[a]=new Option(Tnum[a-1],Tnum[a-1]);}
field.options[0].selected=true;
}

function majOption(selection,objet)
{
var tab = selection.split(/,/);
checkSet=eval(objet);
for (i=0;i<checkSet.length;i++){
for (a=0;a<tab.length;a++){
if(checkSet[i].value==tab[a]){checkSet[i].checked=true;}}}
}

function couleur(couleur,form) {
	Ttype=new Array();
	a=0;Ttype[a++]="Beige";Ttype[a++]="Blanc";
	Ttype[a++]="Bleu";Ttype[a++]="Bordeaux"; Ttype[a++]="Champagne"; Ttype[a++]="Gris";
	Ttype[a++]="Jaune";Ttype[a++]="Marron"; Ttype[a++]="Noir";
	Ttype[a++]="Or";Ttype[a++]="Orange";Ttype[a++]="Rouge";Ttype[a++]="Sable";
	Ttype[a++]="Vert";Ttype[a++]="Violet";Ttype[a++]="Autre";
	
	for (a=1;a<=Ttype.length;a++) { document.getElementsByName(form)[0].couleur.options[a]=new Option(Ttype[a-1],Ttype[a-1]);}
	document.getElementsByName(form)[0].couleur.value=couleur;
}

function couleurBis(choix,form) {
	if (choix=="") {
		document.getElementsByName(form)[0].couleur2.disabled=true;
		document.getElementsByName(form)[0].couleur2.value="";
	} else document.getElementsByName(form)[0].couleur2.disabled=false;
}

function majRegion(objet)
{
   Tregion=new Array();
   a=1;Tregion[a++]="Alsace";
    Tregion[a++]="Aquitaine";Tregion[a++]="Auvergne";Tregion[a++]="Basse-Normandie"; Tregion[a++]="Bourgogne";Tregion[a++]="Bretagne";
    Tregion[a++]="Centre";Tregion[a++]="Champagne-Ardennes";Tregion[a++]="Corse";Tregion[a++]="DOM-TOM"; Tregion[a++]="Franche-Comté";Tregion[a++]="Haute-Normandie";
	Tregion[a++]="Ile-de-France";Tregion[a++]="Languedoc-Roussillon";Tregion[a++]="Limousin";Tregion[a++]="Lorraine";Tregion[a++]="Midi-Pyrénées";
	Tregion[a++]="Nord-Pas-de-Calais";Tregion[a++]="Pays de la Loire";Tregion[a++]="Picardie";Tregion[a++]="Poitou-Charentes";Tregion[a++]="Provence-Alpes-Côte d'Azur";
	Tregion[a++]="Rhône-Alpes";
	
	Tregion2=new Array();
   a=1;Tregion2[a++]="67,68";
    Tregion2[a++]="24,33,40,47,64";Tregion2[a++]="03,15,43,63";Tregion2[a++]="14,50,61"; Tregion2[a++]="21,58,71,89";Tregion2[a++]="22,29,35,56";
    Tregion2[a++]="18,41,36,37,28,45";Tregion2[a++]="08,10,51,52";Tregion2[a++]="20";Tregion2[a++]="971,972,973,974,975,976"; Tregion2[a++]="25,39,70,90";Tregion2[a++]="27,76";
	Tregion2[a++]="75,77,78,91,92,93,94,95";Tregion2[a++]="11,30,34,48,66";Tregion2[a++]="19,23,87";Tregion2[a++]="54,55,57,88";Tregion2[a++]="09,12,31,32,46,65,81,82";
	Tregion2[a++]="59,62";Tregion2[a++]="44,49,53,72,85";Tregion2[a++]="02,60,80";Tregion2[a++]="16,17,79,86";Tregion2[a++]="04,05,06,13,83,84";
	Tregion2[a++]="01,07,26,38,42,49,73,74";
	
			var j;
	for (j=objet.length-1; j>=0; j--) objet.options[j] = null;
	objet.options[0]=new Option("Choix d'une région","");
	for (a=1;a<Tregion.length;a++) {objet.options[a]=new Option(Tregion[a],Tregion2[a]);}
	}

function maj_depart(selection)
{
var tab = selection.split(/,/);
checkSet=eval("document.selection_ville.region");
for (i=0;i<checkSet.length;i++){
for (a=0;a<tab.length;a++){
if(checkSet[i].value==tab[a]){checkSet[i].checked=true;}}}
}

function suprime(nom) {
	resultat=confirm('Etes vous sûr(e) de vouloir supprimer cette photo ?');
	if (resultat=="1") {
		document.actualise.type.value="sup";
		document.actualise.file.value=nom;
		document.actualise.submit();
	}
}

function choix1(nom) {
	resultat=confirm('Etes vous sûr(e) de vouloir mettre cette photo en choix N°1 ?');
	if (resultat=="1") {
		document.actualise.type.value="chgmt";
		document.actualise.file.value=nom;
		document.actualise.submit();
	}
}

function supAnnonce(formulaire,num) {
	resultat=confirm("Etes vous sûr(e) de vouloir supprimer l'annonce "+num+" ?");
	if (resultat=="1") formulaire.submit();
}

function supAnnonce2(num) {
	resultat=confirm("Etes vous sûr(e) de vouloir supprimer cette annonce ?");
	if (resultat=="1") {
		document.supprime2.numAnnonce.value=num;
		document.supprime2.submit();
	}
}

function supAnnonce3(nbre) {
	resultat=confirm("Etes vous sûr(e) de vouloir supprimer ces "+nbre+" annonces ?");
	if (resultat=="1") document.form_supprime.submit();
}

function modif(formulaire,num)
{
formulaire.num.value=num;
formulaire.submit();
}

function plan_immo(num) {
	Modalbox.show("<IFRAME src='http://web-petitesannonces.fr/pages_lightBox/plan_immo.php?num="+num+"' scrolling=no width=100% height=470 frameborder=0 ></IFRAME>", {title: "Localiser le bien", width: 750, height: 530});
}

function geolocaliserObjet(num,rub) {
	Modalbox.show("<IFRAME src='http://web-petitesannonces.fr/pages_lightBox/plan_immo.php?num="+num+"&rub="+rub+"' scrolling=no width=100% height=470 frameborder=0 ></IFRAME>", {title: "Localisation sur une carte", width: 750, height: 530});
}

function plan(num)
{
Modalbox.show("<IFRAME src='http://web-petitesannonces.fr/pages_lightBox/plan.php?num="+num+"' scrolling=no width=100% height=470 frameborder=0 ></IFRAME><span class='liens-ar-12-bold' style='margin-left:20px;'><a href='javascript:Modalbox.hide()' title='Retour'>&raquo; Retour sur la page</a></span>", {title: "Plan d'acc&egrave;s", width: 750, height: 530});
}

function agenda(code) {
	Modalbox.show("<iframe frameborder='0' scrolling='no' width='690' height='500' src='http://www.isurf-media.com/site_pro/liaison_izi_agenda.php?agenda="+code+"'></iframe>", {title: "Agenda des disponibilités", width: 750, height: 550});
}

function calDisponibilite(annonce) {
	Modalbox.show("http://web-petitesannonces.fr/pages_lightBox/disponibilite.php?id="+annonce, {title: "Calendrier des disponibilités", width: 690, height: 650});
}

function mail(id,num)
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/mail.php?id='+id+'&num='+num, {title: "Contacter l'annonceur", width: 550});
}

function prevenir(id,num)
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/mail2.php?id='+id+'&num='+num, {title: "Pr&eacute;venir un ami", width: 550});
}

function contact()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/contact.php', {title: 'Nous contacter', width: 550});
}

function creat_compte()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/creat_compte.html', {title: "En savoir plus sur la cr&eacute;ation d'un compte", width: 650});
}

function abus(id,num)
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/abus.php?id='+id+'&num='+num, {title: 'Signaler un abus', width: 550});
}

function recup_identifiants()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/identifiants.html', {title: 'R&eacute;cup&eacute;ration de vos identifiants', width: 550});
}

function select_region()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/region.html', {title: 'Aide &agrave; la s&eacute;lection: r&eacute;gion(s) et d&eacute;partement(s)', width: 700});
}

function select_ville()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/villes.php', {title: 'Aide &agrave; la s&eacute;lection: ville(s)', width: 550});
}

function select_ville2()
{ 
Modalbox.show('http://web-petitesannonces.fr/pages_lightBox/villes.php?id=ville2', {title: "Aide &agrave; la s&eacute;lection d'une ville", width: 550});
}

function Rond(num,p) {
 p=Math.pow(10,p)
return Math.round(num*p)/p
}

function convert(sens) {
with(document.conv)
 if(sens==1)
francs.value=Rond(parseFloat(euros.value)*6.55957,2)
else
euros.value=Rond(parseFloat(francs.value)/6.55957,2)
}

function conditions(page)
{ NewWindow=window.open("http://web-petitesannonces.fr/conditions.html", "conditions", "height="+(screen.height-100)+",width=570,top=0,left=0,scrollbars=1");}

function test_description(valeur,objet)
{
if (valeur=="Tapez ici le texte de votre annonce !") {objet.value="";}
}

function test_description2(valeur,objet)
{
if (valeur=="Tapez ici des informations concernant votre établissement (présentation, emplacement, horaires d'ouverture, financement et autres particularités). 1000 caract Max.") {objet.value="";}
}

function majPays(objet,nbre)
{
a=nbre;

/* Ttype=new Array();
Ttype[a++]="Allemagne";Ttype[a++]="Andorre";Ttype[a++]="Autriche";Ttype[a++]="Belgique";Ttype[a++]="Canada";Ttype[a++]="Danemark";Ttype[a++]="Espagne";Ttype[a++]="Etats-Unis";
Ttype[a++]="France";Ttype[a++]="Grande Bretagne";Ttype[a++]="Grèce";Ttype[a++]="Italie";Ttype[a++]="Luxembourg";Ttype[a++]="Monaco";Ttype[a++]="Norvège";Ttype[a++]="Pays-Bas";
Ttype[a++]="Portugal";Ttype[a++]="Suède";Ttype[a++]="Suisse"; */
Ttype=new Array();
Ttype[a++]="Afghanistan";Ttype[a++]="Afrique du Sud";Ttype[a++]="Albanie";Ttype[a++]="Algérie";Ttype[a++]="Allemagne";
Ttype[a++]="Andorre";Ttype[a++]="Angola";Ttype[a++]="Antigua et Barbuda";Ttype[a++]="Arabie saoudite";Ttype[a++]="Argentine";Ttype[a++]="Arménie";
Ttype[a++]="Australie";Ttype[a++]="Autriche";Ttype[a++]="Azerbaïdjan";Ttype[a++]="Bahamas";Ttype[a++]="Bahrein";Ttype[a++]="Bangladesh";
Ttype[a++]="Barbade";Ttype[a++]="Belgique";Ttype[a++]="Bélize";Ttype[a++]="Benin";Ttype[a++]="Bermudes";Ttype[a++]="Bhoutan";
Ttype[a++]="Biélorussie";Ttype[a++]="Bolivie";Ttype[a++]="Bosnie-Herzégovine";Ttype[a++]="Botswana";Ttype[a++]="Brésil";Ttype[a++]="Brunei";
Ttype[a++]="Bulgarie";Ttype[a++]="Burkina Faso";Ttype[a++]="Burundi";Ttype[a++]="Cambodge";Ttype[a++]="Cameroun";Ttype[a++]="Canada";
Ttype[a++]="Cap Vert";Ttype[a++]="Centrafrique";Ttype[a++]="Chili";Ttype[a++]="Chine";Ttype[a++]="Chypre";
Ttype[a++]="Colombie";Ttype[a++]="Comores";Ttype[a++]="Congo démocratique";Ttype[a++]="Congo";Ttype[a++]="Corée du Nord";Ttype[a++]="Corée du Sud";
Ttype[a++]="Costa Rica";Ttype[a++]="Côte d'Ivoire";Ttype[a++]="Croatie";Ttype[a++]="Cuba";Ttype[a++]="Danemark";
Ttype[a++]="Djibouti";Ttype[a++]="Dominique";Ttype[a++]="Egypte";Ttype[a++]="Emirats Arabes Unis";Ttype[a++]="Equateur";Ttype[a++]="Erythrée";
Ttype[a++]="Espagne";Ttype[a++]="Estonie";Ttype[a++]="Etats-Unis";Ttype[a++]="Ethiopie";Ttype[a++]="Féroé (îles)";Ttype[a++]="Fidji";
Ttype[a++]="Finlande";Ttype[a++]="France";Ttype[a++]="Gabon";Ttype[a++]="Gambie";Ttype[a++]="Géorgie";Ttype[a++]="Ghana";Ttype[a++]="Grande Bretagne";Ttype[a++]="Grèce";
Ttype[a++]="Grenade";Ttype[a++]="Groenland";Ttype[a++]="Guadeloupe";Ttype[a++]="Guatémala";Ttype[a++]="Guinée";Ttype[a++]="Guinée Bissau";
Ttype[a++]="Guinée équatoriale";Ttype[a++]="Guyana";Ttype[a++]="Guyane";Ttype[a++]="Haïti";Ttype[a++]="Honduras";Ttype[a++]="Hong Kong";
Ttype[a++]="Hongrie";Ttype[a++]="Ile Maurice";Ttype[a++]="Iles Anglo normandes";Ttype[a++]="Iles Cayman";Ttype[a++]="Inde";Ttype[a++]="Indonésie";Ttype[a++]="Irak";Ttype[a++]="Iran";
Ttype[a++]="Irlande";Ttype[a++]="Islande";Ttype[a++]="Israël";Ttype[a++]="Italie";Ttype[a++]="Jamaïque";Ttype[a++]="Japon";
Ttype[a++]="Jordanie";Ttype[a++]="Kazakhstan";Ttype[a++]="Kenya";Ttype[a++]="Kirghizstan";Ttype[a++]="Kiribati";Ttype[a++]="Koweït";
Ttype[a++]="Laos";Ttype[a++]="Lesotho";Ttype[a++]="Lettonie";Ttype[a++]="Liban";Ttype[a++]="Liberia";Ttype[a++]="Libye";
Ttype[a++]="Liechtenstein";Ttype[a++]="Lituanie";Ttype[a++]="Luxembourg";Ttype[a++]="Macao";Ttype[a++]="Macédoine";Ttype[a++]="Madagascar";
Ttype[a++]="Malaisie";Ttype[a++]="Malawi";Ttype[a++]="Maldives";Ttype[a++]="Mali";Ttype[a++]="Malte";Ttype[a++]="Maroc";
Ttype[a++]="Marshall";Ttype[a++]="Martinique";Ttype[a++]="Mauritanie";Ttype[a++]="Mexique";Ttype[a++]="Micronésie";
Ttype[a++]="Moldavie";Ttype[a++]="Monaco";Ttype[a++]="Mongolie";Ttype[a++]="Monténégro";Ttype[a++]="Mozambique";Ttype[a++]="Myanmar (Birmanie)";
Ttype[a++]="Namibie";Ttype[a++]="Nauru";Ttype[a++]="Népal";Ttype[a++]="Nicaragua";Ttype[a++]="Niger";Ttype[a++]="Nigeria";
Ttype[a++]="Norvège";Ttype[a++]="Nouvelle Calédonie";Ttype[a++]="Nouvelle Zélande";Ttype[a++]="Oman";Ttype[a++]="Ouganda";Ttype[a++]="Ouzbekistan";
Ttype[a++]="Pakistan";Ttype[a++]="Palau";Ttype[a++]="Palestine";Ttype[a++]="Panama";Ttype[a++]="Papouasie-Nouvelle Guinée";Ttype[a++]="Paraguay";
Ttype[a++]="Pays-Bas";Ttype[a++]="Pérou";Ttype[a++]="Philippines";Ttype[a++]="Pologne";Ttype[a++]="Polynésie";Ttype[a++]="Porto Rico";Ttype[a++]="Portugal";
Ttype[a++]="Qatar";Ttype[a++]="République Dominicaine";Ttype[a++]="Réunion";Ttype[a++]="Roumanie";Ttype[a++]="Russie";
Ttype[a++]="Rwanda";
Ttype[a++]="Sahara Occidental";Ttype[a++]="Saint Christophe et Nevis";Ttype[a++]="Saint Marin";Ttype[a++]="Saint Vincent et les Grenadines";
Ttype[a++]="Sainte Lucie";Ttype[a++]="Salomon";Ttype[a++]="Salvador";Ttype[a++]="Samoa";Ttype[a++]="São Tomé et Príncipe";Ttype[a++]="Sénégal";
Ttype[a++]="Serbie";Ttype[a++]="Seychelles";Ttype[a++]="Sierra Leone";Ttype[a++]="Singapour";Ttype[a++]="Slovaquie";Ttype[a++]="Slovénie";
Ttype[a++]="Somalie";Ttype[a++]="Somaliland";Ttype[a++]="Soudan";Ttype[a++]="Sri Lanka";Ttype[a++]="Suède";Ttype[a++]="Suisse";
Ttype[a++]="Surinam";Ttype[a++]="Syrie";Ttype[a++]="Swaziland";Ttype[a++]="Tadjikistan";Ttype[a++]="Taïwan";Ttype[a++]="Tanzanie";
Ttype[a++]="Tchad";Ttype[a++]="Tchéquie";Ttype[a++]="Thaïlande";Ttype[a++]="Tibet";Ttype[a++]="Timor Oriental";Ttype[a++]="Togo";
Ttype[a++]="Tonga";Ttype[a++]="Trinité et Tobago";Ttype[a++]="Tunisie";Ttype[a++]="Turkmenistan";Ttype[a++]="Turquie";Ttype[a++]="Tuvalu";
Ttype[a++]="Ukraine";Ttype[a++]="Uruguay";Ttype[a++]="Vanuatu";Ttype[a++]="Vatican";Ttype[a++]="Vénézuéla";Ttype[a++]="Vietnam";
Ttype[a++]="Vierges américaines";Ttype[a++]="Yémen";Ttype[a++]="Zambie";Ttype[a++]="Zimbabwe";

for (a=nbre;a<Ttype.length;a++) {objet.options[a]=new Option(Ttype[a],Ttype[a]);}
}

function majPays2(objet,nbre)
{
a=nbre;

Ttype=new Array();
Ttype[a++]="Afghanistan";Ttype[a++]="Afrique du Sud";Ttype[a++]="Albanie";Ttype[a++]="Algérie";Ttype[a++]="Allemagne";
Ttype[a++]="Andorre";Ttype[a++]="Angola";Ttype[a++]="Antigua et Barbuda";Ttype[a++]="Arabie saoudite";Ttype[a++]="Argentine";Ttype[a++]="Arménie";
Ttype[a++]="Australie";Ttype[a++]="Autriche";Ttype[a++]="Azerbaïdjan";Ttype[a++]="Bahamas";Ttype[a++]="Bahrein";Ttype[a++]="Bangladesh";
Ttype[a++]="Barbade";Ttype[a++]="Belgique";Ttype[a++]="Bélize";Ttype[a++]="Benin";Ttype[a++]="Bermudes";Ttype[a++]="Bhoutan";
Ttype[a++]="Biélorussie";Ttype[a++]="Bolivie";Ttype[a++]="Bosnie-Herzégovine";Ttype[a++]="Botswana";Ttype[a++]="Brésil";Ttype[a++]="Brunei";
Ttype[a++]="Bulgarie";Ttype[a++]="Burkina Faso";Ttype[a++]="Burundi";Ttype[a++]="Cambodge";Ttype[a++]="Cameroun";Ttype[a++]="Canada";
Ttype[a++]="Cap Vert";Ttype[a++]="Centrafrique";Ttype[a++]="Chili";Ttype[a++]="Chine";Ttype[a++]="Chypre";
Ttype[a++]="Colombie";Ttype[a++]="Comores";Ttype[a++]="Congo démocratique";Ttype[a++]="Congo";Ttype[a++]="Corée du Nord";Ttype[a++]="Corée du Sud";
Ttype[a++]="Costa Rica";Ttype[a++]="Côte d'Ivoire";Ttype[a++]="Croatie";Ttype[a++]="Cuba";Ttype[a++]="Danemark";
Ttype[a++]="Djibouti";Ttype[a++]="Dominique";Ttype[a++]="Egypte";Ttype[a++]="Emirats Arabes Unis";Ttype[a++]="Equateur";Ttype[a++]="Erythrée";
Ttype[a++]="Espagne";Ttype[a++]="Estonie";Ttype[a++]="Etats-Unis";Ttype[a++]="Ethiopie";Ttype[a++]="Féroé (îles)";Ttype[a++]="Fidji";
Ttype[a++]="Finlande";Ttype[a++]="France";Ttype[a++]="Gabon";Ttype[a++]="Gambie";Ttype[a++]="Géorgie";Ttype[a++]="Ghana";Ttype[a++]="Grande Bretagne";Ttype[a++]="Grèce";
Ttype[a++]="Grenade";Ttype[a++]="Groenland";Ttype[a++]="Guadeloupe";Ttype[a++]="Guatémala";Ttype[a++]="Guinée";Ttype[a++]="Guinée Bissau";
Ttype[a++]="Guinée équatoriale";Ttype[a++]="Guyana";Ttype[a++]="Guyane";Ttype[a++]="Haïti";Ttype[a++]="Honduras";Ttype[a++]="Hong Kong";
Ttype[a++]="Hongrie";Ttype[a++]="Ile Maurice";Ttype[a++]="Iles Anglo normandes";Ttype[a++]="Iles Cayman";Ttype[a++]="Inde";Ttype[a++]="Indonésie";Ttype[a++]="Irak";Ttype[a++]="Iran";
Ttype[a++]="Irlande";Ttype[a++]="Islande";Ttype[a++]="Israël";Ttype[a++]="Italie";Ttype[a++]="Jamaïque";Ttype[a++]="Japon";
Ttype[a++]="Jordanie";Ttype[a++]="Kazakhstan";Ttype[a++]="Kenya";Ttype[a++]="Kirghizstan";Ttype[a++]="Kiribati";Ttype[a++]="Koweït";
Ttype[a++]="Laos";Ttype[a++]="Lesotho";Ttype[a++]="Lettonie";Ttype[a++]="Liban";Ttype[a++]="Liberia";Ttype[a++]="Libye";
Ttype[a++]="Liechtenstein";Ttype[a++]="Lituanie";Ttype[a++]="Luxembourg";Ttype[a++]="Macao";Ttype[a++]="Macédoine";Ttype[a++]="Madagascar";
Ttype[a++]="Malaisie";Ttype[a++]="Malawi";Ttype[a++]="Maldives";Ttype[a++]="Mali";Ttype[a++]="Malte";Ttype[a++]="Maroc";
Ttype[a++]="Marshall";Ttype[a++]="Martinique";Ttype[a++]="Mauritanie";Ttype[a++]="Mexique";Ttype[a++]="Micronésie";
Ttype[a++]="Moldavie";Ttype[a++]="Monaco";Ttype[a++]="Mongolie";Ttype[a++]="Monténégro";Ttype[a++]="Mozambique";Ttype[a++]="Myanmar (Birmanie)";
Ttype[a++]="Namibie";Ttype[a++]="Nauru";Ttype[a++]="Népal";Ttype[a++]="Nicaragua";Ttype[a++]="Niger";Ttype[a++]="Nigeria";
Ttype[a++]="Norvège";Ttype[a++]="Nouvelle Calédonie";Ttype[a++]="Nouvelle Zélande";Ttype[a++]="Oman";Ttype[a++]="Ouganda";Ttype[a++]="Ouzbekistan";
Ttype[a++]="Pakistan";Ttype[a++]="Palau";Ttype[a++]="Palestine";Ttype[a++]="Panama";Ttype[a++]="Papouasie-Nouvelle Guinée";Ttype[a++]="Paraguay";
Ttype[a++]="Pays-Bas";Ttype[a++]="Pérou";Ttype[a++]="Philippines";Ttype[a++]="Pologne";Ttype[a++]="Polynésie";Ttype[a++]="Porto Rico";Ttype[a++]="Portugal";
Ttype[a++]="Qatar";Ttype[a++]="République Dominicaine";Ttype[a++]="Réunion";Ttype[a++]="Roumanie";Ttype[a++]="Russie";
Ttype[a++]="Rwanda";
Ttype[a++]="Sahara Occidental";Ttype[a++]="Saint Christophe et Nevis";Ttype[a++]="Saint Marin";Ttype[a++]="Saint Vincent et les Grenadines";
Ttype[a++]="Sainte Lucie";Ttype[a++]="Salomon";Ttype[a++]="Salvador";Ttype[a++]="Samoa";Ttype[a++]="São Tomé et Príncipe";Ttype[a++]="Sénégal";
Ttype[a++]="Serbie";Ttype[a++]="Seychelles";Ttype[a++]="Sierra Leone";Ttype[a++]="Singapour";Ttype[a++]="Slovaquie";Ttype[a++]="Slovénie";
Ttype[a++]="Somalie";Ttype[a++]="Somaliland";Ttype[a++]="Soudan";Ttype[a++]="Sri Lanka";Ttype[a++]="Suède";Ttype[a++]="Suisse";
Ttype[a++]="Surinam";Ttype[a++]="Syrie";Ttype[a++]="Swaziland";Ttype[a++]="Tadjikistan";Ttype[a++]="Taïwan";Ttype[a++]="Tanzanie";
Ttype[a++]="Tchad";Ttype[a++]="Tchéquie";Ttype[a++]="Thaïlande";Ttype[a++]="Tibet";Ttype[a++]="Timor Oriental";Ttype[a++]="Togo";
Ttype[a++]="Tonga";Ttype[a++]="Trinité et Tobago";Ttype[a++]="Tunisie";Ttype[a++]="Turkmenistan";Ttype[a++]="Turquie";Ttype[a++]="Tuvalu";
Ttype[a++]="Ukraine";Ttype[a++]="Uruguay";Ttype[a++]="Vanuatu";Ttype[a++]="Vatican";Ttype[a++]="Vénézuéla";Ttype[a++]="Vietnam";
Ttype[a++]="Vierges américaines";Ttype[a++]="Yémen";Ttype[a++]="Zambie";Ttype[a++]="Zimbabwe";

for (a=nbre;a<Ttype.length;a++) {objet.options[a]=new Option(Ttype[a],Ttype[a]);}
}

function convert_prix(choix,debut,fin)
{
var i;
var j;
Expression = new RegExp("(&?devise[=][a-z]+)","gi");
checkSet=eval(document.getElementsByName("lienPagination"));
Expression2 = new RegExp("html[?]","gi");

for (i=0;i<checkSet.length;i++) {
	chaine=checkSet[i].href;
	chaine=chaine.replace(Expression,"");
	if (choix=='franc') {
		if (!Expression2.test(chaine)) chaine+="?"; else chaine+="&";
		checkSet[i].href=chaine+"devise="+choix;
	} else checkSet[i].href=chaine;
}

checkSet=eval(document.getElementsByName("devise"));
for (i=0;i<checkSet.length;i++) checkSet[i].value=choix;

		if (choix=="franc") {
			document.getElementById('trifranc').style.display='none';
			document.getElementById('trifranc2').style.display='block';
			document.getElementById('trieuro').style.display='block';
			document.getElementById('trieuro2').style.display='none';
		}
		if (choix=="euro") {
			document.getElementById('trifranc').style.display='block';
			document.getElementById('trifranc2').style.display='none';
			document.getElementById('trieuro').style.display='none';
			document.getElementById('trieuro2').style.display='block';
		}

for (j=debut;j<fin;j++)
{
	if (document.getElementById('prix_euro'+j)) {
		if (choix=="franc") {
			document.getElementById('prix_euro'+j).style.display='none';
			document.getElementById('prix_franc'+j).style.display='block';
		}
		if (choix=="euro") {
			document.getElementById('prix_euro'+j).style.display='block';
			document.getElementById('prix_franc'+j).style.display='none';
		}
	}
}

}


function ChercheRef()
{
	if ( document.getElementById('ref').style.display=='none' ) { document.getElementById('ref').style.display='block'; }
	else { document.getElementById('ref').style.display='none'; }
}

function ValidChercheRef()
{
	if ( document.ChercheRef.rubrique.value=="" ) { alert ("Choisissez une rubrique !"); }
	else { 	if ( document.ChercheRef.ref.value=="" ) { alert ("Indiquez une référence !"); }
		else {
		switch (document.ChercheRef.rubrique.value) {
			case'1': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/vehicules.php?num="+document.ChercheRef.ref.value;
			break;
			case'2': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/deuxroues.php?num="+document.ChercheRef.ref.value;
			break;
			case'3': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/nautisme.php?num="+document.ChercheRef.ref.value;
			break;
			case'4': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/immo.php?num="+document.ChercheRef.ref.value;
			break;
			case'5': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/animaux.php?num="+document.ChercheRef.ref.value;
			break;
			case'6': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/musique.php?num="+document.ChercheRef.ref.value;
			break;
			case'7': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/services.php?num="+document.ChercheRef.ref.value;
			break;
			case'8': document.location.href="http://web-petitesannonces.fr/pages/result_recherche/affaires.php?num="+document.ChercheRef.ref.value;
			break;
			}
		}
			}
}