
	/*************/
	/* VARIABLES */
	/*************/
	var content;
	var allScreenBackground;
	var onContent			= false;
	var bounce				= 1.8;		
	var margin 				= 100;		// px
	var wait				= 5; 		// miliseconds
	var speedDecrease		= 2;

	/*******************/
	/* INIT BACKGROUND */
	/*******************/
	function initBackground()
	{
		// INIT BACKGROUND
		allScreenBackground = document.getElementById("allScreenBackground");

		// CREATE LISTENER OF BACKGROUND
		allScreenBackground.onclick = function() 
		{  
			// IF CLICK ON BG : HIDE CONTENT
			if(onContent == false) hideContent();
		}
	}

	/****************/
	/* HIDE CONTENT */
	/****************/
	function hideContent()
	{
		content.style.display				= "none";
		allScreenBackground.style.display 	= "none";
	}

	/****************/
	/* SHOW CONTENT */
	/****************/
	function showContent(id,width,height)
	{
		// INIT CONTENT
		initBackground();
		
		// INIT CONTENT
		content = document.getElementById(id);
		
		// INIT LISTENER OF CONTENT
		content.onmouseover = function() {  onContent = true; }
		content.onmouseout = function()  {  onContent = false;}
		
		sclTop 		= f_scrollTop()+(f_clientHeight()-height)/2 - 100;
		content.style.top 	= sclTop+"px";
		
		/*sclLeft 	= (f_clientWidth()-width)/2 - 100;
		content.style.left 	= sclLeft+"px";*/
		
		// ADAPT BACKGROUND SIZE TO THE BODY SIZE
		//allScreenBackground.style.width 	= document.body.offsetWidth+"px";
		//allScreenBackground.style.height 	= document.body.offsetHeight+document.body.scrollHeight+"px";
		
		// SHOW CONTENT AND BACKGROUND
		content.style.display				= "block";
		allScreenBackground.style.display 	= "block";
		
		// ANIMATION
		shrinkContent(width+margin,height+margin,width,height,1,1);
	}

	

	/*****************************/
	/* ANIMATION : BUBBLE SHRINK */
	/*****************************/
	function shrinkContent(minWidth,minHeight,width,height,speedX,speedY)
	{
		// CHANGE SIZE
		minWidth 				-= speedX;
		minHeight 				-= speedY;
		//content.style.width 	 = minWidth+"px";
		//content.style.height 	 = minHeight+"px";

		// FOR CENTER CONTENT
		//content.style.marginLeft = (-1*(minWidth/speedDecrease))+"px";
		//content.style.marginTop  = (-1*(minHeight/speedDecrease))+"px";
		
		// INCREASE SPEED
		speedX++;
		speedY++;
		
		// INIT STOP ANIMATION VAR
		stopShrinkX = false;
		stopShrinkY = false;
		
		// BOUNCE  
		if(minWidth <= width)
		{
			// DECREASE AND INVERSE SPEED
			speedX = Math.round((speedX*-1)/bounce);
			
			// IF SPEED IS TOO SLOW : STOP
			if(speedX > -1) stopShrinkX = true;
		}
		
		// BOUNCE  
		if(minHeight <= height)
		{
			// DECREASE AND INVERSE SPEED
			speedY = Math.round((speedY*-1)/bounce);
			
			// IF SPEED IS TOO SLOW : STOP
			if(speedY > -1) stopShrinkY = true;
		}
	
		// IF CONTINUE
		if(!stopShrinkX && !stopShrinkY )
		{
			// CALL RECURSIVELY ANIMATION
			temps = setTimeout("shrinkContent("+minWidth+","+minHeight+","+width+","+height+","+speedX+","+speedY+")",wait);
		}
	}
	
	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	function f_clientHeight() {
		return f_filterResults (
			window.innerHeight ? window.innerHeight : 0,
			document.documentElement ? document.documentElement.clientHeight : 0,
			document.body ? document.body.clientHeight : 0
		);
	}
	function f_scrollLeft() {
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	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;
	}
