// define a few variables that are required
var vbmenu_usepopups = false;
var ignorequotechars = 0;

// #############################################################################
// lets define the browser we have instead of multiple calls throughout the file
var userAgent = navigator.userAgent.toLowerCase();
var is_opera  = (userAgent.indexOf('opera') != -1);
var is_saf    = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == "Apple Computer, Inc."));
var is_webtv  = (userAgent.indexOf('webtv') != -1);
var is_ie     = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4    = ((is_ie) && (userAgent.indexOf("msie 4.") != -1));
var is_moz    = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon    = (userAgent.indexOf('konqueror') != -1);
var is_ns     = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4    = ((is_ns) && (parseInt(navigator.appVersion) == 4));

// catch possible bugs with WebTV and other older browsers
var is_regexp = (window.RegExp) ? true : false;

// #############################################################################
// let's find out what DOM functions we can use
var vbDOMtype = '';
if (document.getElementById)
{
	vbDOMtype = "std";
}
else if (document.all)
{
	vbDOMtype = "ie4";
}
else if (document.layers)
{
	vbDOMtype = "ns4";
}


if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
 document.writeln('<script language="VBscript">');

 document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
 document.writeln('detectableWithVB = False');
 document.writeln('If ScriptEngineMajorVersion >= 2 then');
 document.writeln('  detectableWithVB = True');
 document.writeln('End If');

 document.writeln('\'this next function will detect most plugins');
 document.writeln('Function detectActiveXControl(activeXControlName)');
 document.writeln('  on error resume next');
 document.writeln('  detectActiveXControl = False');
 document.writeln('  If detectableWithVB Then');
 document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
 document.writeln('  End If');
 document.writeln('End Function');

 document.writeln('\'and the following function handles QuickTime');
 document.writeln('Function detectQuickTimeActiveXControl()');
 document.writeln('  on error resume next');
 document.writeln('  detectQuickTimeActiveXControl = False');
 document.writeln('  If detectableWithVB Then');
 document.writeln('    detectQuickTimeActiveXControl = False');
 document.writeln('    hasQuickTimeChecker = false');
 document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
 document.writeln('    If IsObject(hasQuickTimeChecker) Then');
 document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
 document.writeln('        detectQuickTimeActiveXControl = True');
 document.writeln('      End If');
 document.writeln('    End If');
 document.writeln('  End If');
 document.writeln('End Function');

 document.writeln('</scr' + 'ipt>'); }

// make an array to store cached locations of objects called by fetch_object
var vBobjects = new Array();

// #############################################################################
// function to emulate document.getElementById
function fetch_object(idname, forcefetch)
{
	if (forcefetch || typeof(vBobjects[idname]) == "undefined")
	{
		switch (vbDOMtype)
		{
			case "std":
			{
				vBobjects[idname] = document.getElementById(idname);
			}
			break;

			case "ie4":
			{
				vBobjects[idname] = document.all[idname];
			}
			break;

			case "ns4":
			{
				vBobjects[idname] = document.layers[idname];
			}
			break;
		}
	}
	return vBobjects[idname];
}

// #############################################################################
// simple function to toggle the 'display' attribute of an object
function toggle_display(idname)
{
	obj = fetch_object(idname);
	if (obj)
	{
		if (obj.style.display == "none")
		{
			obj.style.display = "";
		}
		else
		{
			obj.style.display = "none";
		}
	}
	return false;
}

// #############################################################################
// ##################### vBulletin Cookie Functions ############################
// #############################################################################

// #############################################################################
// function to set a cookie
function set_cookie(name, value, expires)
{
	if (!expires)
	{
		expires = new Date();
	}
	document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() +  "; path=/";
}

// #############################################################################
// function to retrieve a cookie
function fetch_cookie(name)
{
	cookie_name = name + "=";
	cookie_length = document.cookie.length;
	cookie_begin = 0;
	while (cookie_begin < cookie_length)
	{
		value_begin = cookie_begin + cookie_name.length;
		if (document.cookie.substring(cookie_begin, value_begin) == cookie_name)
		{
			var value_end = document.cookie.indexOf (";", value_begin);
			if (value_end == -1)
			{
				value_end = cookie_length;
			}
			return unescape(document.cookie.substring(value_begin, value_end));
		}
		cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
		if (cookie_begin == 0)
		{
			break;
		}
	}
	return null;
}

// #############################################################################
// function to delete a cookie
function delete_cookie(name)
{
	var expireNow = new Date();
	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}

// #############################################################################
// ################## vBulletin Collapse HTML Functions ########################
// #############################################################################

// #############################################################################
// function to toggle the collapse state of an object, and save to a cookie
function toggle_collapse(objid)
{
	if (!is_regexp)
	{
		return false;
	}
	
	obj = fetch_object("collapseobj_" + objid);	
	img = fetch_object("collapseimg_" + objid);
	cel = fetch_object("collapsecel_" + objid);
	
	if (!obj)
	{
		// nothing to collapse!
		if (img)
		{
			// hide the clicky image if there is one
			img.style.display = "none";
		}
		return false;
	}

	if (obj.style.display == "none")
	{
		obj.style.display = "";
		save_collapsed(objid, false);
		if (img)
		{
			img_re = new RegExp("_collapsed\\.gif$");
			img.src = img.src.replace(img_re, '.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
			cel.className = cel.className.replace(cel_re, '$1');
		}
	}
	else
	{
		obj.style.display = "none";
		save_collapsed(objid, true);
		if (img)
		{
			img_re = new RegExp("\\.gif$");
			img.src = img.src.replace(img_re, '_collapsed.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)$");
			cel.className = cel.className.replace(cel_re, '$1_collapsed');
		}
	}
	return false;
}

// #############################################################################
// update vbulletin_collapse cookie with collapse preferences
function save_collapsed(objid, addcollapsed)
{
	var collapsed = fetch_cookie("sitemenucollapse");
	var tmp = new Array();

	if (collapsed != null)
	{
		collapsed = collapsed.split("\n");

		for (i in collapsed)
		{
			if (collapsed[i] != objid && collapsed[i] != "")
			{
				tmp[tmp.length] = collapsed[i];
			}
		}
	}

	if (addcollapsed == false)
	{
		tmp[tmp.length] = objid;
	}

	expires = new Date();
	expires.setTime(expires.getTime() + (1000 * 86400 * 365));
	set_cookie("sitemenucollapse", tmp.join("\n"), expires);
}

// #############################################################################
// function to register a menu for later initialization
function vbmenu_register(controlid, nowrite, datefield)
{
	if (vbmenu_usepopups)
	{
		vbmenu_doregister(controlid, nowrite, datefield);
	}
}

// #############################################################################
// functions to handle active cells

// active cell mouse-over
function activecells_mouseover(e)
{
	this.className = this.swapclass;
	if (is_ie)
	{
		this.style.cursor = "hand";
	}
	else
	{
		this.style.cursor = "pointer";
	}
	return true;
}

// active cell mouse-out
function activecells_mouseout(e)
{
	this.className = this.origclass;
	this.style.cursor = "default";
	return true;
}

// active cell click
function activecells_click(e)
{
	this.className = this.origclass;
	var script = '';
	if (r = this.id.match(/^([a-z]{1})([0-9]+)$/))
	{
		switch (r[1])
		{
			case "u": // user
				script = "member.php?" + SESSIONURL + "u=";
				break;
			
			case "f": // forum
				script = "forumdisplay.php?" + SESSIONURL + "f=";
				break;
			
			case "t": // thread
				script = "showthread.php?" + SESSIONURL + "t=";
				break;
			
			case "p": // post
				script = "showthread.php?" + SESSIONURL + "p=";
				break;
			
			case "m": // private message
				script = "private.php?" + SESSIONURL + "pmid=";
				break;
			
			default:
				return;
		}
		window.location = script + r[2];
	}
}

 function getActiveText(msg) 
 {
  selectedText = (document.all) ? document.selection.createRange().text : window.getSelection();if (msg.createTextRange) msg.caretPos = document.selection.createRange().duplicate();return true;
 }

 function confirmMsg(targ,ask) 
 { 
  if(confirm(""+ask+""))
  { 
   location=""+targ+""; 
  }
 }

 function jumpMenu(targ,selObj,restore)
 {
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
 }

 function JMP(targ,page,selObj,restore)
 {
  eval(targ+".location='"+page+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
 }

 function popup(data,name,width,height,srcoll) 
 { 
  var posX=(screen.availWidth-width)/2;
  var posY=(screen.availHeight-height)/2;
  var scrolly = srcoll;
  var id = name;
  window.open(data,name,"scrollbars=" + scrolly + ",resizable=yes, width=" + width + ",height=" + height + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
 }


function datum() {
	var tmp = new Date();
	var maidatum;
	var napok = new Array('Vasárnap','Hétfő','Kedd','Szerda','Csütörtök','Péntek','Szombat');
	var honapok = new Array('január','február','március','április','május','június','július','augusztus','szeptember','október','november','december');
	var mainevnap = nevnap(2000+(tmp.getYear()%100), tmp.getMonth(), tmp.getDate());

	maidatum = 2000+(tmp.getYear()%100) + '. ' + honapok[tmp.getMonth()] + ' ' + tmp.getDate() + '.,  ' + napok[tmp.getDay()] + ' Névnap: ' + mainevnap;
	document.write(maidatum);
}


function nevnap(ev,ho,nap) {
ho = ho+1;
if (ho==1)
  { var nnapok = new Array("Ú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","") }
if (ho==2)
  if ((ev%4==0) && (ev%100!=0) && ev%400==0)
    { var nnapok=new Array("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","","")  }
     else
    { var nnapok=new Array("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","","") }
if (ho==3)
  { var nnapok=new Array("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","" ) }
if (ho==4)
  { var nnapok=new Array("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","" )}
if (ho==5)
  { var nnapok=new Array("MUNKA ÜNN.,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","" )}
if (ho==6)
  { var nnapok=new Array("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","" ) }
if (ho==7)
  { var nnapok=new Array("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","" )}
if (ho==8)
  { var nnapok=new Array("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 ÜNN., István","Sámuel, Hajna",
        "Menyhért, Mirjam","Bence","Bertalan","Lajos, Patrícia","Izsó",
        "Gáspár","Ágoston","Beatrix, Erna","Rózsa","Erika, Bella") }
if (ho==9)
  { var nnapok= new Array("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","" )} 
if (ho==10)
  { var nnapok= new Array("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.KIKIÁLT., Gyöngyi","Salamon","Blanka, Bianka","Dömötör",
        "Szabina","Simon, Szimonetta","Nárcisz","Alfonz","Farkas","" )}
if (ho==11)
  { var nnapok=new Array("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","" )}
if (ho==12)
  { var nnapok=new Array("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","") } 
return nnapok[nap-1]
}

function GoToURL(frameName,URL) {
 if(frameName=="") d=document;
 else d=parent.frames[frameName].document;
 d.location.href=URL;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function toggleInfo(info)
{
 var di=document.getElementById(info);
 if(di.style.display=='none') di.style.display=''; else di.style.display='none';
}

function addHoverToInput()
{
 var inputs=document.getElementsByTagName('input');
 for(var i=0;i<inputs.length;i++)
 {
  if(inputs[i].type=='submit' || (inputs[i].type=='button' && inputs[i].className!="nw_button"))
  {
   inputs[i].onmouseover=function() { this.className='button_hover'; }
   inputs[i].onmouseout=function() { this.className='button'; }
  }
 }
}

function showResult(cr,max)
{
 for(var i=1;i<=max;i++)
 {
  var iname='results'+i;
  var tname='rest'+i;
  document.getElementById(iname).style.display='none';
  document.getElementById(tname).className='search_tabinactive';
 }
 var iname='results'+cr;
 var tname='rest'+cr;
 document.getElementById(iname).style.display='';
 document.getElementById(tname).className='search_tabactive';
}

var dom = document.getElementById ? true:false;
var nn4 = document.layers ? true:false;
var ie4 = document.all ? true:false;

var cmX = 0;
var cmY = 0;

function displayInfo(text)
{
 var il=document.getElementById('itemInfo');
 if(il)
 {
  il.style.visibility='visible';
  il.innerHTML=text;
  il.style.left=cmX+10+'px';
  il.style.top=cmY+10+'px';
 }
}

function hideInfo()
{
 document.getElementById('itemInfo').style.visibility='hidden';
}

function set_mouse_cords(e)
{
 if(ie4){
  cmY = event.clientY + document.body.scrollTop;
  cmX = event.clientX + document.body.scrollLeft;
 }
 else if(nn4 || dom){
  cmY = e.pageY;
  cmX = e.pageX;
 }
 var il=document.getElementById('itemInfo');
 if(il)
 {
  if(il.style.visibility=='visible')
  {
   il.style.left=cmX+10+'px';
   il.style.top=cmY+10+'px';
  }
 }
}

function map()
{
 var mapl=document.getElementById('mapbig');
 if(mapl.style.display=='none')
 {
  mapl.style.left=Math.round((document.body.scrollWidth-638)/2);
  mapl.style.top=Math.round((document.body.clientHeight-548)/2)+document.body.scrollTop;
  mapl.style.display='';
 }
 else
 {
  mapl.style.display='none';
 }
}


function PopupSite()
{
 styletemp=document.body.style;
 document.body.style.height='100%';
 document.body.style.overflow='hidden';
}

function ClosePopup()
{
 var pdb=document.getElementById('popup_bg');
 var pdm=document.getElementById('popup_body');
 pdm.style.display='none';
 pdb.style.display='none';
 document.body.style.height=styletemp.height;
 document.body.style.overflow='';
}

document.onmousemove = set_mouse_cords;
