// 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 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();
}  
function LivrePop(fname,w,h) {
  if (ff==null || ff.closed)ff=window.open("","etiket","resizable=yes,scrollbars=yes,width="+(w+48)+",height="+(h+40));
  else ff.focus();
  if (ff){
  	ff.document.open();
	ff.document.write('<head><title>Couverture<\/title><\/head>');
	ff.document.write('<body bgcolor="#FFFFFF" text="#000000" background="/img/FondSable0.gif">');
	ff.document.write('<table width="100%" height="100%" border="0">');
	ff.document.write('<tr><td align="center"><img src="'+fname+'" width="'+w+'" height="'+h+'"><\/td><\/tr><\/table><\/body>');
/*	ff.document.write('<div align="center"><img src="'+fname+'" width="'+w+'" height="'+h+'"><\/div><\/body>'); */
	ff.document.close();
	}
}
// Generique
function wPop(fname,larg,haut) {
  if (ff==null || ff.closed)ff=window.open(fname,"","scrollbars=yes,resizable=yes,width="+larg+",height="+haut);
  else{
   ff.focus();
   ff.location.href=fname;
  }
}
//Generique avec resize
function WinPopRez(fname,w,h) {
  if (ff3==null || ff3.closed) ff3=window.open(fname,'ChateauMasNeuf','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;
}
