
function showInline(ID) {
  document.getElementById(ID).style.display = 'inline';
}
function showBlock(ID) {
  document.getElementById(ID).style.display = 'block';
}
function hideElement(ID) {
  document.getElementById(ID).style.display = 'none';
}
function focusElement(ID) {
  document.getElementById(ID).focus();
}

// http://www.sitepoint.com/article/standards-compliant-world
function externalLinks()
{ 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++)
 { 
   var anchor = anchors[i];
   if (anchor.getAttribute("href"))
   {
     if (anchor.getAttribute("class") == "targetblank" || anchor.getAttribute("class") == "blank" || anchor.getAttribute("class") == "new")
     {
     anchor.target = "_blank";
     }
   }
 }
} 

function toggleElement(id,display)
{
 var needle;
 
 if(typeof(id) != 'object')
 {
   needle = new getObj(id);
 }
 else
 {
   needle = id;
 }
 
 if (typeof(display) == 'undefined')
 {
   display = needle.style.display == '' ? 'none' : '';
 }
 
 needle.style.display = display;
 
 // HUD refresh hack
 if (document.getElementById('helpUID'))
 {
   helpID = document.getElementById('helpUID').innerHTML;
   RexHELP(helpID);
 }
 
 //return display;
}

function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
    if(this.obj)
      this.style = this.obj.style;
  }
  else if (document.all)
  {
    this.obj = document.all[name];
    if(this.obj)
      this.style = this.obj.style;
  }
  else if (document.layers)
  {
    this.obj = document.layers[name];
    if(this.obj)
      this.style = this.obj;
  }
}

function init_basics()
{
  externalLinks();
}

// onload
window.onload = init_basics;

