//FLASH plugin verzió
var flash_plugin=0;
if(navigator.plugins && navigator.plugins.length){
	plugin=navigator.plugins["Shockwave Flash"];
	if(plugin && plugin.description) flash_plugin=plugin.description.charAt(plugin.description.indexOf('.')-1);
	if(navigator.plugins["Shockwave Flash 2.0"]) flash_plugin=2;
}else{
	document.writeln('<SCRIPT LANGUAGE="VBScript">');
	document.writeln('on error resume next');
	document.writeln('For i = 2 to 6');
	document.writeln('If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then');
	document.writeln('Else flash_plugin = i');
	document.writeln('End If');
	document.writeln('Next');
	document.writeln('</SCRIPT>');
}

//érték ellenőrzése
function ert_ell(_val, _type, _length1, _length2) {
	switch (_type.toLowerCase()) {
		case 'szam':
				x = parseInt(_val, 10);
				if (!isNaN(x)) {
					if (x == _val) return true;
				}
				return false;
			break;
		case 'egyszam':
				zz = _val;
				for (x = 0;x < zz.length;x++) if (!isNaN(parseInt(zz.charAt(x)))) return true;
				return false;
			break;
		case 'egybetu':
				zz = _val;
				for (x = 0;x < zz.length;x++) if (isNaN(parseInt(zz.charAt(x)))) return true;
				return false;
			break;
		case 'minhossz':
				x = "_" + _val;
				if (x.length >= _length1 + 1) return true;
				return false;
			break;
		case 'maxhossz':
				x = '_' + _val;
				if (x.length <= _length1 + 1) return true;
				return false;
			break;
		case 'minmax':
				x = "_" + _val;
				if ((x.length >= _length1 + 1) && (x.length <= _length2 + 1)) return true;
				return false;
			break;
		case 'emailcim':
				var kukac = _val.indexOf('@');
				if (kukac < 1) return false;
				if (_val.length < kukac+3) return false;
				var vege = _val.substr(kukac+1);
				var vanbenne = false;
				if (kukac+1 == _val.length) return false;
				for (i=kukac+1;i<_val.length;i++)
					if (_val.charAt(i) == '.')
						vanbenne = i;
				if (!vanbenne) return false;
				if (_val.length-vanbenne < 3) return false;
				return true;
			break;
	}
}

function radio_ell(radio) {
	var checked = false;
	for (i=0;i<radio.length;i++)
		if (radio[i].checked)
			checked = true;
	return checked;
}

function ell(miben, szoveg) {
	if (miben.value == '') {
		//window.scrollBy(0,-10);
		uzenet(szoveg, miben);
		//miben.focus();
		return false;
	}
	return true;
}

function ell2(bool, miben, szoveg, scroll) {
	if (ell2.arguments[3] == undefined)
		scroll = false;
	if (bool == false) {
		if (scroll) {
			if (typeof(miben) == 'string' && miben.charAt(0) == '#')
				window.location = miben;
			else
				miben.scrollIntoView();
		}
		uzenet(szoveg, miben);
		return false;
	}
	return true;
}

function uzenet(str, obj) {
	mutat(true, str, obj);
}

function mutat(bool, uzenet, hova) {
	var layer = document.getElementById('uzenet').style;
	var layer_hatter = document.getElementById('uzenet_hatter').style;
	l = (screen.width/2)-(302/2);
	t = (screen.height/2)-(300/2)+document.documentElement.scrollTop;
	layer.left = l+'px';
	layer.top = t+'px';

	if (bool) {
		var td = document.getElementById('hibauzenet');
		td.innerHTML = uzenet;
		document.hova = hova;
	}
	layer_hatter.display = (bool) ? '' : 'none';
	elrejt(l, t, 302, 120, 'SELECT');
	if (!bool && document.hova != null) {
		if (typeof(document.hova) == 'string' && document.hova.charAt(0) == '#')
			window.location = document.hova;
		else
			document.hova.focus();
	}
}

function csakszam(_e) {
	var _key = (document.all) ? window.event.keyCode : 0;

	if (((_key > 47) && (_key < 58)) ||
		 ((_key > 95) && (_key < 106)) ||
		 (_key == 8) || (_key == 9) ||
		 (_key == 37) || (_key == 39) ||
		 (_key == 17) || (_key == 16) ||
		 (_key == 46) || (_key == 13) ||
		 (_key == 109) || (_key == 107)
		)
		return true;

	window.event.returnValue = false;
	return false;
}

function kugras(form,hol,hanykarakter,hova) {
	var _key = (document.all) ? window.event.keyCode : 0;

	if ((_key == 8) || (_key == 9) ||
		 (_key == 37) || (_key == 39) ||
		 (_key == 17) || (_key == 16) ||
		 (_key == 46) || (_key == 13))
		return true;
	if (form && hanykarakter && hova) {
		var df = document.forms[form];
		if (df[hol].value.length == hanykarakter)
			df[hova].focus();
	}
	return true;
}

function onlynum(_e) {
	var _key = (document.all) ? window.event.keyCode : 0;

	if (((_key > 47) && (_key < 58)) ||
		 ((_key > 95) && (_key < 106)) ||
		 (_key == 8) || (_key == 9) ||
		 (_key == 37) || (_key == 39) ||
		 (_key == 17) || (_key == 16) ||
		 (_key == 46) || (_key == 13))
		return true;

	window.event.returnValue = false;
	return false;
}

function elrejt(x, y, w, h, tipus) {
	if (!document.all)
		return false;
	var selx,sely,selw,selh,i;
	if (elrejt.arguments[4] == undefined)
		tipus = 'SELECT';
	var sel=document.body.getElementsByTagName(tipus);
	for(i=0;i<sel.length;i++){
		selx=0;
		sely=0;
		var selp;
		if (sel[i].offsetParent) {
			selp=sel[i];
			while (selp.offsetParent) {
				selp=selp.offsetParent;
				selx+=selp.offsetLeft;
				sely+=selp.offsetTop;
			}
		}
		selx+=sel[i].offsetLeft;
		sely+=sel[i].offsetTop;
		selw=sel[i].offsetWidth;
		selh=sel[i].offsetHeight;
		if (selx+selw>x && selx<x+w && sely+selh>y && sely<y+h) {
			if (sel[i].style.visibility != 'hidden')
				sel[i].style.visibility='hidden';
			else
				sel[i].style.visibility='';
		}
	}
}


function csakszam(_e) {
	var _key = (document.all) ? window.event.keyCode : 0;

	if (((_key > 47) && (_key < 58)) ||
		 ((_key > 95) && (_key < 106)) ||
		 (_key == 8) || (_key == 9) ||
		 (_key == 37) || (_key == 39) ||
		 (_key == 17) || (_key == 16) ||
		 (_key == 46) || (_key == 13) ||
		 (_key == 109) || (_key == 107)
		)
		return true;

	if (document.all)
		window.event.returnValue = false;
	return false;
}

// =================== DyLL PRELOADER =======================

var dyll_imgArray = new Array();

// ---------------------------

function dyll_imgDatas(nname, nourl, nnurl) {
	this.name = nname;
	this.oUrl = nourl;
	this.nUrl = nnurl;
	this.origImg = new Image();
	this.newImg = new Image();
	this.origImg.src = this.oUrl;
	this.newImg.src = this.nUrl;
}

// ---------------------------

function dyll_imgLoad(nam, orig, neww) {
	dyll_imgArray[nam] = new dyll_imgDatas(nam, orig, neww);
}

function imgOver(nam,nam2) {
	nam1 = (!nam2) ? nam : nam2;
	document.images[nam].src = dyll_imgArray[nam1].newImg.src;
}

function imgOut(nam,nam2) {
	nam1 = (!nam2) ? nam : nam2;
	document.images[nam].src = dyll_imgArray[nam1].origImg.src;
}

function inpOver(obj,nam2) {
	nam1 = (!nam2) ? nam : nam2;
	obj.src = dyll_imgArray[nam1].newImg.src;
}

function inpOut(obj,nam2) {
	nam1 = (!nam2) ? nam : nam2;
	obj.src = dyll_imgArray[nam1].origImg.src;
}

function lapvalt(szam,lapszam) {
	for (i=1;i<lapszam+1;i++) {
		t = document.getElementById('tartalom'+i);
		if (i == szam) {
			imgOver('lap'+i);
			t.style.display = '';
		} else {
			imgOut('lap'+i);
			t.style.display = 'none';
		}
	}
	aktivlap = szam;
}

function nonflash_valt(szam) {
	aktkep += szam;
	if (aktkep == 0)
		aktkep = 3;
	if (aktkep == 4)
		aktkep = 1;
	document.images['noflash'].src = dyll_imgArray['noflash'+aktkep].origImg.src;
}

function betoltes() {
	if (!osszlap)
		osszlap = 3;
	//alert(typeof(kezdolap));
	if (window.kezdolap)
		hova = kezdolap;
	else
		hova = 1;
	//alert(kezdolap);
	if (!window.aktivlap) {
		aktivlap = hova;
		lapvalt(aktivlap,osszlap);
	}
}
// ---------------------------

function popup(Nev,wi,he) { // onclick="popup('xyz.html','300','200')"
	var str="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+wi+",height="+he+",left=20,top=40";
	var nyit = window.open(Nev,"tartalom",str);
	nyit.focus();
}

function popup_ask(Id) { // onclick="popup('xyz.html','300','200')"
	var str="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=390,height=330,left=20,top=40";
	var nyit = window.open("popup_kerdojel.php?id="+Id,"tartalom",str);
	nyit.focus();
}

function PopupPic(sPicURL) { 
    window.open( "showThumb.php?"+sPicURL, "","resizable=1,HEIGHT=200,WIDTH=200"); 
} 
		
function get_order(){
	var date = new Date();
	var win = window.open('order.php?ts='+date.getTime(), 'order');
	win.focus();
}

//--------------------------

function kereses_csek2() {
var frm = document.forms['search'];
	if (!ell2(ert_ell(frm.q.value, 'minmax', 3, 20),frm.q,"Please type longer word!")) return false;
	return true;
}

function kereses_csek_hu() {
var frm = document.forms['search'];
	if (!ell2(ert_ell(frm.q.value, 'minmax', 3, 20),frm.q,"Kérjük, hosszabb keresendő szót adjon meg!")) return false;
	return true;
}

function kereses_csek_en() {
var frm = document.forms['search'];
	if (!ell2(ert_ell(frm.q.value, 'minmax', 3, 20),frm.q,"Please type longer word!")) return false;
	return true;
}

function ablak(nev, w, h, scroll) {
	if (ablak.arguments[3] == undefined)
		sc = 1;
	else
		sc = ablak.arguments[3];
	var str='scrollbars='+sc+',width='+w+',height='+h+',left='+((screen.width/2)-(w/2))+',top='+((screen.height/2)-(h/2));
	var nyit = window.open(nev, 'tartalom', str);
	nyit.focus();
}
