function write_it(status_text) {
  window.status=status_text;
}

function generate() {
  var enev = document.adat.name.value;
  var eaddr = document.adat.mail.value;  
  hiba= "For this you will need the e-mail address.\n\n The registration-code is to check the availability the addresses.\n\nWe have a letter to you e-mail address with a 14 character code, that you must copy here.\n\nThe registrations code is available only today!\n\n";
  if ( eaddr == "" ) { alert(hiba); return false; }
  if (eaddr.indexOf('@')<1) { alert(hiba); return false;}
	eaddr = escape(eaddr);
  popup("help.php?id=7&email="+eaddr+"&nev="+enev,400,350);
}

function popup(page,w,h)
{
  if (screen.availHeight<h) hx=screen.availHeight;
  else hx=h;  
  
  if (screen.availWidth<w) wx=screen.availWidth;
  else wx=w;   

	oldal = window.open(page, 'pop', 'status=no,width='+w+'px,height='+h+'px,toolbar=no,location=no,directories=no,scrollbars=no,resizable=no,copyhistory=no');
	oldal.moveTo(((screen.availWidth/2)-(wx/2)), ((screen.availHeight/2)-(hx/2)));
  oldal.resizeTo(w,h);  
	oldal.focus();
}

function teszt(adat,minta){
  for (var i=0; i<adat.length; i++)
    if (minta.indexOf(adat.charAt(i)) == -1)
      return false;
  return true;
}

function num(mezo){
  if (!teszt(mezo.value,"1234567890")){
    return false;
  }else{ return true; }
}

function numpont(mezo){
  if (!teszt(mezo.value,"1234567890,")){
    return false;
  }else{ return true; }
}

function adatcheck(){
  var s_name = document.adat.name.value;
  var s_mail = document.adat.mail.value;
  var s_irsz = document.adat.irsz.value;
  var s_city = document.adat.city.value;
  var s_adr = document.adat.adr.value;
  var s_darab = document.adat.darab.value;
  
  if ( s_name == "" ) { alert("Please give your name!"); document.adat.name.focus(); return false; }
  if ( s_mail == "" ) { alert("Please give your e-mail address, wherewith our staff intercourse with you hold can!"); document.adat.mail.focus(); return false; }
  if ( s_irsz == "" )  { alert("Please give your zipcode!"); document.adat.irsz.focus(); return false; }
  if ((s_irsz)&&(num(document.adat.irsz))) {  } else { alert("Please give only number at the zipcode!"); document.adat.irsz.focus(); return false; }
  if ( s_irsz.length != 4 )  { alert("Please give 4 numbers at the zipcode!"); document.adat.irsz.focus(); return false; }
  
  if ( s_city == "" )  { alert("Please give the city!"); document.adat.city.focus(); return false; }
  if ( s_adr == "" )  { alert("Please give the street and streetnumber!"); document.adat.adr.focus(); return false; }
  if ( s_darab == "" )  { alert("Please give the necessary piece!"); document.adat.darab.focus(); return false; }
  if ((s_darab)&&(num(document.adat.darab))) {  } else { alert("Please give only number at the piece!"); document.adat.darab.focus(); return false; }
  if ( s_darab == "0" ) { alert("Please give the necessary piece!"); document.adat.darab.focus(); return false; }
}

function adatcheckreg(){
  var s_name = document.adat.name.value;
  var s_mail = document.adat.mail.value;
  var s_pass1 = document.adat.pass1.value;
  var s_pass2 = document.adat.pass2.value;
  var s_code = document.adat.code.value;
  
  if ( s_name == "" ) { alert("Please give your name!"); document.adat.name.focus(); return false; }
  if ( s_name.length < 5 ) { alert("The name is too short! (minimum 5 character)"); document.adat.name.focus(); return false; }  
  if ( s_mail == "" ) { alert("Please give your e-mail address!"); document.adat.mail.focus(); return false; }
  if ( s_pass1 == "" ) { alert("Please give the password!"); document.adat.pass1.focus(); return false; }
  if ( s_pass1 != s_pass2 ) { alert("The two password are don't match!"); document.adat.pass1.focus(); return false; }
  if ( s_pass1.length < 5 ) { alert("The password is too short! (minimum 5 character)"); document.adat.pass1.focus(); return false; }  
  if ( s_code == "" ) { alert("Please give the registrations code that you have recieve in e-mail!"); document.adat.code.focus(); return false; }
}

function adatcheckkapcs(){
  var s_name = document.adat.name.value;
  var s_mail = document.adat.mail.value;
  var s_cim = document.adat.cim.value;
  var s_kat = document.adat.kat.value;
  var s_leir = document.adat.leir.value;

  if ( s_name == "" ) { alert("Please give your name!"); document.adat.name.focus(); return false; }
  if ( s_name.length < 5 ) { alert("The name is too short! (minimum 5 character)"); document.adat.name.focus(); return false; }
  if ( s_mail == "" ) { alert("Please give your e-mail address!"); document.adat.mail.focus(); return false; }
  if ( s_cim == "" ) { alert("Please give the title of the article!"); document.adat.cim.focus(); return false; }
  if ( s_kat == 0 ) { alert("Please give the chategoty of the article!"); document.adat.kat.focus(); return false; }
  if ( s_leir == "" ) { alert("Please give the text of the article!"); document.adat.leir.focus(); return false; }
}

function UnCryptMailto(s)	{
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	location.href=r;
}
