var oldDivId;
oldDivId = "";
var tag = "";
var setColor = "#f5b0b0";
var defColor = "#f5b0b0";

function openClose(tg,divId)
{
	if(document.getElementById)
	{
    if (oldDivId == "") {
			document.getElementById(divId).style.display="block";
		    	oldDivId = divId;
			tag = tg;
		} else {
		  	if (oldDivId == divId) {
				document.getElementById(oldDivId).style.display="none";
				oldDivId = "";
			} else {
				document.getElementById(oldDivId).style.display="none";
				document.getElementById(divId).style.display="block";
			    	oldDivId = divId;
				tag = tg;
			}
		}
	}
	else if(document.all)
	{
		if (oldDivId == "") {
			document.all[divId].style.display="block";
			tag = tg;
		    	oldDivId = divId;
		} else {
		  	if (oldDivId == divId) {
				document.all[oldDivId].style.display="none";
				oldDivId = "";
			} else {
				document.all[oldDivId].style.display="none";
				document.all[divId].style.display="block";
			    	oldDivId = divId;
				tag = tg;
			}
		}
	}
	else
	{

	}
}

function popup(url, width, height)
{
      var options = "toolbar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+";"
      popupWindow=window.open(url,"_blank",options);
}

function submitForm(page,gallery)
{
  var target = "index.php?web=1200&gal="+gallery+"&page="+page+"";
  document.chpage.action = target;
  document.chpage.submit();
}

function anketa(val)
{
  kukiny = document.cookie.split("; ");
  for (i in kukiny){
    jednaKukina = kukiny[i].split("=");
    if (jednaKukina[0] == "chemiciAnketa") volba=jednaKukina[1];
  }
  if (typeof(volba) == "undefined") {
    document.anketatop.poll.value=val;
    document.cookie = "chemiciAnketa=ok" ;
    document.anketatop.submit();
  }
  else {
    alert("Ľutujem, ale už ste hlasovali.");
  }
}
function newPage(page)
{
  old = document.chpage.action;
  var target = old+"&page="+page+"";
  document.chpage.action = target;
  document.chpage.submit();
}
function sendform(vala,valb)
{
  document.detailForm.akcia.value = vala;
  document.detailForm.uprava.value = valb;
  document.detailForm.submit();
}

//funkcia pre JS zapis flash objektu. Musi byt externe inak to v IE neslo
function writeFlash(text)
{
   document.write(text);
}
