
function kk_hiba(a, b, c) {
  return true;
}

window.onerror = kk_hiba;

function myfocus(w) {
  for (var f = 0; f < w.document.forms.length; f++) {
	for (var i = 0; i < w.document.forms[f].length; i++) {
  	  if (((w.document.forms[f].elements[i].type == "text") || (w.document.forms[f].elements[i].type == "password") || (w.document.forms[f].elements[i].type == "textarea") || (w.document.forms[f].elements[i].type == "file") || (w.document.forms[f].elements[i].type == "select-one")) && (w.document.forms[f].elements[i].name != "fcFOHirlevelEmail")) {
    	w.document.forms[f].elements[i].focus();
    	return 1;
      }
	}
  }
  return 0;
}

function proper(obj) {
  var r = t = s = f = "";
  var c = eval(obj);
  if (c.indexOf("-") > -1) {
    t = c.split("-");
    s = "-";
  } else {
    t = c.split(" ");
    s = " ";
  }
  for (var i = 0; i < t.length; i++) {
    c = t[i];
    c = c.toLowerCase();
    f = c.substring(0,1);
    c = f.toUpperCase() + c.substring(1, c.length);
    r = r + ((r) ? s : "") + c;
  }
  eval(obj + "=\'" + r + "\'");
}

function validnum(obj, tip) {
  var c = eval(obj);
  var ok = "0123456789";
  if (tip) {
	ok += ".";
  }
  var r = "";
  for (var i = 0; i < c.length; i++) {
	r += (ok.indexOf(c.substr(i,1)) == -1) ? "" : c.substr(i,1);
  }
  eval(obj + "=\'" + r + "\'");
}

function validemail(obj) {
  var c = eval(obj);
  var ok = "0123456789qwertzuiopasdfghjklyxcvbnm@_-.";
  var r = "";
  for (var i = 0; i < c.length; i++) {
	r += (ok.indexOf(c.substr(i,1)) == -1) ? "" : c.substr(i,1);
  }
  eval(obj + "=\'" + r + "\'");
}

function ujablak(w, h, u, p, c, s) {
  most = new Date();
  x = (screen.availWidth - 12 - w) / 2;
  y = (screen.availHeight + 20 - h) / 2;
  window.open(u + ((p) ? p + "&" : "?") + "next=" + Date.parse(most.toGMTString()), c, "width=" + w + ",height=" + h + ",status=1,left=" + x + ",top=" + y + ",resizable=1,scrollbars=" + s);
}

function WM7Detect() {
  var WMP7;
  if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.indexOf("MSIE 6.0") != -1)) {
    WMP7 = new ActiveXObject('WMPlayer.OCX');
  }
  return ((WMP7) ? "1" : "0");
}

function kep(w, h, u, p, c, s) {
  var WMP7 = WM7Detect();
  if (screen.width >= 1024) {
    lnMaxW = 1004;
    lnMaxH = 678;
  } else {
    lnMaxW = 780;
    lnMaxH = 510;
  }
  if ((w < 1) || (h < 1)) {
    w = 780;
    h = 510;
  }
  r = (s == 2) ? 1 : 0;
  s = ((lnMaxW < w) || (lnMaxH < h)) ? 1 : 0;
  w = Math.min(lnMaxW, Math.max(w, 160));
  h = Math.min(lnMaxH, Math.max(h, 120));
  most = new Date();
  x = (screen.availWidth - 12 - w) / 2;
  y = (screen.availHeight + 20 - h) / 2;
  window.open(u + ((p) ? p + "&" : "?") + "mp7=" + WMP7 + "&next=" + Date.parse(most.toGMTString()), c, "width=" + w + ",height=" + h + ",status=0,left=" + x + ",top=" + y + ",resizable=" + r + ",scrollbars=" + s);
}

function hozza(tip, id, elozo, W, u) {
  if ((u == 2) || (u == undefined)) {
	alert("Ehhez előbb be kell jelentkezni!");
  } else {
    most = new Date();
    w = 480;
    h = 232;
    x = screen.availWidth - 16 - w;
    y = 4;
    window.open("/prg/hozzaszolas.kk?fcTip=" + tip + "&fnKulcs=" + id + "&fnElozo=" + elozo + "&W=" + W + "&next=" + Date.parse(most.toGMTString()), "Hozzaszolas", "width=" + w + ",height=" + h + ",status=0,left=" + x + ",top=" + y + ",resizable=1,scrollbars=0");
  }
}

function help(url) {
  most = new Date();
  w = 400;
  h = 400;
  x = screen.availWidth - 16 - w;
  y = 4;
  url += ((url.indexOf("?") == -1) ? "?" : "&");
  window.open(url + "next=" + Date.parse(most.toGMTString()), "Segitseg", "width=" + w + ",height=" + h + ",status=0,left=" + x + ",top=" + y + ",resizable=0,scrollbars=1");
}

function feltolt(W) {
  most = new Date();
  w = 400;
  h = 171;
  x = screen.availWidth - 16 - w;
  y = 4;
  window.open("/prg/feltoltes.kk?W=" + W + "&next=" + Date.parse(most.toGMTString()), "Feltoltes", "width=" + w + ",height=" + h + ",status=1,left=" + x + ",top=" + y + ",resizable=0,scrollbars=0");
}

function bee(u) {
  if ((u == 2) || (u == undefined)) {
    alert("Ehhez előbb be kell jelentkezni!");
    return false;
  } else {
	return true;
  }
}

function nav(num) {
  document.formi.fnElso.value = num;
  document.formi.submit();
}

function mark(id) {
  document.formi.action += "#" + id;
  document.formi.submit();
}

function szavazatszamol() {
  var i = 0;
  while ((i < document.formi.fnFOSzavazat.length) && (!document.formi.fnFOSzavazat[i].checked)) {
	i++;
  }
  return ((i < document.formi.fnFOSzavazat.length) ? document.formi.fnFOSzavazat[i].value : 0);
}

function LanguageChange(lng) {
  if (document.formi.fcLanguage.value != lng) {
    document.formi.fcLanguage.value = lng;
    document.formi.submit();
  }
}

function mygo(url) {
  window.location = url;
  return false;
}

function emailDecode(x) {
  x.href = x.href.replace(/qkac/g, "@");
  return true;
}

function emailDispl(x) {
  window.status = x.href.replace(/qkac/g, "@");
}

function clearStat() {
  window.status="";
  return true;
}

function count_and_cut(name, countfield, limit)
{
 if (name.value.length > limit)
   {name.value = name.value.substring(0, limit);}
  else
   {countfield.value = limit+' / '+(name.value.length);}
 return false;
}

function numbersonly(myfield, e, dec)
{
 var key;
 var keychar;
 if (window.event)
   key = window.event.keyCode;
  else if (e)
    key = e.which;
   else
    return true;
 keychar = String.fromCharCode(key);
 // control keys
 if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
   return true;
 // numbers
  else if ((("0123456789").indexOf(keychar) > -1))
    return true;
 // decimal point jump
   else if (dec && (keychar == "."))
    {
     myfield.form.elements[dec].focus();
     return false;
    }
   else
    return false;
} 
