function kepek(kep)
		{
		window.open ("image.php?kep="+ kep, 'kepmutatas', 'width=1024, height=768, toolbar=no, status=no, menubar=no, resizable=yes');
		}
	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];}}
	}
	var forum_validator_ertek='';
	function convert_url (url)
		{
		var hexee='';
		for (i=0;i<url.length;i++) 
			{
			if (url.charCodeAt(i)>=160)
				{
				Hexee2 = '%' + url.charCodeAt(i).toString(16);
				hexee += Hexee2.toUpperCase();
				}
				else 
				{
				hexee+=url.charAt(i);
				}
			}
		return hexee;
		
		}
    function makeRequest(url,div) {
        var http_request = false;
		url=convert_url(url);
		if (url.indexOf('?')==-1)
			{
			url=url+'?rand='+(Math.random() * Date.parse(new Date()));
			}
			else if (url.indexOf('?')!=-1)
			{
			url=url+'&rand='+(Math.random() * Date.parse(new Date()));
			}
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
			
				
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Sajnos a böngszoje nem tmogatja a(z) XMLHTTP technikt. Kérem frissítse!');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request,url,div); };
        http_request.open('GET', url, true);
        http_request.send(null);

    }
	var vissza=new Array();
	var vissza_szama=0;
    function alertContents(http_request,url,div) {

        if (http_request.readyState == 1) 
			{
			var upload_helye=document.getElementById(div);
			upload_helye.innerHTML='<img src="images/loading.gif" alt="Loading" width="16" height="16" /> T&ouml;lt&ouml;m az adatokat... ';
			}
		if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				vissza_szama+=1;
				vissza[vissza_szama]=document.getElementById("mezo").innerHTML;
				if (vissza_szama>10)
				{
					vissza[vissza_szama-10]="";
				}
						
					
                var upload_helye = document.getElementById(div);
					upload_helye.innerHTML = http_request.responseText;
					if (url.indexOf('jatekos_list.php')!=-1)
						{
						tovabb_kuld();
						}
					if (url.indexOf('munkatarsaink.php')!=-1)
						{
						tovabb_kuld_m();
						}
					if (url.indexOf('meccs_list.php')!=-1)
						{tovabb_kuldb();}
					if (url.indexOf('galery.php')!=-1)
						{
						makeRequest('galery_list.php','galery');
						}
					if (url.indexOf('news.php')!=-1)
						{
						makeRequest('news_list.php','hirek');
						}
					if (url.indexOf('forum.php')!=-1)
						{
						makeRequest('forum_list2.php?topic=Vendégkönyv','forum');
						}
					if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1) {alphaImages();}
            } else {
               var upload_helye = document.getElementById(div);
					upload_helye.innerHTML ='<table width="432" border="0"><tr><td width="50"><img src="images/hiba.png" alt="Hiba" width="50" height="50" /></td><td width="372"><span class="style1">'+http_request.status+'</span> <span class="style2">Hiba t&ouml;rt&eacute;nt az oldal bet&ouml;lt&eacute;se k&ouml;zben</span>:<span class="style3">'+url+' </span></td></tr></table>';
			   if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1) {alphaImages();}
            }
        }

    }
	var hol_tart=0;
	function vissza ()
	{
		vissza[vissza_szama+1]=document.getElementById("mezo").innerHTML;
		document.getElementById("mezo").innerHTML=vissza[vissza_szama];
		
		vissza_szama+=1;
		
	}
	function ajax_validator(http_request) {

		if (http_request.readyState == 4) {
            if (http_request.status == 200) {
					forum_validator_ertek=http_request.responseText;
			}
        }

    }
	function tovabb_kuld()
		{
		var url='jatekos_list2.php?korosztaly='+document.getElementById("korosztaly").value+'&csoport='+document.getElementById("csoport").value+'&poszt='+document.getElementById("poszt").value+'&nev='+document.getElementById("nev").value+'&rendezd1='+document.getElementById("rendezd1").value+'&sorrend1='+document.getElementById("sorrend1").value+'&rendezd2='+document.getElementById("rendezd2").value+'&sorrend2='+document.getElementById("sorrend2").value;
		var div='jatekos_list';
		makeRequest(url,div);
		}
	function tovabb_kuldb()
		{
		var url='meccs_list.php?kezdo_ev='+document.getElementById("kezdo_ev").value+'&kezdo_ho='+document.getElementById("kezdo_ho").value+'&kezdo_nap='+document.getElementById("kezdo_nap").value+'&veg_ev='+document.getElementById("veg_ev").value+'&veg_ho='+document.getElementById("veg_ho").value+'&veg_nap='+document.getElementById("veg_nap").value+'&korcs_mutatas='+document.getElementById("korcs_mutatas").value+'&szezon='+document.getElementById("szezon").value;
		var div='meccs_list';
		makeRequest(url,div);
		}
	function tovabb_kuld_gal()
		{
		var url='galery_list.php?search='+document.getElementById("galery_keres").value;
		makeRequest(url,'galery');
		}
	function tovabb_kuld_m()
		{
		var url='munkatarsaink_list.php?nev='+document.getElementById("nev").value+'&rendezd1='+document.getElementById("rendezd1").value+'&sorrend1='+document.getElementById("sorrend1").value;
		var div='munkatars_list';
		makeRequest(url,div);
		}	

	function at_display(x)
	{
	  win = window.open();
	  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
	}
	
	// ----- Show Aux -----
	
	function at_show_aux(parent, child)
	{
	  var p = document.getElementById(parent);
	  var c = document.getElementById(child);
	
	  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
	  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;
	
	  for (; p; p = p.offsetParent)
	  {
		top  += p.offsetTop;
		left += p.offsetLeft;
	  }
	
	  c.style.position   = "absolute";
	  c.style.top        = top +'px';
	  c.style.left       = left+'px';
	  c.style.visibility = "visible";
	}
	
	// ----- Show -----
	
	function at_show()
	{
	  p = document.getElementById(this["at_parent"]);
	  c = document.getElementById(this["at_child" ]);
	
	  at_show_aux(p.id, c.id);
	
	  clearTimeout(c["at_timeout"]);
	}
	
	// ----- Hide -----
	
	function at_hide()
	{
	  c = document.getElementById(this["at_child"]);
	
	  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 600);
	}
	
	// ----- Click -----
	
	function at_click()
	{
	  p = document.getElementById(this["at_parent"]);
	  c = document.getElementById(this["at_child" ]);
	
	  if (c.style.visibility != "visible") at_show_aux(p.id, c.id);
	  else c.style.visibility = "hidden";
	
	  return false;
	}
	
	function at_attach(parent, child, showtype, position, cursor)
	{
	  var p = document.getElementById(parent);
	  var c = document.getElementById(child);
	
	  p["at_parent"]     = p.id;
	  c["at_parent"]     = p.id;
	  p["at_child"]      = c.id;
	  c["at_child"]      = c.id;
	  p["at_position"]   = position;
	  c["at_position"]   = position;
	
	  c.style.position   = "absolute";
	  c.style.visibility = "hidden";
	
	  if (cursor != undefined) p.style.cursor = cursor;
	
	  switch (showtype)
	  {
		case "click":
		  p.onclick     = at_click;
		  p.onmouseout  = at_hide;
		  c.onmouseover = at_show;
		  c.onmouseout  = at_hide;
		  break;
		case "hover":
		  p.onmouseover = at_show;
		  p.onmouseout  = at_hide;
		  c.onmouseover = at_show;
		  c.onmouseout  = at_hide;
		  break;
	  }
	}
		function rowover(id)
		{
		var szin= '#9DBDFF';
		var objektum = (document.getElementById) ? document.getElementById('name' + id) : eval("document.all['name" + id + "']");

			objektum.bgColor=szin;

		}
	function rowout(id)
		{
		var szin= '#FFFFFF';
		var objektum = document.getElementById("name"+id);
		objektum.bgColor=szin;
		}
	function kittkatt (url, div, kell)
		{
		
		if (document.getElementById(div).style.display=="block" || document.getElementById(div).style.display=="")
			{
			document.getElementById(div).style.display="none";
			if (kell!='2fg')
				{
				document.getElementById(div+"b").innerHTML='<img src="images/le1.png" alt="A k&eacute;p nem el&eacute;rhet&#337;" width="25" height="25" border="0"/>';}
			if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1) {alphaImages();}
			}else{
				if (document.getElementById(div).style.display=="none")
					{
					document.getElementById(div).style.display="block";
					if (kell!='2fg')
						{document.getElementById(div+"b").innerHTML='<img src="images/bezar1.png" alt="A k&eacute;p nem el&eacute;rhet&#337;" width="25" height="25" border="0" />';}
					makeRequest(url,div);
					}
				}
		}
	function elrejt ()
		{
		if (document.getElementById("fejlec").style.display=="block" || document.getElementById("fejlec").style.display=="")
			{
			document.getElementById("fejlec").style.display="none";
			document.getElementById("elrejt").innerHTML='<table width="158" border="0"> <tr><td width="25"><a href="javascript:elrejt();"><img src="images/le.png" alt="Elrejt" width="25" height="25" border="0" align="middle" /></a></td><td width="165"><a href="javascript:elrejt();"><span class="style3">Tov&aacute;bbi be&aacute;ll&iacute;t&aacute;sok</span></a></td> </tr> </table>';
			}else{
			if (document.getElementById("fejlec").style.display=="none")
				{
				document.getElementById("fejlec").style.display="block";
				document.getElementById("elrejt").innerHTML='<table width="158" border="0">  <tr><td width="25"><a href="javascript:elrejt();"><img src="images/fel.png" alt="Elrejt" width="25" height="25" border="0" align="middle" /></a></td><td width="165"><a href="javascript:elrejt();"><span class="style3">Be&aacute;ll&iacute;t&aacute;sok elrejt&eacute;se </span></a></td> </tr> </table>';
				}
			}
		}
	function alphaImages() 
		{ 
		var els = document.getElementsByTagName("IMG"); 
		var s, w, h; 
		for (var i=0; i<els.length; i++) 
			{ 
			s = els[i].src; 
			if (s.toLowerCase().indexOf(".png") != -1) 
				{ 
				els[i].src = "images/spacer.gif"; 
				els[i].style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + s + "', sizingMethod=image);"; 
				} 
			} 
		} 
	if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1) window.attachEvent("onload", alphaImages);
	
	function new_forum(url)
		{
		var becenev=document.getElementById("becenev").value;
		var email=document.getElementById("email").value;
		var titkos_email=document.getElementById("titkos_email").value;
		var topic=document.getElementById("topic").value;
		var szoveg=document.getElementById("szoveg").value;
		forum_validator(url+'?becenev='+becenev+'&email='+email+'&titkos_email='+titkos_email+'&topic='+topic+'&szoveg='+szoveg,'uj_forum');

		}

	function forum_validator (url,div)
		{
		var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
		var returnval=emailfilter.test(document.getElementById("email").value);
		var uzenet="A következok hibaüzenettel tért vissza a rendszer: \n";
		var kuld=true;
		if (document.getElementById("becenev").value=="")
			{
			uzenet+=" Töltse ki a név mezot! \n";
			document.getElementById("becenev").select();
			kuld=false;
			}
		if ( document.getElementById("email").value=="" || !returnval)
			{
			uzenet+=" Ellenorizze a megadott e-mail címet! \n";
			kuld=false;
			document.getElementById("email").select();
			}
		if (document.getElementById("topic").value=="")
			{
			uzenet+=" Adjon meg egy téma nevet! \n";
			kuld=false;
			document.getElementById("topic").select();
			}
		if (url.indexOf('forum_new_post.php')!=-1)
			{
			 var http_request = false;
				url2=convert_url('forum_new_validator.php?topic='+document.getElementById("topic").value);
				if (url2.indexOf('?')==-1)
					{
					url2=url2+'?rand='+(Math.random() * Date.parse(new Date()));
					}
					else if (url2.indexOf('?')!=-1)
					{
					url2=url2+'&rand='+(Math.random() * Date.parse(new Date()));
					}
				if (window.XMLHttpRequest) { // Mozilla, Safari, ...
					http_request = new XMLHttpRequest();
					if (http_request.overrideMimeType) {
						http_request.overrideMimeType('text/xml');
						// See note below about this line
					
						
					}
				} else if (window.ActiveXObject) { // IE
					try {
						http_request = new ActiveXObject("Msxml2.XMLHTTP");
					} catch (e) {
						try {
							http_request = new ActiveXObject("Microsoft.XMLHTTP");
						} catch (e) {}
					}
				}
		
				if (!http_request) {
					alert('Sajnos a bngszoje nem tmogatja a(z) XMLHTTP technikt. Krem frisstse!');
					return false;
				}
				http_request.onreadystatechange = function() { ajax_validator(http_request); };
				http_request.open('GET', url2, true);
				http_request.send(null);

			if (forum_validator_ertek=="van")
				{
				kuld=false;
				uzenet+=" Létezik már ilyen nevu téma! Válasszon másikat! \n";
				document.getElementById("topic").select();
				}
			}
		
		if (document.getElementById("szoveg").value=="")
			{
			uzenet+=" Ha hozzá szeretne szólni egy témához, kérem írjon is valamit! \n";
			kuld=false;
			document.getElementById("szoveg").select();
			}

		if (kuld)
			{
			makeRequest(url,div);
			setTimeout("makeRequest('forum_show.php?topic=Vendégkönyv','forum')",2000);
			}
			else
			{
			alert(uzenet);
			}
		}
	function jatekos_popup (id)
	{
		window.open ("jatekos_show.php?id="+ id, 'jatekosmutatas', 'width=640, height=300, toolbar=no, status=no, menubar=no, resizable=yes');
	}
	function news_search()
	{
		var sv=document.getElementById("search").value;
		makeRequest("news_list.php?search="+sv,"hirek");
	}
