function chercheHTML(url, id, param) {
	

		//var url = 'listeFiltre.php';
		
		///detecte si c'est la premiere page
/*		if(limit!=""){
		var parametres = 'limit='+limit;
		}
		else
		{
		var parametres = 'unParametre=ABCD';
		}*/
		
		
		var parametres = param;
		//montre fenetre de chargement
		//$(id).innerHTML="";
		showload('loading');
	
		var myAjax = new Ajax.Updater(
			id,
			url,
			{
			method: 'get',
			evalScripts: true,
			encoding:'UTF-8',
			parameters: parametres,
			//onLoading: showload,
			onFailure: rapporteErreur,
			onComplete: hideload ////cache fenetre chargement
			}
		);
		
	
		
	}

	function rapporteErreur(requete) {
		alert('Désolé, une erreur s\'est produite.');
	}
	
	function showload(id) {
		$(id).show();
	}
	
	function hideload(requete) {
		$('loading').hide();
	}
	
	function showTruc(id) {
		$(id).show();
	}
	
	function hideTruc(id) {
		$(id).hide();
	}



////////////////////news//////////////////////:
	function montrenews(id){
		//$('produit').innerHTML="";
		chercheHTML('fichenews.php','produit', 'id='+id);
		$('produit').show();
		
	}


//////////////////////PRODUIT/////////////////////
	function montreproduit(id){
		$('produit').innerHTML="<div style=\"text-align:center;height:200\"><img src=\"images/loader.gif\" /></div>";
		chercheHTML('produit.php','produit', 'id='+id);
		$('produit').show();
		
	}
	
	function ShowContact(){
		
	chercheHTML('contact.php','contact');	
	$('contact').show();
		
	}
	
	function cacheproduit(){
		$('produit').hide();
		
	}
	
	
	///////////////////////////////////
	
	function infostatus(info){
		
		$('status').innerHTML=info;
	}
	function confirmmail(info){
		$('contact').innerHTML=info;
	}
	
	////////////////////////////////////////////////////v////////////////////////////////////////
	
	////envoie de var a traitemet
	
	////////////////////////////////////////////////////////////////////////vv
function envoiecontact(){
		
		var nom = document.getElementById("nom").value;
		var mail = document.getElementById("mail").value;
		var tel = document.getElementById("tel").value;
		var message = document.getElementById("message").value;
		var image = document.getElementById("image").value;
		//infostatus('Envoyés');
		/*var xhr_object = null; 
	    xhr_object = createXHR();

	 
	   xhr_object.open("POST", "./envoiemail.php", true);
	     
	   xhr_object.onreadystatechange = function() { 
	      if(xhr_object.readyState == 4) {
			 alert(xhr_object.responseText); // DEBUG MODE
			 // --- ICI le retour (c'est à dire tout ce qui est écrit dans le fichier de traitement)
			 // --- est interprété, donc il suffi d'écrire du code JS dans traitement.php pour
			 // --- qu'il soit interprété au retour.
	         //eval(xhr_object.responseText);
			 //alert(xhr_object.responseText);
		  }
	   } 
	 
	   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	   // --- ICI TU PASSE TES ARGUMENTS AU SCRIPT :*/
	 var data = "nom="+nom+"&mail="+mail+"&tel="+tel+"&message="+message+"&image="+image;
	    // var data = "nom="+nom;
	   //alert(data);
	  // xhr_object.send(data);
	   
	   chercheHTML('envoiemail.php', 'status', data);
	   
	//infostatus('Envoyés');
}


/////fonctions du formulaire


function is_empty(a){
	var champ;
		
	champ=document.getElementById(a);
	if(champ.value !=""){
		return false;
	}else{
		return true;
	}
}

function verif_mail(a){
	//var mail;
	//mail=eval("document.forms[0]." + a);

	if(document.getElementById(a).value.indexOf("@")==-1 || document.getElementById(a).value.indexOf(".")==-1 || document.getElementById(a).value.indexOf('"')!=-1){
		//alert("adresse mail non valide");
			infostatus('adresse mail non valide');
		document.getElementById(a).focus();
		return false;
	}else{
		return true;
	}	
}

function valide(){

	if(is_empty("nom")){
		//alert('Entrez votre nom');
		infostatus('Entrez votre nom');
		document.getElementById("nom").focus()
		return false;
	}
	if(verif_mail("mail")!=true){
		return false;
	}
	if(is_empty("tel")){
		//alert('Entrez votre Telephone');
		infostatus('Entrez votre Telephone');
		document.getElementById("tel").focus()
		return false;
	}
	if(is_empty("message")){
		//alert('Entrez votre Message');
		infostatus('Entrez votre Message');
		document.getElementById("message").focus()
		return false;
	}
	
	
	//si j'arruve jusqu'ici c tout bon
	
	//document.getElementById("form1").submit();
	envoiecontact();
	return true;
	
	
	
	
}
////fi fonction du formulaire

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




function boutonon(id){
	
	boutons=document.getElementsByName('boutonmenuleft');

for(var i=0;i<boutons.length;i++){
  //et ici tu fais ce que tu veux avec TabChecks[i]
 if(boutons.item(i).id!=id){
 boutons.item(i).className = 'visiteoff';
  //alert(boutons.item(i).id);]
 }
 else{
	boutons.item(i).className = 'visiteon'; 
 }
}
}

function rechercher(){
	 var texte = document.getElementById('texte').value;
	
	chercheHTML('nouv.php','content','texte='+texte+'' );
	chercheHTML('marques.php','marques','texte='+texte+'' );
	
}









   function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(48.871728, 2.316041), 14);
        //geocoder = new GClientGeocoder();
		      var marker = new GMarker(48.871728, 2.316041);
              map.addOverlay(marker);
              marker.openInfoWindowHtml("antiquecamera");
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
				alert(point);
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
	
	    function showAcces(address) {
			//initialize();
			//showAddress(address);
			//$('plan').src="acces3.php";
			//window.frames["calendar"].src 
			$('map').show();
    }
	
	
		    function showAccesPrint() {
			//initialize();
			//showAddress(address);
			var dest = document.getElementById('fromAddress').value;
			window.open("accesprint.php?dest="+dest ,"popup","status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top =100,left =100");
    }
	
	
			    function showAccesPrint2() {
			//initialize();
			//showAddress(address);window.frames['mon_iframe'].document.getElementById(element);
			var dest = window.frames['plan'].document.getElementById('fromAddress').value;
			window.open("accesprint.php?dest="+dest ,"popup","status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top =100,left =100");
    }
	
	/////ouvre une pop up centrée dans la page
	function winOpen(url, largeur, hauteur){
      gauche = (screen.width/2)-(largeur/2);
      haut = (screen.height/2)-(hauteur/2);
      window.open(url,"popup","height="+hauteur+",width="+largeur+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top ="+haut+",left ="+gauche);
   } 
   
   
   function recupImageValue(image){
	   //alert(top.$('image').value);
	//top.$('image').value=image;
	   $('image').value=image;

   }
   
   
   
