function openWindow(target) {
	myWindow = window.open(target,'info','status=no,toolbar=no,scrollbars=yes,location=no,menubar=no,resizable=yes,width=550,height=460,top=0,left=0');
	myWindow.focus();
	return false;
}
function imagePopup(title,src,x,y) {
	var image=window.open('','popup','width='+x+',height='+y+',top=100,left=100,resizable=yes,scrollbars=no');
	image.document.write('<html>\n<head>\n<title>'+title+'</title>\n</head>');
	image.document.write('<body style="margin:0; padding:0;">\n');
	image.document.write('<a href="#" onclick="window.close()">');
	image.document.write('<img src="'+src+'" width="'+x+'" height="'+y+'" border="0">');
	image.document.write('</a>\n');
	image.document.write('</body>\n</html>\n');
	image.document.close();
	return true;
}

function isObject(targetID) {
  var isFound = false;
  var el = $(targetID);
  if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED"))
    isFound = true;
  return isFound;
}

function replaceSwfWithEmptyDiv(targetID) {
  var el = $(targetID);
  if(el){
    var div = document.createElement("div");
    el.parentNode.insertBefore(div, el);
    swfobject.removeSWF(targetID);
    div.setAttribute("id", targetID);
  }
}

function loadSWF(elm, targetID) {
  var url = elm.href;
  elm.blur();
  if(isObject(targetID))
    replaceSwfWithEmptyDiv(targetID);
  if (swfobject.hasFlashPlayerVersion("7")) {
    var attributes = { data: url, width:"540", height:"470" };
    var params = {};
    var obj = swfobject.createSWF(attributes, params, targetID);
  }
  return false;
}

function testCheck(elm, max) {
  var j = 0;
  var f = elm.form;
  var elms = f.elements;
  if (elm.checked) {
    for (var i = 0; i < elms.length; i++) {
      e = elms[i];
      if (e.type == 'checkbox' && e.checked)
        j++
    }
    if (j > max) {
      elm.checked = false;
      elm.blur();
      alert("Překročil(a) jste maximální počet položek k hlasování");
    }
  }
}
