function getcity(obj) {
      if (obj.value.length==4) {
	    var link='irsz';
	    link+=''
        n=link+
		"am."+"php?"+"irszam="+obj.value;
        document.getElementById('ttt_city_controll').src=n;
      }
}
function add(n) {
max=parent.opener._max
hany=0
mehet=true
for (i=1;i<=max;i++) {
  if (parent.opener.document.getElementById("szakmak"+i).value=='') {
     if (mehet) {
       hany++
       parent.opener.document.getElementById("szakmak"+i).value=n
       mehet=false
     }
  } else {
    hany++
  }
}
parent.topFrame.display_result()
if (hany==max) parent.window.close()
}

function del(n) {
  document.getElementById("szakmak"+n).value='';
}
function kinyit(url,target,param) {
   mywindow=window.open(url,target,param);
   mywindow.focus();
 }

function check() {
ablak=window.open('','w1','location=no,resizable=yes,toolbar=no,scrollbars=yes,width=450,height=100')
form=document.getElementById('rendel')
mi=new Array('ad','ch','ec')
form.action=mi[1]+mi[2]+'k'+'.'+'p'+'hp'
form.target='w1'
form.submit()
ablak.focus()
}

var nyitva='nincs';

function is_popup() {
 if (nyitva=='igen') alert('Az Ön popup blokkolója megakadályozta az ablak megnyitását.');
}

function login(site) {
nyitva='igen';
ablak=window.open("/"+site, "Login", "toolbar=no,directories=no,menubar=no,status=no,resizeable=no,location=no,width=590,height=430,top=150,left=300");
ablak.focus();
setTimeout("is_popup()",2000);
}

function charcheck(obj)
{
  var finaly = obj;
  var i;
  var s;

  s = "";
  for (i=0; i<obj.value.length; i++)
  {
    if ((obj.value.charAt(i) == '0')  || (obj.value.charAt(i) == '1') || (obj.value.charAt(i) == '2')
      || (obj.value.charAt(i) == '3') || (obj.value.charAt(i) == '4') || (obj.value.charAt(i) == '5')
      || (obj.value.charAt(i) == '6') || (obj.value.charAt(i) == '7') || (obj.value.charAt(i) == '8')
      || (obj.value.charAt(i) == '9'))
    {

      s += obj.value.charAt(i);
    }
  }

  finaly.value = s;
}

function talloz() {

var tallozas=window.open('tallozas_parent.php','tallozas','location=no,resizable=yes,toolbar=no,scrollbars=no,width=650,height=700,top=0')
tallozas.focus()

}

function javaslat(kod) {
parent.rightFrame.location.href='tallozas_right.php?kod='+kod
}


function setMaxLength() {
	var x = document.getElementsByTagName('textarea');
	var counter = document.createElement('div');
	counter.className = 'counter';
	for (var i=0;i<x.length;i++) {
		if (x[i].getAttribute('maxlength')) {
			var counterClone = counter.cloneNode(true);
			counterClone.relatedElement = x[i];
			counterClone.innerHTML = '<span>0</span>/'+x[i].getAttribute('maxlength');
			x[i].parentNode.insertBefore(counterClone,x[i].nextSibling);
			x[i].relatedElement = counterClone.getElementsByTagName('span')[0];

			x[i].onkeyup = x[i].onchange = checkMaxLength;
			x[i].onkeyup();
		}
	}
}

function checkMaxLength() {
	var maxLength = this.getAttribute('maxlength');
	var currentLength = this.value.length;
	if (currentLength >= maxLength) {
       this.value=this.value.substr(0,maxLength)
       currentLength=maxLength
    }
	this.relatedElement.firstChild.nodeValue = currentLength;
	// not innerHTML
}
