function sprawdzNIP( inputVal )
{
  if ( !inputVal.match( /^[0-9]{3}-[0-9]{2}-[0-9]{2}-[0-9]{3}$/ ) )
  {
    return false;
  }
  var ar = inputVal.replace(/-/g,'');
  var arg = inputVal.replace(/-/g,'');
  var coefficients = "657234567";
  var sum=0;
  var index=8;
  for (index=8; index>=0 ;index--)if( rr==false )
    sum += (parseInt(coefficients.charAt(index)) * parseInt(arg.charAt(index)));
   if ( (sum % 11) == 10 ? false : ((sum % 11) == parseInt(arg.charAt(9))) )
    return true;

  return false;
}

function walidacja_danych_oso()
        {

        reg = /^[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬._]{1,30}@[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+(\.[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+)+$/;
        wyn = document.dane_oso.e_mail.value.match(reg);
        if (wyn == null)
                {
                alert("Proszê podaæ prawid³owy adres e-mail!");
                return false;
                }
        spra=true;
        if (document.dane_oso.imie.value == "") spra = false
        if (document.dane_oso.tresc.value == "") spra = false
        if (document.dane_oso.e_mail.value == "") spra = false
		

		
        if (spra==false) alert('Proszê wype³niæ wszystkie pola!');
                return spra;
        }


function walidacja_rejestracja(){
	reg = /^[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬._-]{1,30}@[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+(\.[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+)+$/;
    wyn = document.dane_oso.email.value.match(reg);
	if (wyn == null)
	{
		alert("Proszê podaæ prawid³owy adres e-mail!");
		return false;
	}
	spra=true;
	if (document.getElementById('kla1').checked==false ) spra = false; //sprawdzenie czy jest zaznaczone pole wyrazam zgode na przetwarzanie moich danych
	if (document.dane_oso.imie.value == "") spra = false
	if (document.dane_oso.nazwisko.value == "") spra = false
	if (document.dane_oso.email.value == "") spra = false
	if (document.dane_oso.pass.value == "") spra = false
	if (document.dane_oso.pass1.value == "") spra = false
	if (document.dane_oso.adres.value == "") spra = false
	if (document.dane_oso.kod.value == "") spra = false
	if (document.dane_oso.miejsc.value == "") spra = false 
	if (document.dane_oso.tel.value == "") spra = false
	if (document.dane_oso.tel_kom.value == "") spra = false
	spra2=true;
	if(document.dane_oso.nip.value != "")
	spra2=sprawdzNIP( document.dane_oso.nip.value );
	
	if (spra==false) alert('Proszê wype³niæ wszystkie pola oznaczone gwiazdk±!');
    if (spra2==false){
		alert('Proszê wype³niæ poprawnie nr NIP! (xxx-xx-xx-xxx)');
		return spra2;
	}
  return spra;
}

       function walidacja_profil()
        {

        reg = /^[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬._-]{1,30}@[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+(\.[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬-]+)+$/;
        wyn = document.dane_oso.email.value.match(reg);
        if (wyn == null)
                {
                alert("Proszê podaæ prawid³owy adres e-mail!");
                return false;
                }
        spra=true;
	if (document.getElementById('kla1').checked==false ) spra = false; //sprawdzenie czy jest zaznaczone pole wyrazam zgode na przetwarzanie moich danych
        if (document.dane_oso.imie.value == "") spra = false
        if (document.dane_oso.nazwisko.value == "") spra = false
        if (document.dane_oso.email.value == "") spra = false
	if (document.dane_oso.pass.value == "") spra = false
	if (document.dane_oso.pass1.value == "") spra = false
	if (document.dane_oso.adres.value == "") spra = false
	if (document.dane_oso.kod.value == "") spra = false
	if (document.dane_oso.miejsc.value == "") spra = false       
	if (document.dane_oso.tel.value == "") spra = false
	if (document.dane_oso.tel_kom.value == "") spra = false
	if (spra==false) alert('Proszê wype³niæ wszystkie pola oznaczone gwiazdk±!');
        return spra;
        }
        
function walidacja_kontakt()
        {

        reg = /^[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬]{1,30}@[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬]+(\.[a-zA-Z0-9±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬]+)+$/;
        wyn = document.dane_kontakt.e_mail.value.match(reg);
        if (wyn == null)
                {
                alert("Proszê podaæ prawid³owy adres e-mail!");
                return false;
                }
        spra=true;
        if (document.dane_kontakt.imie_nazwisko.value == "") spra = false
        if (document.dane_kontakt.nazwa_firmy.value == "") spra = false
        if (document.dane_kontakt.e_mail.value == "") spra = false
        if (document.dane_kontakt.telefon.value == "") spra = false
        if (document.dane_kontakt.tresc_kontakt.value == "") spra = false
        if (spra==false) alert('Proszê wype³niæ wszystkie pola!');
                return spra;
        }
        
function ShowHideCenter(stan)
{
  if(document.getElementById)
  {
    var div1 = document.getElementById('opis1');
    var div2 = document.getElementById('opis2');
    var div3 = document.getElementById('opis3');
    var div4 = document.getElementById('opis4');
    var div5 = document.getElementById('opis5');
    
    var l1 = document.getElementById('link1');
    var l2 = document.getElementById('link2');
    var l3 = document.getElementById('link3');
    var l4 = document.getElementById('link4');
    var l5 = document.getElementById('link5');

    if (stan == 1)
    {
     div1.style.display = "block";
     div2.style.display = "none";
     div3.style.display = "none";
     div4.style.display = "none";
     div5.style.display = "none";
     l1.style.background = "#313131";
     l2.style.background = "#202020";
     l3.style.background = "#202020";
     l4.style.background = "#202020";
     l5.style.background = "#202020";
    }
    if (stan == 2)
    {
     div1.style.display = "none";
     div2.style.display = "block";
     div3.style.display = "none";
     div4.style.display = "none";
     div5.style.display = "none";
     l1.style.background = "#202020";
     l2.style.background = "#313131";
     l3.style.background = "#202020";
     l4.style.background = "#202020";
     l5.style.background = "#202020";
    }
    if (stan == 3)
    {
     div1.style.display = "none";
     div2.style.display = "none";
     div3.style.display = "block";
     div4.style.display = "none";
     div5.style.display = "none";
     l1.style.background = "#202020";
     l2.style.background = "#202020";
     l3.style.background = "#313131";
     l4.style.background = "#202020";
     l5.style.background = "#202020";
    }
    if (stan == 4)
    {
     div1.style.display = "none";
     div2.style.display = "none";
     div3.style.display = "none";
     div4.style.display = "block";
     div5.style.display = "none";
     l1.style.background = "#202020";
     l2.style.background = "#202020";
     l3.style.background = "#202020";
     l4.style.background = "#313131";
     l5.style.background = "#202020";
    }
    if (stan == 5)
    {
     div1.style.display = "none";
     div2.style.display = "none";
     div3.style.display = "none";
     div4.style.display = "none";
     div5.style.display = "block";
     l1.style.background = "#202020";
     l2.style.background = "#202020";
     l3.style.background = "#202020";
     l4.style.background = "#202020";
     l5.style.background = "#313131";
    }
  }
}


