function Brakproduktusprawdz()
{
	reg = /^[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬._]{1,30}@[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬-]+(\.[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬-]+)+$/;
	wyn = document.brakproduktu.brak_produktu_mail.value.match(reg);
    
	if (document.brakproduktu.brak_produktu_nazwa.value == "") { alert("Proszę wpisać nazwę produktu!"); 	return false; }
	else if (document.brakproduktu.brak_produktu_mail.value !="" && wyn == null) { alert("Podany adres email jest nieprawidłowy!"); return false; }
	else return true;
}




function MM_jumpMenu(targ,selObj,restore)
	{ //v3.0
	eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
	}

function maskujKlawisze(AEvent, AMaska)
{
    if (window.Event) {
        kodKlawisza = AEvent.which;
    } else {
        kodKlawisza = AEvent.keyCode;
    }
// 8 - backspace  // 13 - enter  // 0 klawisze sterujace  // 39 , 37 strzalki
    if ( kodKlawisza == 8 || kodKlawisza == 13 || kodKlawisza == 0 ||kodKlawisza == 37 || kodKlawisza == 39)
	{
        return true;  // Enter
    };
 
    klawisz = String.fromCharCode(kodKlawisza);
 
    if (AMaska.indexOf(klawisz) == -1) {
        return false;
    } else {
        return true;
    }
}	
	

function addToBookmarks( sTitle, sHref ) 
{
if( window.sidebar && window.sidebar.addPanel ) {
//Gecko (Netscape 6 etc.) - add to Sidebar
window.addPanel( sTitle, sHref, '' );
} else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
//IE Win32 or iCab - checking for AddFavorite produces errors for no
//good reason, so I use a platform and browser detect.
//adds the current page page as a favourite; if this is unwanted,
//simply write the desired page in here instead of 'location.href'
window.external.AddFavorite( window.location.href, document.title );
} else if( window.opera && window.print ) {
//Opera 6+ - add as sidebar panel to Hotlist
return true;
} else if( document.layers ) {
//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
//not target page)
window.alert( 'Proszę kilknšć OK a pu&#65533;niej Ctrl+D aby dodać strone do ulubionych' );
} else {
//other browsers - tell them to add a bookmark (adds current page, not target page)
window.alert( 'Proszę użyć manu przeglšdarki by utworzyć dodać strone do ulubionych' );
}
return false;
}
	
//SPRAWDZANIE CZY WYBRANO ROZMIAR PRODUKTU I ILOSC PRODUKTÓW
function walidacja_wymiar()
	{
	
	reg = /^[0-9]/;
    wyn = document.form_produkt.ilosc.value.match(reg);	
	
	var zmienna = document.form_produkt.opcja;
	
	var opcja = zmienna.options[zmienna.selectedIndex].text;
	var stan = true;
	
	if (opcja == "wybierz"){stan = false;}
	if (stan == false){alert("Proszę wybrać rozmiar!");}

	if (wyn == null) //WALIDACJA ILOSCI PRODUKTÓW NA STRONIE Z PODGLĄDEM PRODUKTU
		{
		alert("Proszę wpisać poprawn± ilo¶ć!");
		return false;
		}
	else
		{
		if (document.form_produkt.ilosc.value <= 0)
			{
			alert("Proszę wpisać poprawn± ilo¶ć!");
			return false;
			}
		}
	return stan;
	
	}
//SPRAWDZANIE CZY WYBRANO ROZMIAR PRODUKTU I ILOSC PRODUKTÓW

	
//WALIDACJA CZY UŻYTKOWNIK WYBRAŁ FORMĘ PRZESYŁKI
function rodzaj_dostawy(i)
	{
	spra=true;
	var j;
	for (j=1;j<=i;j++)
		{
		var id;
		var stan;
		id = "a"+j;
		
		if ((document.getElementById(id).checked == true))
			{
			stan = 1;
			spra = true;
			}
			
		if (stan ==1)
			{
			spra = true;
			}
		else
			{
			spra = false;
			}
		}
	if (spra==false) alert('Proszę wybrać formę przesyłki!');
        return spra;
	}
//WALIDACJA CZY UŻYTKOWNIK WYBRAŁ FORMĘ PRZESYŁKI

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;
        }
		
//SPRAWDZANIE CZY NIE WPROWADZONO UJEMEJ LICZBY W POLU ILOSC W PRODUKTACH	
function walidacja_ilosc_produktow()
	{
	reg = /^[0-9]/;
    wyn = document.form_produkt.ilosc.value.match(reg);	
	
	if (wyn == null)
		{
		alert("Proszę wpisać poprawn± ilo¶ć!");
		return false;
		}
	else
		{
		if (document.form_produkt.ilosc.value <= 0)
			{
			alert("Proszę wpisać poprawn± ilo¶ć!");
			return false;
			}
		}
	}
//SPRAWDZANIE CZY NIE WPROWADZONO UJEMEJ LICZBY W POLU ILOSC W PRODUKTACH

//WALIDACJA REJESTRACJI
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;
                }
		
		//AKCEPTACJA REGULAMINU
		if (document.getElementById('kla1').checked==false ) 
			{
			alert("Proszę zaakceptować regulamin!");
			return false;
			}
		//AKCEPTACJA REGULAMINU

		//WALIDACJA POZOSTAŁEJ CZESCI FORMULARZA
		spra=true;
		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.ulica.value == "") spra = false
		if (document.dane_oso.numer_domu.value == "") spra = false
		if (document.dane_oso.kod.value == "") spra = false
		if (document.dane_oso.miejsc.value == "") spra = false       
		if (spra==false) alert('Proszę wypełnić wszystkie pola oznaczone gwiazdk±!');
        return spra;
        }
//WALIDACJA REJESTRACJI

//WALIDACJA FORMULARZA W PROFILU
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.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.ulica.value == "") spra = false
		if (document.dane_oso.numer_domu.value == "") spra = false
		if (document.dane_oso.kod.value == "") spra = false
		if (document.dane_oso.miejsc.value == "") spra = false 
		if (spra==false) alert('Proszę wypełnić wszystkie pola oznaczone gwiazdk±!');
        return spra;
        }
//WALIDACJA FORMULARZA W PROFILU
        
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 ShowAllOpis(stan)
	{
	alert(stan);
	}
	
function ShowPrzechowlania(stan)
	{
		if (stan == 1) //PRZECHOWALNIA
			{
			document.getElementById('przechowalniaid01_left').style.display = "none";
			document.getElementById('przechowalnia').style.display = "block";
			
			document.getElementById('logowanied03_left').style.display = "block";
			document.getElementById('logowanie').style.display = "none";
			
			document.getElementById('koszyk').style.display = "none";
			}
		
		if (stan == 2) //LOGOWANIE
			{
			document.getElementById('logowanie').style.display = "none";
			document.getElementById('przechowalnia').style.display = "none";
			document.getElementById('koszyk').style.display = "block";
			}
			
		if (stan == 3) //KOSZYK
			{
			document.getElementById('przechowalniaid01_left').style.display = "block";
			document.getElementById('przechowalnia').style.display = "none";
			
			document.getElementById('logowanied03_left').style.display = "none";
			document.getElementById('logowanie').style.display = "block";
			
			document.getElementById('koszyk').style.display = "none";
			}
	}
        
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";
    }
  }
}

function ShowHideDiv(idp,allid,ilosc,ido)
{
  var  sel = ido.options[ido.selectedIndex].value;
  var i;
  var warstwa;
  var tabido = allid.split(".");
  for(i=0;i<ilosc;i+=1)
  {
	warstwa = 'p' + idp + 'o' + tabido[i];
	var div = document.getElementById(warstwa);
	div.style.display = "none";
	//alert (warstwa);
  }
  warstwa = 'p' + idp + 'o' + sel;
  var div = document.getElementById(warstwa);
  //alert ('Pokaz' + warstwa);
  div.style.display = "block";
}
//POKYWANIE I UKRYWANIE CENY

//PO KLIKNIECIU W PRZYCISK RADIO OPCJI
function ShowHideDiv1(nron,ilosc)
{
	document.getElementById("opcja"+nron).checked = true;
	document.getElementById("select_cena_zwykla").style.display = "none";	
	
	var stan;
	for(i=1;i<=ilosc;i++)
		{
		document.getElementById("select"+i).style.display = "none";	
		document.getElementById("select_cena"+i).style.display = "none";	
		}
	document.getElementById("select"+nron).style.display = "block";	
	document.getElementById("select_cena"+nron).style.display = "block";	
}
//PO KLIKNIECIU W PRZYCISK RADIO OPCJI

//AKCJA PO KLIKNIĘCIU W PRZYCISK RADIO, DLA PLATNOSCI PL
function ShowHide2(nron)
{
	var stan;
	if (nron == 1)
	{
		document.getElementById("p1").style.display = "block";	
		document.getElementById("p2").style.display = "none";	
	}
	else
	{
		document.getElementById("p2").style.display = "block";	
		document.getElementById("p1").style.display = "none";	
	}
}
//AKCJA PO KLIKNIĘCIU W PRZYCISK RADIO, DLA PLATNOSCI PL


function DostawcyPokazPlatnosci(pokaz,ilosc)
{
	var warstwa;
	for(i=1;i<=ilosc;i++)
	{
		warstwa = 'dostawcy_box_'+i;
		var div = document.getElementById(warstwa);
		div.style.display = "none";
	}

	warstwa = 'dostawcy_box_'+pokaz;
	var div = document.getElementById(warstwa);
	div.style.display = "block";	
	
	document.getElementById('pierwsza_platnosc_'+pokaz).checked=true;

}












