// Art G 2007
// Functions to proccess searchForm

function isSearchFormValid() {
	var location = document.getElementById('location');
	var position = document.getElementById('position');
	var vesseltype = document.getElementById('vesseltype');
	var positionAdrs = position;
	var vesseltypeAdrs = vesseltype;

	location = location.value;
	position = position.value;
	vesseltype = vesseltype.value;

	if (location.length<3) {
		alert('Location not valid!');
		return false;
	} else if (location<100) {
		alert('Location range not valid');
		return false;
	}

	if (position.length>2) {
		alert('Position not valid');
		return false;
	} else if (position>0 && position<10) {
		alert(position+' Position not valid');
		return false;
	}

	if (vesseltype.length>2) {
		alert('Vessel type not valid');
		return false;
	} else if (vesseltype>0 && vesseltype<10) {
		alert(vesseltype+' Vessel type not valid');
		return false;
	}

	seeList(positionAdrs);
	seeList(vesseltypeAdrs);
	return true;
}


function seeList(field) {
	var result = "";
	var picked = 0;
	for (var i = 0; i < field.length; i++) {
		if (field.options[i].selected) {
			result += "\n " + field.options[i].text;
			picked++;
		}
	}
	//alert("You have selected " + picked + " options:" + result);
}
