// check browsers
var op = /opera/i.test(navigator.userAgent);
var ie = !op && /msie/i.test(navigator.userAgent);	     
var mz = !op && /mozilla\/5/i.test(navigator.userAgent); 
// add function getElementById to IE4
if (ie && (document.getElementById == null)) {
  document.getElementById = function( sId ) {
    return document.all[ sId ];
  };
}

function setCookie(name, value, days ) {
  var exp = null;
  if (days != null) {
    exp = new Date();
    exp.setTime( exp.getTime() + (1000 * 60 * 24 * days));
  }
   document.cookie = name + "=" + escape(value) + "; path=/" +
    ((exp == null) ? "" : "; expires=" + exp.toGMTString());
}

function loadFile( fileurl ) {
  if (ie) {
    var myXMLHTTPRequest = new ActiveXObject("msxml2.xmlhttp"); 
  } else {
    var myXMLHTTPRequest = new XMLHttpRequest();
  }
  if (myXMLHTTPRequest != null) {
    myXMLHTTPRequest.open("GET", fileurl, false);
    myXMLHTTPRequest.send(null);
    return myXMLHTTPRequest.responseText;
  } else return "";
}
function buildEmailAddress( who, server ) {
  if ((server == null) || (server == "")) server = "fox.com.pl";
  if (who != "") window.location = "mailto:" + who + "@" + server; 
  return false;
}

function closeInfobar() {
  if ( document.getElementById("infobar") ) {
    var infobar = document.getElementById("infobar")
    infobar.style.display = "none";
    setCookie("infobar","hide",30);
  }
}
var block = false;
function closeHighlight( isWhite, isBlock ) {
  if ((!block || isBlock) && ( document.getElementById("divclose") ) ) {
    block = isBlock && !isWhite;
    var divclose = document.getElementById("divclose");
    if (divclose == null) exit;
    if (isWhite) {
      divclose.style.background = "url(/img/close_white.gif)";
    } else {
      divclose.style.background = "url(/img/close_black.gif)"; 
    }
  }
}

activateMenu = function(nav) {
  if (document.all && document.getElementById(nav) && document.getElementById(nav).currentStyle) {
    var navroot = document.getElementById(nav)
    var lis=navroot.getElementsByTagName("LI");
    for (i=0; i<lis.length; i++) {
      if(lis[i].lastChild.tagName=="UL") {
        lis[i].onmouseover=function() { this.lastChild.style.display="block"; }
        lis[i].onmouseout=function() { this.lastChild.style.display="none"; }
      }
    }
  }
}
window.onload = function(){
    activateMenu('nav');
    activateMenu('lnav');
    activateMenu('lang');
}