positionIt = function() {
	if( document.getElementById ) {
		// Get a reference to BoxId and measure its width.
		var div0 = document.getElementById( "Bkg" );
		var div1 = document.getElementById( "Content" );
		var div2 = document.getElementById( "Intro" );
		var div0Width = div0.offsetWidth ? div0.offsetWidth : div0.style.width ? parseInt( div0.style.width ) : 0;
		var div1Width = div1.offsetWidth ? div1.offsetWidth : div1.style.width ? parseInt( div1.style.width ) : 0;
		var div2Width = div2.offsetWidth ? div2.offsetWidth : div2.style.width ? parseInt( div2.style.width ) : 0;
		
		// Calculating MarginXso the BoxId will be centered in the viewport.
		var WidthT = div0Width + div1Width;				/*Body_Width = Element_Gauche + Element_Droite*/
		var MarginX= ( getViewportWidth() - WidthT ) / 2;		/*Margin_Body = (Viewport_Width - Body_Width) divisé par 2*/
		var MarginXIntro = ( WidthT-div2Width ) / 2;				/*Margin_Element = (Total_Width - Element_Width) divisé par 2*/
		
		// If MarginXhave become smaller than 0, make them 0.
		if( MarginX< 0 ) MarginX= 0;
		
		// Position the BoxId in the center of the page and make it visible.
		div0.style.left = MarginX+ "px";
		div1.style.left = MarginX+ div0Width + "px";
		div2.style.left = MarginX+ MarginXIntro + "px";
		div0.style.visibility = "visible";
		div1.style.visibility = "visible";
		// div2.style.visibility = "visible";
		
		// Element div visible temporairement
		var divCon = document.getElementById( "Con" );
		divCon.style.visibility = "hidden";
	}
}

getViewportWidth = function() {
	var width = 0;
	if( document.documentElement && document.documentElement.clientWidth ) {
		width = document.documentElement.clientWidth;
	}
	else if( document.body && document.body.clientWidth ) {
		width = document.body.clientWidth;
	}
	else if( window.innerWidth ) {
		width = window.innerWidth - 18;
	}
	return width;
};

getViewportHeight = function() {
	var height = 0;
	if( document.documentElement && document.documentElement.clientHeight ) {
		height = document.documentElement.clientHeight;
	}
	else if( document.body && document.body.clientHeight ) {
		height = document.body.clientHeight;
	}
	else if( window.innerHeight ) {
		height = window.innerHeight - 18;
	}
	return height;
};

window.onload = positionIt;
window.onresize = positionIt;

