var previewArticleTimeout = false ;

function showChapeau(id) {
	previewArticleTimeout = window.setTimeout("startLoadingChapeau('" + id + "');",2000) ;
}

function startLoadingChapeau(id) {
	var ajax = new Ajax(true) ;
	ajax.sendAndLoad("/ajax/showChapeau.php?id=" + id,"GET", showChapeauHandler) ;	
}

function showChapeauHandler(conn) {
	var box = document.getElementById("chapeauPreview") ;
	box.innerHTML = conn.responseText ;
	box.style.display = "block" ;
	
	if (x > ((screen.width / 2))) box.style.left = ( parseInt(x) - ( 350 + 10 ) ) + "px" ;											
	else box.style.left = (parseInt(x)+ 10) + "px" ;

	if (isIE) var offsety = document.documentElement.scrollTop ;
	else var offsety = window.pageYOffset;

	if ((y - offsety) > ((screen.height / 2))) box.style.top = (parseInt(y) - (250 + 40)) + "px" ; 	
	else box.style.top = (parseInt(y) + 40) + "px" ;
	
	box.style.height = "auto"; 
}

function moveChapeau() {
	var box = document.getElementById("chapeauPreview") ;

	if (x > ((screen.width / 2))) box.style.left = ( parseInt(x) - ( 350 + 10 ) ) + "px" ;											
	else box.style.left = (parseInt(x)+ 10) + "px" ;

	if (isIE) var offsety = document.documentElement.scrollTop ;
	else var offsety = window.pageYOffset;

	if ((y - offsety) > ((screen.height / 2))) box.style.top = (parseInt(y) - (250 + 40)) + "px" ; 	
	else box.style.top = (parseInt(y) + 40) + "px" ;
}


function hideChapeau(id) {
	window.clearTimeout(previewArticleTimeout) ;
	document.getElementById("chapeauPreview").style.display = "none" ;	
}