function snewsletter(){
	if (document.mainform.email.value==''){
		alert('Proszę wpisać poprawnie adres e-mail !');
		document.mainform.email.focus();
		return false;
	} else {
		if ((document.mainform.email.value.indexOf("@")==document.mainform.email.value.lastIndexOf("@"))&&(document.mainform.email.value.charAt(document.mainform.email.value.indexOf("@")+1) != '.')&&(document.mainform.email.value.charAt(document.mainform.email.value.indexOf("@")-1) != '.')&&(document.mainform.email.value.indexOf("@") != 0)&&(document.mainform.email.value.indexOf(".") != 0)&&(document.mainform.email.value.lastIndexOf(".") > document.mainform.email.value.indexOf("@"))){
			return true;
		} else {
			alert('Proszę wpisać poprawnie adres e-mail !');
			document.mainform.email.focus();
			return false;
		}
	}
}

<!-- zamowienie -->
function zamSum(){
	document.zamowienie.suma.value = document.zamowienie.price.value*document.zamowienie.count.value;
	document.zamowienie.zaliczka.value = (4098.36)*document.zamowienie.count.value;
}

function zamNext(){
	if (document.zamowienie.count.selectedIndex == ''){
		alert('Proszę wybrać "Ilość" !');
	} else if (document.zamowienie.colour.selectedIndex == ''){
		alert('Proszę wybrać "Kolor" !');
	} else if (document.zamowienie.termin.value == ''){
		alert('Proszę wpisać "Termin" !');
		document.zamowienie.termin.focus();
	} else if (document.zamowienie.termin.value == ''){
		alert('Proszę wpisać "Termin" !');
		document.zamowienie.termin.focus();
	} else {
		document.zamowienie.submit();
	}
}

function zamNext1(){
	if (document.zamowienie.firma.value == ''){
		alert('Proszę wybrać "Firma" !');
		document.zamowienie.firma.focus();
	} else if (document.zamowienie.dane.value == ''){
		alert('Proszę wybrać "Dane osobowe zamawiającego" !');
		document.zamowienie.dane.focus();
	} else if (document.zamowienie.adres.value == ''){
		alert('Proszę wpisać "Adres" !');
		document.zamowienie.adres.focus();
	} else if (document.zamowienie.city.value == ''){
		alert('Proszę wpisać "Miasto" !');
		document.zamowienie.city.focus();
	} else if (document.zamowienie.post_code.value == ''){
		alert('Proszę wpisać "Kod pocztowy" !');
		document.zamowienie.post_code.focus();
	} else if (document.zamowienie.adres_email.value == ''){
		alert('Proszę wpisać "Adres e-mail" !');
		document.zamowienie.adres_email.focus();
	} else if (document.zamowienie.phone_kom.value == ''){
		alert('Proszę wpisać "Tel. kom." !');
		document.zamowienie.phone_kom.focus();
	} else if (document.zamowienie.nip.value == ''){
		alert('Proszę wpisać "NIP" !');
		document.zamowienie.nip.focus();
	} else if (document.zamowienie.sposob_zaplaty.selectedIndex == ''){
		alert('Proszę wpisać "Sposób zapłaty" !');
	} else if (!document.zamowienie.warunki.checked){
		alert('Proszę zaznaczyć zgodę na warunki zamówienia !');
	} else {
		
		if ((document.zamowienie.adres_email.value.indexOf("@")==document.zamowienie.adres_email.value.lastIndexOf("@"))&&(document.zamowienie.adres_email.value.charAt(document.zamowienie.adres_email.value.indexOf("@")+1) != '.')&&(document.zamowienie.adres_email.value.charAt(document.zamowienie.adres_email.value.indexOf("@")-1) != '.')&&(document.zamowienie.adres_email.value.indexOf("@") != 0)&&(document.zamowienie.adres_email.value.indexOf(".") != 0)&&(document.zamowienie.adres_email.value.lastIndexOf(".") > document.zamowienie.adres_email.value.indexOf("@"))){
			document.zamowienie.step.value = 2;
			document.zamowienie.submit();
		} else {
			alert('Proszę wpisać poprawnie "Adres e-mail" !');
			document.zamowienie.adres_email.focus();
		}
	}
}

function zamNext2(){
	document.zamowienie.step.value = 3;
	document.zamowienie.submit();
}

function zamBack(){
	document.zamowienie.step.value = '';
	document.zamowienie.submit();
}

function zamBack1(){
	document.zamowienie.step.value = 1;
	document.zamowienie.submit();
}

function validateDate(fld) {
    var RegExPattern = /^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$/;
    var errorMessage = 'Proszę wpisać poprawną datę !\n\nFormat dd-mm-yyyy.';
    if ((fld.value.match(RegExPattern)) && (fld.value!='')) {
       // alert('Date is OK'); 
    } else {
        alert(errorMessage);
        fld.focus();
    } 
}
