<!-- start

function textfieldok(thiselement, message){
var textfieldisok = true;
var value = thiselement.value;
if(value == null){
	textfieldisok=false;
}
else{
//count non-empty characters
var numcharacters = 0;
for(var i=0; i<value.length; i++){
	var ch = value.charAt(i);
	if ((ch!=' ') && (ch!='\n') && (ch!='\t')) numcharacters++;
}
	if(numcharacters==0) textfieldisok = false;
}
if(!textfieldisok){
	alert (message);
	thiselement.focus();
}
return textfieldisok;
}

function checkaddeditform(thisform){

// check quantity
var quantityisok = true;
var value = thisform.quantity.value;
if(value != null && value != ""){
	for(var i=0; i<value.length; i++){
		var ch = value.charAt(i);
		if((ch!='1') && (ch!='2') && (ch!='3') && (ch!='4') && (ch!='5') && (ch!='6') && 
			(ch!='7') && (ch!='8') && (ch!='9') && (ch!='0')) quantityisok = false;
	}
}
else quantityisok = false;

if(!quantityisok){
	alert ("Quantity must be an integer, with no extra spaces or characters.");
	thisform.quantity.focus();
	return false;
} 

// check name to add if cartid 'other' has been selected
// since there is a bug in navigator, you cant rely on knowing
// the order the radio buttons are added, so have to cycle through
// all of them to find 'radio.other'
for(var i = 0; i < thisform.cartid.length; i++){
if(thisform.cartid[i].value == "Other" && thisform.cartid[i].checked == true){
	if(!textfieldok(thisform.othername,"Please supply a name for this shopping list.")) return false;
}
}

return true;
}

// end -->
