//var DHTML = (document.GetElementById || document.all || document.layers);

function getObj(name)
{
  if (document.getElementById)
  {
    if ( document.getElementById(name) )
    {
      this.obj = document.getElementById(name);
      this.style = document.getElementById(name).style;
    }
    else
    {
      this.obj = false;
    }
  }
  else if (document.all)
  {
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
  else if (document.layers)
  {
    this.obj = document.layers[name];
    this.style = document.layers[name];
  }
}
 
function loadCurTime(secs)
{
  var timeDiv = new getObj('curtime');
  var tmpDate = new Date(secs);
  var str = 'Current server time is: ';
  str = str + tmpDate.getFullYear() + '-';
  if ( tmpDate.getMonth()<9 )
    str = str + '0';
  str = str + (tmpDate.getMonth() +1) + '-';
  if ( tmpDate.getDate()<10 )
    str = str + '0';
  str = str + tmpDate.getDate() + ' ';
  if ( tmpDate.getHours()<10 )
    str = str + '0';
  str = str + tmpDate.getHours() + ':';
  if ( tmpDate.getMinutes()<10 )
    str = str + '0';
  str = str + tmpDate.getMinutes();
  timeDiv.obj.innerHTML=str;

  var remaindersecs = (60-tmpDate.getSeconds())*1000;

  if (remaindersecs<1000)
    remaindersecs=60000;
  secs = secs + remaindersecs;
  self.setTimeout("loadCurTime(" + secs + ")",remaindersecs);

}


function handlesXmlHttp()
{
  var ua = navigator.userAgent.toLowerCase();
  
  if (ua.indexOf("safari") > -1 )
  {
    var vindex = ua.indexOf("applewebkit/");
    var vindex2 = ua.indexOf(" ",vindex);
    var v = ua.substring(vindex+12,vindex2);
    return (v>=124);
  }
  return true;
}


function openHelpWin(hid)
{

  window.open('viewhelp.php?hid=' + hid,'HELPWIN','resizable=0,scrollbars=0,height=335,width=420');

}

// Return true if value is a number
function isNumber(value)
{
  if (value=="") return false;

  var d = parseInt(value);
  if (!isNaN(d)) return true; else return false;		

}

function trim(str)
{
  str = str.replace(/^\s*|\s*$/g,"");
  return str;
}

