var timeOn = null;

function chVisibility(id,vis) {
  if (vis == 0)  {
    timeOn = setTimeout("chVisibilityAll()", 400);
  } else {
    clearTimeout(timeOn);
    chVisibilityAll();
    dom.gEl(id).style.visibility='visible';
  }
}

function chVisibilityAll() {
  dom.gEl('projects').style.visibility='hidden';
  dom.gEl('sort').style.visibility='hidden';
  dom.gEl('news').style.visibility='hidden';
  dom.gEl('contact').style.visibility='hidden';
  dom.gEl('team').style.visibility='hidden';
}


function openWindow(url){
  var winWidth = screen.width;
  var winHeight = '550px';
  popWin = window.open(url,'popup','toolbar=no,directories=no,menubar=no,status=yes,scrollbars=yes,resizable=no,width='+winWidth+',height='+winHeight+',location=no'); 
  popWin.focus();
}

function togglePr() {
  var p = document.getElementById('projects');
  p.style.display = (p.style.display == 'none') ? '': 'none';
  return true;
}

function resizeWindow() {
//  var winHeight = (typeof( window.innerWidth ) == 'number') ? window.innerHeight : document.body.clientHeight;
  var winHeight = document.body.clientHeight;

  var elem = document.getElementById('projects');
  elem.style.height = winHeight - 20 + "px";

  var elem = document.getElementById('okno');
  elem.style.height = winHeight - 20 + "px";
  elem.style.width = "auto";
}

function showThumbnail(elem, obr, popis) {
  elem.style.cursor = 'pointer';
  var nahled = document.getElementById('nahled');
  var popisek = document.getElementById('popisek');
  var thumbnail = document.getElementById('thumbnail');
  var loaded = false;

  nahled.src = obr;
//  nahled.alt = popis;
  nahled.alt = '';
  nahled.onload = function() {
    thumbnail.style.left = '';
    thumbnail.style.bottom = '';
    var left = elem.style.left.substring(0,elem.style.left.indexOf('px'))*1;
    thumbnail.style.left = left + 30 + 'px';
    thumbnail.style.top = elem.style.top;
    popisek.innerHTML = popis;
    thumbnail.style.visibility = 'visible';
    nahled.onload = function() { }
  }

}

function hideThumbnail() {
  var thumbnail = document.getElementById('thumbnail');

  thumbnail.style.visibility = 'hidden';
  thumbnail.style.left = '0px';
  thumbnail.style.top = '0px';
}

//document.body.oncontextmenu = function() { return false; }