window.name = 'folap';
var ido = new Date()
var ev = ido.getYear()
var ho = ido.getMonth()+1
var nap = ido.getDate()

var Open = ""
var Closed = ""


/* Form ellenőrzések */
/* Üres mező */
function uresCheck(mezo,mezonev){
  if (mezo.value != "") return true;
  else{
    alert("Nincs megadva: "+mezonev);
    return false;
  }
}
/* mezőhossz ellenőrzés */
function hosszCheck(mezo,mezonev) {
  if (mezo.value.length >= 3) return true;
  else{
    alert("A(z) '"+mezonev+"' legalább 3 karakter hosszú!");
    return false;
  }
}
/* jelszó és megerősítésének egyezése */
function passchk(pass,passch) {
  if ( pass.value == passch.value ) return true;
  else {
   alert ("A jelszó megerősítésének meg kell egyeznie a jelszóval!")
   return false;
  }
}
/* 'A' szintű e-mail ellenőrzés */
function emailchk(email){
  szoveg = email.value;

  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported)
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  if ( ! ( szoveg.length >= 7 && ! r1.test(szoveg) && r2.test(szoveg)))
  {
    alert("Rossz e-mail cím!");
    return false;
  }
  else return true;
}
/* mező elejének space tisztítása */
function cleaner(formobj)
{
 karakter = formobj.value.charAt(0);
 while ( karakter == " " )
 {
  szoveg = formobj.value.substring(1,formobj.value.length);
  formobj.value = szoveg;
  karakter = szoveg.charAt(0);
 }
}
/* textarea beírható karakterek */
var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder)
{
 if (window.event&&event.srcElement.value.length>=maxlength)
  return false
 else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength)
 {
  var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
  if (pressedkey.test(String.fromCharCode(e.which)))
  e.stopPropagation()
 }
}

function countlimit(maxlength,e,placeholder)
{
 var theform=eval(placeholder)
 var lengthleft=maxlength-theform.value.length
 var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
 if (window.event||e.target&&e.target==eval(placeholder))
 {
  if (lengthleft<0)
   theform.value=theform.value.substring(0,maxlength)
  placeholderobj.innerHTML=lengthleft
 }
}

function displaylimit(thename, theid, thelimit)
{
 var theform=theid!=""? document.getElementById(theid) : thename
 var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> karakter írható még be.'
 if (document.all||ns6)
  document.write(limit_text)
 if (document.all)
 {
  eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
  eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
 }
 else if (ns6)
 {
  document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
  document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
 }
}


/* Sütik */
function setCookie(name, value, expire) {
  document.cookie = name + "=" + escape(value)
  + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())+"; path=/");
}

function getCookie(Name){
  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));
    }
  }
}

/* Menühöz */
function preload(lang)
{
 if(document.images){
	Open = new Image(16,13)
	Closed = new Image(16,13)
	Open.src = "imgs/open.gif"
	Closed.src = "imgs/close.gif"
 }
 if ( lang == "hu" )
 {
  if (getCookie('sm2') && getCookie('sm2') == '1' ) showhide('sm2',sm2,m2s);
  if (getCookie('sm4') && getCookie('sm4') == '1' ) showhide('sm4',sm4,m4s);
  if (getCookie('sm5') && getCookie('sm5') == '1' ) showhide('sm5',sm5,m5s);
  if (getCookie('sm6') && getCookie('sm6') == '1' ) showhide('sm6',sm6,m6s);
  if (getCookie('sm7') && getCookie('sm7') == '1' ) showhide('sm7',sm7,m7s);
  if (getCookie('sm9') && getCookie('sm9') == '1' ) showhide('sm9',sm9,m9s);
 } else
 {
  if (getCookie('asm2') && getCookie('asm2') == '1' ) showhide('asm2',asm2,am2s);
  if (getCookie('asm4') && getCookie('asm4') == '1' ) showhide('asm4',asm4,am4s);
  if (getCookie('asm9') && getCookie('asm9') == '1' ) showhide('asm9',asm9,am9s);
 }
}

function mkibe(mit)
{
 for ( i=1; i<=12; i++ )
 {
  expDate = new Date();
  expDate.setTime(expDate.getTime() + (365*24*60*60*1000));
  setCookie( 'sm'+i, mit, expDate );
  location.reload();
 }
}

function showhide(menu,what,what2)
{
 expDate = new Date();
 expDate.setTime(expDate.getTime() + (365*24*60*60*1000));
 if (what.style.display=='none')
 {
  what.style.display='block';
  what2.src=Open.src;
  setCookie(menu, 1, expDate);
 } else
 {
  what.style.display='none';
  what2.src=Closed.src;
  setCookie(menu, 0, expDate);
 }
}

/* ablaknyitások */
function ablak(link,w,h)
{
 ujablak = window.open(link,'win',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width="+w+",height="+h);
 ujablak.moveTo((screen.availWidth-w)/2,(screen.availHeight-h)/2);
 ujablak.focus();
}

function printer()
{
 ujablak = window.open("printer.php"+location.search,'win',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=616,height=560");
 ujablak.moveTo((screen.availWidth-616)/2,(screen.availHeight-560)/2);
 ujablak.focus();
}

function kereses()
{
 window.name = 'folap';
 ujablak = window.open("keres.php?keres="+document.keres_form.keres.value+"&hol="+document.keres_form.hol.value,'win',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=640,height=480");
 ujablak.moveTo(0,0);
 ujablak.focus();
}
//  Táblázatformázó
function setPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
}
function kereses()
{
 window.name = 'folap';
 ujablak = window.open("keres.php?keres="+document.keres_form.keres.value,'win',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=640,height=480");
 ujablak.moveTo(0,0);
 ujablak.focus();
}