
// balmenu csuko-nyito
function bmShow(item) {
  group = "balMenuSub" + item;
  obj = document.getElementById(group);
  if(obj.style.display != "block") {
    dsp = "block";
    setCookie("menuFold" + item, "1");
  } else {
    dsp = "none";
    setCookie("menuFold" + item, "0");
  }
  obj.style.display = dsp;
}

// a civil szervezet regisztraciojahoz
function showHideCivilForm(item) {
  t1 = document.getElementById("civilTabla1");
  t2 = document.getElementById("civilTabla2");
  t1.style.display = "none";
  t2.style.display = "none";

  group = "civilTabla" + item;
  obj = document.getElementById(group);
  dsp = (obj.style.display != "block") ? "block" : "none";
  obj.style.display = dsp;
}

function getCookie(name) {
// return "null" if cookie doesn't exists, else return the value of the cookie
  var search = name + "=";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1){
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      return  unescape(document.cookie.substring(offset, end));
    } else return null;

  }
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "; path=/") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function openCenteredWindow(url, height, width, name, parms) {
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
