function verifyPESEL(a){b=Array(9,7,3,1);c=0;for(i=0;i<=9;i++){c=(c+a[i]*b[i%4])%10;}if(a[10]==c)return true;return false;}
function verifyNIP(a){b=Array(6,5,7,2,3,4,5,6,7);c=0;for(i=0;i<9;i++)c+=a[i]*b[i];if((c%11)%10==a[9])return true;return false;}
function checkFormKontakt(){if(document.kontakt.email.value!=''&&document.kontakt.imie.value!=''&&document.kontakt.nazwisko.value!=''&&document.kontakt.firma.value!=''&&document.kontakt.wiadomosc.value!=''&&document.kontakt.captcha.value!=''){return true;}else{alert('Wszystkie wymagane pola muszą być wypełnione!');return false;}}
function checkFormKontakt2(){if(document.kontakt.email.value!=''&&document.kontakt.imie.value!=''&&document.kontakt.nazwisko.value!=''&&document.kontakt.firma.value!=''&&document.kontakt.wiadomosc.value!=''){return true;}else{alert('Wszystkie wymagane pola muszą być wypełnione!');return false;}}
function checkFormZmianaHasla(){if(document.formzmianahasla.pass1.value!=''&&document.formzmianahasla.pass2.value!=''){if(document.formzmianahasla.pass1.value==document.formzmianahasla.pass2.value){if(document.formzmianahasla.pass1.value.length>5){return true;}else{alert('Nowe hasło musi mieć przynajmniej sześć znaków!');return false;}}else{alert('Oba pola z nowym hasłem muszą być identyczne!');return false;}}else{alert('Oba pola z nowym hasłem muszą być wypełnione!');return false;}}
function checkFormZmianaDanychUczestnika(){if(document.formzmianadanychuczestnika.imie.value!=''&&document.formzmianadanychuczestnika.nazwisko.value!=''&&document.formzmianadanychuczestnika.pesel.value!=''&&document.formzmianadanychuczestnika.email.value!=''&&document.formzmianadanychuczestnika.gsm.value!=''){if(document.formzmianadanychuczestnika.pesel.value.length==11&&verifyPESEL(document.formzmianadanychuczestnika.pesel.value)){if(document.formzmianadanychuczestnika.email.value.length<6){alert('Adres e-mail jest nieprawidłowy!');return false;}}else{alert('Numer PESEL jest nieprawidłowy!');return false;}}else{alert('Wszystkie wymagane pola muszą być wypełnione!');return false;}}
function checkFormZmianaDanychDoWysylki(){if(document.formzmianadanychdowysylki.ulica.value!=''&&document.formzmianadanychdowysylki.miasto.value!=''&&document.formzmianadanychdowysylki.zip.value!=''){return true;}else{alert('Wszystkie wymagane pola muszą być wypełnione!');return false;}}
function getFlashMovieObject(movieName){if(top.document.embeds[movieName]){return top.document.embeds[movieName];}if(top.window.document[movieName]){return top.window.document[movieName];}if(top.window[movieName]){return top.window[movieName];}if(top.document[movieName]){return top.document[movieName];}return null;}
function stanf(comm){fmo=getFlashMovieObject('africa');fmo.SetVariable("stan",comm);}
function pokazNagrode(foto,nazwa,model){
	var nagroda = '<div align="center"><img src="'+foto+'" class="click" /><br /><br /><h4 class="nagroda_duza">'+ nazwa + ' (' + model + ')</h4></div>';
	$(".jedna_kartka").fadeOut('slow'); 
	$("#promocja_membrany").fadeOut('slow'); 
	$("#nagroda").html(nagroda);
	$("#nagroda").slideDown('slow');
	$("#nagroda").click(function(){
			$(this).slideUp('fast');
			$(".jedna_kartka").fadeIn('slow'); 
			$("#promocja_membrany").fadeIn('slow'); 
			});
}
