function menuKatOn(id) {
	
	document.getElementById(id).style.backgroundImage = 'url(/img/menuLeftBtnA.gif)';
	document.getElementById(id+'_a').style.color = '#fbefe3';
}

function menuKatOff(id) {
	
	document.getElementById(id).style.backgroundImage = 'url(/img/menuLeftBtn.gif)';
	document.getElementById(id+'_a').style.color = '#532d27';
}

function menuPozOn(id) {
	
	document.getElementById(id).style.backgroundColor = '#fbefe3';
	document.getElementById(id+'_a').style.color = '#5a352f';
	
}

function menuPozOff(id) {
	
	document.getElementById(id).style.background = 'none';
	document.getElementById(id+'_a').style.color = '#fbefe3';
	
}

function radioIsChecked(radio) {
	var i;
	for(i=0; i<radio.length; i++) if(radio[i].checked) return true;
	
	return false;
}


function zamowienieValidation () {
	
	if ( !document.getElementById('imie').value ) {
		alert('Aby złożyć zamówienie musisz podać swoje imię. '); 
		document.getElementById('imie').focus();
		return false;
	}
	
	if ( !document.getElementById('nazwisko').value ) {
		alert('Aby złożyć zamówienie musisz podać swoje nazwisko. '); 
		document.getElementById('nazwisko').focus();
		return false;
	}
	
	if ( !document.getElementById('kod_pocztowy').value ) {
		alert('Aby złożyć zamówienie musisz podać kod pocztowy. '); 
		document.getElementById('kod_pocztowy').focus();
		return false;
	}
	
	if ( !document.getElementById('miasto').value ) {
		alert('Aby złożyć zamówienie musisz podać miasto. '); 
		document.getElementById('miasto').focus();
		return false;
	}
	
	if ( !document.getElementById('ulica').value ) {
		alert('Aby złożyć zamówienie musisz podać ulicę. '); 
		document.getElementById('ulica').focus();
		return false;
	}
	
	if ( !document.getElementById('nr_domu').value ) {
		alert('Aby złożyć zamówienie musisz podać nr domu. '); 
		document.getElementById('nr_domu').focus();
		return false;
	}
	
	if ( !document.getElementById('tel_kom').value ) {
		alert('Aby złożyć zamówienie musisz podać nr telefonu. '); 
		document.getElementById('tel_kom').focus();
		return false;
	}
	
	if ( document.getElementById('tel_kom').value.length<7 ) {
		alert('Aby złożyć zamówienie musisz podać nr telefonu. '); 
		document.getElementById('tel_kom').focus();
		return false;
	}
	
	if ( !document.getElementById('email').value ) {
		alert('Aby złożyć zamówienie musisz podać swój adres e-mail. '); 
		document.getElementById('email').focus();
		return false;
	}
	
	if ( (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.getElementById('email').value)) == false ) {
		alert('Niepoprawny format adresu e-mail. '); 
		document.getElementById('email').focus();
		return false;
		
	}

	if ( !radioIsChecked(document.zamowienie.platnosc) ) {
		alert('Aby złożyć zamówienie musisz podać formę płatności i dostawy. '); 
		return false;		
		
	}

	
}
