function inputFocus(el) {
	el.style.background='#E3E6FB';
	el.style.border='1px solid #666666'
}

function inputBlur(el) {
	el.style.background='#FFFFFF';
	el.style.border='1px solid #AAAAAA'
}

function checkForm()
{
	s = document.getElementById('serviceform');
	if (s.agreement.checked)	{
		s.send_button.disabled=false;
	}
	else {
		s.send_button.disabled=true;
	}
}

function sendForm()
{
	var ok = true;
	s = document.getElementById('serviceform');	
	with (s) {
		if (uxSerial.value.length == 0) {
			alert('Nie podano numeru seryjnego urządzenia - S/N');
			uxSerial.focus();
			ok = false;
		}
		else if (ValidateSerial(uxSerial.value) == false) {
			alert('Błędny numer seryjny urządzenia - S/N,\nPRAWIDŁOWY NUMER JEST CIĄGIEM 14 lub 16 CYFR');
			uxSerial.focus();
			ok = false;
		}		
		else if (uxFullname.value.length == 0) {
			alert('Nie wpisano imienia i nazwiska / nazwy firmy');
			uxFullname.focus();
			ok = false;
		}		
		else if (uxAddress.value.length == 0) {
			alert('Nie wpisano nazwy ulicy i nr budynku/lokalu');
			uxAddress.focus();
			ok = false;
		}
		else if (uxCity.value.length == 0) {
			alert('Nie podano nazwy miasta');
			uxCity.focus();
			ok = false;
		}			
		else if (uxZip.value.length == 0) {
			alert('Nie wpisano kodu pocztowego');
			uxZip.focus();
			ok = false;
		}		
		else if (ValidateZip(uxZip.value) == 0) {
			alert('Wpisany kod pocztowy jest niepoprawny.');
			uxZip.focus();
			ok = false;
		}
		else if (uxPhone.value.length == 0) {
			alert('Nie wpisano nr telefonu');
			uxPhone.focus();
			ok = false;
		}		
		else if (ValidateTel(uxPhone.value) == false) {
			alert('Wpisany nr telefonu jest niepoprawny.');
			uxPhone.focus();
			ok = false;
		}		
		else if (uxEmail.value.length == 0) {
			alert('Nie podano adresu e-mail.');
			uxEmail.focus();
			ok = false;
		}
		else if (ValidateEmail(uxEmail.value) == false) {
			alert('Wpisany adres e-mail jest niepoprawny.');
			uxEmail.focus();
			ok = false;
		}
	}
	if (ok) {
		s.submit();
	}	
}

function ValidateEmail(m_email) {
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	if (m_email.search(validRegExp) == -1)
		return false;
	else return true;
}

function ValidateSerial(m_serial) {
	validRegExp = /[\d]{14,16}$/i;
	if (m_serial.search(validRegExp) == -1)
		return false;
	else return true;
}

function ValidateTel(m_tel) {
	validRegExp = /^[+0-9- ]*$/i;
	if (m_tel.search(validRegExp) == -1)
		return false;
	else return true;
}

function ValidateZip(m_zip) {
	validRegExp = /^\d\d-\d\d\d$/i;
	if (m_zip.search(validRegExp) == -1)
		return false;
	else return true;
}
