function setInnerHTML(what, txt)
{     
  //alert('setInnerHTML():: what = ' + what);
  document.getElementById(what).innerHTML = txt;
/*
  if (document.layers) //NS
  {
    document.scbform[what].innerHTML = txt;
  }
  else if (document.all) //IE
  {
    document.all[what].innerHTML = txt;
  }
  else //other browsers
  {
    document.getElementById(what).innerHTML = txt;
  }
*/
}

function setDisable(what, dis)
{     
  //alert('setDisable():: what = ' + what);
  document.getElementById(what).disabled = dis;
}

function setImage(what, vis, iname)
{ 
  //alert('setImage():: what = ' + what);
  document.getElementById(what).style.visibility = vis;  //'visible';
  document.getElementById(what).src = iname;
}

function setVisible(what, vis)
{
  document.getElementById(what).style.visibility = vis;
}

function clearAll()
{
  //alert('clearAll()');
  setInnerHTML('description','');
  setInnerHTML('abutton','');
  setInnerHTML('clicknote','');
  setInnerHTML('mycontent','');
  setInnerHTML('footnote','');
  setImage('scbimage','hidden','images/spacer.gif');
}

function roundVal(val, dec)
{
  var result = Math.round(val*Math.pow(10,dec))/Math.pow(10,dec);
  return result;
}

function pad(number,length)
{
  var str = '' + number;
  while (str.length < length)
    str = '0' +  str;
  return str;
}

String.prototype.pad = function(l, s, t)
{  return s || (s = " "), (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length)
                + 1).join(s)).substr(0, t = !t ? l : t == 1 ? 0 : Math.ceil(l / 2))
                + this + s.substr(0, l - t) : this;
}

function replace(string,text,by)
{
// Replaces text with by in string
  var strLength = string.length, txtLength = text.length;  if ((strLength == 0) || (txtLength == 0)) return string;

  var i = string.indexOf(text);
  if ((!i) && (text != string.substring(0,txtLength))) return string;  if (i == -1) return string;

  var newstr = string.substring(0,i) + by;
  if (i+txtLength < strLength)    newstr += replace(string.substring(i+txtLength,strLength),text,by);
  return newstr;
}

function showWait(vis)
{
  if (vis == 'visible')
    waitflag = true;
  else
    waitflag = false;
  setVisible('wait', vis);
}

