dClientWidth = 0;
dClientHeight = 0;
posLeft = 0
dAffich = 1010;

var agt=navigator.userAgent.toLowerCase(); 
var is_ns  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
                && (agt.indexOf('webtv')==-1)); 
var is_ie   = (agt.indexOf("msie") != -1); 

function getObject(name) {
	var ns4 = (document.layers) ? true : false;
	var w3c = (document.getElementById) ? true : false;
	var ie4 = (document.all) ? true : false;
	if (ns4) return eval('document.' + name);
	if (w3c) return document.getElementById(name);
	if (ie4) return eval('document.all.' + name);
	return false;
}

function getWindowDim(){
	if (is_ie) {	
		dClientWidth = window.document.body.clientWidth;
		dClientHeight = window.document.body.clientHeight;
	} else {
		dClientWidth = window.innerWidth;
		dClientHeight = window.innerHeight;
	}
	if (dClientWidth >= dAffich) posLeft = Math.ceil((dClientWidth/2) - (dAffich/2));
	else posLeft = 0;
}

window.onload = setContexte;

function setContexte() {
	tmainWidth = 0;
	tmainHeight = 0;
	
	// Contexte
	getWindowDim();
	
	// CONTOUR
	layerDefine('main',null,posLeft - 1);
	layerDim('main',dClientHeight-1,null);
	getObject('main').style.visibility="visible";

	// MENU
	layerDefine('menu',null,posLeft + 245);
	dMenu = getObject('menu');
	if (dMenu)
		dMenu.style.visibility="visible";

	// PANIER
	layerDefine('shop',null,posLeft + 205);
	dMenu = getObject('shop');
	if (dMenu)
		dMenu.style.visibility="visible";
		
	mbSet('mb2', 'mbh');
}

function layerDefine(aID,aTop,aLeft) {
	aLayer = getObject(aID);
	if (aLayer) {
		if (aTop != null ) aLayer.style.top = aTop;
		if (aLeft != null ) aLayer.style.left = aLeft;
	}
}
function layerDim(aID,aHeight,aWidth) {
	aLayer = getObject(aID);
	if (aLayer) {
		if (aHeight != null ) aLayer.style.height = aHeight;
		if (aWidth != null ) aLayer.style.width = aWidth;
	}
}
function objectDim(aID,aHeight,aWidth) {
	aLayer = getObject(aID);
	if (aHeight != null ) aLayer.height = aHeight;
	if (aWidth != null ) aLayer.width = aWidth;
}

function layerDisplay(aID, state) {
	getObject(aID).style.display = state; 
}

/*
 * date:	2003-11-16
 * info:	http://inspire.server101.com/js/mb/
 */

var mbW=250;
var mbA,mbT,mbTf,mbSf;
var mbR = [];

function mbSet(m,c) {
if (document.getElementById&&document.createElement) {
	var m=document.getElementById(m);
	m.className=c;
	mbR[mbR.length] = m;
	var i;

	e=m.getElementsByTagName('a');
	if (!mbTf) mbTf=new Function('mbHT();');
	if (!mbSf) mbSf=new Function('mbS(this);');
	for (i=0;i<e.length;i++) {
		//alert(i);
		var relAttribute = String(e[i].getAttribute('rel'));
		if (e[i].getAttribute('href') && (relAttribute.toLowerCase().match('ssm'))) {
			e[i].onmouseout=e[i].onblur=mbTf;
			e[i].onmouseover=e[i].onfocus=mbSf;
		}
	}

	m=m.getElementsByTagName('ul');
	for (i=0;i<m.length;i++) {
		mbH(mbL(m[i]));
	}
}}

function mbHA() {
	if (mbA) {
		while (mbA) mbH(mbA);
		mbHE('visible');
	}
}

function mbHT() {
	if (!mbT) mbT=setTimeout('mbHA();', mbW);
}

function mbTC() {
	if (mbT) {
		clearTimeout(mbT);
		mbT=null;
	}
}

function mbS(m) {
	mbTC();
	if (mbA) while (mbA&&m!=mbA&&mbP(m)!=mbA) mbH(mbA);
	else mbHE('hidden');

	if (mbM(m)) {
		//mbSH(m,'visible');
		mbSH(m,'block');
		mbA=m;
	}
}

function mbH(m) {
	if (m==mbA) mbA=mbP(m);
	//mbSH(m,'hidden');
	mbSH(m,'none');
	mbT=null;
}

function mbL(m) {
	while (m && m.tagName != 'A') m = m.previousSibling;
	return m;
}

function mbM(l) {
	while (l && l.tagName != 'UL') l = l.nextSibling;
	return l;
}

function mbP(m) {
	var p = m.parentNode.parentNode;
	if (p.tagName == 'UL') {
		var i = 0;
		while (i < mbR.length) {
			if (mbR[i] == p) return null;
			i++;
		}
	} else {
		return null;
	}
	return mbL(p);
}

function mbSH(m,v) {
	m.className=v;
	//mbM(m).style.visibility=v;
	mbM(m).style.display=v;
}

function mbHE(v) {
	mbHEV(v,document.getElementsByTagName('embed'));
}

function mbHEV(v,e) {
	for (var i=0;i<e.length;i++) e[i].style.visibility=v;
}