var reduction;
var augmentation;

function recherche(type,lien) {
	clearInterval(reduction);
	clearInterval(augmentation);
	reduction = setInterval('fctn_reduction("'+type+'","'+lien+'")',25);
	fctn_debut_page();
}

function appel_ajax(type,lien) {
	//
	document.getElementsByTagName('h1').innerHTML += '<img src="stylenew/wait.gif" />';
	var xhr;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		xhr = new ActiveXObject('Microsoft.XMLHTTP');
	} 
	xhr.open('POST','outils/recharge_texte.php?recharge='+escape(type),true);
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4) {
			dd('wait').style.display = 'none';
			if (dd) dd('contenu_apropos').innerHTML = xhr.responseText;
			augmentation = setInterval('fctn_augmentation()',25);
		}
	}
	xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');			
	xhr.send('');
}
function fctn_reduction(type,lien) {
	var c = dd('conteneur_apropos');
	var larg = c.offsetWidth;
	if(larg>70) {
		nvl_larg = parseInt(larg)-70;
		c.style.width = nvl_larg+'px';
	} else {
		c.style.width = '0';
		clearInterval(reduction);
		appel_ajax(type,lien);
		dd('wait').style.display = 'block';
	}
}
function fctn_augmentation() {
	var c = dd('conteneur_apropos');
	var larg = c.offsetWidth;
	if(larg<579) {
		nvl_larg = parseInt(larg)+70;
		c.style.width = nvl_larg+'px';
	} else {
		c.style.width = '672px';
		clearInterval(augmentation);
	}
}

function fctn_debut_page() {
	debut_page = setInterval('fctn_debut_page2()',25);
}

function fctn_debut_page2() {
	c_tope = parseInt(document.body.scrollTop);
	c_tope -=  c_tope/3;
	document.body.scrollTop = c_tope;
	if(c_tope<3) {
		clearInterval(debut_page);
		document.body.scrollTop = 0;
	}
}
function dd(v) {
	return document.getElementById(v);
}
