function changeto(highlightcolor)
{
	source = event.srcElement;
	if (source.tagName == "TR" || source.tagName == "TABLE") return;
	while (source.tagName != "TR") source = source.parentElement;
	if (source.style.backgroundColor != highlightcolor && source.id != "ignore") source.style.backgroundColor = highlightcolor;
}

function changeback(originalcolor)
{
	if (event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id == "ignore") return;
	if (event.toElement != source) source.style.backgroundColor = originalcolor;
}

if (document.all) 
{
	function getrealtop(l) 
	{
		ypos = l.offsetTop;
		temp_l = l.offsetParent;

		while(temp_l != null) 
		{
			ypos += temp_l.offsetTop;
			temp_l = temp_l.offsetParent;
		}
		return ypos;
	}
}

function setPromoYpos()
{
	if (document.all) 
	{
		document.all['promolayer'].style.top = getrealtop(document.all['id_promopic']);
	}

	if (document.layers || (!document.all && document.getElementById)) 
	{
		kepY = document.images['promopic'].y;
		if (document.layers) document.layers['promolayer'].top = kepY;
		if (document.getElementById) document.getElementById('promolayer').style.top = kepY;
	}
}

function ell(miben,szoveg) {
  if (miben.value == '') {
    miben.focus();
    alert(szoveg);
    return false;
  }
  return true;
}

function ell2(bool,miben,szoveg) {
  if (bool == false) {
    miben.focus();
    alert(szoveg);
    return false;
  }
  return true;
}

function ert_ell(_val, _type, _length) {
	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 >= _length + 1) return true;
				return false;
			break;
    case "maxhossz":
				x = "_" + _val;
				if (x.length <= _length + 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 emailell(df) {
  if (!ell(df.email,'Kérjük, add meg az e-mail címedet.')) return false;
  if (!ell2(ert_ell(df.email.value,'emailcim'),df.email,'Kérjük, valóban működő e-mail címet adj meg.')) return false;
  return true;
}