/*
 *  sprawdza poprawność maila
 */
function checkMail(str)
{
   Wzor=/^[_0-9a-zA-Z.-]+\@[0-9a-zA-Z-]+\.[0-9a-zA-Z.]+$/;
   OK=( Wzor.test(str) == true && str.length != 0 );
   if ( OK )
   {
      return true;
   }
   else
   {
      alert( "Błędny adres email." );
      return false;
   }
}

/*
 *  sprawdza pola przy logowaniu
 */

function validateTresci( tytul, tresc )
{
   if( tytul != "" )
   {
      if( tresc != "" )
      {
         return true;
      }
      else
      {
         alert("Pole z tekstem nie może być puste!");
         return false;
      }
   }
   else
   {
      alert("Pole z tytułem nie może być puste!");
      return false;
   }
}

function validateLogin( login, password )
{
   if( login != "" )
   {
      if( password != "" )
      {
         return true;
      }
      else
      {
         document.getElementById('error').style.display = 'block';
         document.getElementById('error').innerHTML = '<b>Podaj hasło!</b>';
         return false;
      }
   }
   else
   {
      document.getElementById('error').style.display = 'block';
      document.getElementById('error').innerHTML = '<b>Podaj login!</b>';
      return false;
   }
}

/*
 * Odlicznie
 */
function odliczanie( ile , licznik, id ) {
   if( (ile - licznik) == 0) {
      //document.getElementById(id).style.display = 'none';
      Effect.Fade(id);
   } else {
      document.getElementById('licz').innerHTML = '<b>'+(ile-licznik)+'</b>';
      setTimeout("odliczanie("+ile+","+(licznik+1)+",'"+id+"')" , 1000);
   }
}

function popUp( strUrl, intWidth, intHeight )
{
   window.open(strUrl,'okienko','scrollbars=yes, resize=yes, status=no, toolbar=no, location=no, directories=no, width='+intWidth+', height='+intHeight+', left=100, top=100');  
};

