
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function placer(fixe,elem,pos)
{
 var x = findPosX(document.getElementById(fixe));
 document.getElementById(elem).style.visibility = 'hidden';
 document.getElementById(elem).style.left = pos + x + 'px';
}

function placervis(fixe,elem,pos)
{
 var x = findPosX(document.getElementById(fixe));
 document.getElementById(elem).style.left = pos + x + 'px';
 document.getElementById(elem).style.display = 'block';
}

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
var clicked = 0;
var prev = 0;
var next = 0;
var current = 1;

var first = 1;
var first_timer;

var preLoad = new Array();

first_img = new Image();

for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function runslideshow(){
if (current > (pss)) { current=1;}
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.getElementById('attente').style.display='none';
document.images.PictureBox.src = preLoad[current].src;
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
updatecontent();
tss = setTimeout('runslideshow()', SlideShowSpeed);
prev=current;
current++;
}


function slide(){
if (clicked == 0){
document.getElementById('legende-section').style.display='none';
document.getElementById('attente').style.display='block';
clicked = 1;
runslideshow();
} else {
clearTimeout(tss);
clicked=0;
}
}

function nextpic(){
document.getElementById('attente').style.display='none';
clearTimeout(tss);
clicked=0;
if ( next > 0 ){
current=next;
next=0;
}
if (current > (pss)){
current=1;
}
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[current].src;
document.getElementById('legende-section').style.visibility='hidden';
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
updatecontent();
prev=current;
current++;
}

function prevpic(){
document.getElementById('attente').style.display='none';
clearTimeout(tss);
clicked=0;
if ( prev > 0 ){
current=prev;
prev=0;
}
next=current;
current--;
if (current < 1 ){
current=pss+1;
prevpic();
} else {
if (document.all){
document.images.PictureBox.visibility='hidden';
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
updatecontent();
document.images.PictureBox.src = preLoad[current].src;
document.getElementById('legende-section').style.visibility='hidden';
if (document.all) { document.images.PictureBox.filters.blendTrans.Play();
updatecontent();
}
}
}

function updatecontent(){
//if ( current > 2 ) document.getElementById('b-texte').style.visibility='hidden';
if ( Picture_pos[current] == 0 )
{
document.getElementById('tableau-photo').width=width_horiz;
document.getElementById('PictureBox').style.marginTop=height_photo_horiz;
}
if ( Picture_pos[current] == 1 ){
document.getElementById('tableau-photo').width=width_vert;
document.getElementById('PictureBox').style.marginTop=height_photo_vert;
}
if ( Picture_pos[current] == 2 ){
document.getElementById('tableau-photo').width=width_olymp;
document.getElementById('PictureBox').style.marginTop=height_photo_olymp;
}
if ( Picture_pos[current] == 3 ){
document.getElementById('tableau-photo').width=width_olympv;
document.getElementById('PictureBox').style.marginTop=height_photo_olympv;
}
document.getElementById('legende-section').innerHTML = Picture_text[current];
document.getElementById('legende-section').style.display='block';

}