function foto(name, w, h)
{
 window.open("show_img.php?"+name, "foto","tollbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,status=no,resizable=no,width="+w+",height="+h+", top="+((screen.height/2)-(h/2))+",left="+((screen.width/2)-(w/2)));
} // foto()

function foto2(name, w, h)
{
 window.open("show_img2.php?"+name, "foto","tollbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,status=no,resizable=no,width="+w+",height="+h+", top="+((screen.height/2)-(h/2))+",left="+((screen.width/2)-(w/2)));
} // foto()


function dodaj_do_ulubionych()
{
 if( document.all )
    window.external.AddFavorite(location.href, document.title);
 else if( window.sidebar )
    window.sidebar.addPanel(document.title, location.href, "");
} // dodaj_do_ulubionych()


function ustaw_jako_startowa()
{
  if (navigator.appName == "Netscape"){
    alert("Ze względów bezpieczeństwa ta funkcja nie jest dostępna pod przeglądarkami z rodziny Mozilla oraz Netscape.");
  } else {
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage(location.href);
  }
} // ustaw_jako_startowa()





function is_checked(form, element)
{
  with (form)
  {
    for (n = 0; n < elements[element].length; n++)
      if (elements[element][n].checked)
        return true;
    alert ('Zaznacz elementy do usunięcia.');
    return false;
  }
}


function is_empty (form)
{
  with (form)
  {
    for (n = 0; n < length; n++)
    {
      if ((elements[n].type == 'text' || elements[n].type == 'textarea' || elements[n].type == 'password' || elements[n].type == 'file') && elements[n].value == '')
      {
        alert ('Wypełnij wszystkie pola tekstowe.');
        return true;
      }
    }
    return false;
  }
}

function is_username (username)
{
  if (!username.match (/^\w{3,25}$/))          // \w - [A-Za-z0-9_]
  {
    alert ('Podano nieprawidłową nazwę użytkownika.');
    return false;
  }
  return true;
}


function is_password (password)
{
  if (!password.match (/^\w{3,15}$/))
  {
    alert ('Podano nieprawidłowe hasło.');
    return false;
  }
  return true;
}


function is_email (email)
{
  if (!email.match (/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([a-z0-9](-?[a-z0-9])*\.)+[a-z]{2,3}$/))
  {
    alert ('Podano nieprawidłowy adres email.');
    return false;
  }
  return true;
}




