// This highlights a row in a datatable when the user mouseovers it.
function rowHighlight(table) {
    var i=0;
    while(document.getElementById(table) !== null) {
        var table = document.getElementById(table);
        var rows = table.getElementsByTagName("tr");
        for(j=1; j < rows.length; j++){
           rows[j].onmouseover = function() { this.className = "highlightRow"; };
           rows[j].onmouseout = function() { this.className = ""; };
        }
        i++;
    }
}

// This gets the background-color of an element
function getStyleBackgroundColor(el) {
  el = document.getElementById(el);
  if(el.currentStyle) {
    return el.currentStyle.backgroundColor;
  }
  if(document.defaultView) {
    return document.defaultView.getComputedStyle(el, '').getPropertyValue("background-color");
  }
  return "Don\'t know how to get color";
}

// This gets the foreground color of an element
function getStyleColor(el){
  el = document.getElementById(el);
  if(el.currentStyle) {
    return el.currentStyle.backgroundColor;
  }
  if(document.defaultView) {
    return document.defaultView.getComputedStyle(el, '').getPropertyValue("background-color");
  }
  return "Don\'t know how to get color";
}

function removeCharacters(element) {

  searchValue = element.value.replace(/\D/g,"");
  element.value = searchValue;
}

function removeSpecialCharacters(element) {
  if(element.value.indexOf("\"") > -1 || element.value.indexOf("\\") > -1) {
    alert("The following characters are not allowed: \" \\ \{ \}");
  }
  searchValue = element.value.replace(/\"/g, "");
  searchValue = searchValue.replace(/\\/g, "");
  element.value = searchValue;
}
