/* auteur: Nadim Saikali */
/* Date de création: 12/28/2005 */
function closeAllFleDiv(){
	var grouptags2 = document.getElementsByTagName("DIV");
	var imgid="";
	for (i=0;i<grouptags2.length;i++){
		if ( grouptags2[i].id.search("cp")>0 ){
			grouptags2[i].style.display = "none";
			imgid = "i"+grouptags2[i].id.substr(1, 3);
			document.images[imgid].src = "_img/fleche.gif";
		}
	}
}

function openFleDiv(id) {
	var originalState = document.getElementById("dcp"+id).style.display;
	closeAllFleDiv();
	if (originalState=="none") {
		document.getElementById("dcp"+id).style.display = "";
		document.images["icp"+id].src = "_img/fleche1.gif";

	} else {
		document.getElementById("dcp"+id).style.display = "none";
		document.images["icp"+id].src = "_img/fleche.gif";
	}
}

//|------------------------------------------------------------------------
var hideAllTimer;
var divOpenSpeed = 5;

//--
function closeDivMenu(divName) {
	document.getElementById(divName).innerHTML		= "";
	document.getElementById(divName).style.display	= "none";
	showSelectTag();
}
//--
function clickAct(e) {
	closeDivMenu('planDiv');
}
//--
function hideSelectTag() {
	var grouptags2 = document.getElementsByTagName("SELECT");
	for (sl=0;sl<grouptags2.length;sl++){
		grouptags2[sl].style.visibility="hidden";
	}
}
function showSelectTag() {
	var grouptags2 = document.getElementsByTagName("SELECT");
	for (sl=0;sl<grouptags2.length;sl++){
		grouptags2[sl].style.visibility="";
	}
}
//--
function getParentTop(o, p, pos){
	oN = o;
	pN = p;
	while (pN!="BODY"){
		pos = pos+oN.offsetParent.offsetTop;
		pN = oN.offsetParent.tagName;
		oN = oN.offsetParent;
	}
	return pos;
}
function getParentLeft(o, p, pos2){
	oN = o;
	pN = p;
	while (pN!="BODY"){
		pos2 = pos2+oN.offsetParent.offsetLeft;
		pN = oN.offsetParent.tagName;
		oN = oN.offsetParent;
	}
	return pos2;
}
//--
function divPos(topPosition, leftPosition, width, height){
	
	document.getElementById('planDiv2').style.top	= (topPosition);
	document.getElementById('planDiv2').style.left	= (leftPosition);
	document.getElementById('planDiv2').style.width	= (width);
	document.getElementById('planDiv2').style.height= (height);

	document.getElementById('planDiv3').style.top	= (topPosition+2);
	document.getElementById('planDiv3').style.left	= (leftPosition+2);
	document.getElementById('planDiv3').style.width	= (width);
	document.getElementById('planDiv3').style.height= (height);

	document.getElementById('planDiv4').style.top	= (topPosition+3);
	document.getElementById('planDiv4').style.left	= (leftPosition+3);
	document.getElementById('planDiv4').style.width	= (width);
	document.getElementById('planDiv4').style.height= (height);
}

//|---------------------------------------------------------------------| infobulle
function getInfobulle(txt, txt2, oThis, oWidth, oHeight, dirpos, precision){

	pTagName = oThis.offsetParent.tagName;
	var topParentOffest = getParentTop(oThis, pTagName, oThis.offsetTop);
	var leftParentOffest = getParentLeft(oThis, pTagName, oThis.offsetLeft);

	topPosition	= (topParentOffest)+(precision);//
	leftPosition= 300+(leftParentOffest)+(precision);//
	makeInfoSlow(txt, txt2, topPosition, leftPosition, oWidth, oHeight, 0, dirpos);
}

function makeInfobulle(textvalue, textvalue2, topPosition, leftPosition, width, height, widtho, heighto){

	div2dislay1	= '<div align="left" ID="planDiv2" style="z-index: 9;position: absolute;width: '+width+'px;height: '+height+'px;top: 0px;left: 0px;border: 1px solid #F7F6F3;overflow: hidden;background-color: #FAF8F6;padding: 1px;"><img src="../_img/bt_colse.gif" border="0" width="17" height="12" align="right" onclick="clickAct()"><br><div class="goldpop" style="z-index:7;">'+unescape(textvalue)+'</div><div class="noirpop" style="z-index:7;">'+unescape(textvalue2)+'</div></div><div ID="planDiv3" style="z-index:7; FILTER: alpha(opacity=50);-moz-opacity: 0.5; position:absolute; width:'+width+'px; height:'+height+'px; BACKGROUND-COLOR: #666666">&nbsp;</div><div ID="planDiv4" style="z-index:6; FILTER: alpha(opacity=30); -moz-opacity: 0.3; position:absolute; width:'+width+'px; height:'+height+'px; BACKGROUND-COLOR: #666666">&nbsp;</div>';

	document.getElementById('planDiv').style.display= "";
	document.getElementById('planDiv').innerHTML		= div2dislay1;
	divPos(topPosition, leftPosition, width, height)
//	document.onmousedown = clickAct;
}

function makeInfoSlow(textvalue, textvalue2, topPosition, leftPosition, width, height, call, dir){

	clearTimeout(hideAllTimer);
	hideAllTimer = null;

	if (call<divOpenSpeed){
		widthA	= (width/(divOpenSpeed-call));
		heightA	= (height/(divOpenSpeed-call));
		topPositionA	= topPosition+((divOpenSpeed-call)*2);
		if (dir=="rtl"){
			leftPositionA	= leftPosition+width-(width/(divOpenSpeed-call));
		} else {
			leftPositionA	= leftPosition;
		}
		if (call==0) makeInfobulle(textvalue, textvalue2, topPositionA, leftPositionA, widthA, heightA, width, height);
		else divPos(topPositionA, leftPositionA, widthA, heightA);
		call++;

		hideAllTimer = setTimeout('makeInfoSlow("'+textvalue+'", "'+textvalue2+'", '+topPosition+', '+leftPosition+', '+width+', '+height+', '+call+', "'+dir+'")',10);
		resetTime=1;
	}
}