﻿
function showImg(id, width, height)
{
	if (width == 0)
	{		
		showImg2(id);		
	}
	else
	{

    width += 50;
    height+= 50;
    
    if(height + 50 > screen.height)
        height= screen.height- 200;

    if(width + 50 > screen.width)
        width = screen.width - 100;
        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;           
    
    var a = window.open("imgDetail.aspx?imgid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
    }
}


function showImg2(id)
{
	width = 200;
	height = 300;

    width += 50;
    height+= 50;
    
    if(height + 50 > screen.height)
        height= screen.height- 200;

    if(width + 50 > screen.width)
        width = screen.width - 100;
        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;           
    
    var a = window.open("imgDetail.aspx?res=true&imgid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
}



function initFilter()
{
    try
    {
	if($('madv').value == "0")
	{
        $('filtrAdvance').style.display = "none";
        $('fArrow').innerHTML = ">>";
    }
    }
    catch(e)
    {}
}


function toggleFilter()
{
    try {
    s = $("madv");
    fa= $("filtrAdvance");
    a = $('fArrow');
    
	if	(s.value == "1") {
		fa.style.display = "none";
		s.value = "0";
		a.innerHTML = ">>";
	}
	else
	{
		fa.style.display = "block";
		s.value = "1";
		a.innerHTML = "<<";
	}
	} catch(e){}
}

function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}




function checkform(items) {
// check the form checkboxes by form id, if is at least 1 checkbox checked

  var selecteditems;
  selecteditems = 0;

var formitem = document.getElementById(items);

  for (var i = 0;  i < formitem.elements.length; i++)
{
    if (formitem.elements[i].type == 'checkbox'){
	   if ( formitem.elements[i].checked == true ) {	selecteditems++; }
    }  
}

if (selecteditems==0) { alert("Vyberte prosím alespoň jednu odpověď!"); return false; }
else { return true;}

}