/**
Contrairement aux autres navigateurs, avec Opera, un iframe est toujours visible.
Comme il est impossible de modifier le z-index d'un iframe, la solution est de le
rendre 'hidden' au moment de l'affichage d'un menu.
Une autre solution serait de transformer les 'iframe' en 'div' pour afficher
le html.
Implique accessoirement de développer un 'scroll' du contenu des 'div'
d'affecter à div.innerHTML la chaîne HTML devant être affichée, tous les "'"
et '"' auront été au préalable échapés en \' \" .
*/
var opera ; var mac;
var artistes;
var must_hide_iframe;

function sniff() {
	opera = is.opera;
	mac = is.mac;
	artistes = document.getElementById('biographie');
	must_hide_iframe = opera && artistes;
}

function debug(data) {
	dbg=document.getElementById("DEBUG");
	dbg.style.visibility="visible";
	in_ = dbg.innerHTML;
	dbg.innerHTML=in_+'<br>'+data;
}
/**
Affichage dans une autre fenêtre
*/
function displayOtherWindow(url,winname,para) {
	// options: menubar=yes, etc...
	var nbargs = displayOtherWindow.arguments.length;
	if (nbargs==2) para = "width=600 ,height=500 ,scrollbars=yes ,resizable=yes";
	var win = window.open(url,winname,para);
	win.focus();}
	
/**
Coordonnées absolues d'un élément quelconque.
*/
function DL_GetElementLeft(eElement)
{
    if (!eElement && this)                       // if argument is invalid
    {                                            // (not specified, is null or is 0)
        eElement = this;                         // and function is a method
    }                                            // identify the element as the method owner

    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}

function DL_GetElementTop(eElement)
{
    if (!eElement && this)
    {
        eElement = this;
    }

    var nTopPos = eElement.offsetTop;
    var eParElement = eElement.offsetParent;
    while (eParElement != null)
    {
        nTopPos += eParElement.offsetTop;
        eParElement = eParElement.offsetParent;
    }
    return nTopPos;
}
/**
Le système de menus:
*/
var div;var hdiv;var essai;var essaid;var dessus;
// pour le menu KG introduction de la variable popup:
var popup;
function has_id(id) {
	return document.getElementById(id);}
function getDiv(event,calling_div,id,x,y) {
	// Septembre 2005
	if (window.men_id)setVisibility(men_id,'hidden');
	men_id = id;
//    event.cancelBubble = true;
    dessus=1;
    if (must_hide_iframe) artistes.style.visibility = 'visible';
    var dav = false;
	if (document.getElementById(id)) dav=document.getElementById(id);
	var hide_it = must_hide_iframe &&
                  calling_div.className!='ver' &&
                  getStyle(calling_div,'left') > 320 &&
                  dav &&
				  getStyle(dav,'height') > 55 ;
	if (hide_it) artistes.style.visibility = 'hidden';
	if (window.div) div.style.visibility='hidden';
	t = getStyle(calling_div,"top");
	h = getStyle(calling_div,"height");
	l = getStyle(calling_div,"left");
	w = getStyle(calling_div,"width");
	if (l=='auto') {
		ww = document.body.clientWidth;
		r = getStyle(calling_div,"right");
		l = parseInt(ww)-(r+w);}
//		Il est possible que id ne référence aucun menu, on sort dans ce cas
	if (document.getElementById(id)) div=document.getElementById(id); else return;
	if (calling_div.className=='ver') {
		    div.style.top = t + (h-getStyle(div,"height"))/2;
		    div.style.left = l+w+5;
			} else {
			div.style.top=y+t+h+2;
			div.style.left=l+x;}
	wd = getStyle(div,"width");
	div.style.visibility="visible";
	clipIt(div,0,1);
	if (isNaN(w)||w < wd) return;
//	div.style.width=w;
	}
function getHDiv(event,calling_div,id,x,y) {
//	event.cancelBubble = true;
	dessus=1;
	popup=1;
	if (window.hdiv) hdiv.visibility = 'hidden';
	t = DL_GetElementTop(calling_div);
	h = getStyle(calling_div,"height");
	l = DL_GetElementLeft(calling_div);
	w = getStyle(calling_div,"width");
	if (l=='auto') {
		ww = document.body.clientWidth;
		r = getStyle(calling_div,"right");
		l = parseInt(ww)-(r+w);}
//		Il est possible que id ne référence aucun menu, on sort dans ce cas
	if (document.getElementById(id)) hdiv=document.getElementById(id); else return;
	if (calling_div.className=='ver') {
		    hdiv.style.top = t + (h-getStyle(hdiv,"height"))/2;
		    hdiv.style.left = l+w+5;
			} else {
			hdiv.style.top=y+t-3;
			hdiv.style.left=l+w+x;}
	wd = getStyle(hdiv,"width");
	hdiv.style.width=wd;
	hdiv.style.visibility="visible";
//temp	clipIt(hdiv,0,1);
	if (isNaN(w)||w < wd) return;
//	div.style.width=w;
	}

function clipIt(obj,from,dir) {
//	Différence de comportement entre MOZILLA et IE: oblige à augmenter
//	la taille de la clipping window.

	if (dir==1) end=getStyle(obj,"height")+8; else end=0;
	if (dir==1  && from>end) {return;}
	if (dir==-1 && from<end) {return;}
	width=getStyle(obj,"width")+8;
	delta = dir * 3;
	obj.style.clip="rect(0,"+width+","+from+",0)";
	from=from+ delta;
	setTimeout(function(){clipIt(obj,from,dir)},0);}

function getStyle(obj,style) {
	if (document.defaultView)
		v=document.defaultView.getComputedStyle(obj,'').getPropertyValue(style); else
		switch(style) {
			case 'left' :
				v = obj.offsetLeft;return parseInt(v);
			case 'top' :
				v = obj.offsetTop;return parseInt(v);
			case 'width':
				v = obj.offsetWidth;return parseInt(v);
			case 'height':
				v = obj.offsetHeight;return parseInt(v);
			default :
				v = obj.currentStyle[style];}
	vp = parseInt(v);
	if(isNaN(vp)) return v;
	return vp; }

function Sortie(){
	if (!window.div) return;
	if (dessus==0) {
		if (!window.essai) essai=0;
		if(essai > 100) {
			div.style.visibility = "hidden";
			if (must_hide_iframe) artistes.style.visibility = 'visible';
			if (window.hdiv) hdiv.style.visibility = "hidden";
			essaid=0;
			essai=0;
			return;}
		setTimeout("Sortie()",10);
		essai++;}}

// Modifié le 5 mars 2007; Les utilisateurs du Mac voient disparaître
// le menu pop-up de King Gong au moindre mouvement de souris ...
function SortieHDIV(){
	if (mac) return;  // Temporisation infinie.
    	if (!window.hdiv) return;
	if (dessus==dessus) {
		if (!window.essaid) essaid=0;
		if(essaid > 500) {
			hdiv.style.visibility = "hidden";
			essaid=0;
			return;}
		setTimeout("SortieHDIV()",10);
		essaid++;}}




