function AddToBasket(){
 var amount = new Number();
	amount = document.getElementById("amount").value;
	if(!isNaN(amount) && amount>0){
		document.product_form.submit();
	}
}


function check_comment_form(elm){
	if(elm.author.value && elm.email.value && elm.content.value && elm.note.selectedIndex){
		return true;
	}
	else{
		alert("Przed wysłaniem komentarza wypełnij wszystkie pola.");
		return false;
	}
}
function check_payment(){
	radioObj = document.payment_form.payment_form_id;
	var radioLength = radioObj.length;
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			document.payment_form.submit();
			return true;			
		}
	}
	alert('Proszę wybrać formę płatności.');
	return false;
}

function check_login(elm){
	if(elm.email.value && elm.password.value){
		return true;
	}
	else{
		alert("Proszę wpisać nazwę użytkownika i hasło.");
		return false;
	}
}
function check_registration(elm){
	if(elm.name_person.value && elm.email.value && elm.phone_person.value && elm.street_person.value && elm.postal_person.value && elm.city_person.value && elm.country_person.value  &&  elm.name_invoice.value && elm.street_invoice.value && elm.postal_invoice.value && elm.city_invoice.value && elm.country_invoice.value && elm.name_shipment.value && elm.street_shipment.value && elm.postal_shipment.value && elm.city_shipment.value && elm.country_shipment.value){
		if(elm.accept.checked){
			return true;
		}
		else{
			alert("W celu rejestracji należy zaakceptować Regulamin.");
			return false;
		}
	}
	else{
		alert("Proszę wypełnić wszystkie wymagane pola.")
		return false
	}
	return false
}
function check_user_data(){
	elm = document.user_data_form;
	if(elm.name_person.value && elm.email.value && elm.phone_person.value && elm.street_person.value && elm.postal_person.value && elm.city_person.value && elm.country_person.value  &&  elm.name_invoice.value && elm.street_invoice.value && elm.postal_invoice.value && elm.city_invoice.value && elm.country_invoice.value && elm.name_shipment.value && elm.street_shipment.value && elm.postal_shipment.value && elm.city_shipment.value && elm.country_shipment.value){
		elm.submit();
	}
	else{
		alert("Proszę wypełnić wszystkie wymagane pola.")
		return false
	}
}
