
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();
}

// a javascript "sleep" function
// gap specifies the sleep time in miliseconds
function delay(gap){
	var then,now;
	then=new Date().getTime();
	now=then;
	while((now-then)<gap) {
		now=new Date().getTime();
	}
}

// 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") == "blank")       || 
              (anchor.getAttribute("class") == "targetblank") || 
              (anchor.getAttribute("rel")   == "external")        )
        {
         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;
   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 initbasics()
{
  externalLinks();
}

window.onload = initbasics;
