function winH() {
   if (window.innerHeight)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientHeight;
   else
      return null;
}

function winW() {
   if (window.innerWidth) 
      /* NN4 a kompatibilní prohlížeče */
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth) 
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerHeight */
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return null;
}
function odeslatrezcis()
{
	sHodnota1=document.getElementById("rezcis").value;
	if (sHodnota1=='')  {
		alert("Je třeba vyplnit REZERVAČNÍ ČÍSLO !");
		document.getElementById("rezcis").focus();
		return (false);
	}
}
function odeslatcastku()
{
	sHodnota1=document.getElementById("castka").value;
	if (sHodnota1=='')  {
		alert("Je třeba vyplnit ČÁSTKU !");
		document.getElementById("castka").focus();
		return (false);
	}
}
//vymazani zadanych dat formulare
function VymazForm(_form) {
    field=document.getElementById(_form)
    for (i = 0; i < field.length; i++) {
        field[i].checked = false;
        if (field[i].type!="reset" && field[i].type!="submit" && field[i].type!="button")
            field[i].value = "";
    }
}

function kvalita(typ,size) {
var win_size_x=480; //horizontální velikost okna
var win_size_y=130; //vertikální velikost okna
var win_pos_x=(screen.width-win_size_x)/2; //horizontální pozice okna
var win_pos_y=(screen.height-win_size_y)/2; //vertikální velikost okna
window.open("http://"+location.hostname+"/pages/popup-kvalita.html?typ="+typ+"&size="+size,'kvalita','scrollbars=no,resizable=yes,location=no,directories=no,width='

+ win_size_x + ',height=' + win_size_y + ',top=' + win_pos_y + ',left=' + 
win_pos_x );
return false;
}


function selectAktivita(ide) {

var imgId = "act"+ide;
var formId = "a"+ide;

if(document.getElementById(imgId)){

    if(document.forms[0][formId].value > 0)
		{
	    document.getElementById(imgId).style.border = "2px solid rgb(255, 255, 255)";
    	document.forms[0][formId].value = '0';
		}
	else
		{
	    document.getElementById(imgId).style.border = "2px solid rgb(255, 104, 0)";
	    document.forms[0][formId].value = ide;
	}
  }
}

function resetAktivita() {
  var imgId;
  var formId;
  for (var ide=1;ide<=20;ide++) {
    imgId = "act"+ide;
    formId = "a"+ide;
    document.getElementById(imgId).style.border = "2px solid rgb(255, 255, 255)";
    document.forms[0][formId].value = '0';
  }
}

function odroluj(_Kam)
{
	if (document.getElementById(_Kam)!=null)
	{
		document.getElementById(_Kam).scrollIntoView();
	}

}

function jencisla(udalost) {
    var charCode = (udalost.which) ? udalost.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}


function printpreview()
{
  if(document.all) {
/*
    var OLECMDID = 7;
    var PROMPT = 1; // 2 DONTPROMPTUSER
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
*/
    window.print();
  } else {
    window.print();
  }
}


function isEmail(argvalue) {

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(argvalue);
}

function otestujNewsletter(){
	var chyba = "";
	f=document.getElementById("NEWS");

	if (!isEmail(f.newsletter.value)) {chyba="Byl zadán špatný formát emailové adresy pro odběr novine a nabídek.\n\n Pokud máte zájem o odběr novinek a aktuálních nabídek zadejte prosím emeilovou adresu ve správném formátu.";}
	if (chyba!="") {alert(chyba); f.newsletter.focus()}
return (chyba=="");
}

//zobrazeni error okna
function showErrorWin() {
	document.getElementById("errorWin").style.visibility = "visible";
}
//schovani error okna
function hideErrorWin() {
	document.getElementById("errorWin").style.visibility = "hidden";
}


function odesli(f,popis) {
        for(var i=0;i<f.elements.length; i++) {
                var e=f.elements[i];
                if (e.nutno && (e.value=="")) {
                    alert("Je nutno vyplnit všechny údaje označené *");
                    e.focus();
                    return (false);
                }
	}

        var astr=popis+" ze dne "+Date()+"\n\n";
        for(var i=0;i<f.elements.length; i++) {
		var e=f.elements[i];
		if (e.type=="text")
			astr+=e.name+": "+e.value+"\n\n";
		if (e.type=="textarea")
			astr+=e.name+": "+e.value+"\n\n";
		if (e.type=="select-one")
			astr+=e.name+": "+e.options[e.selectedIndex].value+"\n\n";
		if ((e.type=="radio") && e.checked)
			astr+=e.name+": "+e.value+"\n\n";
	   }

  astr+="\n\n";

  f._body.value = astr;
  f._email.value = f.Email.value;
return (true)}

function display_loader() {
if(document.getElementById('loader')){
        var targelem = document.getElementById('loader');
        targelem.style.display='block';
        targelem.style.visibility='visible';
        }
}

function toggle(id,typ,rychle){ //prepinac zobrazeni a buttonu

  if(!typ) typ="";
  var map = typ ;
  var toggle1 = "#toggle"+id;
  var toggle2 = "div.toggle"+id;
  var theClass1 = "button2"+map+"-up";
  var theClass2 = "button2"+map+"-down";
  
  if ( $(toggle2).length ){
    if ( $(toggle1).length ){ 
      if ( $(toggle2).is(':hidden') ){
        $(toggle1).removeClass(theClass2).addClass(theClass1);
        if(typ!="map"){
          $(toggle1).wrapInner("<a href='javascript:void(0);' onclick=\"toggle('"+id+"');\"><span>skrýt</span></a>");
        }
      } else {
        $(toggle1).removeClass(theClass1).addClass(theClass2);
        if(typ!="map"){
          $(toggle1).wrapInner("<a href='javascript:void(0);' onclick=toggle('"+id+"');><span>rozbalit</span></a>");
        }
      }
    }
    if(rychle == null) {
      $(toggle2).toggle("slow");
    } else {
      $(toggle2).toggle();
    }
  }
} 

function otevri_fotogalerii(_co) {
  window.open('http://www.chata.cz/pages/fotogalerie.asp?'+_co,'fotogalerie', 'height=750px, width=970px, top=0px, left=0px, resizable=yes, status=no, toolbar=no,location=no,scrollbars=yes, dependent=yes');
} 
