//menu++----------------------------------------------------------------

var timeoutmenu = 0;
var speed = 500;
var oldid='';
var oldjava='';

function montremenu(id,java) {

	if ( oldid )
	{
		cachevraimentmenu(oldid,oldjava)
	}

	clearTimeout(timeoutmenu);
	document.getElementById('smenu'+id).style.display='block';
	document.getElementById('bigmenu'+id).setAttribute('class','hover');
	document.getElementById('bigmenu'+id).setAttribute('className','hover');

	oldid=id;
	oldjava=java;
}
function cachemenu(id,java)
{
	clearTimeout(timeoutmenu);
	timeoutmenu = setTimeout('cachevraimentmenu('+id+','+java+')', speed);
}

function cachevraimentmenu(id,java) {

	document.getElementById('smenu'+id).style.display='none';
	if ( java == 1 )
	{
		document.getElementById('bigmenu'+id).setAttribute('class','selected');
		document.getElementById('bigmenu'+id).setAttribute('className','selected');
	}
	else
	{
		document.getElementById('bigmenu'+id).setAttribute('class','');
		document.getElementById('bigmenu'+id).setAttribute('className','');
	}
}

//scroll----------------------------------------------------------------

function toTop(id){
document.getElementById(id).scrollTop=0
}

defaultStep=1
step=defaultStep
function scrollDivDown(id){
document.getElementById(id).scrollTop+=step
timerDown=setTimeout("scrollDivDown('"+id+"')",10)
}

function scrollDivUp(id){
document.getElementById(id).scrollTop-=step
timerUp=setTimeout("scrollDivUp('"+id+"')",10)
}

function toBottom(id){
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}

// le diaporama --------------------------------------------------------

/*var old="";

function diapo(id)
{
	if ( id=='' )
	{
		var id='0';
	}


	document.getElementById('diapo').innerHTML=document.getElementById('diapo'+id).innerHTML;

	old=id;
}*/

// le diaporama --------------------------------------------------------

var old="";
var timer = 0;
var delay = 10;
var iOpacity = 0;
var iOpacityOut = 1;

function SetFadeIn(id)
{
	document.getElementById('diapo').innerHTML=document.getElementById('diapo'+id).innerHTML;

	timer = setInterval('FadeIn()', delay);
}

function FadeIn()
{
	var elem = document.getElementById('fade');
	if (iOpacity >= 1)
	{
		if (timer == 0) return;
		clearInterval(timer);
       	timer = 0;
		iOpacity = 1;
		return;
	}
	iOpacity += 0.1;
	elem.style.opacity = iOpacity;
	elem.style.MozOpacity = iOpacity;
	elem.style.KhtmlOpacity = iOpacity;
	elem.style.filter = "alpha(opacity=" + iOpacity * 100 + ")";
}

function SetFadeOut(id)
{
	timer = setInterval('FadeOut('+id+')', delay);
}

function FadeOut(id)
{
	var elem = document.getElementById('fade');
	if (iOpacity <= 0.2)
	{
		if (timer == 0) return;
        clearInterval(timer);
        timer = 0;
		iOpacity = 0;
		SetFadeIn(id);
	}
	iOpacity -= 0.1;
	elem.style.opacity = iOpacity;
	elem.style.MozOpacity = iOpacity;
	elem.style.KhtmlOpacity = iOpacity;
	elem.style.filter = "alpha(opacity=" + iOpacity * 100 + ")";
}

function diapo(id)
{
	if ( id=='' )
	{
		var id='0';
	}

	if ( old )
	{
		SetFadeOut(id);
	}

	else
	{
		if ( iOpacity != 0 ) { iOpacity=0; }
		SetFadeIn(id);
	}

	old=id;
}

// les popups--------------------------------------------------------------

function popup(ici,popupname,height,width)
{
	var topPosition = 0;
	var leftPosition = (screen.width - width) / 2;
	var windowprops = "width=" + width + ",height=" + height + ",top=" + topPosition + ",left=" + leftPosition + ",location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,status=no";

	window.open(ici.href,popupname,windowprops);
	return false
}

function blank(ici,popupname){window.open(ici.href,popupname,'location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,status=no'); return false }



// popup images formulaire--------------------------------------------------

function AfficherImage(img){
  Image1= new Image();
  Image1.src=(img);
  Control(img);
}
function Control(img){
  if((Image1.width!=0)&&(Image1.height!=0)){
    VoirImage(img);
  }
  else{
    fonction="Control('"+img+"')";
    intervalle=setTimeout(fonction,20);
  }
}
function VoirImage(img){
  largeur=Image1.width+20;
  hauteur=Image1.height+20;
  proprietes="width="+ largeur +",height="+ hauteur;
  win=window.open(img,"",proprietes);
}

