function VerifyBanknotes() {
            var f=document.form1;
	var entry = f.bname.value;
	while (entry.charAt(0) == ' ')
		entry = entry.substring(1, entry.length);
	while (entry.charAt(entry.length-1) == ' ')
		entry = entry.substring(0, entry.length-1);
	f.bname.value = entry;
	if((f.bname.value != '')&&(f.bname.value.length < 3)) {
			alert('The field "Title contains" must consist of at least 3 symbols.');
			return false;
		};
	if((f.startYr.value > f.endYr.value)&&(f.startYr.value!=-1)&&(f.endYr.value!=-1)) {
		alert('The value set in the field "from" is higher than that in the field "to" in the "Search for banknotes" form.');
		return false;
	};
            if((f.bname.value=='')&&(f.startYr.value==-1)&&(f.endYr.value==-1)&&(f.nominal.value==-1)&&(f.btype.value==-1)) {
		alert('You must choose at least one search criteria.');
		return false;
	};

	 return true;
}

function VerifyCoins() {
	            var f=document.form2;
		var entry = f.cname.value;
		while (entry.charAt(0) == ' ')
			entry = entry.substring(1, entry.length);
		while (entry.charAt(entry.length-1) == ' ')
			entry = entry.substring(0, entry.length-1);
		f.cname.value = entry;
		if((f.cname.value != '')&&(f.cname.value.length < 3)) {
			alert('The field "Title contains" must consist of at least 3 symbols.');
			return false;
		};
		if((f.startYr.value > f.endYr.value)&&(f.startYr.value!=-1)&&(f.endYr.value!=-1)) {
			alert('The value set in the field "from" is higher than that in the field "to" in the "Search for commemorative coins" form.');
			return false;
		};
            	if((f.cname.value=='')&&(f.startYr.value==-1)&&(f.endYr.value==-1)&&(f.nominal.value==-1)&&(f.alloy.value==-1)&&(f.diameter.value==-1)&&(f.quality.value==-1)&&(f.mintage.value==-1)) {
			alert('You must choose at least one search criteria.');
			return false;
		};


	 	return true;
}

function sortbyfld(fld, defsort) {
	if(document.forms[0].hsortfld.value==fld) {
		if(document.forms[0].sortord.value=='asc')
			document.forms[0].sortord.value='desc'		
		else
			document.forms[0].sortord.value='asc';}
	else{
		document.forms[0].hsortfld.value=fld;
		document.forms[0].sortord.value=defsort;
		
	};	
	document.forms[0].hid.value='hid';
	document.forms[0].submit();
}


