var idC=new Object();
var idG1=new Object();
var idG2=new Object();
var idG3=new Object();
var idP1=new Object();
var idP2=new Object();
var idL=new Object();
var idPlot=new Object;
var pos=0;
var pos2=-210;
var pos3=0;
var arret=0;
var debit=0;
function init(){
var chaine='';
chaine+='<object type="application/x-shockwave-flash" ';
chaine+='data="dewplayer-vol.swf?mp3=son/generique.mp3&amp;volume=50&amp;autostart=1&amp;autoreplay=1&amp;bgcolor=000000" ';
chaine+='width="241" height="20"><param name="wmode" value="transparent" /><param name="movie" ';
chaine+='value="dewplayer-vol.swf?mp3=son/generique.mp3&amp;volume=50&amp;autostart=1&amp;autoreplay=1&amp;bgcolor=000000" /></object>';
chaine+='<br/><span class="text7" style="color:blue">Musique du film "Les grandes gueules"<br/>composée par François de Roubaix<br/>(création personnelle en Midi)<br/></span>';
document.getElementById('avis').innerHTML=chaine;

idC=document.getElementById('coupe').style;
idG1=document.getElementById('grume').style;
idG2=document.getElementById('grume2').style;
idG3=document.getElementById('grume3').style;
idP1=document.getElementById('planche1').style;
idP2=document.getElementById('planche2').style;
idL=document.getElementById('lame').style;
idPlot=document.getElementById('plot').style;
scie();
}

function voit(page){
if(page==1)window.location.href="men1.htm?"+debit+"";
if(page==2)window.location.href="men2.htm?"+debit+"";
}
var pass=0;
function quit(){
	if(pass)return;
	if (debit>1)alert("Vous avez scié "+debit+" planches. Merci pour votre contribution ...");
	else if(debit==1)alert("Vous n'avez scié qu'une planche. Mais c'est un début ...");
	else alert("Vous n'avez scié aucune planche. Mais vous reviendrez ...");
	}




//// stopper //////////////
function stp(){
document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=1;return false">Stopper le sciage</a></span>';
}
///////////////////////////
function scie(){
document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=1;return false">Stopper le sciage</a></span>';
//document.getElementById('sciure').style.visibility='visible';
idL.marginBottom=0+'px';
avance();
lm();
}

///// lame ////////////

function lm(){
if(arret){return;}
idL.top=pos2+'px';
pos2=pos2+5;
if(pos2==0)pos2=-210;
setTimeout("lm()",20);
}
/////////////////////////



//grume 700 -300 lame à 450
/// avance grume 1 /////////
function avance(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();avance();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG1.left)+1;
idG1.left=pos;
idP1.left=pos;
if(pos==-250){
	document.getElementById('sciure').style.visibility='visible';
	phase2();
	return;
	}
setTimeout("avance()",20);
}
//// sciage planche 1 /////////
function phase2(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();phase2();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG1.left)+1;
idG1.left=pos;
idP1.left=pos;
pos3+=1;
idC.width=pos3+'px';
if(pos==450){
	debit++;
	setTimeout("idPlot.height=parseInt(idPlot.height)+17;idPlot.top=parseInt(idPlot.top)-17",2000);
	document.getElementById('sciure').style.visibility='hidden';
	idC.width=0+'px';
	idC.marginBottom=120+'px';
	pos3=0;
	idP1.visibility='hidden';
	idG1.visibility='hidden';
	idG2.left=pos+'px';
	idG2.visibility='visible';
	setTimeout("recul()",2000);
	return;
	}
setTimeout("phase2()",20);
}
//// recul 1 ////////////////
function recul(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();recul();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG2.left)-2;
idG2.left=pos;
if(pos==-300){
	idP2.left=-300+'px';
	idP2.visibility='visible';
	setTimeout("avance2()",1000);
	return;
	}
setTimeout("recul()",20);
}
/// avance grume 2 /////////
function avance2(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();avance2();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG2.left)+1;
idP2.left=pos;
idG2.left=pos;
if(pos==-250){
	document.getElementById('sciure').style.visibility='visible';
	document.getElementById('sciure').style.visibility='visible';
	phase3();
	return;
	}
setTimeout("avance2()",20);
}
//// sciage planche 2 /////////
function phase3(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();phase3();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG2.left)+1;
idG2.left=pos;
idP2.left=pos;
pos3+=1;
idC.width=pos3+'px';
if(pos==450){
	debit++;
	setTimeout("idPlot.height=parseInt(idPlot.height)+17;idPlot.top=parseInt(idPlot.top)-17",2000);
	idC.width=0+'px';
	document.getElementById('sciure').style.visibility='hidden';
	idP2.visibility='hidden';
	idG2.visibility='hidden';
	idG3.left=pos+'px';
	idG3.visibility='visible';
	setTimeout("recul2()",2000);
	return;
	}
setTimeout("phase3()",20);
}
//// recul 2 ///////
function recul2(){
if(arret){
	document.getElementById('sciure').style.visibility='hidden';
	document.getElementById('titre').innerHTML='<span class="sciage"><a href="#" onclick="arret=0;stp();lm();recul2();return false">Scier !</a></span>';
	return;
	}
pos=parseInt(idG3.left)-2;
idG3.left=pos;
if(pos==-300){
	idC.width=0+'px';
	idC.marginBottom=107+'px';
	pos3=0;
	idP1.left=-300+'px';
	setTimeout("idP1.visibility='visible';idG3.visibility='hidden';idG1.left=-300+'px';idG1.visibility='visible';avance()",2000);
	return;
	}
setTimeout("recul2()",20);
}


