var gsListe_seq ="";
var gsListe_Produits_seq ="";

var tempX = 0 ;
var tempY = 0 ;
var FenHeight =0;
var FenWidth=0;
taille_fenetre();
var mid_fenetre=Math.round(FenWidth/2);
function taille_fenetre() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    FenWidth = window.innerWidth;
    FenHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    FenWidth = document.documentElement.clientWidth;
    FenHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    FenWidth = document.body.clientWidth;
    FenHeight = document.body.clientHeight;
  }
  
}


function _RMP(c,o,r){
	var p=0;
	var t=c.indexOf(o);
	var s=new String();
	while(t!=-1){
		s+=c.substring(p,t);
		s+=r;
		p=t+o.length;
		t=c.indexOf(o,p);
			}
	s+=c.substring(p,c.length);
	return s
	}

function _INT_Liste_CHG(obj,n)

{
		
if(ChaineOccurrence(gsListe_Produits_seq,",",1,0)>0) {
document.getElementById("bulle-info-3").style.display="block"; 	
document.getElementById("bulle-info-3").style.top=(obj.offsetTop+20)+"px"; 
obj.checked=0;
return;	
}else {
document.getElementById("bulle-info-3").style.display="none"; 	
}		

if((ChaineOccurrence(gsListe_seq,",",1,0)>9)&&(obj.checked==1))
{
	obj.checked=0;
	document.getElementById("bulle-info-1").style.display="block"; 
	document.getElementById("bulle-info-1").style.top=(obj.offsetTop+20)+"px"; 
}
else
{	if((Position(gsListe_seq,n,null)>0))
	{
		gsListe_seq=_RMP(gsListe_seq,(n+","),"");
		obj.checked=0;
	        document.getElementById("bulle-info-1").style.display="none"; 

	}
	else {
		gsListe_seq=((gsListe_seq+n)+",");
		obj.checked=1;
		document.getElementById("bulle-info-2").style.display="none"; 
	}
}
}


function _INT_Liste_Produits_CHG(obj,n)

{
if(ChaineOccurrence(gsListe_seq,",",1,0)>0) {
document.getElementById("bulle-info-3").style.display="block"; 	
document.getElementById("bulle-info-3").style.top=(obj.offsetTop+20)+"px"; 
obj.checked=0;
return;	
}else {
document.getElementById("bulle-info-3").style.display="none"; 	
}

if((ChaineOccurrence(gsListe_Produits_seq,",",1,0)>9)&&(obj.checked==1))
{
	obj.checked=0;
	document.getElementById("bulle_Produits-1").style.display="block"; 
	document.getElementById("bulle_Produits-1").style.top=(obj.offsetTop+20)+"px"; 
	
	
	
}
else
{

	if((Position(gsListe_Produits_seq,n,null)>0))
	{
		gsListe_Produits_seq=_RMP(gsListe_Produits_seq,(n+","),"");
		obj.checked=0;
	        document.getElementById("bulle_Produits-1").style.display="none"; 

	}
	else {
		gsListe_Produits_seq=((gsListe_Produits_seq+n)+",");
		obj.checked=1;
		document.getElementById("bulle_Produits-2").style.display="none"; 
	}

}

}



function HauteurDoc() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight),
        screen.height,715
    );
}

function LargeurDoc() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
        Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
        Math.max(D.body.clientWidth, D.documentElement.clientWidth),
        screen.width
    );
}



var int=0 ; 
var img_origine="" ;
var id_origine="";

function affiche_image_360() {
	document.getElementById(id_origine).src=img_origine;
	document.getElementById("image-aggrandie").style.display="block";
	}

function image_ouvre(fic,obj,id,tp,rg) {

	var pos_top=0 ;
switch (tp){
	case 1 :
	id_origine="vignette-produit-"+id ;
	document.getElementById("image-aggrandie").style.left=(obj.offsetLeft+120)+"px";
	break;
	case 2 :
	id_origine="mini-produit-"+id ;
	if (rg<9) {
	document.getElementById("image-aggrandie").style.left=(obj.offsetLeft+120)+"px";	
		}
		else
		{
		document.getElementById("image-aggrandie").style.left=(obj.offsetLeft-360-120)+"px";	
		}	
		
	break;
	case 3 :
	id_origine="mini-produit-"+id ;
	
	if (rg<9) {
	document.getElementById("image-aggrandie").style.left=(mid_fenetre-358+(rg*45))+"px";	
		}
		else
		{
			
		document.getElementById("image-aggrandie").style.left=(mid_fenetre-420+((rg-9)*45))+"px";	
		}	
		
	break;
	case 4 :
	id_origine="vignette-produit-"+id ;
	break ;
	}
	
	taille_fenetre();
	pos_top=Math.round(tempY-280+(FenHeight/2)-190);
	if (pos_top < 40) {pos_top=40; }
	document.getElementById("image-aggrandie").src=fic.replace("/T1/", "/T2/")+".jpg";
		
	if (tp<4) {
		img_origine=document.getElementById(id_origine).src
		document.getElementById(id_origine).src="/images-communes/gyros-m.gif"	
		document.getElementById("image-aggrandie").style.top=pos_top+"px"; 
		document.getElementById("image-aggrandie").style.width="360px";
		document.getElementById("image-aggrandie").style.height="360px";
		int=self.setInterval("affiche_image_360()",500);
	
           }
	
	
	
}

function image_ferme() {
int=window.clearInterval(int)	
document.getElementById(id_origine).src=img_origine;
document.getElementById("image-aggrandie").style.display="none";
	//document.getElementById("image-aggrandie").style.width="48px";
	//	document.getElementById("image-aggrandie").style.height="48px";
document.getElementById("image-aggrandie").src="/images-communes/gyros-m.gif";
}		



function pos_souris(obj) {

var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
tempY=scrOfY+40
tempX=scrOfX

}

function ouvre_iframe(tp_mer,ann,act,code_pr,nom_pr,Liste_seq) {
// tp_mer :  1p=Mono-produit ; 2p=Multi-produits ; 2e=Multi-entreprises ; 1e=Mono_entreprise ; 2s= multi-diffusion automatique
 // pour test :
var urlFormulaire="http://mer."
switch(ann) {
	case "a" :
		urlFormulaire=urlFormulaire+"franceameublement.fr"
	break; 
	case "b" :
		urlFormulaire=urlFormulaire+"francebeaute.fr"
	break;
	case "c" :
		urlFormulaire=urlFormulaire+"francecuir.fr"
	break;
	case "e" :
		urlFormulaire=urlFormulaire+"franceenvironnement.com"
	break;
	case "f" :
		urlFormulaire=urlFormulaire+"fourni-labo.fr"
	break;
	case "m" :
		urlFormulaire=urlFormulaire+"francemusiqueimageson.fr"
	break;
	case "n" :
		urlFormulaire=urlFormulaire+"francenature.fr"
	break;
	case "v" :
		urlFormulaire=urlFormulaire+"francebiotechnologies.fr"
	break;
	
	}

var source=urlFormulaire+"/WD160AWP/WD160Awp.exe/CONNECT/from_mer?"
    
    
	
	if (Liste_seq.length==0 && tp_mer.substring(0,1)=="2"){
		switch(tp_mer) {
			case "2p" :		
			document.getElementById("bulle_Produits-2").style.display="block"; 	
			break; 
			case "2e" :		
			document.getElementById("bulle-info-2").style.display="block"; 	
			break; 
			case "2s" :		
			document.getElementById("bulle_Produits-2").style.display="block"; 	
			break;
						}
	
	
	} else	{	
		document.getElementById('cache').style.visibility="visible";
		//document.getElementById('cache').style.width=lDoc+"px"; 
		document.getElementById('cache').style.width="100%"; 
		switch(tp_mer) {
			case "1p" :
			document.getElementById('id_iframe').src=source+"ann="+ann+"&ori=Produit-"+code_pr+"-N&act="+act;
			document.getElementById('titre_formulaire').style.display="inline";
			document.getElementById('titre_formulaire').innerHTML=nom_pr;
			break;
			case "2p" :
			document.getElementById('id_iframe').src=source+"ann="+ann+"&ori=ss-rub_Produit&act="+act+"&sfc="+Liste_seq;
			document.getElementById('titre_formulaire').style.display="inline";
			document.getElementById('titre_formulaire').innerHTML="";
			document.getElementById("bulle_Produits-1").style.display="none"; 
			break; 
			case "1e" :
			document.getElementById('id_iframe').src=source+"ann="+ann+"&ori="+act+"&sfc="+Liste_seq;
			document.getElementById('titre_formulaire').style.display="inline";
			document.getElementById('titre_formulaire').innerHTML=nom_pr;
			document.getElementById('cache').style.zIndex="100";
			break
			case "2e" :
			document.getElementById('id_iframe').src=source+"ann="+ann+"&ori=ss-rubt&act="+act+"&sfc="+Liste_seq;
			document.getElementById('titre_formulaire').style.display="inline";
			document.getElementById('titre_formulaire').innerHTML="";
			document.getElementById("bulle-info-1").style.display="none"; 
			break; 
			case "2s" :
			document.getElementById('id_iframe').src=source+"ann="+ann+"&ori=ss-rub-multi&act="+act+"&sfc="+Liste_seq+"&dp"+code_pr;
			document.getElementById('titre_formulaire').style.display="inline";
			document.getElementById('titre_formulaire').innerHTML="";
			break; 
			
		}		
		document.getElementById('espace-formulaire').style.visibility="visible";
		document.getElementById('espace-formulaire').style.display="block";
		document.getElementById('couche-formulaire').style.display="block";
		document.getElementById('id_iframe').style.width="390px";
		document.getElementById('id_iframe').style.height="600px";
		document.getElementById('container_formulaire').style.width=document.getElementById('id_iframe').style.width;
		document.getElementById('tete_formulaire').style.width=document.getElementById('id_iframe').style.width;
		var pos_top=0 ;
		taille_fenetre();
		if (FenHeight>600) {
			pos_top=Math.round(tempY-40+(FenHeight/2)-300);
		//	if (tp_mer=="1e"&&pos_top>90&&pos_top<170) {  pos_top=90 ; }
		} else	{
			pos_top=tempY-30	
		}
	
	
	     //  document.getElementById('espace-formulaire').style.top=(tempY)+"px" ; 
	      document.getElementById('espace-formulaire').style.top=pos_top+"px" ; 
	      document.getElementById('id_iframe').setAttribute("scrolling", "no");

	}
return;
}

function ouvre_iframe_formulaire(tp_mer,ann,act,code_pr,nom_pr,Liste_seq) {
	
	var urlFormulaire="http://192.168.0.20/FORM_MER_2_WEB/FR/PAGE_essai.awp?P1="+ann+"&P2="+Liste_seq
	document.getElementById('id_iframe').src=urlFormulaire
			document.getElementById('titre_formulaire').style.display="inline";
	
	document.getElementById('espace-formulaire').style.visibility="visible";
		document.getElementById('espace-formulaire').style.display="block";
		document.getElementById('couche-formulaire').style.display="block";
		document.getElementById('id_iframe').style.width="950px";
		document.getElementById('id_iframe').style.height="600px";
		document.getElementById('container_formulaire').style.width=document.getElementById('id_iframe').style.width;
		document.getElementById('tete_formulaire').style.width=document.getElementById('id_iframe').style.width;
		var pos_top=0 ;
		taille_fenetre();
		if (FenHeight>600) {
			pos_top=Math.round(tempY-40+(FenHeight/2)-300);
		//	if (tp_mer=="1e"&&pos_top>90&&pos_top<170) {  pos_top=90 ; }
		} else	{
			pos_top=tempY-30	
		}
	
	
	     //  document.getElementById('espace-formulaire').style.top=(tempY)+"px" ; 
	      document.getElementById('espace-formulaire').style.top=pos_top+"px" ; 
	      document.getElementById('id_iframe').setAttribute("scrolling", "auto");


}

function ouvre_iframe_image(FicImage) {
 // document.getElementById('cache').style.width=lDoc+"px"; 
  document.getElementById('cache').style.width="100%"; 
	
if (FicImage.length>0) {
	var source=""
	
	document.getElementById('titre_formulaire').innerHTML="" ;
	document.getElementById('titre_formulaire').style.display="none";
	document.getElementById('id_iframe').src="/js/espace-inclusion.php?inc="+FicImage;
	document.getElementById('espace-formulaire').style.visibility="visible";
	document.getElementById('espace-formulaire').style.display="block";
	document.getElementById('couche-formulaire').style.display="block";
	document.getElementById('cache').style.visibility="visible";
	document.getElementById('id_iframe').style.width="530px";
	document.getElementById('id_iframe').style.height="1670px";
	
	if (parseInt(screen.height)>parseInt(document.getElementById('id_iframe').style.height)) {
		hauteur= screen.height
	}
	else
	{
		hauteur=(parseInt(document.getElementById('id_iframe').style.height)*1.1)+"px";
	}
	

	document.getElementById('container_formulaire').style.width=document.getElementById('id_iframe').style.width;
	document.getElementById('tete_formulaire').style.width=document.getElementById('id_iframe').style.width;

	document.getElementById('espace-formulaire').style.top="31px";
	document.getElementById('id_iframe').setAttribute("scrolling", "no");
}
return;
}

function ouvre_iframe_maj(sfc) {
	var domaine=(location.hostname.replace("www.","maj."));
 hauteur_corps=hc()-320;
 	document.getElementById('id_iframe').src="http://"+domaine+"/GESTION_MODIFICATIONS_WEB/FR/identification.awp?P1="+sfc;
  	document.getElementById('cache').style.width="100%"; 
	document.getElementById('espace-formulaire').style.visibility="visible";
	document.getElementById('espace-formulaire').style.display="block";
	document.getElementById('couche-formulaire').style.display="block";
	document.getElementById('cache').style.visibility="visible";
	document.getElementById('id_iframe').style.width="992px";
	document.getElementById('id_iframe').style.height=hauteur_corps+"px";
	document.getElementById('container_formulaire').style.width=document.getElementById('id_iframe').style.width;
	document.getElementById('tete_formulaire').style.width=document.getElementById('id_iframe').style.width;
	document.getElementById('espace-formulaire').style.top="150px";
	document.getElementById('id_iframe').setAttribute("scrolling", "yes");
	return;
}

function ouvre_iframe_avis(ann) {
 hauteur_corps=hc()-320;
 	document.getElementById('id_iframe').src="/votre-avis.html?P1="+ann+"&P2="+location.href;
  	document.getElementById('cache').style.width="100%"; 
	document.getElementById('espace-formulaire').style.visibility="visible";
	document.getElementById('espace-formulaire').style.display="block";
	document.getElementById('couche-formulaire').style.display="block";
	document.getElementById('cache').style.visibility="visible";
	document.getElementById('id_iframe').style.width="493px";
	document.getElementById('id_iframe').style.height="450px";
	document.getElementById('container_formulaire').style.width=document.getElementById('id_iframe').style.width;
	document.getElementById('tete_formulaire').style.width=document.getElementById('id_iframe').style.width;
	var pos_top=0 ;
		taille_fenetre();
		if (FenHeight>600) {
			pos_top=Math.round(tempY-40+(FenHeight/2)-300);
			} else	{
			pos_top=tempY-30	
		}
		 
	      document.getElementById('espace-formulaire').style.top=pos_top+"px" ; 
	//document.getElementById('id_iframe').setAttribute("scrolling", "yes");
	return;
}


function ferme_iframe(){
	  document.getElementById('cache').style.width="0"; 
		document.getElementById('cache').style.visibility="hidden";
		document.getElementById('espace-formulaire').style.display="none";
		document.getElementById('couche-formulaire').style.display="none";
		document.getElementById('id_iframe').src="";
		document.getElementById('id_iframe').setAttribute("scrolling", "no");
return;
}

function loupe_vignette_plus(n_ID) {
	
	document.getElementById(n_ID).style.height="80px";
	document.getElementById(n_ID).style.width="80px";
	document.getElementById(n_ID).style.zIndex="80";
	document.getElementById(n_ID).style.margin="-20px 20px 20px -20px";
}

function loupe_vignette_moins(n_ID) {
	
	document.getElementById(n_ID).style.height="40px";
	document.getElementById(n_ID).style.width="40px";
	document.getElementById(n_ID).style.zIndex="10";
	document.getElementById(n_ID).style.margin="0";
}

function _Affiche_Liste_Departements_V4(event){
document.getElementById('liste-departements').style.display="block" ;
document.getElementById('choix-departements').style.visibility="hidden" ;
}

//function page_precedente() {
//	if (document.referrer.substr(9,6) == document.URL.substr(9,6)) {
//	document.getElementById("ariane-n").href=document.referrer;
//	}
 //       else
 //       {
//	document.getElementById("ariane-n").style.display="none";
//	}
	
//}

	
 function attente() {

	document.getElementById('image-attente').style.border="none";
	document.getElementById('image-attente').src="/images-communes/gyros-m.gif";
	document.getElementById('image-attente').style.width="66px";
	document.getElementById('image-attente').style.height="66px";
        document.getElementById('image-attente').style.display="block";
       document.getElementById('image-attente').style.position="fixed";
       document.getElementById('image-attente').style.left=(mid_fenetre)+"px";
       document.getElementById('image-attente').style.top=350+"px"; 
      document.getElementById('image-attente').style.zIndex="102";
       document.getElementById('cache').style.cursor="wait"; 
       document.getElementById('cache').style.visibility="visible";
        document.getElementById('cache').style.width=LargeurDoc()+"px"; 
        document.getElementById('cache').style.zIndex="101";
}

function quitte() {
 document.getElementById('image-attente').style.display="none";	
document.getElementById('cache').style.visibility="hidden";	
}

function fin_chargement() {
	//page_precedente();
var hDoc=HauteurDoc();
var lDoc=LargeurDoc();
document.getElementById('cache').style.height=hDoc+"px";
document.getElementById('tzLIBHTM_GLOBAL').style.height=hDoc+"px";
document.getElementById('cache').style.width="0";
document.getElementById('cache').style.visibility="hidden";
var hauteur_corps ;
if (document.getElementById('corps_gauche').style.height<document.getElementById('corps_droit').style.height) {
	hauteur_corps=document.getElementById('corps_gauche').style.height ;
}
else
{
	hauteur_corps=document.getElementById('corps_droit').style.height ;
}
hauteur_corps= hc() -220 ;
var hauteur_separation= Math.max(1024, document.documentElement.offsetHeight)-480
//alert("body.scrollHeight="+document.body.scrollHeight+"\ndocumentElement.scrollHeight="+document.documentElement.scrollHeight+"\nbody.offsetHeight="+document.body.offsetHeight+"\ndocumentElement.offsetHeight="+document.documentElement.offsetHeight+"\nbody.clientHeight="+document.body.clientHeight+"\ndocumentElement.clientHeight="+document.documentElement.clientHeight);
document.getElementById('separe_corps').style.height=hauteur_separation+"px";
}

function hc() {
	D=document ;
	return 	Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight),
        715
   ); 
  
   
	}	

function cherche_carte(VSLATITUDE,VSLONGITUDE, VSADRESSE){
	{	
		charge_carte(VSLATITUDE,VSLONGITUDE,VSADRESSE,1);
	}
}

function charge_carte(lat,long,adr,zz) {
js_charge_carte_V3(lat,long,adr,zz)
}

function js_charge_carte_V3(lat,long,adr,zz) {
var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 // Try W3C Geolocation (Preferred)
      initialLocation = new google.maps.LatLng(lat,long);
      map.setCenter(initialLocation);
      var marker = new google.maps.Marker({
      position: initialLocation,
      title: ""
  });
   marker.setMap(map); 
   var infowindow = new google.maps.InfoWindow({
   content: adr
}); 
infowindow.open(map,marker);
}


function ouvre_site(u) {
		window.open(u,'_blank');
}
function ouvre_page(u) {
		window.open(u,'_self');
}

function _compte_click_champ(ann,tp,champ,rw,nSeq){
{
var filename = "/js/compte_click_champ.php";
var xhr_object = null; 
	 
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
//	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   return; 
	} 
	
filename+='?&ann='+ann+'&tp='+tp+'&sfc='+nSeq+'&ch='+champ+'&rw='+rw	;
xhr_object.open('get', filename,false);
xhr_object.send(null);

}
}

function loupe_mini_vignette_plus(id_enc) {
	
	switch (id_enc) {
	case  301 :
	document.getElementById('image-p301').style.height="80px";
	document.getElementById('image-p301').style.width="80px";
	document.getElementById('image-p302').style.height="50px";
	document.getElementById('image-p302').style.width="50px";
	document.getElementById('image-p303').style.height="50px";
	document.getElementById('image-p303').style.width="50px";
	break
	case  302 :	
	document.getElementById('image-p302').style.height="80px";
	document.getElementById('image-p302').style.width="80px";
	document.getElementById('image-p301').style.height="50px";
	document.getElementById('image-p301').style.width="50px";
	document.getElementById('image-p303').style.height="50px";
	document.getElementById('image-p303').style.width="50px";
	break	
	case  303 :	
	document.getElementById('image-p303').style.height="80px";
	document.getElementById('image-p303').style.width="80px";
	document.getElementById('image-p301').style.height="50px";
	document.getElementById('image-p301').style.width="50px";
	document.getElementById('image-p302').style.height="50px";
	document.getElementById('image-p302').style.width="50px";
	break	
		}
	
}
function loupe_mini_vignette_moins() {
	
	document.getElementById('image-p302').style.height="60px";
	document.getElementById('image-p302').style.width="60px";
	document.getElementById('image-p301').style.height="60px";
	document.getElementById('image-p301').style.width="60px";
	document.getElementById('image-p303').style.height="60px";
	document.getElementById('image-p303').style.width="60px";
}

function affiche_tel(id_t,id_b) {

	

		document.getElementById(id_t).style.display="block" ;

		document.getElementById(id_b).style.display="none" ;

}

function _grande_image() {

	document.getElementById("i_imageproduit").style.margin = "0 0 0 -180px" ;
	 document.getElementById("i_imageproduit").style.width ="360px";
 	document.getElementById("i_imageproduit").style.zIndex = "200";
 		document.getElementById("d_imageproduit").style.zIndex = "200";

}





function _petite_image() {
	//document.getElementById("d_imageproduit").style.right = "0";

	 document.getElementById("i_imageproduit").style.width ="180px";

	document.getElementById("i_imageproduit").style.margin = "0" ;

 	document.getElementById("d_imageproduit").style.zIndex = "100";
 		document.getElementById("i_imageproduit").style.zIndex = "100";

}



function traduction(champ_origine,champ_traduit,lg2) {



// cache le texte original , montre la traduction et le lien vers original

document.getElementById(champ_origine).style.display="none";

document.getElementById(champ_traduit).style.display="inline";	

document.getElementById('tradfr').style.display="inline";

document.getElementById(champ_traduit).innerHTML ="<br>Traduction en cours<br>Si ce texte reste affich&eacute; plus de quelques secondes, il n'y a pas de traduction disponible<br>"

// récupère le texte original

var text = document.getElementById(champ_origine).innerHTML;

if (text.length>1100){

 text=text.substr(0,1100)+" ... fin de traduction.<br><br>Traduction Automatique par Google"  ;

}



// traduit le texte avec fonction retour AJAX 

 google.language.translate(text, 'fr', lg2, function(result) {

  var translated = document.getElementById(champ_traduit);

 if (result.translation) {

// si retour OK charge le texte de traduction en ajax asynchrone 	

document.getElementById(champ_traduit).innerHTML = result.translation;



}

else

{

// si retour PAS OK charge le texte de original en ajax asynchrone 	

document.getElementById(champ_traduit).innerHTML ="pas de traduction disponible" ;	

}

   });  

}



function texteorigine(champ_origine,champ_traduit) {

// rétabli le texte original	

document.getElementById('tradfr').style.display="none";

document.getElementById(champ_traduit).style.display="none";

document.getElementById(champ_origine).style.display="inline";

}	



			




	

	


