function open_gallery_win( galfile )
{
  var sx = (screen.width / 2)-360;
  var sy = (screen.height / 2)-270;
  window.open ( galfile, "", "width=720,height=540,left="+sx+",top="+sy );
}

function nothing()
{
}

function countdown(cnt)
{
  cnt = cnt - 1;
  if ( cnt < 1 && document.getElementById('iscnt').checked )
  {
    if ( document.getElementById('cntnext').value != '0' )
    {
      location.href = "gallery.php?id="+document.getElementById('cntnext').value+"&gal="+document.getElementById('cntgal').value+"&count="+document.getElementById('iscnt').checked;
    }
  }
  else
  {
    if ( document.getElementById('iscnt').checked )
    {
      document.getElementById('cntvalue').value = cnt;
      setTimeout ('countdown('+cnt+')', 1000);
    }
    else
    {
      document.getElementById('cntvalue').value = "3";
      setTimeout ('nothing()', 1);
    }
  }
}

function gallery_counter()
{
  cnt = 3;
  document.getElementById('cntvalue').value = cnt;
  if ( document.getElementById('iscnt').checked )
  {
    setTimeout ('countdown(cnt)', 1000);
  }
  else
  {
    document.getElementById('cntvalue').value = "3";
    setTimeout ('nothing()', 1);
  }
}

function check_email_form()
{
  if ( document.contactform.msgname.value == "" )
  {
    alert("Nem adott meg nevet!")
    document.contactform.msgname.focus();
    document.contactform.msgname.select();
  }
  else if ( document.contactform.msgemail.value == "" )
  {
    alert("Nem adott meg e-mail címet!")
    document.contactform.msgemail.focus();
    document.contactform.msgemail.select();
  }
  else if ( document.contactform.msgemail.value.indexOf('@') < 0 || document.contactform.msgemail.value.indexOf('.') < 0 )
  {
    alert("Érvénytelen e-mail címet adott meg!")
    document.contactform.msgemail.focus();
    document.contactform.msgemail.select();
  }
  else if ( document.contactform.msgtext.value == "" )
  {
    alert("Nem írt üzenetet!")
    document.contactform.msgtext.focus();
    document.contactform.msgtext.select();
  }
  else
  {
    document.contactform.submit();
  }
}
