function byId(id) {
  return document.getElementById ? document.getElementById(id) : document[id];
}

function Highlight(elem){
	var radix = elem.id.substring(0,elem.id.length - 1);
	
	if(byId(radix+"l").className != "tab-left-selected"){
		byId(radix+"l").style.backgroundImage="url(images/menutop_left_over.gif)";
		byId(radix+"m").style.backgroundImage="url(images/menutop_middle_over.gif)";
		byId(radix+"r").style.backgroundImage="url(images/menutop_right_over.gif)";
		byId(radix+"m").firstChild.style.color="white";
	}
}

function Unlight(elem){
	var radix = elem.id.substring(0,elem.id.length - 1);
	
	if(byId(radix+"l").className != "tab-left-selected"){
		byId(radix+"l").style.backgroundImage="url(images/menutop_left.gif)";
		byId(radix+"m").style.backgroundImage="url(images/menutop_middle.gif)";
		byId(radix+"r").style.backgroundImage="url(images/menutop_right.gif)";
		byId(radix+"m").firstChild.style.color="#5f5f61";
	}
}


function addToFavorites(anchor) 
{ 
	var urlAddress = "http://www.1pierre2coups.com"; 
	var pageName = "titre"; 

	if (window.external) 
	{ 
	window.external.AddFavorite(anchor.getAttribute('href'), anchor.getAttribute('mon titre')); 
	} 
} 

//------------------
/*
evenement appel : href='javascript:ShowForm();'
div de fond  : <div id="D_FOND" style="display:none;width:100%;height:100%;background-color:#000000;filter:progid:DXImageTransform.Microsoft.Alpha( Opacity=80, Style=0,)"></div>
div ferme : <div id="D_FORM" style="display:none;">
<table border=1 width="200" height="200" bgcolor="#c0c0c0">
<tr><td bgcolor="#808080"><b>Le Titre</b></td></tr><tr><td align="center">
<br><b>Ceci est un formulaire</b>
<br>
<br><input type="button" name="I_BTN1" id="I_BTN1" onclick="HideForm();" value="Fermer">
</td></tr></table>
</div>
*/
function ShowForm(){
  var Obj;
  //-- on affiche le fond
  Obj = document.getElementById('D_FOND');
  if( Obj){
    with( Obj.style){
      position="absolute";
      display="";
      left = "0px";
      top  = "0px";
      zIndex= 10;
    }
  }
  //-- on affiche le formulaire
  Obj = document.getElementById('D_FORM');
  if( Obj){
    with( Obj.style){
      position="absolute";
      display="";
      zIndex= 11;
    }
    Obj.focus();
  }
}
//-----------------
function HideForm(){
  var Obj;
  Obj = document.getElementById('D_FORM');
  //-- on masque le formulaire
  if( Obj){
    with( Obj.style){
      display="none";
    }
  }
  //-- on masque le fond  
  Obj = document.getElementById('D_FOND');
  if( Obj){
    with( Obj.style){
      display="none";
    }
  }
}
function PopupCentrer(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}


// Ajoutées juin 2009  /  DANVIN CREATION
function AfficheCoupon()
{
	document.getElementById("calk_coupon").style.display = "inline";
	document.getElementById("idFond").style.display = "inline";
}
function FermeCoupon()
{
	document.getElementById("calk_coupon").style.display = "none";
	document.getElementById("idFond").style.display = "none";
}

function EnvoiAmi()
{
	document.getElementById("calk_envoiami").style.display = "inline";
	document.getElementById("idFond").style.display = "inline";
}
function FermeEnvoiAmi()
{
	document.getElementById("calk_envoiami").style.display = "none";
	document.getElementById("idFond").style.display = "none";
}
function AvertirOffre(id)
{
	document.getElementById("calk_avertiroffre").style.display = "inline";
	document.getElementById("avertir_res_id").value = id;
	document.getElementById("idFond").style.display = "inline";
}
function FermeAvertirOffre()
{
	document.getElementById("calk_avertiroffre").style.display = "none";
	document.getElementById("idFond").style.display = "none";
}
