function NewWindow(mypage, myname, w, h, myscroll) {
var winl = (window.screen.width - w) / 2;
var wint = (window.screen.height - h) / 2 -20;
var fw = window.screen.availWidth-10;
var fh = window.screen.availHeight-50;
var winprops;
var agent=navigator.userAgent.toLowerCase();
var khtml = (agent.indexOf("khtml") != -1);

if (myscroll=='full') {
	if (!khtml && document.all) winprops='fullscreen=1,scrollbars=1,status=1';
	else winprops='screenX=0,status=1,screenY=0,scrollbars=1,top=0,left=0,height='+fh+',width='+fw;
}
else if (myscroll=='max' || myscroll=='maxurl' || myscroll=='maxtool') {
	winprops='top=0,left=0,screenX=0,screenY=0,status=1,resizable=1,scrollbars=1,width='+fw;
	if (myscroll=='maxurl') winprops+=',heigth='+(fh-20)+',location=yes,toolbar=yes,menubar=no';
	else winprops+=',toolbar=no,menubar=no,height='+fh;

}
else {
	winprops='scrollbars='+myscroll+',resizable=1,height='+h+',width='+w+',top='+wint+',left='+winl;
}
win = window.open ( mypage, myname, winprops);
if (win && window.focus) win.focus();
return false;
}

function hideButtons() {
//disable all buttons of all forms
var current = false;
var el=false;
var i=0;
var e=0;
var doDesactivate = true;
for (i = 0; i < document.forms.length; i++) {
	current=document.forms[i];
	for (e = 0; e < current.elements.length; e++) {
	 el = current.elements[e];
   if(el.name=='btnExcel') doDesactivate = false;
	}
}
if(doDesactivate)
{ 
  for (i = 0; i < document.forms.length; i++) {
  	current=document.forms[i];
  	for (e = 0; e < current.elements.length; e++) {
  		el = current.elements[e];
  		if (el.type == 'submit' || el.type == 'button') el.style.visibility="hidden";
  		
  	}
  }
}

return true;
}

function activateHideButtons() {
var current = false;
var el=false;
var i=0;
var e=0;

if (document.forms) for (i = 0; i < document.forms.length; i++) {
	current=document.forms[i];
	if (!current.onsubmit) current.onsubmit=hideButtons;
}
}

/*
 * Cette fonction permet une redirection
 * automatique lors d'un choix dans le menu
 * de navigation "Amen international".
 * */
function SelectRedirect(list, secure) {
	var prefix = "";
	if (secure == 1) prefix = "https://";
	else prefix = "http://www.";

	if (list.options) {
		location.href = prefix + list.options[list.selectedIndex].value;
	}
}



function getLeft(l) 
{ 
  
   if (l.offsetParent ) return (l.offsetLeft + getLeft(l.offsetParent));   
  else return (l.offsetLeft); 
 } 
function getTop(l) {  
   if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));   
  else return (l.offsetTop); 
}

function pop_it(the_form) {
	my_form = eval(the_form)
   
	var fen;
	fen=window.open(this.href, "popup","menubar=no, status=no, scrollbars=yes, menubar=no, resizable=yes,width=500, height=350");
	fen.focus();

	my_form.target = "popup";
	my_form.submit();
}

function place_sql(id,loc)
{
if(loc=='site')
{
  var x= document.getElementById('sqlcnt'+id).offsetLeft;
  var y= document.getElementById('sqlcnt'+id).offsetTop;
}
else if(loc=='intranet')
{
  var x= getLeft(document.getElementById('sqlcnt'+id));
  var y= getTop(document.getElementById('sqlcnt'+id));
}

if (!MonTableau[x]) 
			{
				MonTableau[x]=new Array();
			}
			
			if(MonTableau[x].indexOf(y) != '-1')
			{
				
				if (!MonTableau[x]) MonTableau[x]=new Array();
				
				while (MonTableau[x].indexOf(y) != '-1')
				{	
					x=x+20;
          if(x>1200) 
          { 
            y=y+12;
            x=0;
          }
					if (!MonTableau[x]) MonTableau[x]=new Array();
				}
			}
			MonTableau[x].push(y);
			document.getElementById('sqlcnt'+id).style.top=y;
			document.getElementById('sqlcnt'+id).style.left=x;

			document.getElementById('sqlcnt'+id).style.position='absolute';
      document.getElementById('sqlcnt'+id).style.zIndex=20;
}

function menuderoulant(selection)
{
  window.location=selection.options[selection.selectedIndex].value;
}

