function scriptInit() {
if (!document.getElementById) {
	return;
	}
}
function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
	elm.addEventListener(evType, fn, useCapture);
	return true;
	} else if (elm.attachEvent) {
	var r = elm.attachEvent('on' + evType, fn);
	return r;
	} else {
	elm['on' + evType] = fn;
	}
}
function checkActive() {
	var a = document.getElementsByTagName("a");
	if (window.location.href.substr(location.href.length - 1, 1) == '/') {
		var loc = window.location.href + 'index.html'; 
	}
	else {
		var loc = window.location.href;
	}
	for(var i=0; i < a.length; i++) {
		if (a[i].href == loc) {
			a[i].setAttribute("class", "active");
			a[i].setAttribute("className", "active");
		}
	}
}
addEvent(window, 'load', checkActive, false);




/* 
function setActive() {
 
    aObjj = document.getElementById('menu-header').getElementsByTagName('a');
  for(i=0;i<aObjj.length;i++) {
    if(document.location.href.indexOf(aObjj[i].href)>=0) {
      aObjj[i].className='activee';
    }
  }
  
  
  aObj = document.getElementById('menu-left').getElementsByTagName('a');
  for(i=0;i<aObj.length;i++) {
    if(document.location.href.indexOf(aObj[i].href)>=0) {
      aObj[i].className='active';
    }
  }
    
}*/


function check_email(e)
{
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++)
{
 if(ok.indexOf(e.charAt(i))<0){return (false);}
}

if (document.images)
{
 re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
 re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
  if (!e.match(re) && e.match(re_two)){return (-1);}
}
}


function check_contact_form(f)
{

 if(f.meno.value.length < 1)
 {
 alert("Kérem adja meg a nevét.");
 return false;
 }
 
 if(f.tel.value.length < 1)
 {
 alert("Tel. mező nincs kitöltve.");
 return false;
 }
 
 if(!check_email(f.email.value))
 {
 alert("Emai mező nincs kitöltve.");
 return false;
 }
 
 if(f.predmet.value.length < 1)
 {
 alert("Tárgy mező nincs kitöltve.");
 return false;
 }
 
  if(f.sprava.value.length < 1)
 {
 alert("Üzenet mező nincs kitöltve.");
 return false;
 }
 
 if(f.captcha.value.length < 4)
 {
 alert("Kérem írja be a biztonsági kódot.");
 return false;
 }
 
}
