function hideElement(id) {
	document.getElementById(id).style.display='none';    
}

function showElement(id) {
    document.getElementById(id).style.display='block';
}
function addToFavorites() {
	if (document.all) {
		window.external.AddFavorite(location.href, document.title);
	} else {
		alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.')
	}
}

// Initialise le fish eye sur la fiche annonce.
function initFishEye() {
	new iFishEye({
	 dimThumb : {width:32, height:32},
	 dimFocus : {width:55, height:55},
	 norm: "L2",
	 useAxis: "both"
	});
}

// Ouvre une image en popup
function PopUpImage(src, chemin, titre) {

    // Génère un tableau avec les différentes parties de l'url, afin de récuper le dernier élement
    // Qui est le nom de l'image.
    var tableauTemporaire = src.split("/");
    
    // Récupère la dimension du tableau.
    var dimensionTableau = tableauTemporaire.length;
    
    // Le dernier élément est le nom de l'image.
    var nomImage = tableauTemporaire[dimensionTableau-1];
    
    // Génère le chemin complet vers l'image.
    if(chemin == '') {
      var image = src;
    }else{
      var image = chemin+nomImage;
    }
 
    var pub = window.open('','pub','width=10,height=10');
	pub.document.write( "<html><head><title>"+titre+"</title>\n" );
	pub.document.write( "<script language='JavaScript'>\n");
	pub.document.write( "IE5=NN4=NN6=false;\n");
	pub.document.write( "if(document.all)IE5=true;\n");
	pub.document.write( "else if(document.getElementById)NN6=true;\n");
	pub.document.write( "else if(document.layers)NN4=true;\n");
	pub.document.write( "function autoSize() {\n");
	pub.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+31)\n");
	pub.document.write( "else if(NN6) self.sizeToContent();\n");
	pub.document.write( "else window.resizeTo(document.images[0].width, document.images[0].height+20)\n");
	pub.document.write( "self.focus();\n");
	pub.document.write( "}\n</scri");
	pub.document.write( "pt>\n");
	pub.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	pub.document.write( "<a href='javascript:window.close();'><img src='"+image+"' border=0 alt='"+titre+"'></a><scr" );
	pub.document.write( "ipt type='text/javascript'>autoSize();</scri" );
	pub.document.write( "pt></body></html>");
	pub.document.close();
		
}

 function popup(page) {
	window.open(page,'popup','width=950,height=400,toolbar=yes,scrollbars=yes');	
 }



// Ouvre la version "zoom" d'une photo en popup.
function ouvrePopupZoom(src,chemin) {
    
    // Génère un tableau avec les différentes parties de l'url, afin de récuper le dernier élement
    // Qui est le nom de l'image.
    var tableauTemporaire = src.split("/");
    
    // Récupère la dimension du tableau.
    var dimensionTableau = tableauTemporaire.length;
    
    // Le dernier élément est le nom de l'image.
    var nomImage = tableauTemporaire[dimensionTableau-1];
    
    // Génère le chemin complet vers l'image.
    var zoom = chemin+nomImage;
    
    // Crée un objet de type image afin de récupérer ses dimensions.
    var image = new Image();
    image.src=(zoom);
    var hauteur  = image.height;
    var largeur  = image.width;
    
    // Ouverture du popup.
    window.open(zoom,"zoom","width="+largeur+",height="+hauteur+",toolbar= 0,scrollbars=0,resizable=0,status=0,menubar=0");
}


function linkfirst_callback(){
	fenn=window.open('http://www.moto85.com/addons/linkeo/appel.php','popupcallbacklinkeo','width=560,height=610,top=25,left=25,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=1');
	fenn.focus();
}

function switchButton(current) {
    
    var nbOfButtons = document.getElementById("boutons").getElementsByTagName("a").length;
    
	for (i = 0; i < nbOfButtons; i++) {
        document.getElementById("boutons").getElementsByTagName("a")[i].className="out";
	}
    document.getElementById("boutons").getElementsByTagName("a")[current].className="in";
    
}

// Permet de switch entre les onglets de la fiche annonce 
function switchInfosFicheAnnonce(onglet) {
    
    var nomOnglet = 'onglet-' + onglet;
 
    var listeOnglets = new Array();
    listeOnglets[0] = 'description';
    listeOnglets[1] = 'coordonnees';
    listeOnglets[2] = 'forum';
    listeOnglets[3] = 'email';
    var nbOnglets = listeOnglets.length;

 for (var i = 0; i < nbOnglets; i++) {
     document.getElementById('onglet-' + listeOnglets[i]).parentNode.style.backgroundPosition = 'top right';
     document.getElementById('onglet-' + listeOnglets[i]).style.backgroundPosition = 'top left';
     document.getElementById('onglet-' + listeOnglets[i]).style.color = 'black';
     document.getElementById('fiche-annonce-' + listeOnglets[i]).style.display = 'none';
 }
 
 document.getElementById('onglet-' + onglet).parentNode.style.backgroundPosition = 'right -24px';
 document.getElementById('onglet-' + onglet).style.backgroundPosition = '0 -24px';
 document.getElementById('onglet-' + onglet).style.color = '#ffbf00';
 document.getElementById('fiche-annonce-' + onglet).style.display = 'block';
}

window.addEvent('domready', function() {

    var accordion = new Accordion('.FAQToggler', '.FAQYou');

});

function openPictoTv() {
	Lightbox.init({
		defaultIframeWidth : 450, 
		defaultIframeHeight: 360
	});
	Lightbox.show('pictotv.html', 'Vu à la TV', 'pictotv');
}