$(document).ready(onContainerReady);
$(document).load(onResize);
$(window).resize(onResize);
/*

var windowHeight;
var windowWidth;
*/

function onContainerReady()
{
	initBottomContainer();
	
	initContainerSize();
	
	initGoodies();
}

function initBottomContainer()
{
	//alert(navigator.userAgent);
	var noJS=(navigator.userAgent.indexOf("Mobile")>0) || (navigator.userAgent.indexOf("MSIE 6.0")>0);
	
	if (noJS)
	{
		var elem=$(".BottomContainer");
		elem.attr("style" , "position:relative");
		elem.remove();
		$("body").append(elem);
		
		$( $(".Box").parent() ).css("overflow" , "hidden");
		
		$( $(".ContainerRight") ).css("float" , "left");
		
	//	$( $(".PartnerContainer").children() ).css("border" , "none");
		$("a>img").css("border" , "none");
			
	}
	
	$(".BottomContainer").css("display" , "block");
	
}

function initContainerSize()
{
	var max_height=0;
	/*$.each($(".ContainerCompTiers>.Box>.trois,.ContainerCompTiers>.Box.trois") ,  function(i , n)
			{
				max_height=($(n).height()>max_height)?$(n).height():max_height; 
			});
	
	$(".ContainerCompTiers>.Box>.trois,.ContainerCompTiers>.Box.trois").height(max_height);
	*/
	
	$.each($(".ContainerCompTiers>.Box>.trois,.ContainerCompTiers>.Box.trois,.ContainerWhite>.Box.trois") ,  function(i , n)
			{
				max_height=($(n).height()>max_height)?$(n).height():max_height; 
			});
	
	$(".ContainerCompTiers>.Box>.trois,.ContainerCompTiers>.Box.trois,.ContainerWhite>.Box.trois").height(max_height)
	
//	$(".ContainerWhite").position().top;
	//alert($(window).height());
	
	
	
//	$(".ContainerWhite").height(x);
}

function replaceBottomContainer()
{
	$(".BottomContainer").css("position" , "absolute");
	$(".BottomContainer").css("top" , windowHeight-(parseInt($(".BottomContainer").css("height")))+'px');
}


function onResize()
{
	initGoodies();
}

function initGoodies()
{
	if ($(".ContainerWhite").offset())
	{
		$(".ContainerWhite").css( "min-height" , 
				$(window).height()
				-$(".ContainerWhite").offset().top
				-($(".PartnerContainer").outerHeight()+$(".Goodies").outerHeight())
		);
		
	}
}

/*
$(document).ready(onBottomReady);

function onBottomReady()
{
	$(".BottomContainer").css("hasLayout" , "-1");
		$(".BottomContainer").css("position" , "fixed");
}*/

