function getElementsByClassName(oClassNames, strTagName, oElm){
    if (oElm == null)
        oElm = document;
    if (strTagName == null)
        strTagName = '*';
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
  
    var arrReturnElements = new Array();
    var arrRegExpClassNames = new Array();
    if(typeof oClassNames == "object"){
        for(var i = 0; i < oClassNames.length; i++){
            arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
        }
    }
    else{
        arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
    }
    var oElement;
    var bMatchesAll;
    for (var j = 0; j < arrElements.length; j++){
        oElement = arrElements[j];
        bMatchesAll = true;
        for(var k = 0; k < arrRegExpClassNames.length; k++){
            if(!arrRegExpClassNames[k].test(oElement.className)){
                bMatchesAll = false;
                break;                      
            }
        }
        if (bMatchesAll){
            arrReturnElements.push(oElement);
        }
    }
    return (arrReturnElements)
}
// pro ie5 nutno pridat podporu metody push pro pole
if(typeof Array.prototype.push != "function"){
    Array.prototype.push = ArrayPush;
    function ArrayPush(value){
        this[this.length] = value;
    }
}

function handleInputClicked(inputObj, hideInputFakeText) {
	if(hideInputFakeText)
		inputObj.style.backgroundImage = 'none';
}

var searchClicked2 = false;
function handleSearchClicked2(input) {
	if(!searchClicked2)
		input.value = '';
	searchClicked2 = true;
}

var searchClicked3 = false;
function handleSearchClicked3(input) {
	if(!searchClicked3)
		input.style.background = '#f1f1f1';
	searchClicked3 = true;
}

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
	

var org_onload = window.onload;
window.onload = function() {
	if (typeof org_onload == "function") org_onload();
	for(var z = 0, f = document.getElementsByTagName('form').length; z < f; z++) {
		document.getElementsByTagName('form').item(z).setAttribute('autocomplete', 'off');
	}
	$$('.frm').each(function(el){
    if ($F(el)!='') {
      handleInputClicked(el,true);
    }
  });
	try {
		//document.getElementById('nlemail').value = "";
	} catch (error) {}
};

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, false);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}	
	
function displayOverlay() {
  var container = document.getElementById('containerSub');
  var cW = container.clientWidth;
  var cH = container.clientHeight;
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var overlay = document.getElementById('overlay');
  var overlayInner = document.getElementById('overlayInner');
  overlay.style.display = "block";
  document.getElementsByTagName("body")[0].style.overflow = "hidden";
  overlay.style.width = overlayInner.style.width = myWidth + 'px';
  overlay.style.height = overlayInner.style.height = myHeight + 'px';

  var mtop = ((myHeight - 600)/2);
  mtop = mtop < 0 ? 0 : mtop;

  document.getElementById("overlay-cont").style.marginTop = mtop + "px";

}

function closeOverlay() {
  var overlay = document.getElementById('overlay');
  overlay.style.display = "none";
  document.getElementsByTagName("body")[0].style.overflow = "";
}
/*
function hideOverlay() {
  try {
    document.getElementById("obanner").onclick = function(e) {
    if(!e) var e = window.event;

          if (typeof e.bubbles == "undefined") {  // Internet Exlorer
            e.cancelBubble = true;
          } else {
             if (e.bubbles) {
               e.stopPropagation ();
            }
          }*/
      /*
      if(!e) var e = window.event;

      //e.cancelBubble is supported by IE - this will kill the bubbling process.
      e.cancelBubble = true;
      e.returnValue = false;

      //e.stopPropagation works only in Firefox.
      if (e.stopPropagation) {
        e.stopPropagation();
        e.preventDefault();
      }
      */
      //return false;
 /*   };
    document.getElementById("overlay").onclick = function() {
      closeOverlay();
    };
  } catch (error) {}
}

addEvent(window,"load",hideOverlay);*/


function hideOverlay() {
  
  
  

  

    document.getElementById("overlay").onclick = function(ev) {
     
      closeOverlay();
    };
    document.getElementById("obanner").onclick = function(ev) {
      
      closeOverlay();
    };
    document.getElementById("flash").onclick = function(ev) {
      
      delejNic();
    };

}

var delejNic = function(e){
   
   if (!e) var e = window.event;
   if(e){ 
     e.cancelBubble = true;
   	 if (e.stopPropagation) e.stopPropagation();
	 }

} 



window.onload=function(){ 
  if (document.getElementById("overlay")) {
    var e = window.event;
    if (e){
      e.cancelBubble = true;
      hideOverlay();
    } else {
      
      document.getElementById("flash").addEventListener('click',delejNic,true);
      document.getElementById("obanner").addEventListener('click',closeOverlay,false);
      document.getElementById("overlay").addEventListener('click',closeOverlay,false)

      
    }
    
  }
} 

