/* 2006 Kahiloa Solutions et Communication */
/* Nicolas Project */
/* SCRIPT GLOBAL DU SITE Cercle */

//surcharge de getElementById , plus fiable
if (document.getElementById) {
  window.GE = function(id) {
    return document.getElementById(id);
  }
} else if (document.all) {
  window.GE = function(id) {
    return document.all[id]
  }
} else {
  window.GE = function(id) {
    return false;
  }
}

//Test du navigator
var gCursor = null;
if(navigator.appName=='Microsoft Internet Explorer')	gCursor = 'hand';
else	gCursor = 'pointer';

// Navigator informations
var n = navigator;
var d = document;
var agent = n.userAgent.toLowerCase();
var name = n.appName.toLowerCase();
var opera = agent.indexOf("opera") != -1;

//Browser sniff hash obj
var sniff = {
	bw: {
	ie:agent.indexOf("msie") != -1 && !opera,
	ie4:agent.indexOf("msie 4.") != -1 && !opera,
	ie5:agent.indexOf("msie 5.") != -1 && !opera,
	ie6:agent.indexOf("msie 6.") != -1 && !opera,
	ns:name.indexOf("netscape") != -1 && agent.indexOf("gecko") == -1,
	ns6:agent.indexOf("netscape6") != -1
	},
	os: {
	win:n.userAgent.indexOf("Win") != -1,
	mac:n.userAgent.indexOf("Mac") != -1
	}
};

/* Récupération de la hauteur d'un div */
function getHeightDivById(pId){
	var vDivHeight = 0;
	vDivHeight=(sniff.bw.ns)?d[pId].clip.height:sniff.bw.ie?d.all[pId].offsetHeight:d.getElementById(pId).offsetHeight;
	return vDivHeight;
}

/* Affectation de la hauteur d'un div */
function setHeightDivById(pId, pHeight){	
	if(d.getElementById(pId)){ //fix js bug (d.getElementById(pId).style undefined where no sidebar)
		var vStyle=(sniff.bw.ns)?d[pId]:sniff.bw.ie?d.all[pId].style:d.getElementById(pId).style;
		if(pHeight>0)	vStyle.height = pHeight+'px';
	}
}

/* Redimensionnement du fond de la colonne de la navigation 3e niveau */
function resizeBgkLeftMenu(pLeftColValue){
	var vId = 'glo_nav_niv2_variable';
	var vLeftHeightDiv = getHeightDivById('glo_left');
	var vRightHeightDiv = getHeightDivById('glo_right');
	var vDiff = 0;
	if(pLeftColValue!=null && pLeftColValue>0) 	vDiff = vRightHeightDiv-pLeftColValue;
	else 	vDiff = vRightHeightDiv-vLeftHeightDiv;

	//Test navigator
	if(sniff.bw.ie) vDiff=vDiff+10;
	else vDiff=vDiff+9;
	if(vDiff>0) setHeightDivById(vId, vDiff);
}

