  var act = 0;
	function StopPropa(e){
		if(!e) 
			var e = window.event;
		e.cancelBubble = true;
		if(e.stopPropagation)
			e.stopPropagation();		
	}
	
	function ShowMenu(event, id, from){
	  HideMenus(id);
		var pos = $(from).offset(); 
		$('#' + id).css({top: pos.top + $(from).height()});
		//$('#' + id).width($(from).width());
		$('#' + id).slideDown(400);
		++act;
		StopPropa(event);
	}
	
	function HideMenus(except){
		if(act){
		  $('.BlocMenu').each(function(){
         var d = $(this).css('display');
         if(d != null && d != 'none'){
          if($(this).attr('id') != except){
            $(this).hide(1);
            --act;
          }
         }
      });
		}
	}
	
	function ShowWtAni(id, from){
	  var parent = $(from).parents('.BlocMenu').first();
    if(parent.size() > 0){
      $('#' + id).css({top: parent.offset().top});
      $('#' + id).fadeIn(300, function(){parent.hide(); parent = null;});
    }
  }
  
  $('body').mouseover(function(){
     HideMenus(null);
  });


function MM_swapImgRestore() { //v3.0
  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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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() { //v3.0
  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];}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/**
 * Caddie
 * */
function JGoTo(jqdiv){
  $(window).scrollTop(jqdiv.offset().top);
} 

function GetCurrTime(){
  return (new Date().getTime());
}

TLWH = function(s){
  this.top = (s == null || s.top == null) ? 0: s.top;
  this.left = (s == null || s.left == null) ? 0 : s.left;
  this.width = (s == null || s.width == null) ? 0 : s.width;
  this.height = (s == null || s.height == null) ? 0 : s.height;
  
  this.diff = function(totl){
    var out = new TLWH;
    if(totl.top < top){
      out.top = this.top - totl.top;
      out.left = this.left - totl.left;
      out.width = this.width - totl.width;
      out.height = this.height - totl.height;
    } 
    else{
      out.top = totl.top - this.top;
      out.left = totl.left - this.left;
      out.width = totl.width - this.width;
      out.height = totl.height - this.height;
    }
    return out;
  }
}

function JQToTLWH(div){
  return (new TLWH({top: div.offset().top, left: div.offset().left, width: div.width(), height: div.height()}));  
}

AnimCaddie = function(divcible, divsrc){
  if($('#toCaddie').size() > 0){
    $('#toCaddie').data('AnimCaddie', null);  
    $('#toCaddie').remove();
  }
  
  this.dest = divcible;
  this.tspeed = 20; //vitesse de l'anim                      
  this.timeanim = 800; //durée de l'anim
  this.starttm = GetCurrTime(); //debut de l'anim
  this.destdt = JQToTLWH(this.dest);
  this.currdt = JQToTLWH(divsrc);
  this.endCallback = null;
  
  this.div = divsrc.clone().attr('id', 'toCaddie').css({top: this.currdt.top, left: this.currdt.left, height: this.currdt.height, width: this.currdt.width});
  $('body').append(this.div);
  this.div.data('AnimCaddie', this); 
  
  this.timer = $.timer(
    this.tspeed,
    function(timer){
      var cl = null;
      if($('#toCaddie').size() > 0)
        cl = $('#toCaddie').data('AnimCaddie');   
      
      if(cl == null){
        timer.stop();
        return false;
      }   
      
      var trest = cl.timeanim - (GetCurrTime() - cl.starttm);
      var nbb = Math.round(trest / cl.tspeed);          
      var d = cl.destdt.diff(cl.currdt);
        
      if(nbb <= 0){
        cl.destruct();
        return false;
      }
        
      var ndt = new TLWH({top: (cl.currdt.top - parseInt(d.top / nbb)), left: (cl.currdt.left - parseInt(d.left / nbb)), width: (cl.currdt.width - parseInt(d.width / nbb)), height: (cl.currdt.height - parseInt(d.height / nbb))});
        
      cl.div.offset({top: ndt.top, left: ndt.left});
      cl.div.width(ndt.width);
      cl.div.height(ndt.height);
      cl.currdt = ndt;
    }
  )

  this.destruct = function(){
    this.timer.stop();
    this.timer = null;  
    this.div.data('AnimCaddie', null);
    if(this.endCallback != null){
      this.endCallback();        
      this.div.remove();
    }
  }
}
