
var tab_img = new Array('1','2','3','4');
var nb_img = tab_img.length;
var marqueur = 0;
var opa_nou = 0;
var n_anc;
var n_nou;
var ttt = new Array();
var opa_int = 100;
var tab_int = new Array('interieur1.jpg','interieur2.jpg','interieur3.jpg','interieur4.jpg','interieur5.jpg','2.jpg');
var tab_env = new Array('3.jpg','environ1.jpg','environ2.jpg','environ3.jpg','environ4.jpg','environ5.jpg');
var is_ready = true;


// DEFILEMENT TOPH PAGE D'ACCUEIL
function image() {	
	n_anc = marqueur;
	opa_nou = 0;
	marqueur++;
	if(marqueur==nb_img) {
		marqueur = 0;
	}
	n_nou = marqueur;
	
	document.getElementById('rec_img').innerHTML += '<img src="" id="image'+n_nou+'" />';
	
	if(set_opacite(n_nou,0)) {
		document.getElementById('image'+n_nou).src = 'style/images/'+tab_img[n_nou]+'.jpg';
	}
	
	setTimeout("degrade('"+n_anc+"','"+n_nou+"')",4000);	
}
function set_opacite(n,opa) {
	if(document.all && !window.opera){
		document.getElementById('image'+n).style.filter = 'alpha(opacity=' + opa + ');';	
	} else{
		document.getElementById('image'+n).style.opacity = opa/100;
	}
	return true;
}
function degrade(n_anc,n_nou) {
	if(opa_nou<100) {
		opa_nou+=5;
	} else {
		document.getElementById('rec_img').removeChild(document.getElementById('image'+n_anc));
		image();
		return false;
	}
	set_opacite(n_nou,opa_nou);
	setTimeout("degrade('"+n_anc+"','"+n_nou+"')",25);

}

// DEFILEMENT TEXTE
function defil_bas() {
	isdefil = true;
	defil_bas_action();
}
function defil_bas_action() {
	clip = document.getElementById('cont_texte');
	mt = clip.offsetTop;
	H2 = clip.offsetHeight;
	
	if((150-mt)>H2) {
		isdefil = false;
	}
	if(isdefil) {
		mt-=12;
		clip.style.marginTop = mt+'px';
		setTimeout("defil_bas_action()",25);
	}
}
function defil_haut() {
	isdefil = true;
	defil_haut_action();
}
function defil_haut_action() {
	clip = document.getElementById('cont_texte');
	mt = clip.offsetTop;
	H2 = clip.offsetHeight;
	
	if(mt==10) {
		isdefil = false;
	}
	if(isdefil) {
		mt-=8;
		clip.style.marginTop = mt+'px';
		setTimeout("defil_haut_action()",25);
	}
}
function stop_defil() {
	isdefil = false;
}

// DEFILEMENT TOPH PAGE
function charge(type) {
	if(type=='int') tab = tab_int;
	if(type=='env') tab = tab_env;
	for(i=0;i<tab.length;i++) {
		ttt[i] = new Image;
		ttt[i].src = 'style/images/'+tab[i];
	}
}
function change_toph(n) {	
	
	if(is_ready) {
		if(ttt[n].complete) {
			change_toph_action_of(n);
			is_ready = false;
		}
	}
}
function change_toph_action_of(n) {
	c = document.getElementById('image0');
	opa_int-=10;
	set_opacite('0',opa_int);
	
	if(opa_int==0) {
		c.src = ttt[n].src;
		change_toph_action_on();
		return false;
	}	setTimeout("change_toph_action_of('"+n+"')",25);
}
function change_toph_action_on() {
	opa_int+=10;
	set_opacite('0',opa_int);
	
	if(opa_int>90) {
		is_ready = true;
		return false;
	}
	setTimeout("change_toph_action_on()",25);
}

