function kontrola_formulare(typ) {
  nevyplneno_vse = 0;
  prvni = '';
  
  if (typ == 'vzkaz') {
    text = 'Vzkaz nemůže být vložen, protože nebyla vyplněna tato pole:' + "\n";
  }
  else if (typ == 'objednavka') {
    text = 'Objednávka nemůže být odeslána, protože nebyla vyplněna tato pole:' + "\n";
  }		 	 
	
  for (var i = 1; i < kontrola_formulare.arguments.length; i++) {
    prvek = kontrola_formulare.arguments[i];
    i++;
    jmeno = kontrola_formulare.arguments[i];
			
    if (document.getElementById(prvek).value == '') {
      nevyplneno_vse = 1;

      if (prvni == '') {
        prvni = prvek;
      }

      text += jmeno + "\n";
    }	
  }

  if (nevyplneno_vse) {
    alert(text);
    document.getElementById(prvni).focus();
    return false;
  }

  return true;
}

// skryva banner
function skryj_banner() {
  document.getElementById('banner').style.display = 'none';
}

// roztahuje stranku na vysku prohlizece
function nastav_velikost() {
  if (_window_height() >= document.body.scrollHeight) {
    vyska = _window_height() - 447;

    document.getElementById('main').style.height = vyska + 'px';
  }
}

// vraci vysku okna
function _window_height() {
  if (window.innerHeight) {
    return window.innerHeight;
  }
	else if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientHeight) {
		return document.body.clientHeight;
	}
	else {
    return null;
  }
}

// vraci sirku okna
function _window_width() {
  if (window.innerWidth) {
    return window.innerWidth;
  }
	else if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
  }
	else if (document.body && document.body.clientWidth) {
		return document.body.clientWidth;
	}
	else {
    return null;
  }
}
