/** gestion du bug de centrage si la fenêtre est trop petite pour le site **/
var larg=0;
var haut = 0;
function lcmIfInf1024()
{
	if (self.innerHeight) // all except Explorer
	{
		larg = self.innerWidth;
		haut = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		larg = document.documentElement.clientWidth;
		haut = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		larg = document.body.clientWidth;
		haut = document.body.clientHeight;
	}
}

function lcmWriteFix(x)
{
// 	alert(larg); 1008
//	alert(haut); 563
	if(larg<1000 || haut <595){
	/*
	document.writeln('<style type="text/css">');
	document.writeln('#contenedor_primario {');
	document.writeln('width:100%;');
	document.writeln('height:100%;');
	document.writeln('position:absolute;left:0px;top:0px;margin:0;padding:0');
	document.writeln('display:block;}');
	document.writeln('}');
	document.writeln('body{');
	document.writeln('background-image: url(/_img/bg_defaultsite.png);');
	document.writeln('background-position: -4px 0;');
	document.writeln('background-color:#fff;');
	document.writeln('background-repeat:no-repeat;');
	document.writeln('}');
	document.writeln('</style>')
	*/

	var contenedor = document.getElementById('contenedor_primario');
	contenedor.style.width='100%';
	contenedor.style.height='100%';
	contenedor.style.position='absolute';
	contenedor.style.margin='0';
	contenedor.style.left='0';
	contenedor.style.top='0';
//			contenedor.style.width='1000px';
//			contenedor.style.height='595px';
	document.body.style.backgroundImage='url(/_img/bg_defaultsite.png)';
	document.body.style.backgroundPosition='-4px 0';
	}else{
		if(!x) var valSite = 'defaultsite';
		else var valSite = x;
		
		if(haut>720){
			document.body.style.backgroundImage='url(/_img/bg_defaultsite_highres.png)';
		}else{
			document.body.style.backgroundImage='url(/_img/bg_defaultsite.png)';
		}
		document.body.style.backgroundPosition='50% 50%';
	}
}
/** fin de gestion du pb de centrage **/


/** gestion du bug de centrage si la fenêtre est trop petite pour le site **/
//if(!iemac) lcmIfInf1024();
//if(!iemac) lcmWriteFix();

function FixResolution() {
if(!iemac) lcmIfInf1024();
if(!iemac) lcmWriteFix();
}

if (window.addEventListener) {
	window.addEventListener("load",FixResolution,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",FixResolution);
} else {
	window.load = function() {FixResolution();}
}

function lcmResize()
{
	if(!iemac) lcmIfInf1024();
	if(!iemac){
		if(larg<1000 || haut <595){
			var contenedor = document.getElementById('contenedor_primario');
			contenedor.style.margin='0';
			contenedor.style.left='0';
			contenedor.style.top='0';
//			contenedor.style.width='1000px';
//			contenedor.style.height='595px';
			contenedor.style.width='100%';
			contenedor.style.height='100%';
			document.body.style.backgroundImage='url(/_img/bg_defaultsite.png)';
			document.body.style.backgroundPosition='-4px 0';
		}
		else
		{
			var contenedor = document.getElementById('contenedor_primario');
			contenedor.style.marginLeft='-500px';
			contenedor.style.marginTop='-307px';
			contenedor.style.left='50%';
			contenedor.style.top='50%';
			contenedor.style.width='1000px';
			contenedor.style.height='614px';
			if(haut>720){
				document.body.style.backgroundImage='url(/_img/bg_defaultsite_highres.png)';
			}else{
				document.body.style.backgroundImage='url(/_img/bg_defaultsite.png)';
			}
			document.body.style.backgroundPosition='50% 50%';

		}
	}
}
//window.onresize=lcmResize;

if (window.addEventListener) {
	window.addEventListener("resize",lcmResize,false);
} else if (window.attachEvent) {
	window.attachEvent("onresize",lcmResize);
} else {
	window.resize = function() {lcmResize();}
}
