/* IE tr:hover */

function ieHover() {
  var TRs = document.getElementsByTagName("tr");
    for (var i=0; i<TRs.length; i++) {
      TRs[i].onmouseover = function() {
        this.className += " iehover";
      }
      TRs[i].onmouseout = function() {
        this.className = this.className.replace
        (new RegExp(" iehover\\b"), "");
      }
    }
  }
  if(window.attachEvent) window.attachEvent("onload", ieHover);


/* IE button:active */

function ieHover() {
  var Buttons = document.getElementsByTagName("button");
    for (var i=0; i<Buttons.length; i++) {
      Buttons[i].onmouseover = function() {
        this.className += " iehover";
      }
      Buttons[i].onmouseout = function() {
        this.className = this.className.replace
        (new RegExp(" iehover\\b"), "");
      }
    }
  }
  if(window.attachEvent) window.attachEvent("onload", ieHover);


/* IE button:active */

function ieActive() {
  var Buttons = document.getElementsByTagName("button");
    for (var i=0; i<Buttons.length; i++) {
      Buttons[i].onmousedown = function() {
        this.className += " ieactive";
      }
      Buttons[i].onmouseout = function() {
        this.className = this.className.replace
        (new RegExp(" ieactive\\b"), "");
      }
    }
  }
  if(window.attachEvent) window.attachEvent("onload", ieActive);


/* MULTI UPLOAD */

var f = 0;
function addInput () {
  if (document.all || document.getElementById) {
    var table = document.all ? document.all.formElems :
      document.getElementById('formElems');
    var row = table.insertRow(++f);
    if (document.all) {
      var cell = row.insertCell(0);
      cell.innerHTML =
        '<INPUT TYPE="file" NAME="fileName' + f + '"'
        + ' ONCHANGE="addInput()">';
      cell = row.insertCell(1);
      cell.innerHTML =
        '<INPUT TYPE="button" VALUE="select another file"' +
        ' ID="addButton' + f + '"' +
        ' ONCLICK="addInput();">';
      document.all['addButton' + (f - 1)].outerHTML = '';
    }
    else {
      var cell = row.insertCell(0);
      var input = document.createElement('INPUT');
      input.setAttribute('type', 'button');
      input.id = 'addButton' + f;
      input.value = 'select another file';
      input.onclick = function () { addInput(); };
      cell.appendChild(input);
      cell = row.insertCell(1);
      input = document.createElement('INPUT');
      input.setAttribute('type', 'file');
      input.name = 'fileName' + f;
      input.onchange = function () { addInput(); };
      cell.appendChild(input);
      var oldButton = document.getElementById('addButton' + (f - 1));
      oldButton.parentNode.removeChild(oldButton);
    }
  }
}