//*******************************************************
// Fonction ajax commune
//*******************************************************

 function ajax(url,cible) {

        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        

        if (!http_request) {
            alert('Abandon :( Impossible de créer une instance XMLHTTP');
            return false;
        }
		
        http_request.onreadystatechange = function() { alertContents(http_request, cible); };
        http_request.open('GET', url, true);
        http_request.send(null);
	
    }
    
function alertContents(http_request, cible) {
		document.getElementById(cible).innerHTML = "<center><img src=\"images/indicator.gif\" /></center>";
        if (http_request.readyState == 4) {
            //if (http_request.status == 200) {
           	
				document.getElementById(cible).innerHTML = http_request.responseText;
				
            //} else {
            
              //  alert('Un problème est survenu avec la requête.' + http_request.status);
                
            //}
        }

    }
    
//************************************************


function choixville(dept, ville, cp, numville, pays) {
	document.getElementById("cp").value = cp;
	document.getElementById("ville").value = ville;
	document.getElementById("dept").value = dept;
	document.getElementById("numville").value = numville;
	document.getElementById("repcp").className = 'repcp_off';
}

function rechCp() {
	CP = document.getElementById("cp").value;
	if(CP.length > 2) {
		url = "system/ajax/recherche_cp.asp?cp="+CP;
		cible = "repcp";
		ajax(url,cible);		
		//document.getElementById("repcp").style.visibility = "visible";
		document.getElementById("repcp").className = 'repcp_on';
	}
}


//************************************************
// Fonctions javaScript pour gestion des tags
//************************************************

function listeTag() {
	tag = document.getElementById("taglib").value;
	typetag = document.getElementById("tt").value;
	iditem = document.getElementById("it").value;
	url = "system/ajax/tag_liste.asp?iditem="+iditem+"&tt="+typetag+"&tag="+tag;
	cible = "reptag";
	ajax(url,cible);
	document.getElementById("reptag").style.visibility = "visible";

}

function liaisonTag(idtag,item,typetag) {
	url = "system/ajax/modif_liaison_tag.asp?td=liaison&typetag="+typetag+"&item="+item+"&idtag="+idtag;
	cible = "liste_tag";
	ajax(url,cible);
}
  
function ajoutTag() {
	
	try {
		tag = document.getElementById("taglib").value;
		typetag = document.getElementById("tt").value;
		iditem = document.getElementById("it").value;
	}
	
	catch(e) {
		alert("une erreur s'est produite");
	}
	
	url = "system/ajax/modif_liaison_tag.asp?td=ajouttag&typetag="+typetag+"&item="+iditem+"&tag="+ tag;
	cible = "liste_tag";
	ajax(url,cible);
}
  
function supprTag(i) {
	url = "system/ajax/modif_tag_suppr.asp?idtag="+i;
	cible = "liste_tag";
	ajax(url,cible);
}

function supprLiaisonTag(idtag,item,typetag) {
	url = "system/ajax/modif_liaison_tag.asp?td=supprliaison&typetag="+typetag+"&item="+item+"&idtag="+idtag;
	cible = "liste_tag";
	ajax(url,cible);
}

/**
*   Permet d'ouvrir et de fermer le formulaire de contact
**/

function OpenFormContact()
{
   if ( document.getElementById('form_contact').style.visibility == 'visible') {
        document.getElementById('form_contact').style.visibility = 'hidden';
        //document.getElementById('form_contact').style.display = 'block';
   }
   else {
        document.getElementById('form_contact').style.visibility = 'visible';
        //document.getElementById('form_contact').style.display = 'block';
   }   
       
}

/*
*   Envoi du mail en AJAX pour les contacts
*/
function EnvoiMailAjax(mail,nom,prenom,commentaire,destinataire,IDItem)
{
    url = "system/ajax/envoi_mail_contact.asp?mail="+mail+"&prenom="+prenom+"&nom="+nom+"&commentaire="+commentaire+"&destinataire="+destinataire+"&IDItem="+IDItem;
	cible = "form_contact";
	ajax(url,cible);
}

/*
*   Favoris
*/
function favoris(url,nom) {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel(nom,url,""); }
else { window.external.AddFavorite(url,nom); } }

/*
*   Gestion > mode_connecte >  Critete_thematique
*/
function CritereThematique(IDItem,IDThematiqueCritere,cible)
{
     
     url = "system/ajax/critere_thematique.asp?IDItem="+IDItem+"&IDThematiqueCritere="+IDThematiqueCritere ;
	 ajax(url,cible);
	 
}

/*
*   Gestion > mode_connecte > CritereFiche
*/
function CritereFicheThematique(IDItemFiche,IDThematiqueCritereFiche)
{

    url = "system/ajax/critere_fiche_thematique.asp?IDItemFiche="+IDItemFiche+"&IDThematiqueCritereFiche="+IDThematiqueCritereFiche ;
    cible = 'load';
    ajax(url,cible);
    
}

/*
*   Activer les recommandations d'un formulaire
*/
function ActiveRecommandation(form) {

    var champ=document.getElementById(form).getElementsByTagName('input');
    for(i=0;i != champ.length;i++){    
        if (champ[i].title.length > 0)
        {
          champ[i].onfocus=function(){this.nextSibling.style.display='inline'};
          champ[i].onblur=function(){this.nextSibling.style.display='none'};  
        }    
    }
}

/**
*   Selection Utilisateur
*/
function AjoutSelection(IDItem)
{
    url = "system/ajax/ajout_selection.asp?IDItem="+IDItem ;
    cible = 'selection';
    ajax(url,cible); 
}

/*
*   Vide une sélection
*/
function VideSelection(msg)
{
    if (confirm(msg)) 
    {
        url = "system/ajax/suppr_selection.asp" ;
        cible = 'selection';
        ajax(url,cible); 
    }
}

/*
*   Supprime une selection
*/
function SupprSelection(IDItem,msg)
{
  
  if (confirm(msg))
  {
    url = "system/ajax/suppr_item_selection.asp?IDItem=" + IDItem ;
    cible = 'selection';
    ajax(url,cible); 
  }
  
}

/*
*   Affichage des selections !
*/
function AfficheSelection()
{
    url = "system/ajax/affiche_selection.asp";
    cible = 'selection';
    ajax(url,cible); 
}

/**
*   AfficheMesPlans
**
*/
function AfficheMesPlans()
{
   url = "system/ajax/affiche_mes_plans.asp";
    cible = 'plan-vacances';
    ajax(url,cible);  
}

/**
**  Suppression d'un plan vacances
**/
function SupprPlanVacances(PlanVacances,msg)
{
   if (confirm(msg))
  {
    url = "system/ajax/suppr_plan_vacances.asp?PlanVacances=" + PlanVacances ;
    cible = 'plan-vacances';
    ajax(url,cible); 
  } 
}

/**
*   Recharche la selection apres un drag & drop
**/
function ReloadSelection()
{
    url = "system/ajax/reload_selection.asp";
    cible = 'votre_selection';
    ajax(url,cible); 
}
function AppearGroupeItem(id)
{ 
    if ( document.getElementById(id).className == 'cache_groupe')
    {
        document.getElementById(id).className = 'montre_groupe';
    }
    else 
    {
        document.getElementById(id).className = 'cache_groupe';
    }
}

/*
*   Fonction pour remplacer
*/
function Remplace(expr,a,b) {

  var i=0
  while (i!=-1) {
     i=expr.indexOf(a,i);
     if (i>=0) {
        expr=expr.substring(0,i)+b+expr.substring(i+a.length);
        i+=b.length;
     }
  }
  return expr
}

/*
*   Rechercher ma sélectionner
*/
function EnregistrerMonPlan(DateJournee)
{
    if ( DateJournee != '*')
    {
        total = 0;
        
        //|| Serialize matin
        serial = $.SortSerialize('matin');
	    if  ( serial.hash == '' )
	    {
	        total += 1;
	    }
	    
	    serial = $.SortSerialize('midi');
	    if  ( serial.hash == '' )
	    {
	        total += 1;
	    }
	    
	    serial = $.SortSerialize('aprem');
	    if  ( serial.hash == '' )
	    {
	        total += 1;
	    }
	    
	    serial = $.SortSerialize('soiree');
	    if  ( serial.hash == '' )
	    {
	        total += 1;
	    }
	    
	    serial = $.SortSerialize('nuit');
	    if  ( serial.hash == '' )
	    {
	        total += 1;
	    }
	    
	    //|| Generation ou pas
	    if ( total == 5 )
	    {
	        alert('Veuillez glisser/déposer vos établissements !');
	    }
	    else 
	    {  
	        var reg=new RegExp("&","");
	        
	       //|| Matin
	       serial = $.SortSerialize('matin');
	       Matin = serial.hash;	
	       Matin = Remplace(Matin,'&',',');
	       
	       //|| Midi
	       serial = $.SortSerialize('midi');
	       Midi = serial.hash;
	       Midi = Remplace(Midi,'&',',');
	       
	       //|| Aprem
	       serial = $.SortSerialize('aprem');
	       Aprem = serial.hash;
	       Aprem = Remplace(Aprem,'&',',');	    
	       
	       //|| Soirée
	       serial = $.SortSerialize('soiree');
	       Soiree = serial.hash;
	       Soiree = Remplace(Soiree,'&',',');	  	      
	      	       
	       //|| Nuit
	       serial = $.SortSerialize('nuit');
	       Nuit = serial.hash;
	       Nuit = Remplace(Nuit,'&',',');	      
	     	       
	       url = "system/ajax/generation_plan_vacances.asp?DateJournee=" + DateJournee +"&Matin=" + Matin + "&Midi=" + Midi  + "&Aprem=" + Aprem + "&Soiree=" + Soiree + "&Nuit=" + Nuit ;
           cible = 'generation';
           ajax(url,cible);         
	    }
	        
    }
    else 
    {
        alert('Veuillez renseigner une date ou un nom !');
    }
}


/*
*
*   Destination SELECT
*/
function destination(value)
{
    if ( value != '*' ) 
    {
        document.location.href = value;
    }
}

/*
**  JavaScript Menu
*/
function RollovMenu(id,className)
{
    document.getElementById(id).className = className;
}

/*
*   Affiche le contact des amis
*/
function AfficheContactAmi()
{
    document.getElementById('ami_plan_vacances').style.visibility = 'visible';
}

function  CacheContactAmi()
{
    document.getElementById('ami_plan_vacances').style.visibility = 'hidden';   
}


/**
**  Envoi d'un plan-vacances à un ami
**/
function EnvoiPlanVacances(mail,plan,pseudo)
{
   if ( mail!= '' )  
  {
    //||Verification de l'email
    email = mail;
    var maReg = new RegExp ( "^\\w[\\w+\.\-]*@[\\w\-]+\.\\w[\\w+\.\-]*\\w$", "gi" ) ;
    
    if ( email.search(maReg) == -1 ){
        alert('Adresse email invalide !')  
    }
    else
    {
        url = "system/ajax/envoi_plan_vacances.asp?mail=" + mail +"&plan="+plan+"&pseudo="+pseudo;
        cible = 'debug';
        ajax(url,cible); 
        alert('Email envoyé avec succès !\nIl se peut que cet email soit considéré comme indésirable.\nDemandez à votre correspondant de vérifier.\nMerci')    
    }
   
  } 
}



//*************************************************
//<![CDATA[ 

var map = null; 
var geocoder = null; 

function load() { 
  if (GBrowserIsCompatible()) { 
    map = new GMap2(document.getElementById("map")); 
    map.setCenter(new GLatLng(48.9, 2.3), 7); 
    map.addControl(new GSmallMapControl()); 
    map.addControl(new GMapTypeControl()); 
    geocoder = new GClientGeocoder(); 
  }
} 

function afficherAdresse(address) { 
  if (geocoder) { 
    geocoder.getLatLng( 
      address, 
      function(point) { 
        if (!point) { 
          
        } else { 
          map.setCenter(point, 13); 
          var marker = new GMarker(point); 
          map.addOverlay(marker); 
          marker.openInfoWindowHtml(address); 
        } 
      } 
    ); 
  } 
} 
//]]> 

function flash(tag) {
    document.write(tag);
}

function verifMailContact() {
   str = document.getElementById("email2").value;
   if ((str.indexOf(".") > 2) && (str.indexOf("@") > 0)) {
	return true;
   } else {
	alert("Votre email ne semble pas valide");
	return false;
   }
}


/*--------------------------------------------------------------*/
//		Formulaire d'inscription

// variable globale
FormInscriptOk = 0;

function verifFormInscript() {
	message = "";
	FormInscriptOk = 0;
	
	// partie utilisateur
	nom = document.getElementById("u_nom").value;				// obligatoire
	prenom = document.getElementById("u_prenom").value;			// obligatoire
	adresse = document.getElementById("u_adresse").value;		// obligatoire
	cp = document.getElementById("u_cp").value;					// obligatoire
	ville = document.getElementById("u_ville").value;			// obligatoire
	tel1 = document.getElementById("u_tel").value;				
	email = document.getElementById("u_mail").value;			// obligatoire
	
	// partie item
	libelle = document.getElementById("i_libelle").value;		// obligatoire
	adresse2 = document.getElementById("i_adresse2").value;		// obligatoire
	codepostal = document.getElementById("cp").value;			// obligatoire
	i_ville = document.getElementById("ville").value;			// obligatoire
	tel = document.getElementById("i_tel").value;
	fax = document.getElementById("i_fax").value;
	portable = document.getElementById("i_portable").value;
	i_email = document.getElementById("i_email").value;
	site = document.getElementById("i_site").value;
	numville = document.getElementById("numville").value;		// obligatoire
	dept = document.getElementById("dept").value;				// obligatoire
	
	// vérification de champs obligatoires
	verifChampObli(nom,document.getElementById("u_nom"));
	verifChampObli(prenom,document.getElementById("u_prenom"));
	verifChampObli(adresse,document.getElementById("u_adresse"));
	verifChampObli(cp,document.getElementById("u_cp"));
	verifChampObli(ville,document.getElementById("u_ville"));
	verifChampObli(email,document.getElementById("u_mail"));
	
	verifChampObli(libelle,document.getElementById("i_libelle"));
	verifChampObli(adresse2,document.getElementById("i_adresse2"));
	verifChampObli(codepostal,document.getElementById("cp"));
	verifChampObli(i_ville,document.getElementById("ville"));
	verifChampObli(numville,document.getElementById("numville"));
	verifChampObli(dept,document.getElementById("dept"));
	
	
	
	
	// verification spécifique pour champs thématiques
	theme = document.getElementById("theme").value;
	if (theme != 6) {
		try {
			stheme = document.getElementById("stheme").value;
		}
		catch(e) {
			stheme = "";
		}
	}
	if (theme == "*") {
		document.getElementById("theme").style.backgroundColor = '#FFEC90';
		FormInscriptOk = 1;
	} else {
		document.getElementById("theme").style.backgroundColor = '#FFFFFF';
	}
	
	// verification si radio present est cliqué
	Vu = document.inscription.present[0].status;
	PasVu = document.inscription.present[1].status;
	if((Vu == false) && (PasVu == false)) {
		document.getElementById("TabPresent").style.backgroundColor = '#FFEC90';
		FormInscriptOk = 1;
	} else {
		document.getElementById("TabPresent").style.backgroundColor = '#FFFFFF';
	}
	
	// vérification si radio choix offres est cliqué
	Gratuit = document.inscription.offre[0].status;
	
	// test des offres payantes
		Payant = document.inscription.offre[1].status;
	
	if(Payant == false) {
		Payant = document.inscription.offre[2].status;
	}
	if(Payant == false) {
		Payant = document.inscription.offre[3].status;
	}
	
	if((Payant == false) && (Gratuit == false)) {
		document.getElementById("TabOffre").style.backgroundColor = '#FFEC90';
		document.getElementById("TabOffre1").style.backgroundColor = '#FFEC90';
		message += "- Vous devez choisir une des offres. <br />"
		FormInscriptOk = 1;
		
	} else {
		document.getElementById("TabOffre").style.backgroundColor = '#FFFFFF';
		document.getElementById("TabOffre1").style.backgroundColor = '#FFFFFF';
		
	}
	
	
	
	if (FormInscriptOk == 0) {
		
	} else {
		 message += "- Il manque des renseignements pour que votre inscription soit prise en compte. Les champs colorés sont obligatoires.<br />"
	}
	
	// vérification de la validité du mail
	if (emailOK(email) == 0) {
		message += "- Votre adresse email n'est pas valide.<br />"
		document.getElementById("u_mail").style.backgroundColor = "#FFEC90";
	} else {
		document.getElementById("u_mail").style.backgroundColor = "#FFFFFF";
	}
	
	
	// vérification des conditions
	if (document.getElementById("condition").checked == false) {
		message += "- Vous devez accepter les conditions générales d'utilisation"
		FormInscriptOk = 1;
	}
	
	if (FormInscriptOk == 0) {
		document.inscription.submit();
	}
	
	document.getElementById("reponseForm").innerHTML = message;
}


function verifChampObli(val,obj) {
	if (val.length == 0) {
		obj.style.backgroundColor = '#FFEC90';
		FormInscriptOk = 1;
	} else {
		obj.style.backgroundColor = 'white';
	}
}

function voirSousTheme() {
	theme = document.getElementById("theme").value;
	if(theme!=6) {
		url = "system/ajax/listeSousTheme.asp?theme="+theme;
		document.getElementById("tdStheme").innerHTML = "Thématique:"
		ajax(url,'dStheme');
	} else {
		document.getElementById("tdStheme").innerHTML = ""
		document.getElementById("dStheme").innerHTML = ""
	}
}



function checkEmail(emailAddr) {
	// Cette fonction vérifie la bon format d'une adresse e-mail.
	// Comme :
	// user@domain.com ou user.perso@domain.com
	
	var i;
	
	// Recherche de @
	i = emailAddr.indexOf("@");
	if (i == -1) {
		return false;
	}
	
	// Séparation du nom de l'utilisateur et du nom de domaine.
	var username = emailAddr.substring(0, i);
	var domain = emailAddr.substring(i + 1, emailAddr.length)

	// Recherche des espaces au début du nom de l'utilisateur.
	i = 0;
	while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
		i++;
	}
	// Les enlève s'il en trouve.
	if (i > 0) {
		username = username.substring(i, username.length);
	}

	// Recherche d'espaces à la fin du nom de domaine.
	i = domain.length - 1;
	while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
		i--;
	}
	// Les enlève s'il en trouve.
	if (i < (domain.length - 1)) {
		domain = domain.substring(0, i + 1);
	}

	// Vérifie que le nom de l'utilisateur et du domaine ne soit pas vide.
	if ((username == "") || (domain == "")) {
		return false;
	}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
	var ch;
	for (i = 0; i < username.length; i++) {
		ch = (username.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}

// Ajouter ci-dessous de nouveaux noms de domaine.
// Voir tous les noms de domaine sur http://www.toulouse-renaissance.net/c_outils/c-nom-domaine.htm
//
var aSuffix = new Array("com","net","int","aero","biz","museum","name","info","coop","pro","eu","edu","org","gov","mil","bj","dz","de","ad","be","ca","bf","bi","cm","cf","cg","cd","ci","dj","fr","ga","gp","gf","lu","mg","ml","ma","mq","mr","mc","nc","pf","re","pm","sn","ch","td","tf","tn");
	var bFoundSuffix = false;
	i = 0;
	while (i < aSuffix.length) {
		if (("." + aSuffix[i]) == domain.substring(domain.length - aSuffix[i].length - 1, domain.length)) {
			return true;
		}
		i++;
	}
	// Si le nom de domaine est inconnu  : return false
	return false;
	
}	
	

function emailOK(emailAddr) {
	if (!(checkEmail(emailAddr))) {
		return 0;
	} else {
		return 1;
	}
}


/*--------------------------------------------------------------*/




/*---------------------------------------------------------------*/
// Animation pour la fermeture et l'ouverture de la carto
//

  var verif = 1;
  var accel = 40;
  hauteur_carto = 550;
  
  init = 1;
  
  function cache_carto() {
	//alert(window.document.getElementById("fond_plan").style.display);
	if (window.document.getElementById("fond_plan").style.display != "none" ) {
	window.document.getElementById("fond_plan").style.display = "none";
	window.document.getElementById("plan_flash").style.display = "none";
	window.document.getElementById("recherche_carto").style.overflow = "hidden";
	window.document.getElementById("recherche_carto").style.height = hauteur_carto+"px";
	}
	
	var reg = new RegExp("px","g");
  	h = window.document.getElementById("recherche_carto").style.height;
  	h = h.replace(reg,"");

	if(h==40) {
		accel = 5;
	}
	
	if(h==30) {
		accel = 4;
	}
	if(h==18) {
		accel = 3;
	}
	if(h==9) {
		accel = 1;
	}
	
	if (h>0) {
		window.document.getElementById("recherche_carto").style.height = h - accel + "px";
	}
	
	if(h>0) {	
		t = setTimeout("cache_carto()",10);
	} else {
		accel = 40;
		verif = 1;
	}
	
  }
  
  
  function montrer_carto() {
	//window.document.getElementById("entete_resultat").style.display = "none";
	
	if(window.document.getElementById("plan_flash").style.display != "block") {
		
		window.document.getElementById("cible_accueil").innerHTML = "";
		
		window.document.getElementById("recherche_carto").style.overflow = "hidden";
	
		var reg = new RegExp("px","g");
  		h = document.getElementById("recherche_carto").style.height;
  		h = h.replace(reg,"");
	
	
		if(h==490) {
			accel = 5;
		}
	
		if(h==510) {
			accel = 4;
		}
		if(h==530) {
			accel = 3;
		}
		if(h==542) {
			accel = 1;
		}
	
		if (h<=550) {
			
			nouvelhauteur = 0;
			nouvelhauteur += parseInt(h);
			nouvelhauteur += parseInt(accel);
			
			document.getElementById("recherche_carto").style.height = nouvelhauteur + "px";
		}
	
		if(h<550) {	
			t = setTimeout("montrer_carto()",10);
		} else {
			accel = 40;
			verif = 1;
			window.document.getElementById("recherche_carto").style.height = "";
			
			window.document.getElementById("recherche_carto").style.overflow = "visible";
			window.document.getElementById("recherche_carto").style.display = "block";
			
			window.document.getElementById("fond_plan").style.display = "block";
			window.document.getElementById("plan_flash").style.display = "block";
		}
	}
	
	
  }

// Fin animation pour la fermeture et l'ouverture de la carto
/*--------------------------------------------------------------------------------------------*/


/*---------------------------------*/
// Correspondance urlrewrite des régions et nom réel

function corresRegion(r) {
		switch (r) {
			
			case "auvergne":
			return "Auvergne";
			break;
			
			case "basse-normandie":
			return "Basse Normandie";
			break;
			
			case "bretagne":
			return "Bretagne";
			break;
			
			case "champagne-ardennes":
			return "Champagne Ardennes"
			break;
			
			case "haute-normandie":
			return "Haute Normandie";
			break;
			
			case "nord-pas-de-calais":
			return "Nord Pas de Calais";
			break;
			
			case "picardie":
			return "Picardie";
			break;
			
			case "lorraine":
			return "Lorraine";
			break;
			
			case "alsace":
			return "Alsace";
			break;
			
			case "ile-de-france":
			return "Ile de France";
			break;
			
			case "centre":
			return "Centre";
			break;
			
			case "pays-de-la-loire":
			return "Pays de la Loire";
			break;
			
			case "poitou-charente":
			return "Poitou Charentes";
			break;
			
			case "bourgogne":
			return "Bourgogne";
			break;
			
			case "franche-comte":
			return "Franche Comté";
			break;
			
			case "rhone-alpes":
			return "Rhône Alpes";
			break;
			
			case "limousin":
			return "Limousin";
			break;
			
			case "aquitaine":
			return "Aquitaine";
			break;
			
			case "midi-pyrenees":
			return "Midi Pyrénées";
			break;
			
			case "languedoc-roussillion":
			return "Languedoc Roussillion";
			break;
			
			case "paca":
			return "Provence Alpes Côte d'Azur";
			break;
			
			case "corse":
			return "Corse";
			break;
		}
		
	}
	
// correspondance entre urlrewrite et département	
	
	function corresDept(d) {
	switch (d) {
		
		case "nord":
		return "Nord";
		break;
		
		case "pas-de-calais":
		return "Pas-de-Calais";
		break;
		
		case "somme":
		return "Somme";
		break;
		
		case "aisne":
		return "Aisne";
		break;
		
		case "oise":
		return "Oise";
		break;
		
		case "seine-maritime":
		return "Seine-Maritime";
		break;
		
		case "eure":
		return "Eure";
		break;
		
		case "calvados":
		return "Calvados";
		break;
		
		case "manche":
		return "Manche";
		break;
		
		case "orne":
		return "Orne";
		break;
		
		case "finistere":
		return "Finistere";
		break;
		
		case "cote-d-armor":
		return "Côtes d'Armor";
		break;
		
		case "morbihan":
		return "Morbihan";
		break;
		
		case "ile-et-vilaine":
		return "Ille-et-vilaine";
		break;
		
		case "vendee":
		return "Vendée";
		break;
		
		case "loire-atlantique":
		return "Loire-Atlantique";
		break;
		
		case "maine-et-loire":
		return "Maine-et-Loire";
		break;
		
		case "mayenne":
		return "Mayenne";
		break;
		
		case "sarthe":
		return "Sarthe";
		break;
		
		case "eure-et-loir":
		return "Eure-et-Loir";
		break;
		
		case "loiret":
		return "Loiret";
		break;
		
		case "loir-et-cher":
		return "Loir-et-Cher";
		break;
		
		case "indre-et-loire":
		return "Indre-et-Loire";
		break;
		
		case "indre":
		return "Indre";
		break;
		
		case "cher":
		return "Cher";
		break;
		
		case "yvelines":
		return "Yvelines";
		break;
		
		case "val-d-oise":
		return "Val-d'Oise";
		break;
		
		case "hauts-de-seine":
		return "Hauts-de-Seine";
		break;
		
		case "ville-de-paris":
		return "Ville de Paris";
		break;
		
		case "seine-saint-denis":
		return "Seine-Saint-Denis";
		break;
		
		case "val-de-marne":
		return "Val-de-Marne";
		break;
		
		case "seine-et-marne":
		return "Seine-et-Marne";
		break;
		
		case "essonne":
		return "Essonne";
		break;
		
		case "ardennes":
		return "Ardennes";
		break;
		
		case "marne":
		return "Marne";
		break;
		
		case "aube":
		return "Aube";
		break;
		
		case "haute-marne":
		return "Haute-Marne";
		break;
		
		case "meuse":
		return "Meuse";
		break;
		
		case "meurthe-et-moselle":
		return "Meurthe-et-Moselle";
		break;
		
		case "vosges":
		return "Vosges";
		break;
		
		case "bas-rhin":
		return "Bas-Rhin";
		break;
		
		case "haut-rhin":
		return "Haut-Rhin";
		break;
		
		case "haute-saone":
		return "Haute-Saône";
		break;
		
		case "doubs":
		return "Doubs";
		break;
		
		case "jura":
		return "Jura";
		break;
		
		case "cote-d-or":
		return "Côte-d'or";
		break;
		
		case "yonne":
		return "Yonne";
		break;
		
		case "nievre":
		return "Nièvre";
		break;
		
		case "saone-et-loire":
		return "Saône-et-Loire";
		break;
		
		case "charente-maritime":
		return "Charente Maritime";
		break;
		
		case "charente":
		return "Charente";
		break;
		
		case "deux-sevres":
		return "Deux-Sèvres";
		break;
		
		case "vienne":
		return "Vienne";
		break;
		
		case "creuse":
		return "Creuse";
		break;
		
		case "haute-vienne":
		return "Haute-Vienne";
		break;
		
		case "correze":
		return "Correze";
		break;
		
		case "allier":
		return "Allier";
		break;
		
		case "puy-de-dome":
		return "Puy de Dôme";
		break;
		
		case "cantal":
		return "Cantal";
		break;
		
		case "haute-loire":
		return "Haute-Loire";
		break;
		
		case "ain":
		return "Ain";
		break;
		
		case "rhone":
		return "Rhône";
		break;
		
		case "loire":
		return "Loire";
		break;
		
		case "isere":
		return "Isère";
		break;
		
		case "savoie":
		return "Savoie";
		break;
		
		case "haute-savoie":
		return "Haute-Savoie";
		break;
		
		case "drome":
		return "Drôme";
		break;
		
		case "ardeche":
		return "Ardèche";
		break;
		
		case "hautes-alpes":
		return "Hautes-Alpes";
		break;
		
		case "alpes-de-hautes-provences":
		return "Alpes de Hautes Provences";
		break;
		
		case "alpes-maritimes":
		return "Alpes-Maritimes";
		break;
		
		case "var":
		return "Var";
		break;
		
		case "bouches-du-rhone":
		return "Bouches-du-Rhône";
		break;
		
		case "vaucluse":
		return "Vaucluse";
		break;
		
		case "lozere":
		return "Lozère";
		break;
		
		case "gard":
		return "Gard";
		break;
		
		case "herault":
		return "Hérault";
		break;
		
		case "aude":
		return "Aude";
		break;
		
		case "pyrenees-orientales":
		return "Pyrénées-Orientales";
		break;
		
		case "aveyron":
		return "Aveyron";
		break;
		
		case "lot":
		return "Lot";
		break;
		
		case "tarne-et-garonne":
		return "Tarne-et-Garonne";
		break;
		
		case "tarn":
		return "Tarn";
		break;
		
		case "haute-garonne":
		return "Haute-Garonne";
		break;
		
		case "ariege":
		return "Ariège";
		break;
		
		case "pyrenees-haute":
		return "Hautes-Pyrénées";
		break;
		
		case "gers":
		return "Gers";
		break;
		
		case "dordogne":
		return "Dordogne";
		break;
		
		case "lot-et-garonne":
		return "Lot-et-Garonne";
		break;
		
		case "gironde":
		return "Gironde";
		break;
		
		case "landes":
		return "Landes";
		break;
		
		case "pyrenees-atlantiques":
		return "Pyrénées-Atlantiques";
		break;
		
		case "haute-corse":
		return "Haute-Corse";
		break;
		
		case "corse-du-sud":
		return "Corse-du-Sud";
		break;
	}
   }
	

/*----------------------------------*/


