function popup_fixed( url, height, width )
{

	var winl = (screen.width - width ) / 2;
	var wint = (screen.height - height ) / 2;

	window.open( url, 'POPUP', "top="+wint+", left="+winl+", height="+ height +", width="+width+", menubar=no, resizable=no, scroolbars=no, status=no, toolbar=no" );
}

function popup( url, height, width )
{

	var winl = (screen.width - width ) / 2;
	var wint = (screen.height - height ) / 2;

	window.open( url, 'POPUP', "top="+wint+", left="+winl+", height="+ height +", width="+width+", menubar=no, resizable=no, scroolbars=no, status=no, toolbar=no" );
}

function deleteChild( element )
{
	if( element == null){ return ; }
	if( element.childNodes )
	{
		for( var i = 0 ; i < element.childNodes.length ; i++ )
		{
			var child = element.childNodes[i] ;
			element.removeChild( child );
		}
	}
}

function updateChildText( element, newtext )
{

	if( element == null){ return ; }

	deleteChild( element );
	var newNode = document.createTextNode( newtext );
	element.appendChild( newNode );

}

function montreJeux()
{
	document.getElementById('corps_deroulant').style.display = 'block';
}

function cacheJeux()
{
	document.getElementById('corps_deroulant').style.display = 'none';
}

function preloadImages()
{
	var d = document;
	if( d.images )
	{

		if( !d.p ) d.p = new Array();
		var i, j = d.p.length, a = preloadImages.arguments ;

		for( i = 0 ; i < a.length ; i++ )
		{
			if ( a[i].indexOf("#") != 0 )
			{
				d.p[j] = new Image;
				d.p[j++].src= a[i] ;
			}
		}
	}
}

function changeOffer( count )
{

	var i		= 0 ;
	var current	= 0 ;
	var last	= 100 ;
	var name	= 'offre-' ;

	for( i = 1 ; i <= last ; i ++ )
	{

		var cur = document.getElementById( name + i ) ;

		if( cur != null )
		{

			if( cur.style.display == 'block' )
			{
				current = i ;
			}

		}
		else
		{
			last = i - 1;
		}
	}

	var speed = 7000;

	if( count <= 1 )	speed = 800;	
	if( last == current )
	{
		count ++ ;
		current	= 0 ;
		if( count > 1 )	speed = 7000;
	}
	
	current ++ ;

	for( i = 1 ; i <= last ; i++ )
	{
		document.getElementById( name + i ).style.display = 'none';
	}

	document.getElementById( name + current ).style.display = 'block';

	window.setTimeout( 'changeOffer( ' + count + ' )', speed );

}

function afficheMenu( smenu )
{

	var start = 1;
	var end = 4;
	var current = 0;
	
	for( current = start; current <= end ; current ++ )
	{
		document.getElementById( 'smenu-' + current ).style.display = 'none';
	}

	document.getElementById( 'smenu-' + smenu ).style.display = 'block';
}

function createRequest()
{

	var requette = null;
	
	try
	{
		requette = new XMLHttpRequest();
	}
	catch( crosoft )
	{

		try
		{
			requette = new ActiveXObject( "Msxml2.XMLHTTP" );
		}
		catch( crosoft2 )
		{

			try
			{
				requette = new ActiveXObject( "Microsoft.XMLHTTP" );
			}
			catch( erreur )
			{
				requette = null;
			}

		}

	}

	if( requette == null )
	{
		alert( "Impossible de créer une requette Ajax !" );
	}

	return requette ;
}

function getFirst( XmlTree, Name )
{
	try
	{
		var items = XmlTree.getElementsByTagName( Name ) ;
		return items[0];
	}
	catch( Exception )
	{
		return null;
	}
}

function getFirstNodeValue( XmlTree, Name )
{
	try
	{
		var items = XmlTree.getElementsByTagName( Name ) ;
		return items[0].firstChild.nodeValue;
	}
	catch( Exception )
	{
		return null;
	}
}

function showTR( name )
{

	try
	{
		document.getElementById( name ).style.display = 'table-row';
	}
	catch( error )
	{
		document.getElementById( name ).style.display = 'block';
	}

}

function hideTR( name )
{
	document.getElementById( name ).style.display = 'none';
}

function showTABLE( name )
{

	try
	{
		document.getElementById( name ).style.display = 'table';
	}
	catch( error )
	{
		document.getElementById( name ).style.display = 'block';
	}

}

function hideTABLE( name )
{
	document.getElementById( name ).style.display = 'none';
}