var windowEasyClosed = false;
var ewW = 240;
var ewH = 115;
var ewTime = null;
var mwTime = null;

function loadMessageWindowNow()
{			
	positionMessageWindow();
	loadMessageWindow();
			
}

function loadMessageWindow()
{
	var windowMessage = document.getElementById( 'windowMessage' );
	var posM = parseInt( windowMessage.style.top );
	if( posM > 0 )
	{
		windowMessage.style.top = ( posM - 5 ) + 'px';
		setTimeout( 'loadMessageWindow()', 30 );
	}
}
function positionMessageWindow() {
	divMBG = document.getElementById( 'windowMessageBackground' );
	divMBG.style.top = ( getScrollTop() + getWindowHeight() - ewH ) + 'px';
	divMBG.style.left = ( getScrollLeft() + getWindowWidth() - ewW - 10 ) + 'px';
	mwTime = setTimeout( "positionMessageWindow()", 100 );	
}
function closeMessageWindow() {
	if (document.getElementById('windowMessageBackground')) { document.getElementById( 'windowMessageBackground' ).style.display = 'none'; }
	windowEasyClosed = true;
	clearTimeout( mwTime );
}




function loadEasyWindow()
{
	var windowEasy = document.getElementById( 'windowEasyAlert' );
	var pos = parseInt( windowEasy.style.top );
	if( pos > 0 )
	{
		windowEasy.style.top = ( pos - 5 ) + 'px';
		setTimeout( 'loadEasyWindow()', 30 );
	}
}
function closeEasyWindow( test,id_inviteur ) {
	if(test == 1 ) { window.open('chat.php?cible='+id_inviteur, 'generation974_'+id_inviteur, 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=550,height=460,left = 200,top = 64'); }
	if (document.getElementById('windowEasyAlertBackground')) { document.getElementById( 'windowEasyAlertBackground' ).style.display = 'none'; }
	windowEasyClosed = true;
	clearTimeout( ewTime );
}
function positionEasyWindow() {
	divBG = document.getElementById( 'windowEasyAlertBackground' );
	divBG.style.top = ( getScrollTop() + getWindowHeight() - ewH ) + 'px';
	divBG.style.left = ( getScrollLeft() + getWindowWidth() - ewW - 10 ) + 'px';
	ewTime = setTimeout( "positionEasyWindow()", 100 );	
}

// fonction de positions
var is_Netscape = navigator.appName.indexOf("Netscape")!= -1;
var is_Body = document.body;
function getWindowHeight()
{
	if( typeof window.innerHeight == 'number' )
	{
		var winH = window.innerHeight;
		if( window.scrollMaxX > 0 )
		{
			winH -= 17;
		}
		return winH;
	}
	else if ( document.documentElement.clientHeight)
	{
		return document.documentElement.clientHeight;
	}
	else if( typeof document.body.clientHeight == 'number' )
	{
		return document.body.clientHeight;
	}
}
function getWindowWidth()
{
	if( typeof window.innerWidth == 'number' )
	{
		var winW = window.innerWidth;
		if( window.scrollMaxY > 0 )
		{
			winW -= 17;
		}
		return winW;
	}
	else if ( document.documentElement.clientWidth )
	{
		return document.documentElement.clientWidth;
	}
	else if( document.body && document.body.clientWidth )
	{
		return document.body.clientWidth;
	}
}
function getScrollLeft()
{
	var posLeft = false;
	
	if( is_Netscape )
	{
		posLeft = window.pageXOffset;
	}
	else if( document.documentElement && document.documentElement.scrollTop )
	{
		posLeft = document.documentElement.scrollLeft;
	}
	else if( is_Body )
	{
		posLeft = document.body.scrollLeft;
	}
	
	return typeof posLeft == 'number' ? posLeft : 0;
}
function getScrollTop()
{
	var posTop = false;
	
	if (window.innerHeight)
	{
		posTop = window.pageYOffset;
	}
	else if( document.documentElement && document.documentElement.scrollTop )
	{
		posTop = document.documentElement.scrollTop;
	}
	else if( is_Body )
	{
		posTop = document.body.scrollTop;
	}
	
	return typeof posTop == 'number' ? posTop : 0;
}
function loadEasyWindowNow()
{			
	positionEasyWindow();
	loadEasyWindow();
			
}