function OpenNewWindow(url, x, y) {
	var options = "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;
		msgWindow=window.open(url,"", options);
}

function OpenNewWindowNoScroll(url, x, y) {
	var options = "toolbar=no,menubar=no,scrollbars=no,resizable=yes,width=" + x + ",height=" + y;
		msgWindow=window.open(url,"", options);
}

function hirl_action() {
	var filter = /^.+@.+\..{2,6}$/;
	var tipus = 1;
	if (document.nwsletter.tipus[0].checked==true) tipus=1; else tipus=0;
	//window.alert(tipus);
	if (filter.test(document.nwsletter.posta.value)) {
		if (document.nwsletter.nev.value.length!=0) {
			OpenNewWindowNoScroll("hirlevel.php?e="+document.nwsletter.posta.value+"&t="+tipus+"&n="+document.nwsletter.nev.value,320,240);
		} else {
			window.alert("Kérjük add meg a neved! Köszönjük!");
		}
	} else window.alert("Hibás email cím formátum!");
}



function megjelenit(url, kep, bio)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById('szoveg').innerHTML=xmlHttp.responseText;
		document.getElementById('foAblak').style.backgroundImage = "url("+kep+")";
		document.getElementById('foAblak').style.backgroundRepeat = "no-repeat";
		if (bio>0) {
			megjelenit_bio('sub/bio_reszl.php?member='+bio);
		}
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function megjelenit_besz(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById('lista').style.visibility='hidden';
		document.getElementById('lista').style.height='1px';
		document.getElementById('reszletek').style.visibility='visible';
		document.getElementById('reszletek').style.height='158px';
        document.getElementById('tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function megjelenit_konc(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		document.getElementById('konc_lista').style.visibility='hidden';
		document.getElementById('konc_lista').style.height='1px';
		document.getElementById('konc_reszletek').style.visibility='visible';
		document.getElementById('konc_reszletek').style.height='279px';
        document.getElementById('konc_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function megjelenit_bio(url)
  {
  var xmlHttp;
  var ran_number=Math.floor(Math.random()*10000000);
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById('bio_lista').style.overflow='scroll';
		document.getElementById('bio_lista').style.visibility='hidden';
		document.getElementById('bio_lista').style.height='1px';
		
        document.getElementById('bio_reszletek').style.visibility='visible';
		document.getElementById('bio_reszletek').style.height='342px';
		document.getElementById('bio_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url+"&code="+ran_number,true);
    xmlHttp.send(null);
  }  
  
function megjelenit_videobio(url)
  {
  var xmlHttp;
  var ran_number=Math.floor(Math.random()*10000000);
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById('bio_lista').style.overflow='scroll';
		document.getElementById('bio_lista').style.visibility='hidden';
		document.getElementById('bio_lista').style.height='1px';
		
        document.getElementById('bio_reszletek').style.visibility='visible';
		document.getElementById('bio_reszletek').style.height='342px';
		document.getElementById('bio_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url+"&code="+ran_number,true);
    xmlHttp.send(null);
  }  
  
function megjelenit_gal(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById('gal_lista').style.height='1px';
        document.getElementById('gal_lista').style.overflow='scroll';
		document.getElementById('gal_lista').style.visibility='hidden';
		
		//document.getElementById('gal_reszletek').style.overflow='scroll';
		document.getElementById('gal_reszletek').style.visibility='visible';
		document.getElementById('gal_reszletek').style.height='98%';
		document.getElementById('gal_lista0').style.visibility='visible';
		document.getElementById('gal_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }  
  
function megjelenit_vendegk(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		document.getElementById('elso_oldal').style.visibility='hidden';
		document.getElementById('elso_oldal').style.height='1px';
        document.getElementById('kov_oldal').style.visibility='visible';
		document.getElementById('kov_oldal').style.height='389px';
		document.getElementById('vendegk_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function megjelenit_ujbejegy(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		document.getElementById('div_lapozas').style.visibility='hidden';
		document.getElementById('div_lapozas').style.height='0px';
		document.getElementById('div_lapozas2').style.visibility='hidden';
		document.getElementById('div_lapozas2').style.height='0px';
		document.getElementById('div_cmd').style.visibility='hidden';
		document.getElementById('div_cmd').style.height='0px';
		document.getElementById('kov_oldal').style.visibility='hidden';
		document.getElementById('kov_oldal').style.height='0px';
		document.getElementById('elso_oldal').style.visibility='hidden';
		document.getElementById('elso_oldal').style.height='0px';
        document.getElementById('uj_bejegy').style.visibility='visible';
		document.getElementById('uj_bejegy').style.height='390px';
		document.getElementById('ujbejegy_tartalom').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function megjelenit_lapozas(url)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer 6+
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
	  // Internet Explorer 5.5+
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
		document.getElementById('div_lapozas').style.visibility='hidden';
		document.getElementById('div_lapozas').style.height='1px';
		document.getElementById('div_lapozas2').style.visibility='visible';
		document.getElementById('div_lapozas2').style.height='39px';		
        document.getElementById('lapozas2').innerHTML=xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }


function checkNLMail_guest()
{
	var x = document.guest_form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x))
		return true
	else {
		return false
	}
}

function write_button() {
	if (document.guest_form.nick.value != '') {
		if (checkNLMail_guest()==false) {
			window.alert('Az E-mail cím nem helyes!');
		} else {
			if (document.guest_form.message.value != '')
			{
				var link = "sub/vendegkonyv.php?write=1&message="+document.guest_form.message.value+"&code_ell="+document.guest_form.code_ell.value+"&code="+document.guest_form.code.value+"&nick="+document.guest_form.nick.value+"&email="+document.guest_form.email.value;
				megjelenit(link,'images/hatterek/vendegkonyv.jpg');
			}
			else window.alert('Minden mezőt ki kell tölteni!');
		}
	} else window.alert('Minden mezőt ki kell tölteni!');
}