/**
* js commun
*/
var myPopup=null;

var nbmnu = 4;
var nommnu = 'e-';
var	itemMenu = 0;

	function  selectMnu(p) {
		for(var i=1; i<=nbmnu; i++) {
			hide(nommnu+i);
		}
		if(p>0) {
			show(nommnu+p);
		}
	}

	function messagePopup(message, delay, x, y, action) {
		if (  message==null || message=='' || message=='undefined')
			return;
		setTimeout("myPopup.hideIt();", delay==null || delay==''? 8000: delay);
		setHTML('messagePopup',message);
		if ( action!=null && action!='') {
			setHTML('messageActionPopup',action);
		}
		myPopup=new lib_obj('myPopup');
		myPopup.dragdrop();
		if (x!=null || y!=null) {
			x= x==null ? 0:x;
			y= y==null ? 0:y;
		} else {
			x=ptX+50; y=ptY-50;
		}
		myPopup.moveIt(x, y);
		myPopup.showIt();

	}
	function messagePopupHide() {
		myPopup.hideIt();
	}

	function messagePopupId(message, id, x, y, delay) {
		if (  message==null || message=='' || message=='undefined')
			return;
		setTimeout("myPopup.hideIt();", (delay==null || delay=='')? 8000: delay);
		setHTML('messagePopup',message);

		var xy=findPos(id);
		var x1= x==null ? 50: x;
		var y1= y==null ? -50: y;

		myPopup=new lib_obj('myPopup');
		myPopup.dragdrop();

		myPopup.moveIt(xy[0]+x1, xy[1]+y1);
		myPopup.showIt();

	}
 	function winPopUp(url, width, height, params) {
		open(url, '', "width=" + width + ",height=" + height + "," + params);
 	}

 	function windowPopUp(url, width, height, resize) {
		var params = "resizable=" + resize + ",scrollbars=" + "0" + ",menubar=" + "0" + ",toolbar=" + "0";
		params += ",directories=" + "0" + ",location=" + "0" + ",status=" + "0";
		winPopUp(url, width, height, params);
  	}
//--
	function findPos(id) {
		if (!is_object(id)) {
			return [0,0];
		}
		var curleft = curtop = 0;
		var obj = getObject(id);
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
		return [curleft,curtop];
	}
	function goBasket() {
		window.location='/modules/panier/';
	}

	// formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
	function format(valeur,decimal,separateur) {
		var deci=Math.round( Math.pow(10,decimal)*(Math.abs(valeur)-Math.floor(Math.abs(valeur)))) ;
		var val=Math.floor(Math.abs(valeur));
		if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.floor(Math.abs(valeur)); deci=0;}
		var val_format=val+"";
		var nb=val_format.length;
		for (var i=1;i<4;i++) {
			if (val>=Math.pow(10,(3*i))) {
				val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
			}
		}
		if (decimal>0) {
			var decim="";
			for (var j=0;j<(decimal-deci.toString().length);j++) {decim+="0";}
			deci=decim+deci.toString();
			val_format=val_format+"."+deci;
		}
		if (parseFloat(valeur)<0) {val_format="-"+val_format;}
		return val_format;
	}

	function updateCnx() {
		 setTimeout("updateCnx();",300000);
	}

// retourne la position horizontale sur la page du pointeur de la souris
	function pointeurX(e) {
	  if (window.event)
	    return (window.event.clientX);
	  else
	    return(e.pageX);
	} // fin pointeurX(e)

// retourne la position verticale sur la page du pointeur de la souris
	function pointeurY(e) {
	  if (window.event)
	    return (window.event.clientY);
	  else
	    return(e.pageY);
	} // fin pointeurY(e)

	function setXY(e) {
		ptX = pointeurX(e);
		ptY = pointeurY(e);
	}

var ptX=0;
var ptY=0;
document.onmousemove = setXY;



