// Check Browser

var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
var ie5 = false;

if (ie4) {
  if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {
    ie5 = true;
  }
  if (ns6) {
    ns6 = false;
  }
}


// Init document.getElemenuById for browsers that do not support it

if(!document.getElementById){
  if(document.all)
    document.getElementById=function() {
      if(typeof document.all[arguments[0]]!="undefined")
        return document.all[arguments[0]]
      else
        return null
    }
  else if(document.layers)
    document.getElementById=function() {
      if(typeof document[arguments[0]]!="undefined")
        return document[arguments[0]]
      else
        return null
    }
}

//-----------------------------------------
// Functions
//-----------------------------------------

function ElemById(ID) {
  return document.getElementById(ID);
}

function ShowObject(obj) {
  if (ns4) obj.visibility = "show";
  else if (ie4) obj.visibility = "visible";
  else if (ns6) obj.style.visibility = "visible";
}

function ShowObjectId(objid) {
  var obj=document.getElementById(objid);
  if (obj!=null) ShowObject(obj);
}

function HideObject(obj) {
  if (ns4) obj.visibility = "hide";
  else if (ie4) obj.visibility = "hidden";
  else if (ns6) obj.style.visibility = "hidden";
}

function HideObjectId(objid) {
  var obj=document.getElementById(objid);
  if (obj!=null) HideObject(obj);
}


function ShowBlock(blck) {
  blck.style.display="block";
}

function ShowBlockId(blckid) {
  var blck=document.getElementById(blckid);
  if (blck!=null) ShowBlock(blck);
}

function HideBlock(blck) {
  blck.style.display="none";
}

function HideBlockId(blckid) {
  var blck=document.getElementById(blckid);
  if (blck!=null) HideBlock(blck);
}

function ReplaceHTMLContent(blckid,HTMLContent) {
  var blck=document.getElementById(blckid);
  if (blck!=null) {
    blck.innerHTML=HTMLContent;
  }
}


function LocalToInternetURL(FilePath) {
  return FilePath.replace(/\\/g,'/');
}

function IncludeBackSlash(FilePath) {
  if (FilePath.length>0 && FilePath.charAt(FilePath.length-1)!='/')
    return FilePath+'/';
  else return FilePath;
}

function ExcludeFrontSlash(FilePath) {
  if (FilePath.length>0 && FilePath.charAt(0)=='/')
    return FilePath.substr(1);
  else return FilePath;
}
