/*
 * Created on 2006-11-11
 *
 * author: Dariusz Grabowski
 */

aEL(window, 'load', start);

function w(e,t){//t-tekst
  if(this.value==t) this.value='';
}

function s(e,t){//t-tekst
  if(this.value=='') this.value=t;
}

function sb(){//t-tekst
  i=document.getElementById('nazwisko');
  if (i.value=='' || i.value=='Wpisz imie i nazwisko'){
    alert('Podaj imie i nazwisko');
    i.focus();
    return false}
  i=document.getElementById('email');
  if (i.value==''  || i.value=='Wpisz adres poczty elektronicznej'|| !(/^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*@([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)*(\.[a-zA-Z]{2,4})$/i.test(i.value))){
    alert('Podaj adres email');
    i.focus();
    return false}
  i=document.getElementById('wiadomosc');
  if (i.value==''  || i.value=='Tu wpisz swoje pytanie lub komentarz'){
    alert('Podaj tresc wiadomosci');
    i.focus();
    return false}

 return true;// if(this.value=='') this.value=t;
}

function start(ev) {
  i=document.getElementById('nazwisko');
  t='Wpisz imie i nazwisko'
  if (i.value=='')
    i.value=t;
  aEL(i, 'focus', w, t);

  i=document.getElementById('email');
  t='Wpisz adres poczty elektronicznej';
  if (i.value=='')
    i.value=t;
  aEL(i, 'focus', w, t);

  i=document.getElementById('wiadomosc');
  t='Tu wpisz swoje pytanie lub komentarz';
  if (i.value=='')
    i.value=t;
  aEL(i, 'focus', w,t);

  aEL(document.getElementById('nazwisko'), 'blur', s, 'Wpisz imie i nazwisko');
  aEL(document.getElementById('email'), 'blur', s, 'Wpisz adres poczty elektronicznej');
  aEL(document.getElementById('wiadomosc'), 'blur', s, 'Tu wpisz swoje pytanie lub komentarz');

 aEL(document.getElementById('kontakt'), 'submit', sb);


}