// Calques
function findObj(theObj, theDoc)
{
  var p, i, foundObj;  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);}
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2){
    if ((obj = findObj(args[i])) != null){
      visStr = args[i+1];
      if (obj.style){
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';}
      obj.visibility = visStr;}
  }
}
function showcalq(calque){ // avec une liste établie
	var i,visi,obj;
	for(i=0; i<calq.length; i++){
		visi=calq[i]==calque?'show':'hide';
	    if ((obj = findObj(calq[i])) != null){
	      	if (obj.style){
    	    	obj = obj.style;
				visi=calq[i]==calque?'visible':'hidden';}
			obj.visibility=visi;
		}
	}
}
function show1calq(calque){
	var obj;
	if ((obj = findObj(calque)) != null){
		if (obj.style){
    	  obj = obj.style;
				obj.visibility='visible';}
		else obj.visibility='show';
	}
}
function hide1calq(calque){
	var obj;
	if ((obj = findObj(calque)) != null){
		if (obj.style){
    	  obj = obj.style;
				obj.visibility='hidden';}
		else obj.visibility='hide';
	}
}
function setLayersHeight(){ 
	var i, obj, args = setLayersHeight.arguments;
	h=screen.height-60;
	if (h<800) h=800;
  for (i=0; i<(args.length); i++){
    if ((obj = findObj(args[i])) != null){
			if (obj.style) obj = obj.style;
			if (document.layers) obj.height=h;
			else obj.height = h+'px';
		}
	}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// fenetres pop-ups d'etiquette et de prix

var ff,ff2,ff3;
function WinPop(fname,titre,params) {
  if (ff3==null || ff3.closed)ff3=window.open(fname,titre,params);
  else ff3.focus();
}  
// sans scrollbars avec resize
function WinPopa(fname,w,h) {
  if (ffa==null || ffa.closed) ffa=window.open(fname,'DenisBarraud','resizable=yes,scrollbars=no,width='+w+',height='+h);
  else {
 	ffa.focus();
	ffa.resizeTo(w+12,h+36);
	ffa.location.href=fname;
  }
}
// Generique 
function wPop(fname,larg,haut) {
	h=screen.height;
	if (h<600) h=600;
	h=h-90;
	if (haut > h) haut=h;
  if (ff==null || ff.closed)ff=window.open(fname,"DenisBarraud","scrollbars=yes,resizable=yes,width="+larg+",height="+haut);
  else{
   ff.focus();
   ff.location.href=fname;
  }
}
// Generique avec dimensions par défaut ("Bonjour c'est POP2") ;-)
function wPop2(fname) {
  if (ff==null || ff.closed)ff=window.open(fname,"DenisBarraud","scrollbars=yes,resizable=yes,width=750,height=600");
  else{ff.focus();ff.location.href=fname;}
}
function wPop2x(fname) {
  if (ff==null || ff.closed)ff=window.open(fname,"Denis Barraud","scrollbars=yes,resizable=yes,width=950,height=600");
  else{ff.focus();ff.location.href=fname;}
}
//Generique avec resize
function WinPopRs(fname,w,h) {
  if (ff3==null || ff3.closed) ff3=window.open(fname,'DenisBarraud','resizable=yes,scrollbars=yes,width='+w+',height='+h);
  else {
 	ff3.focus();
	ff3.resizeTo(w+12,h+36);
	ff3.location.href=fname;
  }
}
function ferme_popup(){
   if(ff && !ff.closed) ff.close();
   ff=null;
   if(ff2 && !ff2.closed) ff2.close();
   ff2=null;
   if(ff3 && !ff3.closed) ff3.close();
   ff3=null;
}


var timerID = null;
var timerOn = false;
var timecount = 500;
var menudown =0;

function showMenu(nummenu){
	stopTim();
	closeMenu();
	menudown=nummenu;
	show1calq('smliens'+menudown);
}
function closeMenu(){
	if (menudown){hide1calq('smliens'+menudown);menudown=0;}
}
function startTim() {if (timerOn == false) {timerID=setTimeout( "closeMenu()" , timecount);timerOn = true;}}
function stopTim() {if (timerOn) {clearTimeout(timerID);timerID = null;timerOn = false;}}
var ffama;
function AmaLeg(fname){if (ffama==null || ffama.closed) ffama=window.open(fname,"","scrollbars=yes,resizable=yes,width=490,height=480");else{ffama.focus();ffama.location.href=fname;}}

function setprof()
{ 
if (navigator.appName == "Netscape" && eval(navigator.appVersion.substring(0,3) ) < 5) document.pge.document.mainpg.document.courrier.prof[1].checked=true;
else document.courrier.prof[1].checked=true;
}
