function goTo( path ) {
	document.location.href = path.value;
}

function changePage (_offset)
{
	var form = document.getElementById ('formSearchResults');
	if (form == null) {
		return false;
	}
	
	var field = form.elements['recordsoffset'];
	if (field == null) {
	    return false;
	}
	
	field.value = _offset;
	form.submit();
}

//sprawdza, czy zadany cig jest poprawnym skadniowo adresem e-mail
function checkEMail(element, msg)
{
	var	validMail = /^[\w-]+(\.[\w-]+)*\@([\w-]+\.)+[\w]{2,6}$/;
	var email     = trim(element.value);
	if (email.search(validMail) == -1) {
		alert(msg);
		element.focus();
		return false;
	}
	return true;
}

//obcina ewentualne spacje z pocztku i koca zadanego acucha
function trim (s)
{
	return s.replace (new RegExp('(^\\s*)|(\\s*$)', 'g'), '');
}


function checkInput(element, msg)
{
	if (element.value == '') {
		alert(msg);
		element.focus();
		return false;
	}
	return true;
}

function checkCheckboxes(array, msg)
{
	if (array.length > 0) {
		for (i=0; i < array.length; i++) {
			if (array[i].checked) return true;
		}
	}
	else {
		return array.checked;
	}

	alert(msg);
	if (array.length > 0) {
		array[0].focus();
	}
	else {
		array.focus();
	}
	return false;
}
