function toggleAll()
{
	document.getElementById('menu1').style.display = "block";
	document.getElementById('menu2').style.display = "block";
}

function toggleVisibility(me)
{
	if (document.getElementById(me).style.display=="none")
	{
		toggleAll();
		document.getElementById(me).style.display="block";
	}
	else 
	{
		document.getElementById(me).style.display="none";
	}
}

function JustNumber(val, id)
	{
	JNval = val.replace(/[^0-9, ',']/g, '');
	document.getElementById(id).value=JNval;
	};


function fn_form_submit(fform,txhidden,txaction) 
{
	txhidden.value = txaction;
	fform.submit();
}

/*------------------------------------------------------------------*/

// div görgetés
function progressscroll()
{
		tavolsagatetotol=40;
//	progress_id.style.top=document.body.scrollTop+tavolsagatetotol;
//	progress_id.style.top=document.body.scrollTop+tavolsagatetotol-20;
		document.getElementById('infoscroll_id').style.top=document.body.scrollTop+tavolsagatetotol-20;
		document.getElementById('progress_id').style.top=document.body.scrollTop+tavolsagatetotol+150;
}

function enterpage(e)
{
	
	if (e.keyCode) keycode=e.keyCode;
		else keycode = e.which;
	if (keycode==13)
		{
		document.form_login.login_submit.value = 'OK';
		document.form_login.submit();
		}
}

function entersend(e,search_text)
{
	if (e.keyCode) keycode=e.keyCode;
	else keycode = e.which;
	
	if (keycode==13)
	{
		if (search_text.length!=0)
		{ 
			location.href = 'index.php?main=main&filter=' + encodeURIComponent(search_text);
		}
		else
		{
			location.href = 'index.php';
		}
	}
}

var hova;
var miben;
var n;
var osszesen;
var t = null;
function systemmessage(txt, id, mindegyik)
{
for (i = 1; i < mindegyik+1; i++)
	{
	if (i != id)
		{
		document.getElementById('systemmessage_id'+i).style.display='none';
		} else {
		hova = id;
		document.getElementById('systemmessage_id'+hova).innerHTML=txt;
		document.getElementById('systemmessage_id'+hova).style.display="block";
		window.clearTimeout(t);			
		t = setTimeout("fadeout(100, hova, osszesen)", 100);
		};

	};

};

function fadeout(num, hova, osszesen)
{

if (num == 0)
	{
	document.getElementById('systemmessage_id'+hova).style.display="none";
	} else {	
	document.getElementById('systemmessage_id'+hova).style.filter="Alpha(opacity="+num*2+")";
	document.getElementById('systemmessage_id'+hova).style.MozOpacity = num/100;

	fadetime(num, hova, osszesen);
	};	
};

function fadetime(num, hova, osszesen)
{
n = num-1;
setTimeout("fadeout(n, hova, osszesen)", 1);

}

function initArray() {
  this.length = initArray.arguments.length
  for (var i = 0; i < this.length; i++)
  this[i+1] = initArray.arguments[i];
}

function havinev(ev, ho, nap) {
if (ho==1)
  { var napok = new initArray("Újév, Fruzsina", "Ábel", "Genovéva, Benjámin", "Titusz, Leona",
	"Simon", "Boldizsár", "Attila, Ramóna", "Gyöngyvér", "Marcell",
	"Melánia", "Ágota", "Ernő", "Veronika", "Bódog", "Lóránt, Loránd",
	"Gusztáv", "Antal, Antónia", "Piroska", "Sára, Márió", "Fábián, Sebestyén",
	"Ágnes", "Vince, Artúr", "Zelma, Rajmund", "Timót", "Pál", "Vanda, Paula",
	"Angelika", "Károly, Karola", "Adél", "Martina, Gerda", "Marcella", "Ignác") }
if (ho==2)
  if ((ev!=2000) && (ev!=2004) && ev!=1996)
    { var napok=new initArray("Ignác", "Karolina, Aida", "Balázs", "Ráhel, Csenge", "Ágota, Ingrid",
	"Dorottya, Dóra", "Tódor, Rómeó", "Aranka", "Abigél, Alex", "Elvira",
	"Bertold, Marietta", "Lívia, Lídia", "Ella, Linda", "Bálint, Valentin",
	"Kolos, Georgina", "Julianna, Lilla", "Donát", "Bernadett", "Zsuzsanna",
	"Aladár, Álmos", "Eleonóra", "Gerzson", "Alfréd",
	"Mátyás", "Géza", "Edina", "Ákos, Bátor", "Elemér", "Albin")  }
     else
    { var napok=new initArray("Ignác", "Karolina, Aida", "Balázs", "Ráhel, Csenge", "Ágota, Ingrid",
	"Dorottya, Dóra", "Tódor, Rómeó", "Aranka", "Abigél, Alex", "Elvira",
	"Bertold, Marietta", "Lívia, Lídia", "Ella, Linda", "Bálint, Valentin",
	"Kolos, Georgina", "Julianna, Lilla", "Donát", "Bernadett", "Zsuzsanna",
	"Aladár, Álmos", "Eleonóra", "Gerzson", "Alfréd",
	"Szőkőnap", "Mátyás", "Géza", "Edina", "Ákos, Bátor", "Elemér", "Albin") }
if (ho==3)
  { var napok=new initArray("Albin", "Lujza", "Kornélia", "Kázmér", "Adorján, Adrián", "Leonóra, Inez",
	"Tamás", "Nemz.Nőnap, Zoltán", "Franciska, Fanni", "Ildikó", "Szilárd",
	"Gergely", "Krisztián, Ajtony", "Matild", "Nemzeti Ünnep, Kristóf",
	"Henrietta", "Gertrúd, Patrik", "Sándor, Ede", "József, Bánk", "Klaudia",
	"Benedek", "Beáta, Izolda", "Emőke", "Gábor, Karina", "Irén, Irisz",
	"Emánuel", "Hajnalka", "Gedeon, Johanna", "Auguszta", "Zalán", "Árpád", "Hugó") }
if (ho==4)
  { var napok=new initArray("Hugó", "Áron", "Buda, Richárd", "Izidor", "Vince", "Vilmos, Bíborka",
	"Herman", "Dénes", "Erhard", "Zsolt", "Leó, Szaniszló", "Gyula", "Ida",
	"Tibor", "Anasztázia, Tas", "Csongor", "Rudolf", "Andrea, Ilma", "Emma",
	"Tivadar", "Konrád", "Csilla, Noémi", "Béla", "György", "Márk", "Ervin",
	"Zita", "Valéria", "Péter", "Katalin, Kitti", "Munka Ünnepe, Fülöp, Jakab")}
if (ho==5)
  { var napok=new initArray("Munka Ünnepe , Fülöp, Jakab", "Zsigmond", "Tímea, Irma", "Mónika, Flórián",
	"Györgyi", "Ivett, Frida", "Gizella", "Mihály", "Gergely", "Ármin, Pálma",
	"Ferenc", "Pongrác", "Szervác, Imola", "Bonifác", "Zsófia, Szonja",
	"Mózes, Botond", "Paszkál", "Erik, Alexandra", "Ivó, Milán",
	"Bernát, Felícia", "Konstantin", "Júlia, Rita", "Dezső", "Eszter, Eliza",
	"Orbán", "Fülöp, Evelin", "Hella", "Emil, Csanád", "Magdolna",
	"Janka, Zsanett", "Angéla, Petronella", "Tünde")}
if (ho==6)
  { var napok=new initArray("Tünde", "Kármen, Anita", "Klotild", "Bulcsú", "Fatime", "Norbert, Cintia",
	"Róbert", "Medárd", "Félix", "Margit, Gréta", "Barnabás", "Villő",
	"Antal, Anett", "Vazul", "Jolán, Vid", "Jusztin", "Laura, Alida",
	"Arnold, Levente", "Gyárfás", "Rafael", "Alajos, Leila", "Paulina",
	"Zoltán", "Iván", "Vilmos", "János, Pál", "László", "Levente, Irén",
	"Péter, Pál", "Pál", "Tihamér") }
if (ho==7)
  { var napok=new initArray("Tihamér, Annamária", "Ottó", "Kornél, Soma", "Ulrik", "Emese, Sarolta",
	"Csaba", "Appolónia", "Ellák", "Lukrécia", "Amália", "Nóra, Lili",
	"Izabella, Dalma", "Jenő", "Őrs, Stella", "Henrik, Roland", "Valter",
	"Endre, Elek", "Frigyes", "Emília", "Illés", "Dániel, Daniella",
	"Magdolna", "Lenke", "Kinga, Kincső", "Kristóf, Jakab", "Anna, Anikó",
	"Olga, Liliána", "Szabolcs", "Márta, Flóra", "Judit, Xénia", "Oszkár", "Boglárka")}
if (ho==8)
  { var napok=new initArray("Boglárka", "Lehel", "Hermina", "Domonkos, Dominika", "Krisztina",
	"Berta, Bettina", "Ibolya", "László", "Emőd", "Lörinc",
	"Zsuzsanna, Tiborc", "Klára", "Ipoly", "Marcell", "Mária", "Ábrahám",
	"Jácint", "Ilona", "Huba", "Alkotmány Ünnepe, István", "Sámuel, Hajna",
	"Menyhért, Mirjam", "Bence", "Bertalan", "Lajos, Patrícia", "Izsó",
	"Gáspár", "Ágoston", "Beatrix, Erna", "Rózsa", "Erika, Bella", "Egyed, Egon")}
if (ho==9)
  { var napok= new initArray("Egyed, Egon", "Rebeka, Dorina", "Hilda", "Rozália", "Viktor, Lőrinc",
	"Zakariás", "Regina", "Mária, Adrienn", "Ádám", "Nikolett, Hunor",
	"Teodóra", "Mária", "Kornél", "Szeréna, Roxána", "Enikő, Melitta", "Edit",
	"Zsófia", "Diána", "Vilhelmina", "Friderika", "Máté, Mirella", "Móric",
	"Tekla", "Gellért, Mercédesz", "Eufrozina, Kende", "Jusztina", "Adalbert",
	"Vencel", "Mihály", "Jeromos", "Malvin")}
if (ho==10)
  { var napok= new initArray("Malvin", "Petra", "Helga", "Ferenc", "Aurél", "Brúnó, Renáta", "Amália",
	"Koppány", "Dénes", "Gedeon", "Brigitta", "Miksa", "Kálmán, Ede", "Helén",
	"Teréz", "Gál", "Hedvig", "Lukács", "Nándor", "Vendel", "Orsolya", "Előd",
	"Köztársaság kikiált., Gyöngyi", "Salamon", "Blanka, Bianka", "Dömötör",
	"Szabina", "Simon, Szimonetta", "Nárcisz", "Alfonz", "Farkas", "Marianna")}
if (ho==11)
  { var napok=new initArray("Marianna", "Achilles", "Győző", "Károly", "Imre", "Lénárd", "Rezső",
	"Zsombor", "Tivadar", "Réka", "Márton", "Jónás, Renátó", "Szilvia",
	"Aliz", "Albert, Lipót", "Ödön", "Hortenzia, Gergő", "Jenő", "Erzsébet",
	"Jolán", "Olivér", "Cecília", "Kelemen, Klementina", "Emma", "Katalin",
	"Virág", "Virgil", "Stefánia", "Taksony", "András, Andor", "Elza")}
if (ho==12)
  { var napok=new initArray("Elza", "Melinda, Vivien", "Ferenc, Olívia", "Borbála, Barbara", "Vilma",
	"Miklós", "Ambrus", "Mária", "Natália", "Judit", "Árpád", "Gabriella",
	"Luca, Otília", "Szilárda", "Valér", "Etelka, Aletta", "Lázár, Olimpia",
	"Auguszta", "Viola", "Teofil", "Tamás", "Zéno", "Viktória", "Ádám, Éva",
	"Karácsony, Eugénia", "Karácsony, István", "János", "Kamilla",
	"Tamás, Tamara", "Dávid", "Szilveszter", "Újév, Fruzsina")}
return napok[nap];
}

function honev(ho) {
var month = new initArray("január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december");
return month[ho];
}

function napnev(szam) {
var napok = new initArray("vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat", "vasárnap")
return napok[szam];
}

var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (oldLink) oldLink.style.fontWeight = 'normal';
  oldLink = link;
  link.style.fontWeight = 'bold';
  return false;
}

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled.  In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here.  However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function flatSelected(cal, date) {
  var el = document.getElementById("preview");
  el.innerHTML = date;
}

function showFlatCalendar() {
  var parent = document.getElementById("display");

  // construct a calendar giving only the "selected" handler.
  var cal = new Calendar(0, null, flatSelected);

  // hide week numbers
  cal.weekNumbers = false;

  // We want some dates to be disabled; see function isDisabled above
  cal.setDisabledHandler(isDisabled);
  cal.setDateFormat("%A, %B %e");

  // this call must be the last as it might use data initialized above; if
  // we specify a parent, as opposite to the "showCalendar" function above,
  // then we create a flat calendar -- not popup.  Hidden, though, but...
  cal.create(parent);

  // ... we can show it here.
  cal.show();
}


