function displayWaitScreen() {
  var obj2 = getObj("waitingScreen");
  obj2.style.display = "block";
}

function hideWaitScreen() {
  var obj2 = getObj("waitingScreen");
  obj2.style.display = "none";
}

function in_array(needle,stack) {
  for (var index=0;index<stack.length;++index) {
    if (stack[index] == needle) return true;
  }
  return false;
}

function trim(str) {
  var regExpBeginning = /^\s+/;
  var regExpEnd       = /\s+$/;
  return str.replace(regExpBeginning,"").replace(regExpEnd,"");
}

function getWindowSize(dim) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if (dim == 'width') {
    return myWidth;
  }
  else if (dim == 'height') {
    return myHeight;
  }
  else {
    return [myWidth,myHeight];
  }
}

function resizeContent() {
  $('content').style.height = (getWindowSize('height') - 240) + 'px';
}

/**
 * Ajout/Supprime la class de l'element l'appellant
 */
function    highlightTd(event) {
    var aTd = Event.element(event).parentNode.getElementsByTagName('td');
    for (var td_i = 0; aTd[td_i]; ++td_i) {
        if (aTd[td_i].className == 'highLight')
            $(aTd[td_i]).removeClassName('highLight');
        else
            $(aTd[td_i]).addClassName('highLight');
    }
}

/**
 * Ajoute la fonction pour modifier le background au click pour les tableaux dont la class = className
 */
function    addHighLightTable() {
    var elems = $$('table.o_table');
    for (var table_i = 0; elems[table_i]; ++table_i) {
        var aTr = elems[table_i].getElementsByTagName('tr');
        for (var tr_i = 0; aTr[tr_i]; ++tr_i) {
            if (aTr[tr_i].parentNode.tagName != 'THEAD')
                Event.observe(aTr[tr_i], 'click', highlightTd);
        }
    }
}

Event.observe(window, 'load', resizeContent,false);
Event.observe(window, 'resize', resizeContent,false);
Event.observe(window, 'load', addHighLightTable);

