/********* generate drop down menu ***************/
var Timer = false;

function showMenuItems(id, noOfMenu) {
  hideAllMenuItems(noOfMenu);
  if (id==''|| id==undefined) return;
  id = "menuTable"+id;
  var item = document.getElementById(id);
  item.style.display="block";
  Timer = true;
}

function hideAllMenuItems(noOfMenu) {
  if(noOfMenu==null) noOfMenu=5;

  if(Timer) {
    for (i=1; i<=noOfMenu; i++) {
      var id = "menuTable"+i;
      var item = document.getElementById(id);
      if(item!=undefined || item!=null) item.style.display="none";
    }
  }
 // setTimeOut("hideAllMenuItems(5)", 1000);
}
function menuTableOn() {Timer=false; }
function menuTableOff() {Timer=true; }
window.setInterval("hideAllMenuItems(5)", 1000);


/*************************************************************************
  Fonctions g�n�riques utilis�es dans le site internet
  Harrison & Wolf
  version : 3.3
  Date de modification : 08/12/05

****************************************************************************************
*                Roll Over (fonction native Dreamweaver renomm�es avec le prefixe MM_)  *
*****************************************************************************************/
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
    x.src=x.oSrc;
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }

  if(!(x=d[n])&&d.all) x=d.all[n];

  for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
      x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById)
    x=d.getElementById(n); 
  return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
     document.MM_sr[j++]=x; 
     if(!x.oSrc) x.oSrc=x.src;
     x.src=a[i+2];
   }
}

/********************************************************************
*                   Tableaux                                        *
********************************************************************/
function openMag(langue,URL) {
  path = '/energies/';

  if (!URL) {
    URL = '/energies/' + langue;
  }

  lAttributes = '';
  lAttributes += 'toolbar=0,';
  lAttributes += 'Location=0,';
  lAttributes += 'directory=0,';
  lAttributes += 'status=0,';
  lAttributes += 'menubar=0,';
  lAttributes += 'scrollbars=0,';
  lAttributes += 'resizable=0,';
  lAttributes += 'width=780,';
  lAttributes += 'height=532';
  winId = window.open(URL,'',lAttributes);
}

function openMagSom(langue,URL) {
  //var URL = 'http://129.35.162.76/energies/allissues/'+langue+'/tousnumeros.htm';
  if (URL=='') URL = '/energies/allissues/'+langue+'/tousnumeros.htm';

  lAttributes = '';
  lAttributes += 'toolbar=0,';
  lAttributes += 'Location=0,';
  lAttributes += 'directory=0,';
  lAttributes += 'status=0,';
  lAttributes += 'menubar=0,';
  lAttributes += 'scrollbars=1,';
  lAttributes += 'resizable=0,';
  lAttributes += 'width=420,';
  lAttributes += 'height=400';
  winId = window.open(URL,'',lAttributes);
}

/********************************************************************
*                   Marquee                                         *
********************************************************************/

function Defilant(id, pos_init, pos_min, pos_max, delta, direction) {
	 this.id          = id;
	 this.element     = document.getElementById(id);
	 this.pos_init    = pos_init;
	 this.pos_min     = pos_min;
	 this.pos_max     = pos_max;
	 this.pos_current = pos_init;
	 this.delta       = delta;
	 this.direction   = direction;
}
Defilant.prototype.defile = function() {
	 if (!this.element) {
			this.element = document.getElementById(this.id);
	 }
	 if (this.element) {
			if(this.direction == 'vertical'){
				 if(this.pos_current < (this.pos_min - this.element.offsetHeight) ){
						this.pos_current = this.pos_init;
				 } else if (this.pos_current > this.pos_max ) {
						this.pos_current = this.pos_init - this.element.offsetHeight;
				 } else {
						this.pos_current += this.delta;
				 }
				 this.element.style.top = this.pos_current+"px";
			} else if(this.direction == 'horizontal') {
				 if(this.pos_current < (this.pos_min - this.element.offsetWidth) ){
						this.pos_current = this.pos_init;
				 } else if (this.pos_current > this.pos_max ) {
						this.pos_current = this.pos_init - this.element.offsetWidth;
				 } else {
						this.pos_current += this.delta;
				 }
				 this.element.style.left = this.pos_current+"px";
			}
	 }
}








