// JavaScript Document

function active_box(box)
{
	if (window.document.getElementById(box).disabled == true) {
		window.document.getElementById(box).disabled = false;
	} else {
		window.document.getElementById(box).disabled = true;
	}
}

function showhide(layer_ref,img)
{
	if (document.getElementById(layer_ref).style.visibility == 'visible'){
		document.getElementById(layer_ref).style.visibility = 'hidden';
		document.getElementById(layer_ref).style.display = 'none';
		img.src='http://adelaya.nfrance.com/~eq36845/images/plus.png';
	} else {
		document.getElementById(layer_ref).style.visibility = 'visible';
		document.getElementById(layer_ref).style.display = 'block';
		img.src='http://adelaya.nfrance.com/~eq36845/images/moins.png';
	}
}

function showdiv(div)
{
	
	if (document.getElementById(div).style.display == 'block'){
		animatedcollapse.hide('text'+div);	
		commande = "document.getElementById('"+div+"').style.display = 'none'";		
		setTimeout(commande, 400);	
	} else {
		document.getElementById(div).style.display = 'block';
		windowCenter(div);
		if( typeof( window.innerHeight ) == 'number' ) {
    		//Non-IE
			document.getElementById('text'+div).style.height = (window.innerHeight-150)+"px";
  		} else if( document.documentElement && document.documentElement.clientHeight ) {
    		//IE 6+ in 'standards compliant mode'
			document.getElementById('text'+div).style.height = (document.documentElement.clientHeight-150)+"px";
  		} else if( document.body && document.body.clientHeight  ) {
    		//IE 4 compatible
			document.getElementById('text'+div).style.height = (document.body.clientHeight-150)+"px";
  		}		
		
		//Timer avant declanchement du colapse
		commande = "animatedcollapse.show('text"+div+"')";
		setTimeout(commande, 300);
		//animatedcollapse.show('text'+div)
	}
}

function returnSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var result = new Array(myWidth,myHeight);
  return result;
}
function windowCenter(myId) {
	result=returnSize();
	var myWidth=result[0];
	var myHeight=result[1];
	var elementWidth=document.getElementById(myId).offsetWidth;
	var elementHeight=document.getElementById(myId).offsetHeight;
    var myScrollLeft=document.documentElement.scrollLeft;
	var myScrollTop=document.documentElement.scrollTop;
	//var posX=myScrollLeft+myWidth-myWidth/2-elementWidth/2;
	//var posY=myScrollTop+myHeight-myHeight/2-elementHeight/2;
	var posX=myScrollLeft+myWidth/2-elementWidth/2;
	var posY=myHeight/2-elementHeight/2;	
	document.getElementById(myId).style.left=posX+"px";
	document.getElementById(myId).style.top=posY+"px";
}

function afficher(div)
{
	
	if (document.getElementById(div).style.visibility == 'visible'){
		document.getElementById(div).style.visibility = 'hidden';
		document.getElementById(div).style.display = 'none';
	} else {		
		document.getElementById(div).style.visibility = 'visible';
		document.getElementById(div).style.display = 'block';
	}
}

function update(champ,valeur)
{
	for(i=0;i<window.opener.document.getElementById(champ).length;++i){
		if(window.opener.document.getElementById(champ).options[i].value == valeur) {
			window.opener.document.getElementById(champ).options[i].selected = true;
		}
	}
	self.close();
}