/*------------------------------------------------------------------------------------------*/
/* AFFICHAGE DU BOUTON RETOUR SELON LA POSITION DU SCROLLBAR VERTICAL */
/*------------------------------------------------------------------------------------------*/

function update () {
	if (document.documentElement != null) {
		document.forms['retourtop'].elements['scrollVert'].value = document.documentElement.scrollTop;
		if (document.forms['retourtop'].elements['scrollVert'].value > '0'){
      $('div[id=top]').fadeIn('slow');
		}
		else if (document.forms['retourtop'].elements['scrollVert'].value == '0'){
      $('div[id=top]').fadeOut('fast');
		}
	}
	else {
		document.forms['retourtop'].elements['scrollVert'].value = 'undefined';
	}

	setTimeout('update()', 100);

}

update();

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
