function rand_value()
{
	var rand_value = Math.round(Math.random() * 10000000000000000);
	return rand_value;
}

function WindowResize(width, height)
{
	window.resizeTo(width + 50, height + 80);
	self.focus();
}

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 checkGuestBook_name()
{
	if (document.guest_book.name.value.length < 5)
	{
		formMessage = "Twoje imię / nick powinno zawierać conajmniej 5 znaków!";
		return true;
	}
}
function checkGuestBook_essence()
{
	if (document.guest_book.essence.value.length < 5)
	{
		formMessage = "Treść wpisu powinna składać się z conajmniej 5 znaków!";
		return true;
	}
}
function checkGuestBook_code()
{
	if (document.guest_book.code.value.length < 6)
	{
		formMessage = "Brak kodu potwierdzającego lub jego długość jest za krótka!";
		return true;
	}
}
function checkGuestBook()
{
	if ( (checkGuestBook_name()) || (checkGuestBook_essence()) || (checkGuestBook_code()) )
	{
		alert(formMessage);
		return false;
	}
	else
	{
		return true;
	}
}

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

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

function check_send_comment_author()
{
	if (document.send_comment.author.value.length < 3)
	{
		formMessage = "Proszę podać swoje imię lub nick!";
		return true;
	}
}
function check_send_comment_comment()
{
	if (document.send_comment.comment.value.length < 10)
	{
		formMessage = "Treść komentarza to minimum 10 znaków!";
		return true;
	}
}
function check_send_comment()
{
	if ( (check_send_comment_author()) || (check_send_comment_comment()) )
	{
		alert(formMessage);
		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)
{
	newWindow=window.open(url,'displayWindow','width=' + width + ',height=' + height + ',resizable=no, scrollbars=yes, menubar=no,status=no,toolbar=no');
	newWindow.focus();
}

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