/**
 * @author Michał Kozak
 */
function HTMLObjectWrapper( objectId ){
  if( document.getElementById ){
    this.object = document.getElementById(objectId);
    this.style = this.object.style;
  }else if( document.all ){
    this.object = document.all[objectId];
    this.style = document.all[objectId].style;
  }else if( document.layers ){
    this.object = document.layers[objectId];
    this.style = document.layers[objectId];
  }
}

function loadImage( imgPath ){
  img = new Image();
  img.src = imgPath;
}

function formElementFocus( form, element ){
  if( document.forms[form] && document.forms[form].elements[element] ){
    document.forms[form].elements[element].focus();
  }
}

function popup( url, width, height ){
  win = window.open( url, 'popup', 'scrollbars=1,resizable=1,width='+width+',height='+height);
  win.focus();
}

function tabRuler(tableClass, normalRowClass, hoverRowClass, onClickFunction){
  if(document.getElementById && document.createTextNode){
    tableList = document.getElementsByTagName( 'table' );
    for(i = 0; i < tableList.length; i++ ){
      if(tableList[i].className == tableClass){
        tr = tableList[i].getElementsByTagName( 'tr' );
        for(j = 0; j < tr.length; j++){
          if(tr[j].parentNode.nodeName == 'TBODY' && tr[j].className == normalRowClass){
            tr[j].onmouseover = function(){ this.className = hoverRowClass; return false }
            tr[j].onmouseout = function(){ this.className = normalRowClass; return false }

            if( onClickFunction ){
              tr[j].style.cursor = 'pointer';
              tr[j].onclick = onClickFunction;
            }
          }
        }
      }
    }
  }
}

var __onLoadEvents = Array();
function registerOnLoadEvent(event){
    __onLoadEvents.push(event);
}

function lunchEvents(){
    for(i = 0; i < __onLoadEvents.length; i++){
        __onLoadEvents[i]();
    }
}

function nothing(){}
