document.mocorgo='';
var IE = document.all?true:false;
function ajax_alap(){
var ret;
try{
		// Opera 8.0+, Firefox, Safari
		ret = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ret = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ret = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("A böngésződ XAR!");
			}
		}
	}
	return ret;
}
function gombcsere(o){
	var divtags=o.getElementsByTagName('div');
	divtags[0].style.backgroundImage='url(./imgs/gombok/butt_left_2.png)';
	divtags[1].style.backgroundImage='url(./imgs/gombok/butt_mid_2.png)';
	divtags[2].style.backgroundImage='url(./imgs/gombok/butt_right_2.png)';
	divtags[1].style.color='white';
}
function gombback(o){
	var divtags=o.getElementsByTagName('div');
	divtags[0].style.backgroundImage='url(./imgs/gombok/butt_left_1.png)';
	divtags[1].style.backgroundImage='url(./imgs/gombok/butt_mid_1.png)';
	divtags[2].style.backgroundImage='url(./imgs/gombok/butt_right_1.png)';
	divtags[1].style.color='';
}
function moving(e){
var szel=document.documentElement.clientWidth;
var difko=szel/20;
if (navigator.appName == "Microsoft Internet Explorer") {
dik = Math.round(window.event.clientX / difko);
} else {
dik = Math.round(e.pageX / difko);
}

document.getElementById('bambi1').style.left=(200+(parseInt(dik)*5))+"px";
document.getElementById('bambi2').style.left=(40+(parseInt(dik)*2))+"px";
}
var fgm='';
function fg_megy(oid,c,i){
	clearTimeout(fgm);
	var o=document.getElementById(oid),speed=15,m=parseInt(o.style.left);
	if (i && m>c){
		if (m-c>145) speed=60;
		o.style.left=(m-speed)+"px";
		fgm=setTimeout("fg_megy('"+oid+"',"+c+","+i+");",50);
	} else if (!i && m<c) {
		if (c-m>145) speed=60;
		o.style.left=(m+speed)+"px";
		fgm=setTimeout("fg_megy('"+oid+"',"+c+","+i+");",50);
	} else {
		o.style.left=c+"px";
		document.getElementById('fgal_bal').onclick=function(){fooldal_galeria('balra');}
		document.getElementById('fgal_jobb').onclick=function(){fooldal_galeria('jobbra');}
		var element = document.getElementById('fgal_tok');
		element.onselectstart = function () { return true; }
		element.onmousedown = function () { return true; }
	}
}
function fooldal_galeria(irany){
	document.getElementById('fgal_bal').onclick="";
	document.getElementById('fgal_jobb').onclick="";
	var element = document.getElementById('fgal_tok');
	element.onselectstart = function () { return false; }
	element.onmousedown = function () { return false; }
	var tok=document.getElementById('kepek_tok'),kolykok=tok.childNodes,ossz=0,h=kolykok.length,most=parseInt(tok.style.left);
	while(h--) if (kolykok[h].offsetWidth) if (kolykok[h].nodeName=='A') ossz+=145;
	if (irany=='jobbra'){
		if (most<=(ossz*-1)+145)
			fg_megy('kepek_tok',0,false);
		else
			fg_megy('kepek_tok',(most-145),true);
	} else {
		if (most>=0)
			fg_megy('kepek_tok',((ossz*-1)+145),true);
		else
			fg_megy('kepek_tok',(most+145),false);
	}
}
function menukiszamolo(){
	var sor=0,szum=0;
	while(document.getElementById('menu_'+sor)){
		szum+=parseInt(document.getElementById('menu_'+sor).offsetWidth);
		sor++;
	}
	document.getElementById('menu_tok').style.width=(szum+20)+"px";
	document.getElementById('menu_tok').style.left=(Math.round((550-szum)/2)+45)+"px";
}
function nyelvvalto(meik){
	clearInterval(document.mocorgo);
	if (meik==0)
		var o=document.getElementById('l_hun'),e=document.getElementById('l_deu'),mire=1,alap='hun',alap2='deu';
	else
		var e=document.getElementById('l_hun'),o=document.getElementById('l_deu'),mire=0,alap='deu',alap2='hun';
	o.style.cursor='';
	o.onmouseover='';
	o.onmouseout='';
	o.onclick='';
	o.style.backgroundImage='url(./imgs/'+alap+'_fent.png)';
	e.style.cursor='pointer';
	e.style.backgroundImage='url(./imgs/'+alap2+'_lent.png)';
	e.onmouseover=function(){ this.style.backgroundImage='url(./imgs/'+alap2+'_fent.png)'; }
	e.onmouseout=function(){ this.style.backgroundImage='url(./imgs/'+alap2+'_lent.png)'; }
	e.onclick=function(){ nyelvvalto(mire); }
	var ajaxRequest = ajax_alap(),ajaxRequest2 = ajax_alap();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var adagok=ajaxRequest.responseText.split(";");
			for (i in adagok)
				if (adagok[i]!=''){
					var szet=adagok[i].split("|");
					if (szet[0]=='menu'){
						var tmp=szet[1].split(",");
						for (j in tmp){
							document.getElementById('menuin_'+j).innerHTML="&nbsp;"+tmp[j]+"&nbsp;";
							if (document.getElementById('menuinki_'+j)) document.getElementById('menuinki_'+j).innerHTML="<b>"+tmp[j]+"</b>";
						}
						menukiszamolo();
					} else {
						if (szet[0]=='f_18' || szet[0]=='f_19')
							if (szet[0]=='f_18') document.getElementById('l_hun').title=szet[1];
							else document.getElementById('l_deu').title=szet[1];
						else
						if (document.getElementById(szet[0])) document.getElementById(szet[0]).innerHTML=szet[1];
					}
				}
			if (document.getElementById('tartalom_tarto') || document.getElementById('foold_tori')){
		var url = window.location.pathname,filename = url.substring(url.lastIndexOf('/')+1);
			if (filename=='fooldal.htm' || filename=='index.php'){
			ajaxRequest2.open("GET", "nyelv_kezelo.php?oldalt=tortenelem.htm", false);
			ajaxRequest2.send(null);
			document.getElementById('foold_tori').innerHTML=ajaxRequest2.responseText;
			egyhir(document.hiregy);
			} else {
			ajaxRequest2.open("GET", "nyelv_kezelo.php?oldalt="+filename, false);
			ajaxRequest2.send(null);
			document.getElementById('tartalom_tarto').innerHTML=ajaxRequest2.responseText;
			}
		}
			if (document.getElementById('galtarto')){
				galeria_nezo(document.gallap,document.galmax);
			}
			if (document.getElementById('hirtarto')){
				hir_beado(document.hirlap,document.hirmax);
			}
		/*if (document.body)
			document.body.removeChild(takaro);
		else
			document.documentElement.removeChild(takaro);*/
		for(i=1;i<7;i++) document.getElementById('hd_'+i).style.top='0px';
		document.mocorgo=setInterval("dolgozok();",5000);
	}}
	/*var takaro=document.createElement('div'),tsz="position: fixed; width: 100%; height: 100%; top: 0px; left: 0px; z-index: 1000; background-image: url('./imgs/alap_bg.jpg');";
		takaro.setAttribute('style',tsz);
		takaro.innerHTML="<img src='./imgs/nyelv_load.gif' style='position: fixed; left: 50%; top: 50%; margin-left: -110px; margin-top: -10px;'>";
		if (document.body)
			document.body.appendChild(takaro);
		else
			document.documentElement.appendChild(takaro);*/
	ajaxRequest.open("GET", "nyelv_kezelo.php?nyelv="+meik, true);
	ajaxRequest.send(null);
}
var hmove;
function hattermove(x,akt){
	clearTimeout(hmove);
	var bgd=document.getElementById('anbg'),speed=50;
	if (x){
		akt--;
		if (akt>0){
			if (IE) bgd.style.filter='alpha(opacity:'+akt+'0)'; else bgd.style.opacity='.'+akt;
			hmove=setTimeout('hattermove('+x+','+akt+');',speed);
		} else 
			if (IE) bgd.style.filter='alpha(opacity:0)'; else bgd.style.opacity='0';
	} else {
		akt++;
		if (akt<10){
			if (IE) bgd.style.filter='alpha(opacity:'+akt+'0)'; else bgd.style.opacity='.'+akt;
			hmove=setTimeout('hattermove('+x+','+akt+');',speed);
		} else 
			if (IE) bgd.style.filter='alpha(opacity:100)'; else bgd.style.opacity='1';
	}
}
function napszakvaltas(mire){
	var theRules = new Array(),lampa=document.getElementById('lampa'),lampavalt=document.getElementById('lampa_valto');
	if (mire==0){
		hattermove(true,10);
		lampa.style.backgroundImage='url(./imgs/fooldal/lampa.png)';
		lampavalt.onmouseover=function(){this.parentNode.style.backgroundImage='url(./imgs/fooldal/lampa2.png)';}
		lampavalt.onmouseout=function(){this.parentNode.style.backgroundImage='url(./imgs/fooldal/lampa.png)';}
		lampavalt.onclick=function(){ napszakvaltas(1); }
		var nemmire=1;
	} else {
		hattermove(false,0);
		lampa.style.backgroundImage='url(./imgs/fooldal/lampa2.png)';
		lampavalt.onmouseover=function(){this.parentNode.style.backgroundImage='url(./imgs/fooldal/lampa.png)';}
		lampavalt.onmouseout=function(){this.parentNode.style.backgroundImage='url(./imgs/fooldal/lampa2.png)';}
		lampavalt.onclick=function(){ napszakvaltas(0); }
		var nemmire=0;
	}
	var ajaxRequest = ajax_alap();
	ajaxRequest.open("GET", "nyelv_kezelo.php?vilagitas="+nemmire, false);
	ajaxRequest.send(null);
}
function mailcheck(email){
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(email) == false) {
	  document.getElementById('k_mail').parentNode.style.backgroundImage="url(./imgs/tartalmak/kitoltetlen_mezo.png)";
      alert('Hibás e-mail cím');
      return false;
   }
   return true;
}
function kapcs_ellenor(){
	var hiba=0;
	if (document.getElementById('k_nev').value==''){
		hiba++;
		document.getElementById('k_nev').parentNode.style.backgroundImage="url(./imgs/tartalmak/kitoltetlen_mezo.png)";
	}
	if (document.getElementById('k_mail').value==''){
		hiba++;
		document.getElementById('k_mail').parentNode.style.backgroundImage="url(./imgs/tartalmak/kitoltetlen_mezo.png)";
	}
	if (document.getElementById('k_uzi').value==''){
		hiba++;
		document.getElementById('k_uzi').parentNode.parentNode.style.backgroundImage="url(./imgs/tartalmak/text_mezo.png)";
	}
	if (hiba==0) document.getElementById('mail_form').submit();
}
document.gallap=0;
document.galmax=0;
function galeria_nezo(hova,max,kid){
	if (!kid) kid=0;
	document.galmax=max;
	if (hova=='bal'){
		if (document.gallap>0) document.gallap--;
	} else if (hova=='jobb'){
		if (document.gallap<max-1) document.gallap++;
	} else {
		document.gallap=hova;
	}
	for (i=1;i<=max;i++){
		var elem=document.getElementById('galapoz_'+i);
		elem.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)';
		elem.onmouseover=function(){ this.style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)'; }
		elem.onmouseout=function(){ this.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)'; }
		elem.style.cursor='pointer';
	}
	document.getElementById('galapoz_'+(document.gallap+1)).style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)';
	document.getElementById('galapoz_'+(document.gallap+1)).style.cursor='';
	document.getElementById('galapoz_'+(document.gallap+1)).onmouseover='';
	document.getElementById('galapoz_'+(document.gallap+1)).onmouseout='';
	var ajaxRequest = ajax_alap();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('galtarto').innerHTML=ajaxRequest.responseText;
	}}
	ajaxRequest.open("GET", "nyelv_kezelo.php?galeria="+kid+"&lap="+document.gallap, true);
	ajaxRequest.send(null);
}
document.hirlap=0;
document.hirmax=0;
function hir_beado(hova,max,kid){
	if (!kid) kid=0;
	document.hirmax=max;
	if (hova=='bal'){
		if (document.hirlap>0) document.hirlap--;
	} else if (hova=='jobb'){
		if (document.hirlap<max-1) document.hirlap++;
	} else {
		document.hirlap=hova;
	}
	for (i=1;i<=max;i++){
		var elem=document.getElementById('hirlapoz_'+i);
		elem.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)';
		elem.onmouseover=function(){ this.style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)'; }
		elem.onmouseout=function(){ this.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)'; }
		elem.style.cursor='pointer';
	}
	document.getElementById('hirlapoz_'+(document.hirlap+1)).style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)';
	document.getElementById('hirlapoz_'+(document.hirlap+1)).style.cursor='';
	document.getElementById('hirlapoz_'+(document.hirlap+1)).onmouseover='';
	document.getElementById('hirlapoz_'+(document.hirlap+1)).onmouseout='';
	var ajaxRequest = ajax_alap();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('hirtarto').innerHTML=ajaxRequest.responseText;
	}}
	ajaxRequest.open("GET", "nyelv_kezelo.php?hirek="+kid+"&lap="+document.hirlap, true);
	ajaxRequest.send(null);
}
document.hiregy=0;
function egyhir(hova){
	if (hova=='bal'){
		if (document.hiregy>0) document.hiregy--;
	} else if (hova=='jobb'){
		if (document.hiregy<3) document.hiregy++;
	} else {
		document.hiregy=hova;
	}
	for (i=1;i<=4;i++){
		var elem=document.getElementById('egyhirlapoz_'+i);
		elem.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)';
		elem.onmouseover=function(){ this.style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)'; }
		elem.onmouseout=function(){ this.style.backgroundImage='url(./imgs/galeria/hir_lapozo_alap.png)'; }
		elem.style.cursor='pointer';
	}
	document.getElementById('egyhirlapoz_'+(document.hiregy+1)).style.backgroundImage='url(./imgs/galeria/lapozo_alap_2.png)';
	document.getElementById('egyhirlapoz_'+(document.hiregy+1)).style.cursor='';
	document.getElementById('egyhirlapoz_'+(document.hiregy+1)).onmouseover='';
	document.getElementById('egyhirlapoz_'+(document.hiregy+1)).onmouseout='';
	var ajaxRequest = ajax_alap();
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var elmz=ajaxRequest.responseText.split("|");
			document.getElementById('ehcim').innerHTML=elmz[0];
			document.getElementById('f_hirtok').innerHTML=elmz[1];
	}}
	ajaxRequest.open("GET", "nyelv_kezelo.php?egyhir="+document.hiregy, true);
	ajaxRequest.send(null);
}
document.dolgoz=1;
function dolgozok(){
	for(i=1;i<7;i++)
		if (i==document.dolgoz)
			if (i==1) document.getElementById('hd_'+i).style.top='150px';
			else
			document.getElementById('hd_'+i).style.top=document.getElementById('hd_1').style.top;
		else
		document.getElementById('hd_'+i).style.top=(parseInt(document.getElementById('hd_'+i).style.top)-30)+'px';
		
	if (document.dolgoz==6) document.dolgoz=1; else document.dolgoz++;
}
pic1=new Image(100,25); 
pic1.src="./imgs/fooldal/lampa2.png";
