/**************************************************/
/**************************************************/
/*************** DIALLO SEKOU KANE ****************/
/**************************************************/
/**************************************************/

//-------------------------------------------------
//-------------------------------------------------
/*                CHARGEMENT                     */               
//-------------------------------------------------
//-------------------------------------------------
var url_gene = 'http://www.vacance-maroc.com/';
//var url_gene = 'http://localhost/vacance-maroc/';
function chargement(id_div){ 

	$(id_div).innerHTML = '';
	Element.update(id_div,"<img src='../images/progress.gif' width='16' height='16' />");	
	
	}

function chargement_fin(id_div){ 
	$(id_div).innerHTML = '';	
	}

function chargement_resultat(){
	
    chargement('liste_inc'); 
	new Ajax.Updater($('liste_inc'),"liste_inc.php",{method: 'get' });
	
	   }              
//-------------------------------------------------
//-------------------------------------------------
	   
 function submit_annonce(tache){ 
   
   if(tache==1){ document.formGene.action = 'annonce_ajout.php';}
   if(tache==2){ document.formGene.action = 'annonce_activite.php';}
   if(tache==3){ document.formGene.action = 'annonce_services.php';}
    document.formGene.method = 'post';
	document.formGene.submit();
	
 }
 
function r_particulier(){
	 var url = '';
	 var type_particulier_v = document.formGene.type_particulier.value;
	 var ville_particulier_v = document.formGene.ville_particulier.value;
	 var nb_particulier_v = document.formGene.nb_particulier.value;
	 
	 if( (type_particulier_v!='') && (ville_particulier_v!='') && (nb_particulier_v!='') ){
	 url ='http://www.vacance-maroc.com/'+type_particulier_v+'-a-'+ville_particulier_v+'-nombre-de-personnes-'+nb_particulier_v+'-au-maroc';	 
		 }
	 if( (type_particulier_v!='') && (ville_particulier_v!='') && (nb_particulier_v=='') ){
	 url ='http://www.vacance-maroc.com/'+type_particulier_v+'-a-'+ville_particulier_v+'-au-maroc';	 
		 }
	 if( (type_particulier_v!='') && (ville_particulier_v=='') && (nb_particulier_v=='') ){
	 url ='http://www.vacance-maroc.com/location-'+type_particulier_v+'-au-maroc';	 
		 }
	 if( (type_particulier_v=='') && (ville_particulier_v=='') && (nb_particulier_v=='') ){
	 url ='http://www.vacance-maroc.com/resultat-location-de-vacances-au-maroc';	 
		 }
		 
		 
	 if( (type_particulier_v!='') && (ville_particulier_v=='') && (nb_particulier_v!='') ){	 
	 url ='http://www.vacance-maroc.com/'+type_particulier_v+'-pour-'+nb_particulier_v+'-personnes-au-maroc';	 
		 }	
	 if( (type_particulier_v=='') && (ville_particulier_v!='') && (nb_particulier_v!='') ){
	 url ='http://www.vacance-maroc.com/location-de-vacances-a-'+ville_particulier_v+'-pour-'+nb_particulier_v+'-personnes-au-maroc';	 
		 }	
	 if( (type_particulier_v=='') && (ville_particulier_v=='') && (nb_particulier_v!='') ){
	 url ='http://www.vacance-maroc.com/location-de-vacances-pour-'+nb_particulier_v+'-personnes-au-maroc';	 
		 }	
	if( (type_particulier_v=='') && (ville_particulier_v!='') && (nb_particulier_v=='') ){
	 url ='http://www.vacance-maroc.com/sejour-a-'+ville_particulier_v;	 
		 }	 
		 
	 //document.formGene.method='get';
	 document.location.href = url;
	 //document.formGene.submit();
	 }
function r_professionel(){
	 document.formGene.action='locations/resultat-par-maison-hote.php';
	 document.formGene.method='get';
	 document.formGene.submit();
	 }	 
function gestion_passe(){
   if(document.formGene.afficher_passe.checked){ 
	    //$('gest_passe').style.visibility = 'visible';
		$('gest_passe').style.display = 'block';
   }else{ 
        //$('gest_passe').style.visibility = 'hidden';
		$('gest_passe').style.display = 'none'; }
 }
 
function gestion_formule(fonction){
	
   if(fonction==1){ 
		//$('formul_professionel').style.display = 'none';
		$('particulier').style.display = 'block';
		$('professionel').style.display = 'none';
		$('drap_linge').checked=false;
   }else{ 
		//$('formul_professionel').style.display = 'block';		
		$('particulier').style.display = 'none';
		$('professionel').style.display = 'block';
		$('drap_linge').checked=true;
		}
 }
/*********** CE SCRIPT CONTIENT DE L'AJAX **********/
/**************************************************/
/**************************************************/

// LA FONCTION CONNEXION
function connexion_index(){ 

	var propri_identifiant = $F('propri_identifiant');
	var propri_pass = $F('propri_pass');
	$('gestconnecxion').innerHTML = 'Passientez pendant la verification...';
	
	if((propri_pass.length >= 5) && (propri_identifiant.length > 2) ){ 
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php"; 
	var parametres = "tache=CONEXION"+"&propri_identifiant="+propri_identifiant+"&propri_pass="+propri_pass; 
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText;  
	   eval(response);
			if(con){
			$('gestconnecxion').innerHTML = 'Votre êtes connecté';
			document.formCon.action = url_gene+'liste-des-annonces';
			document.formCon.method = 'post';
			document.formCon.submit();
			}else{
			$('gestconnecxion').innerHTML = 'Votre couple mot de passe login est incorrecte';	            
				}
		}
	} 
	new Ajax.Request(url, option);
	   }else{alert('Le mot de passe doit comporter six caracteres au minimum');}
	 }
// LA FONCTION CONNEXION
function modifier_passe(){
	
	var propri_id = $F('propri_id');
	var passe_ancien = $F('passe_ancien');
	var passe_nauveau = $F('passe_nauveau');
	var passe_confirmer = $F('passe_confirmer');
	
	//$('gestconnecxion').innerHTML = 'Passientez pendant la verification...';
	if( (passe_nauveau.length >= 6) ){
	if((passe_ancien!='') && (passe_nauveau!='') && (passe_confirmer!='') ){
	if( (passe_ancien!=passe_confirmer) ){
	if( (passe_confirmer==passe_nauveau) ){
	
	var url = url_gene+"locations/gest_class_verification.php"; 
	var parametres = "tache=CONEXION-MODIF"+"&propri_id="+propri_id+"&passe_nauveau="+passe_nauveau+"&passe_ancien="+passe_ancien+"&passe_confirmer="+passe_confirmer;  
	
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   		response = transport.responseText;
	   		eval(response);
			if(con){			
			document.formGene.method = 'post';
			document.formGene.action = url_gene+'locations/inscription_modif.php';
			document.formGene.submit();
			}else{
			$('gestconnecxion').innerHTML = 'Votre couple mot de passe login est incorrecte';	            
				}
		}
	} 
			new Ajax.Request(url, option);
	     }else{alert('Le mot de passe n\'est pas confirmer');}
	   }else{alert('Choisir un nouveau mot de passe different de l\ancien');}
   }else{alert('Tous les champs doivent être remplis');}
  }else{alert('Le mot de passe doit comporter six caracteres au minimum');}
}	 
// LA FONCTION CONNEXION
function connexion(){
	 
	var propri_identifiant = $F('propri_identifiant');
	var propri_pass = $F('propri_pass');
	$('gestconnecxion').innerHTML = 'Passientez pendant la verification...';
	
	if( (propri_pass.length >= 5) && (propri_identifiant != '') ){
				 
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php"; 
	var parametres = "tache=CONEXION"+"&propri_identifiant="+propri_identifiant+"&propri_pass="+propri_pass; 
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText;  
	        eval(response);
			if(con){
			$('gestconnecxion').innerHTML = 'Vous êtes connecté';
			document.formCon.action = url_gene+'liste-des-annonces';
			document.formCon.method = 'post';
			document.formCon.submit();
			}else{
			$('gestconnecxion').innerHTML = 'Votre couple mot de passe login est incorrecte';	            
				}
		}
	} 
	new Ajax.Request(url, option);	
	   }else{alert('Le mot de passe doit comporter six caracteres au minimum');}
	 }

function connexion_etape(){
	 
	var propri_identifiant = document.formConnection.propri_identifiant.value;
	var propri_pass = document.formConnection.propri_pass.value; 
		$('gestconnecxion').innerHTML = 'Passientez pendant la verification...';
	
	if( (propri_pass.length >= 5) && (propri_identifiant != '') ){
				 
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php"; 
	var parametres = "tache=CONEXION"+"&propri_identifiant="+propri_identifiant+"&propri_pass="+propri_pass; 
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText;  
	        eval(response);
			if(con){
			$('gestconnecxion').innerHTML = 'Vous êtes connecté';
			document.formCon.action = url_gene+'liste-des-annonces';
			document.formCon.method = 'post';
			document.formCon.submit();
			}else{
			$('gestconnecxion').innerHTML = 'Votre couple mot de passe login est incorrecte';	            
				}
		}
	} 
	new Ajax.Request(url, option);	
	   }else{alert('Le mot de passe doit comporter six caracteres au minimum');}
	 }	 
// LA FONCTION DECONNEXION
function deconnexion(page){ 

	//$('connexionpro').innerHTML = 'Passientez pendant la deconnexion...';	
	
	var destination = 'http://www.vacance-maroc.com/location-vacances-maroc';
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php";
	
	
	var parametres = "tache=DECONEXION";
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){ 
	   response = transport.responseText; 
			//$('connexionpro').innerHTML = 'Vous êtes déconnecté'; 
			document.location.href=destination;
		}
	} 
	new Ajax.Request(url, option);
	 }
/*********************************************/
/*********************************************/
// CONTROL EMAIL ****************************/
/*********************************************/
/*********************************************/
function supprimer_image(id_img, name_img){ 
	//$('connexionpro').innerHTML = 'Passientez pendant la deconnexion...';
	if(confirm("Vous êtes sur le point de supprimer l\'image en cours\n Voulez-vous continuer ?")){
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php";
	var parametres = "tache=SUPP_IMG"+"&id_img="+id_img+"&name_img="+name_img;  
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	         alert(response);
			//$('connexionpro').innerHTML = 'Vous êtes déconnecté'; 
			//document.formGene.action = 'annonce_images.php';
			document.formGene.method = 'post';
			document.formGene.submit();
		}
	} 
	new Ajax.Request(url, option);
	  }
	 }


// LA FONCTION VERIFICATION DE L'INDENTIFIANT

function verifier_email(id_div){ 

	chargement(id_div);
	var email_confirm = $F('email_confirm');	
	var email = $F('email'); 	
	
	if( controlEmail(email) ){
			
	document.getElementById('email').className = 'class_vrai';
	document.getElementById('email_confirm').className = 'class_vrai';
	
	var url = url_gene+"locations/gest_class_verification.php"; 
	var parametres = "tache=VERI_ID"+"&email="+email;
	
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	       eval(response); 			
		   chargement_fin(id_div);
		   $('btn_inscription').style.visibility = 'visible';
	}
  } 
	new Ajax.Request(url, option);
	}else{
		  document.getElementById('email').className = 'class_faux'; 
	      alert("Votre email est incorrect");
		  chargement_fin(id_div);
		  }
  
  }

function verif_identifiant(id_div){ 
	
	chargement(id_div);
	var email_confirm = $F('email_confirm');	
	var email = $F('email'); 	
	
	if( email==email_confirm ){
		
	document.getElementById('email').className = 'class_vrai';
	document.getElementById('email_confirm').className = 'class_vrai';
	
	var url = url_gene+"locations/gest_class_verification.php"; 
	var parametres = "tache=VERI_ID_ENR"+"&email="+email;
	
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	        eval(response);
		  chargement_fin(id_div);
		
	}
  } 
	new Ajax.Request(url, option);
	
	}else{
		  document.getElementById('email').className = 'class_faux';
		  document.getElementById('email_confirm').className = 'class_faux'; 
	      alert("Vous devez confirmer votre courriel");
		  chargement_fin(id_div);
		  }
		 
  
  }
  
// LA FONCTION VERIFICATION DE L'INDENTIFIANT
function verier_identifient_modif(tache){
	 
	var identifiant = $F('identifiant');
	var email = $F('email');
	if( (identifiant.length >= 6) ){
	document.getElementById('identifiant').className = 'class_vrai';
	
	if( controlEmail(email) ){	
	document.getElementById('email').className = 'class_vrai';
		var propri_id = $F('propri_id'); 
	$('inscription_inf').innerHTML = 'Passientez pendant la verification...';
	  
	var url = "gest_class_verification.php"; 
	var parametres = "tache=VERI_MD"+"&identifiant="+identifiant+"&email="+email+"&propri_id="+propri_id;
	 
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	       eval(response);
			var trouve = true;
		if( (v_ok==0) || (v_ok==2) ){
			if( (v_ok==0) ){
			$('inscription_inf').innerHTML = 'Votre identifiant est indisponible';
			trouve = false;
			}else if( v_ok==2 ){				
			$('inscription_inf').innerHTML = 'Cet email est déjà utilise';
			trouve = false;
			}		 
			
		}
		    
		    if(trouve){
				$('inscription_inf').innerHTML = '';
				if(tache==3){ 
				f_inscription_modif();
				}else{
				f_inscription(tache);
				}
				}
		}
	} 
	new Ajax.Request(url, option);
	
	}else{
		  document.getElementById('email').className = 'class_faux'; 
	      alert("Votre email est incorrect");
		  }
   }else{
		  document.getElementById('identifiant').className = 'class_faux'; 
	      alert("Login min 6 caractères");
		  }
  }
// LA FONCTION VERIFICATION DE L'INDENTIFIANT
function verier_identifient_modif_n(tache){	
	if(document.formGene.afficher_passe.checked){
	 	verier_identifient_modif(tache);
	}else{f_inscription_modif();}
	
  }
// LA FONCTION VERIFICATION DE L'INDENTIFIANT
function verier_identifient_modif_inscription(tache){	
   f_inscription_modif();	
  }
/*********************************************/
/*********************************************/
// CONTREL EMAIL ****************************/
/*********************************************/
/*********************************************/
function controlEmail(str) {
    var str = str;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        //alert("Verify the e-mail address format.");
        //setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
        return false;
    } else {
        return true;
    }
}
/*********************************************/
/*********************************************/
// GESTION DE DIV
/*********************************************/
/*********************************************/
function cacher_div(input,div){ 
	if($F(input)=='on'){
		$(div).style.visibility = 'visible';}	
	else{$(div).style.visibility = 'hidden';}
	}
/*********************************************/
/*********************************************/
// LA FONCTION PAYS
/*********************************************/
/*********************************************/
function select_pays(){
	  var pays = $F('pays'); 
	  var indicatif = pays.split('**');
	  $('indicatif_f').value = indicatif[1];
	  $('indic_telecopie').value = indicatif[1];
	  $('indicatif_m').value = indicatif[1];
	}
/*********************************************/
/*********************************************/
// LA FONCTION VERIFICATION DE L'INDENTIFIANT
/*********************************************/
/*********************************************/
function f_inscription(tache){ 
	var valider = 0; 
	// civilite
	var civilite_v = $F('civilite'); 
	if(civilite_v!=""){
		document.getElementById('civilite').className = 'class_vrai'; 
		valider = valider + 1;
		}else{document.getElementById('civilite').className = 'class_faux';} 
	// Nom
	var nom_v = $F('propri_nom');
	if(nom_v!=""){
		document.getElementById('propri_nom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_nom').className = 'class_faux';}
	// prenom
	var prenom_v = $F('propri_prenom');
	if(prenom_v!=""){
		document.getElementById('propri_prenom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_prenom').className = 'class_faux';}
	// pays
	var pays_v = $F('pays');
	if(pays_v!=""){
		document.getElementById('pays').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('pays').className = 'class_faux';}
	// Ville
	var ville_v = $F('ville');
	if(ville_v!=""){
		document.getElementById('ville').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('ville').className = 'class_faux';}
	// adresse
	var adresse_v = $F('adresse');
	if(adresse_v.length >= 6){
		document.getElementById('adresse').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('adresse').className = 'class_faux';}
	// Code postal
	var code_postal_v = $F('code_postal');
	if(code_postal_v!=""){
		document.getElementById('code_postal').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('code_postal').className = 'class_faux';}
	// email
	var email_v = $F('email');
	if(controlEmail(email_v)){
		document.getElementById('email').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('email').className = 'class_faux';}	
		
	


	if(valider==8){ 
	
	    if( (tache==1) ){
		 document.formGene.method = 'post';
		 document.formGene.action = url_gene+'locations/inscription.php';
		 document.formGene.submit();
		  }
	    if( (tache==2) ){
		 document.formGene.method = 'post';
		 document.formGene.action = url_gene+'locations/inscription.php';
		 document.formGene.submit();
		  }
	    if( (tache==3) ){
		 document.formGene.method = 'post';
		 document.formGene.action = 'inscription_modif.php';
		 document.formGene.submit();
		  }
	 } 
}
/*********************************************/
/*********************************************/
// INSCRIPTION ESPACE ANNONCEUR
/*********************************************/
/*********************************************/
function inscription_annonceur(){ 
	var valider = 0; 
	// civilite
	var civilite_v = $F('civilite'); 
	if(civilite_v!=""){
		document.getElementById('civilite').className = 'class_vrai'; 
		valider = valider + 1;
		}else{document.getElementById('civilite').className = 'class_faux';} 
	// Nom
	var nom_v = $F('propri_nom');
	if(nom_v!=""){
		document.getElementById('propri_nom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_nom').className = 'class_faux';}
	// prenom
	var prenom_v = $F('propri_prenom');
	if(prenom_v!=""){
		document.getElementById('propri_prenom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_prenom').className = 'class_faux';}
	// pays
	var pays_v = $F('pays');
	if(pays_v!=""){
		document.getElementById('pays').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('pays').className = 'class_faux';}
	// Ville
	var ville_v = $F('ville');
	if(ville_v!=""){
		document.getElementById('ville').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('ville').className = 'class_faux';}
	// adresse
	var adresse_v = $F('adresse');
	if(adresse_v.length >= 6){
		document.getElementById('adresse').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('adresse').className = 'class_faux';}
	// Code postal
	var code_postal_v = $F('code_postal');
	if(code_postal_v!=""){
		document.getElementById('code_postal').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('code_postal').className = 'class_faux';}
	// email
	var email_v = $F('email');
	if(controlEmail(email_v)){
		document.getElementById('email').className = 'class_vrai'; valider = valider +1;
		}else { 
		document.getElementById('email').className = 'class_faux';
		}	


	if(valider==8){ 
		 document.formGene.method = 'post';
		 document.formGene.action = 'http://www.vacance-maroc.com/locations/inscription_espace_annonceur.php';
		 document.formGene.submit();
	 }
	  
}
/*********************************************/
/*********************************************/
// LA FONCTION CONTACT
/*********************************************/
function validerEmail(){
	
	 var email = $F('email');
	 $('control_email').innerHTML = '<img src="../images/load.gif" width="16" height="16" />';
	 $('chargmentControl').innerHTML = '<img src="../images/load.gif" width="16" height="16" /> Chargment en cours...';
	 
	 if(controlEmail(email)){		
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php";	
	var parametres = "tache=EMAIL_V"+"&email="+email;   
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	   var json_tab = response.evalJSON(); 
	   if(json_tab.status==1){
		   	   
	    $('control_email').innerHTML = '<img src="../images/1.gif" width="16" height="16" />';
		document.getElementById('email').className = 'class_vrai';
		
	    /*$('btn_inspt').innerHTML = '<input type="button" onclick="javascript:inscription_annonceur();" value="Enregistrer" />';*/
	   $('chargmentControl').innerHTML = '<img src="../images/load.gif" width="16" height="16" /> Patientez pendant l\'envoi des informations...';
		  inscription_annonceur();
	       }else{
			   
	 	document.getElementById('email').className = 'class_faux_email';
	 	$('control_email').innerHTML = '<img src="../images/0.gif" width="16" height="16" />';
	    $('btn_inspt').innerHTML = '';
	   $('chargmentControl').innerHTML = '<img src="../images/load.gif" width="16" height="16" /> Votre email exist deja...';
		 document.formGene.method = 'post';
		 document.formGene.action = 'http://www.vacance-maroc.com/locations/inscription_etapes.php';
		 document.formGene.submit();
			   }
		}
	} 
	new Ajax.Request(url, option);
	
		}else{
		//document.getElementById('email').className = 'class_faux';
	 	document.getElementById('email').className = 'class_faux_email';
	 	$('chargmentControl').innerHTML = '';
	 	$('control_email').innerHTML = '<img src="../images/0.gif" width="16" height="16" />';
		$('btn_inspt').innerHTML = '<input type="button" onclick="javascript:inscription_annonceur();" value="Enregistrer" />';	
	    /*$('control_email').innerHTML = '<img src="../images/0.gif" width="16" height="16" />';*/}
	 
	}
/*function validerEmail(){
	
	 var email = $F('email');
	 $('control_email').innerHTML = '<img src="../images/load.gif" width="16" height="16" />';
	 if(controlEmail(email)){		 
		
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php";	
	var parametres = "tache=EMAIL_V"+"&email="+email;   
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){ 
	
	   response = transport.responseText; 
	   var json_tab = response.evalJSON(); 
	   if(json_tab.status==1){	   
	    $('control_email').innerHTML = '<img src="../images/1.gif" width="16" height="16" />';
		document.getElementById('email').className = 'class_vrai';
	    $('btn_inspt').innerHTML = '<input type="button" onclick="javascript:inscription_annonceur();" value="Enregistrer" />';
	       }else{
	 document.getElementById('email').className = 'class_faux_email';
	 $('control_email').innerHTML = '<img src="../images/0.gif" width="16" height="16" />';
	    $('btn_inspt').innerHTML = '';		   
			   }
		}
	} 
	new Ajax.Request(url, option);
	
		}else{
		//document.getElementById('email').className = 'class_faux';
	    $('btn_inspt').innerHTML = '';		   
	    /*$('control_email').innerHTML = '<img src="../images/0.gif" width="16" height="16" />';*//*}
	 
	}*/
/*********************************************/
/*********************************************/
function f_inscription_modif(){ 
	var valider = 0; 
	var compar = 8;
	// civilite
	var civilite_v = $F('civilite'); 
	if(civilite_v!=""){
		document.getElementById('civilite').className = 'class_vrai'; 
		valider = valider + 1;
		}else{document.getElementById('civilite').className = 'class_faux';} 
	// Nom
	var nom_v = $F('propri_nom');
	if(nom_v!=""){
		document.getElementById('propri_nom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_nom').className = 'class_faux';}
	// prenom
	var prenom_v = $F('propri_prenom');
	if(prenom_v!=""){
		document.getElementById('propri_prenom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_prenom').className = 'class_faux';}
	// pays
	var pays_v = $F('pays');
	if(pays_v!=""){
		document.getElementById('pays').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('pays').className = 'class_faux';}
	// Ville
	var ville_v = $F('ville');
	if(ville_v!=""){
		document.getElementById('ville').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('ville').className = 'class_faux';}
	// adresse
	var adresse_v = $F('adresse');
	if(adresse_v.length >= 6){
		document.getElementById('adresse').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('adresse').className = 'class_faux';}
	// Code postal
	var code_postal_v = $F('code_postal');
	if(code_postal_v!=""){
		document.getElementById('code_postal').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('code_postal').className = 'class_faux';}
	// email
	var email_v = $F('email');
	if(controlEmail(email_v)){
		document.getElementById('email').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('email').className = 'class_faux';}
		
	
	if(valider==compar){ 
		 document.formGene.method = 'post';
		 document.formGene.action = 'http://www.vacance-maroc.com/'+'locations/inscription_modif_inscription.php';
		 document.formGene.submit();
	 } 
}

function f_inscription_modif_gestion(){ 
	var valider = 0; 
	var compar = 8;
	// civilite
	var civilite_v = $F('civilite'); 
	if(civilite_v!=""){
		document.getElementById('civilite').className = 'class_vrai'; 
		valider = valider + 1;
		}else{document.getElementById('civilite').className = 'class_faux';} 
	// Nom
	var nom_v = $F('propri_nom');
	if(nom_v!=""){
		document.getElementById('propri_nom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_nom').className = 'class_faux';}
	// prenom
	var prenom_v = $F('propri_prenom');
	if(prenom_v!=""){
		document.getElementById('propri_prenom').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('propri_prenom').className = 'class_faux';}
	// pays
	var pays_v = $F('pays');
	if(pays_v!=""){
		document.getElementById('pays').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('pays').className = 'class_faux';}
	// Ville
	var ville_v = $F('ville');
	if(ville_v!=""){
		document.getElementById('ville').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('ville').className = 'class_faux';}
	// adresse
	var adresse_v = $F('adresse');
	if(adresse_v.length >= 6){
		document.getElementById('adresse').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('adresse').className = 'class_faux';}
	// Code postal
	var code_postal_v = $F('code_postal');
	if(code_postal_v!=""){
		document.getElementById('code_postal').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('code_postal').className = 'class_faux';}
	// email
	var email_v = $F('email');
	if(controlEmail(email_v)){
		document.getElementById('email').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('email').className = 'class_faux';}
		
		if(valider==compar){ 
		 document.formGene.submit();
	 } 
}
/*********************************************/
/*********************************************/
// LA FONCTION CONTACT
/*********************************************/
/*********************************************/
function f_annonce_contact(){
	var valider = 0; 
	var choix_control = false;
	// Nom
	var nom_prenom_v = $F('nom_prenom');
	if(nom_prenom_v!=""){
		document.getElementById('nom_prenom').className = 'class_vrai'; 
		valider = valider + 1;
		}else{document.getElementById('nom_prenom').className = 'class_faux';}
	// tel_fix
	var tel_fix_v = $F('tel_fix');
	var indicatif_v = $F('indicatif_f');
	if( (tel_fix_v!="") && (indicatif_v!="") ){
		document.getElementById('tel_fix').className = 'class_vrai';
		document.getElementById('indicatif_f').className = 'class_vrai';
		valider = valider + 1;
		choix_control = true;
		}else{
			document.getElementById('tel_fix').className = 'class_faux';
			document.getElementById('indicatif_f').className = 'class_faux';
			}
	// tel_mobil
	var tel_mobil_v = $F('tel_mobil');
	var indicatif_m_v = $F('indicatif_m');
	if( (tel_mobil_v!="") && (indicatif_m_v!="") ){
		document.getElementById('tel_mobil').className = 'class_vrai';
		document.getElementById('indicatif_m').className = 'class_vrai';
		valider = valider + 1;
		choix_control = true;
		}else{
			document.getElementById('tel_mobil').className = 'class_faux';
			document.getElementById('indicatif_m').className = 'class_faux';
			}
	if(choix_control){
		document.getElementById('tel_mobil').className = 'class_vrai';
		document.getElementById('indicatif_m').className = 'class_vrai';
		document.getElementById('tel_fix').className = 'class_vrai';
		document.getElementById('indicatif_f').className = 'class_vrai';		  
		 }
	// email
	var email_v = $F('email');
	if(controlEmail(email_v)){
		document.getElementById('email').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('email').className = 'class_faux';}
	
			 
	if(valider >= 3){ 
		 document.formGene.method = 'post';
		 document.formGene.action = 'annonce_contact.php';
		 document.formGene.submit();
		 } 
}
/*********************************************/
/*********************************************/
// LA FONCTION VERIFICATION
/*********************************************/
/*********************************************/
function f_localisation(){ 
	var valider = 0; 
	// ville
	var ville_v = $F('ville'); 
	if(ville_v!=""){
		document.getElementById('ville').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('ville').className = 'class_faux';} 
	// Adresse
	var adresse_v = $F('adresse');
	if(adresse_v.length >= 6){
		document.getElementById('adresse').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('adresse').className = 'class_faux';}
		
	if(valider==2){
		 document.formGene.method = 'post';
		 document.formGene.action = 'annonce_localisation.php';
		 document.formGene.submit();
		 } 
}
/*********************************************/
/*********************************************/
// LA FONCTION VERIFICATION PROPRIETE
/*********************************************/
/*********************************************/
function f_propriete(){ 
	var valider = 0; 
	// type_logement
	var type_logement_v = $F('type_logement'); 
	if(type_logement_v!=""){
		document.getElementById('type_logement').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('type_logement').className = 'class_faux';}
// etage
	var etage_v = $F('etage');
	if(etage_v!= ""){
		document.getElementById('etage').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('etage').className = 'class_faux';}
// chambre
	var chambre_v = $F('chambre');
	if(chambre_v!= ""){
		document.getElementById('chambre').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('chambre').className = 'class_faux';}
// capacite
	var capacite_v = $F('capacite');
	if(capacite_v!= ""){
		document.getElementById('capacite').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('capacite').className = 'class_faux';}
// location_class
	var location_class_v = $F('location_class');
	if(location_class_v!= ""){
		document.getElementById('location_class').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('location_class').className = 'class_faux';}		
		
	if(valider==5){
		
		 document.formGene.method = 'post';
		 document.formGene.action = 'annonce_proprietes.php';
		 document.formGene.submit();
		 
		 }else{alert("Les champs Orang sont Incorect");} 
}
/*********************************************/
/*********************************************/
// APPEL DE EDITEUR
/*********************************************/
/*********************************************/
function editeur_textarea(id, w, h){ 	  
		  
         var oFCKeditor = new FCKeditor(id); 
         oFCKeditor.ToolbarSet = 'Basic' ;
         oFCKeditor.BasePath = "../fckeditor/" ;
		 oFCKeditor.Height	= h ;
		 oFCKeditor.Width	= w ;
         oFCKeditor.ReplaceTextarea() ;
      }
/*********************************************/
/*********************************************/
// LA FONCTION VERIFICATION TARIFS
/*********************************************/
/*********************************************/
function f_tarifs(){ 
	var valider = 0; 
	// prix
	/*var prix_v = $F('prix'); 
	if(parseInt(prix_v)){
		document.getElementById('prix').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('prix').className = 'class_faux';}*/ 
	// prix_bas
	var prix_bas_v = $F('prix_bas');
	if(parseInt(prix_bas_v)){
		document.getElementById('prix_bas').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('prix_bas').className = 'class_faux';}
    // prix_moyen
	var prix_moyen_v = $F('prix_moyen'); 
	if(parseInt(prix_moyen_v)){
		document.getElementById('prix_moyen').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('prix_moyen').className = 'class_faux';}
    // prix_haut
	var prix_haut_v = $F('prix_haut');
	if(parseInt(prix_haut_v)){
		document.getElementById('prix_haut').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('prix_haut').className = 'class_faux';}
   // prix_tres_haut
	var prix_tres_haut_v = $F('prix_tres_haut');
	if(parseInt(prix_tres_haut_v)){
		document.getElementById('prix_tres_haut').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('prix_tres_haut').className = 'class_faux';}
   // nuite
	var nuite_v = $F('nuite');
	if(nuite_v!= ""){
		document.getElementById('nuite').className = 'class_vrai'; valider = valider +1;
		}else{document.getElementById('nuite').className = 'class_faux';}		
		
	if(valider==5){
		 document.formGene.method = 'post';
		 document.formGene.action = 'annonce_tarifs.php';
		 document.formGene.submit();
		 } 
}	 	 

/*********************************************/
/*********************************************/
// LA FONCTION VERIFICATION ANNONCE LISTE
/*********************************************/
/*********************************************/
function f_annonce_ajout(){ 
	var valider = 0; 
	// type_location
	var type_logement_v = $F('type_location'); 
	if(type_logement_v!=""){
		document.getElementById('type_location').className = 'class_vrai'; 
		valider = valider +1;
		}else{document.getElementById('type_location').className = 'class_faux';} 
    // location
	var location1_v = $F('location1');
	var location2_v = $F('location2');
	if(location1_v!=location2_v){
		document.getElementById('location1').className = 'class_vrai';
		document.getElementById('location2').className = 'class_vrai'; 
		valider = valider +1;
		}else{
			  document.getElementById('location1').className = 'class_faux';
		      document.getElementById('location2').className = 'class_faux';
		      }
  	
	if(valider==2){
		 document.formGene.method = 'post';
		 document.formGene.action = 'annonce_ajout.php';
		 document.formGene.submit();
		 } 
}

/*********************************************/
/*********************************************/
// LA CHANGER STYLE
/*********************************************/
/*********************************************/
 function control_etage(){
    var type_location_val = document.getElementById("type_location").value;	
	if(type_location_val=='Appartement'){
		document.getElementById("etage").style.visibility="visible";
		document.getElementById("etage_label").innerHTML="Etages";
		}else{
		document.getElementById("etage").style.visibility="hidden";
		document.getElementById("etage_label").innerHTML="";
			}
	 }
function changer_style(){ 
   if(document.getElementById("etage").value!=0){
    document.getElementById("acsenseur").style.visibility="visible";
	}else{
    document.getElementById("acsenseur").style.visibility="hidden";	
	}
  }
/*********************************************/
/*********************************************/
// IMAGE PRINCIPALE
/*********************************************/
/*********************************************/
function image_principle(id_produit, nom_photo, propri_id){ 

	if(confirm("Vous êtes sur le point de marque l\'image comme pricipale\n Voulez-vous continuer ?")){
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php";
	
	var parametres = "tache=IMG_PRIN"+"&id_produit="+id_produit+"&nom_photo="+nom_photo;  
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	       // alert(response);
		var url_submit = 
		url_gene+'locations/annonce_images_inscription.php?ref='+id_produit+'&propri_id='+propri_id;
		document.location.href = url_submit;
		}
	} 
	new Ajax.Request(url, option);
	  }
 }
 
function image_principle_act_service(id_produit, nom_photo, propri_id, type){ 

	if(confirm("Vous êtes sur le point de marque l\'image comme pricipale\n Voulez-vous continuer ?")){
	var url = 'http://www.vacance-maroc.com/'+"locations/gest_class_verification.php";
	
	var parametres = "tache=IMG_PRIN"+"&id_produit="+id_produit+"&nom_photo="+nom_photo+"&type="+type;
	
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){
	   response = transport.responseText; 
	       // alert(response);
		if(type=='act'){
		var url_submit = 
		'http://www.vacance-maroc.com/'+'locations/annonce_activite_images.php?ref='+id_produit+'&propri_id='+propri_id;
		}else if(type=='ser'){
		var url_submit = 
		'http://www.vacance-maroc.com/'+'locations/annonce_service_images.php?ref='+id_produit+'&propri_id='+propri_id;
		} 
		document.location.href = url_submit;
		}
	} 
	new Ajax.Request(url, option);
	  }
 }
/*********************************************/
/*********************************************/
// LA CHANGER STYLE
/*********************************************/
/*********************************************/
function nb_site_officiel(id_produit, site_adresse){
	
	var url = "http://www.vacance-maroc.com/locations/gest_class_verification.php"; 
	var parametres = "tache=VISITER_SITE"+"&id_produit="+id_produit+"&site_adresse="+site_adresse;
	option = { 
	asynchronous : true, 
	methode : "POST",
	parameters : parametres,
	onSuccess : function(transport){ response = transport.responseText; }
		}
	new Ajax.Request(url, option);
	 }

/*********************************************/
/*********************************************/
// 
/*********************************************/
/*********************************************/
function selectionner_type(valeur){ 
   if(valeur==1){
    $('bancaire').style.display="block";
    $('cheque').style.display="none";
    $('virement').style.display="none";
	} 
   if(valeur==2){
    //$('bancaire').style.display="none";
    $('cheque').style.display="block";
    $('virement').style.display="none";
	} 
   if(valeur==3){
    //$('bancaire').style.display="none";
    $('cheque').style.display="none";
    $('virement').style.display="block";
	}
	
  }
