var isDOM = (document.getElementById);
var isIE4 = (document.all && !isDOM);
var isNS4 = (document.layers);
var isDyn = (isDOM || isIE4 || isNS4);

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
return null;
}

function getName(name) {
if (isDOM) return document.getElementsByTagName(name);
return null;
}

function getVP(x) {
if (typeof x == 'undefined') x = 'vp';
return document.forms[x];
}

function r2(x, desMist) {
x = parseFloat(x);
return Math.round(x * Math.pow(10, desMist)) / Math.pow(10, desMist);
}

function nf(x) {
x = parseFloat(x.replace(/,/g, ".").replace(/ /g, ''));
return isNaN(x) ? 0 : x;
}

function showNum(x, hr) {
return (x == Infinity || x == -Infinity || isNaN(x)) ? '-' : (hr ? hr_number(x) : x);
}

function enAb(theObject) {
theObject.disabled = false;
if (theObject.nodeName == 'INPUT' && theObject.type == 'text' || theObject.nodeName == 'SELECT' || theObject.nodeName == 'TEXTAREA') theObject.style.backgroundColor = '#fff';
}

function disAb(theObject) {
theObject.disabled = true;
if (theObject.nodeName == 'INPUT' && theObject.type == 'text' || theObject.nodeName == 'SELECT' || theObject.nodeName == 'TEXTAREA') theObject.style.backgroundColor = '#ddd';
}

function itemIndex(r) {
for (var i = 0; i < r.length; i++) { if (r[i].checked == true) {return i} }
return -1;
}

function createSelect(s, p, d) {
s.length = 0;
for (var i = 0; i < p.length; i++) { s[i] = new Option(p[i]); }
s.selectedIndex = d;
}

function delOptions(theList,statuses) {
  var i = 0;
  while (i < theList.length) {
    if (in_array(theList[i].value,statuses)) theList.options[i]=null; else i++;
  }
}

function htmlShow(obj,displ) {
switch (displ) {
  case 'inline':
    obj.style.display='inline';
    break;
  case 'block':
  default:
    obj.style.display='block';
}
}

function htmlHide(obj) {
obj.style.display='none';
}
