
$(document).ready(
				function(){
		$('ul#headers').innerfade({
				speed: 1000,
				timeout: 4000,
				type: 'sequence',
				containerheight: '220px'
			});
});


function check_mail()
{
	Wzor=/^[0-9a-zA-Z._-]+\@[0-9a-zA-Z._-]+\.[0-9a-zA-Z.]+$/;
	OK=(Wzor.test(document.email.email.value)==true);
	if (!OK)
	{
		alert ("Niepoprawny adres e-mail!");
		return false;
	}
}

function checkCalcForm()
{
	if (document.calc.calc_value.value.length > 0)
	{
		allow=RegExp("^[0-9]{1,20}$");
		if (!allow.test(document.calc.calc_value.value))
		{ 
			alert ("Wartość do przeliczenia może zawierać tylko cyfry!");
			return false;
		}
	}
	else
	{
		alert ("Proszę podać wartość do przeliczenia!");
		return false;
	}
}

function checkGuestBook_name()
{
	if (document.guest_book.name.value.length < 5)
	{
		formMessage = "Twoje imię / nick powinno zawierać co najmniej 5 znaków!";
		return true;
	}
}
function checkGuestBook_essence()
{
	if (document.guest_book.essence.value.length < 5)
	{
		formMessage = "Treść wpisu powinna składać się z co najmniej 5 znaków!";
		return true;
	}
}
function checkGuestBook()
{
	if ( (checkGuestBook_name()) || (checkGuestBook_essence()) )
	{
		alert(formMessage);
		return false;
	}
	else
	{
		return true;
	}
}

function checkSearch()
{
	if (document.search.search_string.value.length < 3)
	{
		alert ("Wyszukiwana fraza musi zawierać co najmniej 3 znaki!");
		return false;
	}
	else
	{
		return true;
	}
}

function checkSearch_ext()
{
	if (document.search_ext.search_string.value.length < 3)
	{
		alert ("Wyszukiwana fraza musi zawierać co najmniej 3 znaki!");
		return false;
	}
	else
	{
		return true;
	}
}

function displayImage(url,width,height)
{
	newWindow=window.open(url,'newWinidow','width=' + width + ',height='+ height + ', resizable=no, scrollbars=no, menubar=no, status=no, toolbar=no');
	newWindow.focus();
}

function displayWindow(url, width, height)
{
	var Win = window.open(url,'displayWindow','width=' + width + ',height=' + height + ', resizable=no, scrollbars=yes, menubar=no, status=no, toolbar=no');
}

function displayPopup(url)
{
	var Win = window.open(url,'displayWindow','width=1, height=1, resizable=no, scrollbars=yes, menubar=no, status=no, toolbar=no');
}

function WindowResize(width, height)
{
	var i=0;
	if (navigator.appName == 'Netscape')
	{
		i=10;
	}
	window.resizeTo(width + 30, height + 60 - i);
	self.focus();
}

function checkSend_mail_name()
{
	if (document.send_email.name.value.length < 8)
	{
		formMessage = "Proszę podać imię lub nazwiako!";
		return true;
	}
}

function checkSend_mail_name()
{
	if (document.send_email.name.value.length < 8)
	{
		formMessage = "Proszę podać imię lub nazwiako!";
		return true;
	}
}

function checkSend_mail_email()
{
	Wzor=/^[0-9a-zA-Z._-]+\@[0-9a-zA-Z._-]+\.[0-9a-zA-Z.]+$/;
	OK=(Wzor.test(document.send_email.email.value)==true);
	if (!OK)
	{
		formMessage = "Niepoprawny adres e-mail!";
		return true;
	}
}

function checkSend_mail_phone()
{
	if (document.send_email.phone.value.length > 0)
	{
		Wzor=RegExp("^[0-9-+() ]{8,}$");
		OK=(Wzor.test(document.send_email.phone.value)==true); 
		if (!OK)  
		{ 
			formMessage = "Niepoprawny numer telefonu!";
			return true; 
		}
	}
}

function checkSend_mail_message()
{
	if (document.send_email.message.value.length < 20)
	{
		formMessage = "Treść pyania powinna składać się z co najmniej 20 znaków!";
		return true;
	}
}

function checkSend_mail()
{
	if ( (checkSend_mail_name()) || (checkSend_mail_email()) || (checkSend_mail_phone()) || (checkSend_mail_message()) )
	{
		alert(formMessage);
		return false;
	}
	else
	{
		return true;
	}
}

function check_reservation_name()
{
	if (document.reservation.name.value.length < 7)
	{
		formMessage = "Proszę podać imię i nazwisko!";
		return true;
	}
}

function check_reservation_phone()
{
	Wzor=RegExp("^[0-9-() ]{8,}$");
	OK=(Wzor.test(document.reservation.phone.value)==true); 
	if (!OK)  
	{ 
		formMessage = "Niepoprawny lub brak numeru telefonu!\nNumer telefonu najlepiej podać w formacie:\nStacjonarny +48 74 111 11 11\nKomórki +48 501 11 11 11";
		return true; 
	}
}

function check_reservation_mail()
{
	Wzor=/^[0-9a-zA-Z._-]+\@[0-9a-zA-Z._-]+\.[0-9a-zA-Z.]+$/;
	OK=(Wzor.test(document.reservation.email.value)==true);
	if (!OK)
	{
		formMessage = "Brak lub niepoprawny adres e-mail!";
		return true;
	}
}

function check_reservation_from()
{
	Wzor=RegExp("^[0-9-./]{10,10}$");
	OK=(Wzor.test(document.reservation.from_date.value)==true); 
	if (!OK)  
	{ 
		formMessage = "Proszę określić termin rozpoczęcia pobytu!\nData w formacie dd-mm-rrrr";
		return true; 
	}
}

function check_reservation_to()
{
	Wzor=RegExp("^[0-9-./]{10,10}$");
	OK=(Wzor.test(document.reservation.to_date.value)==true); 
	if (!OK)  
	{ 
		formMessage = "Proszę określić termin zakończenia pobytu!\nData w formacie dd-mm-rrrr";
		return true; 
	}
}

function check_reservation_room()
{
	if (document.reservation.room.value.length < 5)
	{
		formMessage = "Proszę określić rodzaj pokoju do rezerwacji!";
		return true;
	}
}

function check_reservation_persons()
{
	Wzor=RegExp("^[0-9]{1,3}$");
	OK=(Wzor.test(document.reservation.persons.value)==true); 
	if (!OK)  
	{ 
		formMessage = "Proszę podać liczbę osób, tylko cyfry!";
		return true; 
	}
}

function check_reservation()
{
	if ( (check_reservation_name()) || (check_reservation_phone()) || (check_reservation_mail()) || (check_reservation_from()) || (check_reservation_to()) || (check_reservation_room()) || (check_reservation_persons()))
	{
		alert(formMessage);
		return false;
	}
	else
	{
		return true;
	}
}

function check_phone()
{
	if (document.sms.phone.value.length > 0)
	{
		Wzor=RegExp("^[0-9+]{12}$");
		OK=(Wzor.test(document.sms.phone.value)==true); 
		if (!OK)  
		{ 
			alert("Niepoprawny numer telefonu!\nFormat poprawnego numeru: +48601223344");
			return false;
		}
	}
}


