var RULES = 	{	"name"				:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a nev"+ch(233)+"t!","english")},
			"login"				:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg felhaszn"+ch(225)+"l"+ch(243)+"i nev"+ch(233)+"t!","english")},
			"password"			:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg jelszav"+ch(225)+"t!","english")},
			"password2"			:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg m"+ch(233)+"gegyszer a jelszav"+ch(225)+"t!","english")},
			"_password"			:	{"type":"eq","source":"password","target":"password2","msg":Array("","A k"+ch(233)+"t jelsz"+ch(243)+" nem egyezik meg!","english")},
			"email"				:	{"type":"reg","reg":/^[a-z0-9._-]+@([a-z0-9-]{2,})([.][a-z0-9-]{2,})*[.][a-z]{2,3}$/i,"msg":Array("","A megadott e-mail c"+ch(237)+"m nem helyes!","english")},
			"postai_cim_orszag"		:	{"type":"sel","reg":/[0-9]+/,"msg":Array("","Nem adta meg a postai c"+ch(237)+"m eset"+ch(233)+"n az orsz"+ch(225)+"got!","english")},
			"postai_cim_varos"		:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a postai c"+ch(237)+"m eset"+ch(233)+"n az v"+ch(225)+"rost!","english")},
			"postai_cim_iranyitoszam"	:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a postai c"+ch(237)+"m eset"+ch(233)+"n az ir"+ch(225)+"ny"+ch(237)+"t"+ch(243)+"sz"+ch(225)+"mot!","english")},
			"postai_cim_cim"		:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a postai c"+ch(237)+"m c"+ch(237)+"m"+ch(233)+"t!","english")},
			"postai_cim_telefon"		:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg vagy nem helyesen adta meg a postai c"+ch(237)+"m eset"+ch(233)+"n a telefonsz"+ch(225)+"mot!","english")},
			"postai_cim_email"		:	{"type":"reg","reg":/^[a-z0-9._-]+@([a-z0-9-]{2,})([.][a-z0-9-]{2,})*[.][a-z]{2,3}$/i,"msg":Array("","A postai c"+ch(237)+"mn"+ch(233)+"l megadott e-mail c"+ch(237)+"m nem helyes!","english")},
			"szallitasi_cim_orszag"		:	{"type":"sel","reg":/[0-9]+/,"msg":Array("","Nem adta meg a sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"m eset"+ch(233)+"n az orsz"+ch(225)+"got!","english")},
			"szallitasi_cim_varos"		:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"m eset"+ch(233)+"n az v"+ch(225)+"rost!","english")},
			"szallitasi_cim_iranyitoszam"	:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"m eset"+ch(233)+"n az ir"+ch(225)+"ny"+ch(237)+"t"+ch(243)+"sz"+ch(225)+"mot!","english")},
			"szallitasi_cim_cim"		:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg a sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"m c"+ch(237)+"m"+ch(233)+"t!","english")},
			"szallitasi_cim_telefon"	:	{"type":"reg","reg":/.+/,"msg":Array("","Nem adta meg vagy nem helyesen adta meg a sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"m eset"+ch(233)+"n a telefonsz"+ch(225)+"mot!","english")},
			"szallitasi_cim_email"		:	{"type":"reg","reg":/^[a-z0-9._-]+@([a-z0-9-]{2,})([.][a-z0-9-]{2,})*[.][a-z]{2,3}$/i,"msg":Array("","A sz"+ch(225)+"ll"+ch(237)+"t"+ch(225)+"si c"+ch(237)+"mn"+ch(233)+"l megadott e-mail c"+ch(237)+"m nem helyes!","english")}
		};
var CIMITEM = 	{	"orszag"	:	"select",
			"varos"		:	"text",
			"cim"		:	"text",
			"iranyitoszam"	:	"text",
			"postafiok"	:	"text",
			"telefon"	:	"text",
			"fax"		:	"text",
			"email"		:	"text"
		}
			
function regisztracio()
 {
  var form=document.regisztracioForm;
  var ok=true;

  for (var i in RULES)
   {
    var elem = form["fh_"+i];

    switch (RULES[i].type)
     {
      case "reg"	: if (!RULES[i].reg.exec(elem.value)) {ok=false;alert(RULES[i].msg[LANG]);} break;
      case "reg2"	: if (elem.value!="" && !RULES[i].reg.exec(elem.value)) {ok=false; alert(RULES[i].msg[LANG]);} break;
      case "eq"		: if (form["fh_"+RULES[i].source].value!=form["fh_"+RULES[i].target].value) {ok=false; alert(RULES[i].msg[LANG]);} break;
      case "sel"	: if (!RULES[i].reg.exec(elem.selectedIndex<0 ? "" : elem.options[elem.selectedIndex].value)) {ok=false;alert(RULES[i].msg[LANG]);} break;
      default		: break;
     }
    if (!ok) break;
   }
  if (ok)
   {
    form._action.value = "regisztracio";
    form.submit();
   }
 }

function checkPostafiok()
 {
  var form = document.regisztracioForm;
  var p_postafiok  = form.fh_postai_cim_postafiok.value;
  var sz_postafiok = form.fh_szallitasi_cim_postafiok.value;
  var p_fax  = form.fh_postai_cim_fax.value;
  var sz_fax = form.fh_szallitasi_cim_fax.value;  
  
  if (p_postafiok!="" && p_postafiok!="-") form.fh_postai_cim_cim.value='-';
  if (sz_postafiok!="" && sz_postafiok!="-") form.fh_szallitasi_cim_cim.value='-';
  if (p_fax=="") form.fh_postai_cim_fax.value='-';
  if (sz_fax=="") form.fh_szallitasi_cim_fax.value='-';
 }

function cimCopy()
 {
  var form=document.regisztracioForm;
  for (var i in CIMITEM)
   {
    var source = form["fh_postai_cim_"+i];
    var target = form["fh_szallitasi_cim_"+i];
    switch (CIMITEM[i])
     {
      case "text"	:	target.value = source.value; break;
      case "select"	:	target.selectedIndex = source.selectedIndex; break;
      default		: 	break;
     }
   }
 }




