var submitcount=0;

function reset() {
with (document.forms['contactform'])
{
name.value="";
mail.value="";
tipp.value="";
}
}

function checkFields() {   
with (document.forms['contactform'])
{                 
if (                                    
     (veznev.value=="") ||
 (kernev.value=="")  ||
 (varos.value=="")  ||
 (cim.value=="") ||
 (irsz.value=="")  ||
 (mail.value==""))
   {
   alert("Minden mező kötelező!");
   return false;
   }

else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("Ezt az űrlapot már elküldted egyszer!");
      return false;
      }
   }
	}
}
    

function openwindow(theURL, width, height) {
    settings = 'resizable=no,scrollbars=yes,left=0,top=0,width='+width+',height='+height;
    newwindow = window.open(theURL, 'winName', settings);
    if (window.focus) {newwindow.focus()}
}
      
/*A popup függvényei*/
function closeMyPopup() {
  document.getElementById("mypopup").style.display = "none";
}

function myPopupRelocate() {
  var scrolledX, scrolledY;
  if( self.pageYOffset ) {
    scrolledX = self.pageXOffset;
    scrolledY = self.pageYOffset;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    scrolledX = document.documentElement.scrollLeft;
    scrolledY = document.documentElement.scrollTop;
  } else if( document.body ) {
    scrolledX = document.body.scrollLeft;
    scrolledY = document.body.scrollTop;
  }

  var centerX, centerY;
  if( self.innerHeight ) {
    centerX = self.innerWidth;
    centerY = self.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    centerX = document.documentElement.clientWidth;
    centerY = document.documentElement.clientHeight;
  } else if( document.body ) {
    centerX = document.body.clientWidth;
    centerY = document.body.clientHeight;
  }

  var leftOffset = scrolledX + (centerX - 1060) / 2;
  var topOffset = scrolledY + (centerY - 525) / 2;

  document.getElementById("mypopup").style.top = topOffset + "px";
  document.getElementById("mypopup").style.left = leftOffset + "px";
}

function fireMyPopup() {
  myPopupRelocate();
  document.getElementById("mypopup").style.display = "block";
  document.body.onscroll = myPopupRelocate;
  window.onscroll = myPopupRelocate;
  /*window.setTimeout("closeMyPopup()", 15000);*/
}
