function calquevisible(lecalque){
document.getElementById(lecalque).style.display = 'block';
calque_actif = lecalque;
for (a=0; a<16; a++){
		if(a != lecalque.substring(1)){
			if(a < 12){
			document.getElementById("i"+a).src=document.getElementById("i"+a).src.replace("_on.","_off.");
			}
			document.getElementById("c"+a).style.display = 'none';
		}
	}
}

function calquevisibleform(lecalque){
document.getElementById(lecalque).style.display = 'block';
}

function calquecache(lecalque){
document.getElementById(lecalque).style.display = 'none';
}


function rollon(limage){
 limage = document.getElementById(limage);
 limage.src=limage.src.replace("_off.","_on.");
}
function rolloff(limage){
	if("c"+limage.substring(1) != calque_actif){
 		limage = document.getElementById(limage);
 		limage.src=limage.src.replace("_on.","_off.");
	}
}



function at_show_pos(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+0 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +0 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.display = "block";
}

// ***** at_show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);
var img = document.getElementById(this["at_image" ]);
img.src=img.src.replace('_off.','_on.');
  at_show_pos(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);
var img = document.getElementById(this["at_image" ]);
if(img.id != menu_actif){
	img.src=img.src.replace('_on.','_off.');
	}
if(p.id == "public_menu" && document.getElementById("public_sssmenu").style.display=="block"){
	document.getElementById("public_sssmenu").style.display="none";
	}
if(p.id == "laborenard_menu" && document.getElementById("laborenard_sssmenu").style.display=="block"){
	document.getElementById("laborenard_sssmenu").style.display="none";
	}
if(p.id == "entreprise_menu" && document.getElementById("entreprise_sssmenu2").style.display=="block"){
	document.getElementById("entreprise_sssmenu2").style.display="none";
	}
c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.display = 'none'", 200);
}

// ***** at_click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.display != "block") at_show_pos(p.id, c.id); else c.style.display = "none";
  return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor, imgmenu)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);
var image = document.getElementById(imgmenu);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;
p["at_image"]   = image.id;
c["at_image"]   = image.id;

  c.style.position   = "absolute";
  c.style.display = "none";

  //if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

