// JavaScript Document
function affichenoir(){
	$('noiron1').down('img').setAttribute('src', 'anim/l2_2.gif');
	$('noiron2').down('img').setAttribute('src', 'anim/l3_c1_l1_2.gif');
	$('noiron3').down('img').setAttribute('src', 'anim/l3_c3_l1_2.gif');
	new Event.observe($('noiron1') ,'mouseout', montrebouton, false);
	new Event.observe($('noiron2') ,'mouseout', montrebouton, false);
	new Event.observe($('noiron3') ,'mouseout', montrebouton, false);
}
function montrebouton(){
	$('noiron1').down('img').setAttribute('src', 'anim/l2_1.gif');
	$('noiron2').down('img').setAttribute('src', 'anim/l3_c1_l1_1.gif');
	$('noiron3').down('img').setAttribute('src', 'anim/l3_c3_l1_1.gif');
	var image = $('noiron1').innerHTML;
	$('noiron1').update('<a href="affiche.html" >'+image+'</a>');
	new Event.observe($('noiron1') ,'mouseover', affichenoir, false);
	new Event.observe($('noiron2') ,'mouseover', affichenoir, false);
	new Event.observe($('noiron3') ,'mouseover', affichenoir, false);

}
/*function montrebouton2(){
	$('noiron2').down('img').setAttribute('src', 'anim/l3_c1_l1_1.gif');;
}
function montrebouton3(){
	$('noiron3').down('img').setAttribute('src', 'anim/l3_c3_l1_1.gif');
}*/


function razBouton(){
	$('noiron1').down('img').setAttribute('src', 'anim/l2_0.gif');
	$('noiron2').down('img').setAttribute('src', 'anim/l3_c1_l1_0.gif');
	$('noiron3').down('img').setAttribute('src', 'anim/l3_c3_l1_0.gif');
	$('noiron1').update('<img src="anim/l2_0.gif" width="323" height="229" border="0" />');
	new Event.stopObserving($('noiron1') ,'mouseover', affichenoir, false);
	new Event.stopObserving($('noiron2') ,'mouseover', affichenoir, false);
	new Event.stopObserving($('noiron3') ,'mouseover', affichenoir, false);
	new Event.stopObserving($('noiron1') ,'mouseout', montrebouton, false);
	new Event.stopObserving($('noiron2') ,'mouseout', montrebouton, false);
	new Event.stopObserving($('noiron3') ,'mouseout', montrebouton, false);
	new Event.stopObserving($('allume') ,'click', razBouton, false);
	new Event.observe($('allume') ,'click', allumage, false);
}

function enfonceInterupteur(){
	$('allume').down('img').setAttribute('src', 'anim/l3_c2_2.gif');
	new Event.stopObserving($('allume') ,'click', allumage, false);
	new Event.observe($('allume') ,'click', razBouton, false);
	
}
function allumage(){
	enfonceInterupteur();
	montrebouton();
}
	
function initLampe(){
	new Event.observe($('allume') ,'click', allumage, false);
	$('allume').down('img').setStyle({cursor:'pointer'});
}





new Event.observe(window ,'load', initLampe, false);








