/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/
function P7_colH2(){ 
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ 
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ 
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ 
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}


// form validalas


function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' helyes mailcímet tartalmazzon.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' csak számokat tartalmazhat.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' számokat kell hogy tartalmazzon '+min+' és '+max+' között.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' hiányos.\n'; }
    } if (errors) alert('Hiba:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

// jump menu selecthez

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// input mezobe erteket rak
function MM_setTextOfTextfield(objId,x,newText) { //v9.0
  with (document){ if (getElementById){
    var obj = getElementById(objId);} if (obj) obj.value = newText;
  }
}


// psw validalas es szabalyzat elfogadas validalas

function checkForm(form)
  {
    // validation fails if the input is blank
    if(form.psw.value == '') {
      alert("A jelszó üres!");
      form.psw.focus();
      return false;
    }

    // regular expression to match alphanumeric characters and spaces
    var re = /^[A-Za-z\d]{1,20}$/;
    //var re = /^[\w ]+$/;
     // var re = /^(\s*)([\W\w]*)(\b\s*$)/;
    
    // validation fails if the input doesn't match the regular expression
    if(!re.test(form.psw.value)) {
      alert("A jelszóhoz ékezetes betűket és szóközt ne használj!");
      form.psw.focus();
      return false;
    }
    
    if(!document.form1.elfogad.checked){alert("A szabályzatot el kell fogadni ahoz, hogy a közöségnek a tagja legyél."); 
return false; } 
    
    // validation was successful
    return true;
  }
  

// jelszo kontroll adatlap

function validatePwd() {
var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
var pw1 = document.editform.Jelszo.value;
var pw2 = document.editform.Jelszo2.value;
// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('A jelszavadat kétszer írd be.');
return false;
}
// check for minimum length
if (document.editform.Jelszo.value.length < minLength) {
alert('A jelszavad minimum ' + minLength + ' karakter legyen.');
return false;
}
// check for spaces
if (document.editform.Jelszo.value.indexOf(invalid) > -1) {
alert("Ne használj a jelszóban szóközt.");
return false;
}
else {
if (pw1 != pw2) {
alert ("Nem írtad be kétszer ugyanazt a jelszót.");
return false;
}
else {
return true;
      }
   }
}


function orszagbeall(x)
	{
	db=document.getElementById('orszag').options.length
	for(i=0;i<db;i++)
	    {
		if (x==document.getElementById('orszag').options[i].value)
			{
			document.getElementById('orszag').selectedIndex=i;
			orszag_csere(i)
			break;
			}
		}
	}
function megyebeall(x)
	{
	db=document.getElementById('megye').options.length
	for(i=0;i<db;i++)
	    {
		if (x==document.getElementById('megye').options[i].value)
			{
			document.getElementById('megye').selectedIndex=i;
			megye_csere(i)
			break;
			}
		}
	}

function varosbeall(x)
	{
	db=document.getElementById('varos').options.length
	for(i=0;i<db;i++)
	    {
		if (x==document.getElementById('varos').options[i].value)
			{
			document.getElementById('varos').selectedIndex=i;
			break;
			}
		}
	}


function orszag_csere(mire)
{
mire--
v=mire
// Régi megye kitörlés
db=document.getElementById('megye').options.length
for(i=0;i<db;i++)
    {
    document.getElementById('megye').options[0]=null
    }
// Régi város kitörlés
db=document.getElementById('varos').options.length
for(i=0;i<db;i++)
    {
    document.getElementById('varos').options[0]=null
    }
if (mire>=0)
    {
	newOptionName = new Option("--- Válassz megyét ---", 0);
	document.getElementById('megye').options[0] = newOptionName;
	t=tomb[mire]
	for(i=2;i<t.length;i++)
	   {
		newOptionName = new Option(t[i][1], t[i][0]);
		document.getElementById('megye').options[i-1] = newOptionName;
	   }
	}
}

function megye_csere(mire)
{
mire--
// Régi megye kitörlés
db=document.getElementById('varos').options.length
for(i=0;i<db;i++)
    {
    document.getElementById('varos').options[0]=null
    }
if (mire>=0)
   {
	newOptionName = new Option("--- Válassz települést ---", 0);
	document.getElementById('varos').options[0] = newOptionName;
	t=tomb[v][mire+2]
	for(i=2;i<t.length;i++)
	   {
		newOptionName = new Option(t[i][1], t[i][0]);
		document.getElementById('varos').options[i-1] = newOptionName;
	   }
	}
}

