
// newsletter
function ReqPassVal(ReqPass) 
 {

var UserReqEMail = ReqPass.elements['e_mail'].value;
 if (UserReqEMail == "")
  {
     alert("Musisz wpisać adres e-mail!");
     ReqPass.elements['e_mail'].style.backgroundColor='#FFF9EC';
     return false;
  }
else if (!(UserReqEMail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1))
 {
    alert("Podany e-mail jest nieprawidłowy.\n Popraw adres i spróbuj ponownie.");
    ReqPass.elements['e_mail'].style.backgroundColor='#FFF9EC';
    return false ;
}
return true;
}


// kontakt
function UnameContactFocus() 
 {
   document.getElementById('fname').style.backgroundColor = '#fcf7fa'; 
   document.getElementById('lblconuname').style.color = '#000000';
   document.getElementById('lblconuname').innerHTML = 'Imię i nazwisko:'; 
}
function UemailContactFocus() 
 {
   document.getElementById('email').style.backgroundColor = '#fcf7fa'; 
   document.getElementById('lblconemail').style.color = '#000000';
   document.getElementById('lblconemail').innerHTML = 'E-mail:';
}
function UcommentContactFocus() 
 {
   document.getElementById('comments').style.backgroundColor = '#fcf7fa'; 
   document.getElementById('lblcomment').style.color = '#000000';
   document.getElementById('lblcomment').innerHTML = 'Tre¶ć:';
}
// Handle Contact Form Validation
function ContactVal(ConForm) 
 {
 var FirstName = ConForm.elements['fname'].value;
 var UserEMail = ConForm.elements['email'].value;
 var ConComments = ConForm.elements['comments'].value;
if (FirstName == "" && UserEMail == "" && ConComments =="") 
  {
     // Change the background color of the textbox,border as well as label text
     document.getElementById('fname').style.backgroundColor='#FFF4F4'; 
     document.getElementById('fname').style.border = '1px solid #CC0000';
     document.getElementById('lblconuname').style.color = '#CC0000';
     document.getElementById('lblconuname').innerHTML = 'Uzupełnij dane:';
     document.getElementById('email').style.backgroundColor='#FFF4F4'; 
     document.getElementById('email').style.border = '1px solid #CC0000';
     document.getElementById('lblconemail').style.color = '#CC0000';
     document.getElementById('lblconemail').innerHTML = 'Uzupełnij dane:';
     document.getElementById('comments').style.backgroundColor='#FFF4F4'; 
     document.getElementById('comments').style.border = '1px solid #CC0000';
     document.getElementById('lblcomment').style.color = '#CC0000';
     document.getElementById('lblcomment').innerHTML = 'Uzupełnij dane:';
     alert("Proszę uzupełnić wymagane dane.\n- Imię i Nazwisko\n- Adres e-mail\n- Tre¶ć");
     return false;
}
// Contact First name
 if (FirstName == "")
  {
     alert("Musisz podać swoje Imię i Nazwisko");
     document.getElementById('fname').style.backgroundColor='#FFF4F4'; 
     document.getElementById('fname').style.border = '1px solid #CC0000';
     document.getElementById('lblconuname').style.color = '#CC0000';
     document.getElementById('lblconuname').innerHTML = 'Uzupełnij dane:';
     return false;
  }
// Allow only letters 
else if (FirstName.search(/^[a-zA-Z±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬ ]+$/i) == -1) 
  {
     alert ("Podane Imię i Nazwisko zawiera niedopuszczalne znaki.\n Popraw dane i spróbuj ponownie.");
     document.getElementById('fname').style.backgroundColor='#FFF4F4'; 
     document.getElementById('fname').style.border = '1px solid #CC0000';
     document.getElementById('lblconuname').style.color = '#CC0000';
     document.getElementById('lblconuname').innerHTML = 'Popraw dane:';
     return false;
} 
 // Contact Email
 if (UserEMail == "")
  {
     alert("Musisz podać swój adres e-mail");
     document.getElementById('email').style.backgroundColor='#FFF4F4'; 
     document.getElementById('email').style.border = '1px solid #CC0000';
     document.getElementById('lblconemail').style.color = '#CC0000';
     document.getElementById('lblconemail').innerHTML = 'Uzupełnij dane:';
     return false;
  }
else if (!(UserEMail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1))
 {
    alert("Podany adres jest nieprawidłowy.\n Popraw dane i spróbuj ponownie.");
    document.getElementById('email').style.backgroundColor='#FFF4F4'; 
    document.getElementById('email').style.border = '1px solid #CC0000';
    document.getElementById('lblconemail').style.color = '#CC0000';
    document.getElementById('lblconemail').innerHTML = 'Popraw dane:';
    return false ;
}
 // Contact Comments Field
 if (ConComments == "")
  {
     alert("Je¶li chcesz przekazać nam informacje lub pytania wpisz je w pole Tre¶ć.");
     document.getElementById('comments').style.backgroundColor='#FFF4F4'; 
     document.getElementById('comments').style.border = '1px solid #CC0000';
     document.getElementById('lblcomment').style.color = '#CC0000';
     document.getElementById('lblcomment').innerHTML = 'Uzupełnij dane:';
     return false;
  }
return true;
}

