function showElement(id) {
        var element = document.getElementById(id);

        if (element) {
                element.style.visibility = 'visible';
        }
}

function hideElement(id) {
        var element = document.getElementById(id);

        if (element) {
                element.style.visibility = 'hidden';
        }
}

/**
 * @returns true when IE is detected, otherwise returns false.
 */
function isIE()
{
        if (navigator.appName.indexOf("Explorer") == -1) {
                return false;
        }
        else {
                return true;
        }
}

function getPos(el) 
{
       var r = { x: el.offsetLeft, y: el.offsetTop, w: el.offsetWidth, h: el.offsetHeight};

       if (el.offsetParent) {
               var tmp = getPos(el.offsetParent);
               r.x += tmp.x;
               r.y += tmp.y;
       }
       return r;
};


/**
 * @redirects page to given url
 */
function redir(path)
{
    document.location.href = path;
}

/* Features Table 
	----------------------------------------------------------
 */
function toggleFeatureTable(id) 
{
	var element = document.getElementById(id);
	if (element) {
		if (element.style.display == 'block') {
			element.style.display = 'none';
		} else {
			element.style.display = 'block';
		}
	}
}

function popupFeatureTable(elm,popup)
{
   var popup  = document.getElementById(popup);
   if(popup.style.display == 'block') return;
   var elmPos = getPos(elm);

   // popup position
   popup.style.marginLeft = 0 +"px";
   popup.style.display    = 'block';
   popup.style.top        = (elmPos.y - popup.offsetHeight + 9) +"px";
    
   if (typeof elm.onmouseout !== 'function'){
       elm.onmouseout = function(){
          popup.style.display = 'none';
       }
   }
}
