function AffEff(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? '' : 'none';
	el.style.display = display;
}

function Eff(id)
{
   el = document.getElementById(id);
   el.style.display = 'none'
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function sendIT(fileName)
{
  if (fileName !="")
    {
       Somfen=window.open(fileName,"Som","toolbar=1,location=1,scrollbars=1,status=1,menubar=1,resizable=1")
    }
}
      
//function voirSelection(IN_SES)
//{
//window.location.href='/scripts/consult/annonce/liste.asp?IN_Process=PANIER&IN_SES='+IN_SES;
//}


function ouvre(ref)
     { var WinName;
       // Par 2 facultatif = nomme la fenêtre : ouvrir la même "Som" (si non fourni) ou un nom de fenêtre spécifié par cet argument
       if (ouvre.arguments.length==2) {WinName =ouvre.arguments[1];} else {WinName = "Som";}
       Somfen=window.open("",WinName,"toolbar=0,scrollbars=1,location=0,status=0,resizeable=1,menubar=0,width=650,height=525,marginwidth=0,marginheight=0")
       Somfen=window.open(ref,WinName);
      }
function ouvrePlusGrand(ref)
     { var WinName;
       // Par 2 facultatif = nomme la fenêtre : ouvrir la même "Som" (si non fourni) ou un nom de fenêtre spécifié par cet argument
       if (ouvrePlusGrand.arguments.length==2) {WinName =ouvrePlusGrand.arguments[1];} else {WinName = "Som";}
       Somfen=window.open("",WinName,"toolbar=0,scrollbars=1,location=0,status=0,resizeable=1,menubar=0,width=800,height=600,marginwidth=0,marginheight=0")
       Somfen=window.open(ref,WinName);
      }
			
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// #############################
// ###  BarreMenu  #### Début ##
// #############################

function OmbRetail(Ident,Ombre) // Calcul et restitue la bonne hauteur à l'ombre de droite
{
 var HChoix = document.getElementById(Ident).offsetHeight ;
// alert (HChoix);
 HOmbre = HChoix+'px' ;
// alert (HOmbre);
 document.getElementById(Ombre).style.height = HOmbre ;
}

function findPosX(Chx)
{
  var curleft = 0;
  var obj = document.getElementById(Chx) ;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(Chx)
{
	var curtop = 0;
  var obj = document.getElementById(Chx) ;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function AffChx(Chx,PopUp,Couleur)
{
	var ChxX = findPosX(Chx);
	var ChxY = findPosY(Chx);
  var ChxH = document.getElementById(Chx).offsetHeight ;
  var PopUpProp = document.getElementById(PopUp).style ;
	var Signet = document.getElementById(Chx).style ;
//  alert(ChxX+'px ,'+ChxY+'px, hauteur:'+ChxH+'px');
  PopUpProp.visibility = 'visible';
  PopUpProp.top = ChxY+ChxH+'px';
  PopUpProp.left = ChxX+'px';
  OmbRetail('Lst'+PopUp,'Ombr'+PopUp);
	Signet.background = 'url(/style/FlchBarre.gif) no-repeat 50% bottom '+Couleur ;
}

function CacheChx(Chx,PopUp,Couleurfond)
{
 document.getElementById(PopUp).style.visibility = 'hidden';
 document.getElementById(Chx).style.backgroundImage = 'none';
 document.getElementById(Chx).style.backgroundColor = Couleurfond;

// alert (Couleurfond);
// '#0c51a6'
}

// #############################
// ###  BarreMenu  ###### Fin ##
// #############################

// #####################################
// ###  Test formulaire  ###### Début ##
// #####################################

function isnumeric ( valeur )
{
   for (var i = 0; i < valeur.length; i++) 
   {
      var ch = valeur.substring(i, i + 1);
      if (ch < "0" || "9" < ch)
      {
         return false;
      }
   }
   return true;
}

function Aremplir ( Zone, Libelle )
{
   if ( Zone.value == "")
   {
      alert("\nLe champ '" + Libelle + "' est vide.\n\nSVP introduisez votre " + Libelle + ".");
      Zone.focus();
      return false;
   }
   else
   {
      return true;
   }
}
function TestEmail( Zone, Libelle )
{
// vérification de la présence d'un "@" et d'un ".".

   if (Zone.value.indexOf ('@',0) == -1 || Zone.value.indexOf ('.',0) == -1 )
   {
      alert("\nLe champ '" + Libelle + "' requière un \"@\" et un \".\"\n\nSVP resaisissez " + Libelle + ".");
      Zone.value='';
      Zone.select();
      Zone.focus();
      return false;
   }
   else
   {
      return true;
   }
}

function TestNumeric(Zone, Libelle)
{
   if ( isnumeric (Zone.value) )
   {
      return true;
   }
   else
   {
      alert("\nLe champ '" + Libelle + "' n'accepte que les chiffres 0-9.\n\nSVP resaisissez " + Libelle + ".");
      Zone.value='';
      Zone.select();
      Zone.focus();
      return false;
   }
}   

// #####################################
// ###  Test formulaire  ######## Fin ##
// #####################################

// ############################################
// ###  Affiche/efface un bloc  ###### Début ##
// ############################################

function AffEff(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? '' : 'none';
	el.style.display = display;
}

// ##########################################
// ###  Affiche/efface un bloc  ###### Fin ##
// ##########################################

// #############################
// ###  Pluriel  ###### Début ##
// #############################

function Pluriel(Nbre,libZero,accord)
{
 var nombre = document.getElementById(Nbre).innerHTML ;
 if (nombre == 0 || nombre =='' )
 {
  document.getElementById(Nbre).innerHTML = libZero;
 }
 if (nombre >= 2)
 {
  document.write(accord);
 }
}

// #############################
// ###  Pluriel  ######## Fin ##
// #############################

// *** Juste pour la liste d'annonce, effet de onmouseover ***
function tablChgOff(id)
{
 id.style.borderColor = '#fff';
 id.style.borderTopColor = '#ddd';
 id.style.borderBottomColor = '#ddd';
} 
function tablChgOn(id)
{
 id.style.borderColor = '#0c51a6';
}
// *** fin de l'effet d'annonce ***

