function swapimg(id,dir) {
	oldid = document.getElementById("actsm").value;
	menu = document.getElementById("menuke").value;

	if(dir == 1) {
		newimg = id+'a.gif?x=1';
	} else {
		newimg = id+'.gif?x=1';
	}

	if(menu == 0) { //fõoldal
		if((id == 2 || id == 6) && dir == 1) smenu(id,1);
		if((id == 2 || id == 6) && dir == 0) {
			if(oldid != 2 && oldid != 6) smenu(id,0);
		}
		if (id != oldid) {
			document.getElementById("menu"+id+"img").src = '/images/menu/m'+newimg;
			document.getElementById("menu"+id+"bg").style.backgroundColor = (dir == 1)?'#98B6D3':'#5386B5';
		}
		if(dir == 1 && id != oldid && oldid != '') {
			smenu(oldid,0);
			swapimg(oldid,0);
		}
	}

	if(menu == 2 || menu == 6) { //almenus oldal
		if((id == 2 || id == 6) && dir == 1 && id != menu) {
			smenu(menu,0);
			smenu(id,1);
		}
		if (id != oldid && menu != id) {
			document.getElementById("menu"+id+"img").src = '/images/menu/m'+newimg;
			document.getElementById("menu"+id+"bg").style.backgroundColor = (dir == 1)?'#98B6D3':'#5386B5';
		}
		if(id != 2 && id != 6 && id != menu && oldid != menu) {
			smenu(oldid,0);
			swapimg(oldid,0);
			smenu(menu,1);
		}
	}

	if(menu == 1 || menu == 3 || menu == 4 || menu == 5) { //almenutlen oldal
		if((id == 2 || id == 6) && dir == 1) smenu(id,1);
		if((id == 2 || id == 6) && dir == 0) {
			if(oldid != 2 && oldid != 6) smenu(id,0);
		}
		if(id != oldid && menu != id) {
			document.getElementById("menu"+id+"img").src = '/images/menu/m'+newimg;
			document.getElementById("menu"+id+"bg").style.backgroundColor = (dir == 1)?'#98B6D3':'#5386B5';
		}
		if(dir == 1 && id != oldid && oldid != '' && menu != id) {
			smenu(oldid,0);
			swapimg(oldid,0);
		}

		if(id == menu && oldid != '' && dir == 1) {
			smenu(oldid,0);
			swapimg(oldid,0);
		}
	}
}

function smenu(id,dir) {
	if(dir == 1) {
		sm = '';
		document.getElementById("actsm").value = id;
	} else {
		sm = 'none';
		document.getElementById("actsm").value = '';
	}
	document.getElementById("smenu"+id).style.display = sm;
}

function showmap(melyik) {
	sw = screen.width;
	sh = screen.height;
	lf = (sw/2)-(448/2);
	tp = (sh/2)-(448/2);
	if(melyik == 'denis') {
		window.open('/includes/denismap.html','','width=448, height=448, left='+lf+', top='+tp);
	} else {
		window.open('/includes/focusmap.html','','width=448, height=448, left='+lf+', top='+tp);		
	}
}

function showmap2() {
	sw = screen.width;
	lf = (sw/2)-(800/2);
	window.open('/includes/denismap.html','','width=820, height=600, left='+lf+', top=50, scrollbars=1');
}

function qa() {
	hiba = 0;
	hibas = '<img src=/images/hiba.gif>';
	
	neve = document.qaform.name.value;
	emailcim = document.qaform.email.value;
	kerdes = document.qaform.question.value;

	if(neve == '') { r1 = hibas; hiba++; } else { r1 = '' };

	ereg = new RegExp("^[a-zA-Z0-9\.\-_]{2,}@([a-zA-Z0-9\-_]{2,}\.){1,7}[a-zA-Z]{2,3}$");
	if(!ereg.test(emailcim)) {
		r2 = hibas;
		hiba++;
	} else {
		r2 = '';
	}
	
	if(kerdes == '') { r3 = hibas; hiba++; } else { r3 = '' };

	document.getElementById("row1").innerHTML = r1;
	document.getElementById("row2").innerHTML = r2;
	document.getElementById("row3").innerHTML = r3;
	
	if(hiba == 0) document.qaform.submit();
}

function pagerfunc() {
	start = document.getElementById("pagerselect").value;
	document.location = "/qa/?list=1&start="+start;
}

function mezo(id,hiba) {
	document.getElementById(id).style.backgroundColor = '#84B1D9';
	document.getElementById(id).style.color = '#FFFFFF';
	document.getElementById(id).onfocus = function vissza() {
		this.style.backgroundColor = '#F0F5F8';
		this.style.color = '#333333';
	};
	hiba++;
	return hiba;
}

function formcheck(melyik) {
	f = document.anForm;
	hiba = 0;
	if(f.name.value == "") hiba = mezo('name',hiba);
	if(f.email.value == "") hiba = mezo('email',hiba);
	if(f.tel.value == "") hiba = mezo('tel',hiba);
	if(f.t1.value == "") hiba = mezo('t1',hiba);
	telminta = RegExp("^[0-9/-]{6,}$");
	emailminta = RegExp("^[a-zA-Z0-9\.\-_]{2,}@([a-zA-Z0-9\-_]{2,}\.){1,7}[a-zA-Z]{2,3}$");
	if(!telminta.test(f.tel.value)) hiba = mezo('tel',hiba);
	if(!emailminta.test(f.email.value)) hiba = mezo('email',hiba);
	if(hiba == 0) {
		document.getElementById("melyik").value = melyik;
		f.submit();		
	}
}

function showform(i) {
	lf = screen.width/2-212;
	tp = screen.height/2-300;	
	window.open('/pf/form.php?i='+i,'','width=424, height=600, left='+lf+', top='+tp);
}