document.WWW.bypassValidateDeposit = false;
document.WWW.doValidateDeposit = 'validateDeposit()';

function validateDeposit() {//20050722

	var f;
	var regex=/^[0-9A-Za-z]+$/; //^[a-zA-z]+$/

		f=MM_findObj('item_name_1'); if (f==null) return true;//fail +ve
	if (f.value==''){
		alert('Please enter the code given by Mia Masri.\nIf you don\'t have a code please call or email first');
		f.focus(); return false;
	}
		f=MM_findObj('item_name_1'); if (!regex.test(f.value)) {
		alert('Please enter the code given by Mia Masri.\nThis should only contain alphanumeric characters');
		f.focus(); return false;
	}
		f=MM_findObj('amount_1'); if (f==null) return true;//fail +ve
	if (f.value==''){
		alert('Please enter the deposit amount given by Mia Masri.');
		f.focus(); return false;
	}
		f=MM_findObj('amount_1');
	var amount = new Number(f.value);
	var noDecimal = (amount.toFixed(0));
	var decimal = (amount.toFixed(2));
	
	if (isNaN(f.value)) {
		alert ('Please enter your deposit amount as a number. \nDo not include currency symbols.');
		f.focus(); return false;
	}
	if (amount<=0) {
		alert ('Please check and re-enter the deposit amount agreed with Mia Masri.');
		f.focus(); return false;
	}
	if (amount == noDecimal){ return true; }
	else if (amount == decimal) { return true;}
	else {
		alert ('Please enter the amount in the form 123 or 123.45');
		f.focus(); return false;
	}
return true;
}

