function switchClass(id,aClass)	{
	document.getElementById(id).className=aClass;
}

function showComponent(id)	{
	document.getElementById(id).style.visibility="";
}

function hideComponent(id)	{
	document.getElementById(id).style.visibility="hidden";
}

function hideWait() {
	showComponent('mainPane');
	hideComponent('waitPane');
}
function showWait() {
	showComponent('waitPane');
	hideComponent('mainPane');
}

function windowOpener(url, name, args) {
  if (typeof(popupWin) != "object"){
    popupWin = window.open(url,name,args);
  } else {
    if (!popupWin.closed){
      popupWin.location.href = url;
    } else {
      popupWin = window.open(url, name,args);
    }
  }
  popupWin.focus();
}

var imageWindow = "";
function openImageWindow (url,aWidth,aHeight){
/*
	var imageWindow = "";
	var windowName = ""	;
	if ( arguments[3] ) windowName = arguments[3]	;
  var h = ( screen.availHeight - aHeight) / 2;
  var l = ( screen.availWidth - aWidth) / 2;
	if ( imageWindow &&  !imageWindow.closed ) imageWindow.close()	;
	url = encodeURI(MMS_JAVASCRIPT_APPLICATION_CONTEXT + "/jsp/core/MmsImage.jsp"
	             + "?MMS_IMAGE_URL=" + url
	             + "&MMS_JAVASCRIPT_IMAGE_TITLE=" + MMS_JAVASCRIPT_IMAGE_TITLE
	             + "&MMS_JAVASCRIPT_PROMPT_CLOSE=" + MMS_JAVASCRIPT_PROMPT_CLOSE
	             + "&MMS_JAVASCRIPT_TOOLS_PRINT_LABEL=" + MMS_JAVASCRIPT_TOOLS_PRINT_LABEL);
	imageWindow = window.open(url, windowName,"status=no,scrollbars=yes,resizable=yes,top="+h+",left="+l+",width="+aWidth+",height="+aHeight);
	window.skipcycle = true;
*/
	var windowName = ""	;
	if ( arguments[3] ) {
	 windowName = arguments[3];
	} 
  var h = ( screen.availHeight - aHeight) / 2;
  var l = ( screen.availWidth - aWidth) / 2;
  if ( imageWindow &&  !imageWindow.closed ) {
   imageWindow.close()	;
  }
	imageWindow = window.open(url, windowName,"status=no,scrollbars=yes,resizable=yes,top="+h+",left="+l+",width="+aWidth+",height="+aHeight);
	window.skipcycle = true;
}

function confirmAndActionPerformed(msg, action) {
	if ( confirm(msg) ) {
		displayTransition();
		document.location.href=action;
	}
	return false;
}

function clickButton(buttonId) {

  var button = document.getElementById(buttonId);
  if ( button ) {
    button.click();
    return true;
  } else {
    alert('Erreur');
  }

  return false;
}


function confirmAndDisplay(msg) {
	if ( confirm(msg) ) {
		displayTransition();
		return true;
	}
	return false;
}

function exportResult() {
	var form = form = document.getElementById("exportForm");
	if ( form != null ) {
		skipcycle = true;
		form.submit();
	}
	return false;
}

function checkAll() {
  var d=document;
  var el=d.getElementsByTagName('INPUT');
  for(i=0;i<el.length;i++) {
    el[i].checked=true;
  }
}

function uncheckAll() {
  var d=document;
  var el=d.getElementsByTagName('INPUT');
  for(i=0;i<el.length;i++) {
    el[i].checked=false;
  }
}

function checkAllById(formId) {
	var table=document.getElementById(formId);
 	var el = table.getElementsByTagName('INPUT');
  for ( i=0; i<el.length; i++ ) {
  	el[i].checked = true;
  }
}

function uncheckAllById(formId) {
	var table=document.getElementById(formId);
 	var el = table.getElementsByTagName('INPUT');
  for ( i=0; i<el.length; i++ ) {
  	el[i].checked = false;
  }
}

// handle an event generated when a user press "enter" from an input form element
function handleReturnKeyPressed(evt) {
  // character code for the key which has been pressed
  var characterCode;

  if (evt.which) {
    characterCode = evt.which;
  } else if (evt.keyCode && evt.srcElement) {
    // IE specific
    characterCode = evt.keyCode;
  }

  // ascii 13 is the character code for the 'return' key
  if (characterCode && characterCode == 13) {
    var actionElement = document.getElementById('defaultAction');
    if (actionElement) {
      actionElement.click();
    }
  }
}

function resize () {
  var left = document.getElementById("leftColumn");
  var leftMenu = document.getElementById("leftColumnMenu");
  var right = document.getElementById("rightColumn");
  var max = 0 ;
  max = right.offsetHeight;
//  max = left.offsetHeight<max?max:mid.offsetHeight;
//  max = leftMenu.offsetHeight<max?max:mid.offsetHeight;
  if ( navigator.appName.substr(0,2) != "Mi" ) {
    left.style.height = max-170 ;
    leftMenu.style.height = max-430 ;
  }
  else {
    left.style.height = max-189 ;
    leftMenu.style.height = max-420 ;
  }
}