
//fonction qui cache un element d'identifiant id
function hide(id){
  var element2hide = document.getElementById(id);     
  if (element2hide) {
    element2hide.style.visibility='hidden';
    element2hide.style.display='none';
  }
}

//fonction qui affiche un element d'identifiant id (cache l'ancien et montre le nouveau)
function show(id) {
  var element2show = document.getElementById(id);          
  if (element2show) {
    element2show.style.visibility='visible';
    element2show.style.display='';
  }
}    

function get_height_page(topMenu_Height)
{
  //le 100 = la taille du menu d'en haut
  var h= document.body.clientHeight - topMenu_Height;
  return h; 
}

function get_width_page()
{
  var w= document.body.clientwidth;
  return w; 
}

function iFrameWidthHeight() {
    var h = 0;
    
    h =get_height_page();            
    w =get_width_page();  
    if ( !document.all ) { 
      document.getElementById('iframeexternal').style.height = h + 20 + 'px';    
      document.getElementById('iframeexternal').style.width = w + 20 + 'px';
    }
    else
    {
      document.all.iframeexternal.style.height = h + 20 + 'px';
      document.all.iframeexternal.style.width = h + 20 + 'px';
    }          
    
 }


//object_at_mousepos, utilisation:
// onmouseover="javascript:object_at_mousepos(event,'divorobjectname');"
function object_at_mousepos(evt, ObjectName)
{  
  // Detect if the browser is IE or not.
  // If it is not IE, we assume that the browser is NS.
  var IE = document.all?true:false
  if(IE)
  {
  	evt = window.event;
  	mouse_X = evt.clientX + document.documentElement.scrollLeft;
  	mouse_Y = evt.clientY + document.documentElement.scrollTop;
  }
  else
  {  	
  	mouse_X = evt.pageX + document.body.scrollLeft;
  	mouse_Y = evt.pageY + document.body.scrollTop;
  }
     
  //alert('left:'+ mouse_X +'; top:'+ mouse_Y+';');
  //positionner l'objet
  document.getElementById(ObjectName).style.left = mouse_X + 'px';
  document.getElementById(ObjectName).style.top = mouse_Y + 'px';      
}

function OpenCenteredWindow(theURL,winName,width,height) { //v2.0
var wintop = Math.round((screen.height-height)/2);
var winleft = Math.round((screen.width-width)/2);
  window.open(theURL,winName,'scrollbars=yes,resizable=yes,left='+winleft+',top='+wintop+',width='+width+',height='+height);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
var width = 470;
var height = 560;
var wintop = Math.round((screen.height-height)/2);
var winleft = Math.round((screen.width-width)/2);
var popup = window.open(theURL,winName,features);

popup.moveTo(0,wintop);

var winpostop = (0);
var winposleft = (0);
	if(navigator.appVersion.charAt(0) >=4) {
		for(winpostop = 1 ; winpostop < wintop ; winpostop = winpostop + 10) {
			popup.moveTo(0,winpostop);
		}
		for(winposleft = 1 ; winposleft < winleft ; winposleft = winposleft + 10) {
			popup.moveTo(winposleft,wintop);
		}
	}
}

