/* Use Object Detection to detect IE6 */
var ie6 = document.uniqueID      /*IE*/
       && document.compatMode    /*>=IE6*/ 
       && !window.XMLHttpRequest /*<=IE6*/
       && document.execCommand;
try {
  if(!!ie6) {
    ie6("BackgroundImageCache", false, true) /* = IE6 only */
  }
} catch(e) {};


// First active history item: Default text
var activeHistoryItem = 'history-default';

// Active item in continent list
var activeContinent = null;
var activeContinentHotspot = null;



// Load ULI on every page
window.onload = function() { showLine() };



/**
 * Displays the ULI between the top level navigation and subnavigation
 */
function showLine()
{
  var header = document.getElementById("header");
  var mainNav = document.getElementById("mainNavigation");
  var leftNav = document.getElementById("leftNavigation");

  // Exit if the left navigation is empty
  if(leftNav==null || header==null || mainNav==null) return false; // проверка
    if (leftNav.getElementsByTagName("a").length == 0) return false; 

  // Calculate the height of the upper part
  try
  {
    for(i = 0; (mainNav.getElementsByTagName("li")[i].className != "active") && (i < mainNav.getElementsByTagName("li").length);i++) {}
  } catch(e) {
    //return false;
  }
  var curNav = mainNav.getElementsByTagName("li")[i];
  var topLineHeight = header.offsetHeight - curNav.parentNode.offsetTop - curNav.offsetTop - (curNav.offsetHeight/2);

  var topLine = document.createElement("div");
  topLine.id = 'navigationLine';
  topLine.style.height = topLineHeight + 'px'; //document.getElementById("header").clientHeight;
  header.appendChild(topLine);

  // Create the upper part
  var bottomLine = document.createElement("div");
  bottomLine.id = 'navigationLineBottom';
  bottomLine.style.top = header.offsetHeight + 'px';

  // Create the lower part
  var leftNavHeadline = leftNav.getElementsByTagName("h1")[0];
  bottomLineHeight = leftNav.offsetTop - header.offsetHeight + (leftNavHeadline.offsetHeight/2);
  bottomLine.style.height = bottomLineHeight + 'px'; //document.getElementById("header").clientHeight;
  document.body.appendChild(bottomLine);
 
}

