hotova=new Image(); hotova.src="img/hotova-jidla-bw.jpg";

	
	
/*
	for (a=1; a<=31; a++) {
		"s"+a=new Image(); "s"+a.src="s"+a+".gif";		
	}

	*/
function zamen(nazev_obr, novy_obr) 
{
	document.images[nazev_obr].src=novy_obr;
	//return novy_obr;
}
function vystraha(string) {
    window.alert(string);
}

function confirmDelete(message, redirect) {

	if(window.confirm(message)) {

		window.location=redirect;
/*		return false;*/
		return false;
		
	} else {
		return false;
	}
}
//AJAX
var xmlHttp;

function vytvorXMLHttpRequest() {
  if (window.ActiveXObject) {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp = new XMLHttpRequest();
  }
}

function zahajPozadavek(id) {
  vytvorXMLHttpRequest();
  xmlHttp.onreadystatechange = zpracujZmenuStavu;
  xmlHttp.open("GET", "ajaxgallerygenerator.php?img=" + id, true);
  xmlHttp.send(null);
}

function validForm(fieldName, value) {
  vytvorXMLHttpRequest();
  if(fieldName == "email") {
  	xmlHttp.onreadystatechange = zpracujStavKontaktEmail;
  }  
  if(fieldName == "subject") {
  	xmlHttp.onreadystatechange = zpracujStavKontaktSubject;
  }
  if(fieldName == "textfield") {
  	xmlHttp.onreadystatechange = zpracujStavKontaktTextfield;
  }
  
  xmlHttp.open("GET", "ajaxgallerygenerator.php?action=kontakt&" + fieldName + "=" + value, true);
  xmlHttp.send(null);
}

function zpracujStavKontaktEmail() {
  if(xmlHttp.readyState == 4) {
    if(xmlHttp.status == 200) {
      document.getElementById("ajaxemail").innerHTML = xmlHttp.responseText;
    }
  }
}
function zpracujStavKontaktSubject() {
  if(xmlHttp.readyState == 4) {
    if(xmlHttp.status == 200) {
      document.getElementById("ajaxsubject").innerHTML = xmlHttp.responseText;
    }
  }
}
function zpracujStavKontaktTextfield() {
  if(xmlHttp.readyState == 4) {
    if(xmlHttp.status == 200) {
      document.getElementById("ajaxtextfield").innerHTML = xmlHttp.responseText;
    }
  }
}

function zpracujZmenuStavu() {
  if(xmlHttp.readyState == 4) {
    if(xmlHttp.status == 200) {
      document.getElementById("ajaxgallery").innerHTML = xmlHttp.responseText;
    }
  }
}



function popUpProps(obj)
{
	subwin=window.open("","","height=700,width=550,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no");
    	subwin.document.write('<html><head></head>\n');
    	subwin.document.write('<body>'+printProps(obj, "obj")+'</body>\n');
    	subwin.document.write('</html>\n');
	subwin.focus();
}

function popUpImageKill()
{
   if (typeof(subwin)=='undefined')
    return;
   if (typeof(subwin.closed)=='undefined')
    return;
   if (subwin.closed==true)
    return;
   subwin.close();
}

function popUpImage(anch, width, height)
{
	var targetUrl = anch.href;
	var title = anch.firstChild.alt;
	popUpImageKill();
 //  	popUpProps(subwin);return false;

   	swleft  = Math.round((screen.width - width)/2);
   	swtop   = Math.round((screen.height - height)/3);

	subwin=window.open("","","height="+height+",width="+width+", left="+swleft+", top="+swtop+", toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no");
    	subwin.document.write('<html><head><title>'+title+'</title><style>body {background: #000; margin: 0px; padding: 0px; width:'+width+'; height:'+height+'}</style></head>\n');
    	subwin.document.write('<body><img width="'+width+'" height="'+height+'" src="'+targetUrl+'" onclick="window.close();" /></body>\n');
    	subwin.document.write('</html>\n');

	subwin.focus();
}