function notEmpty(field, fieldName) {
	var hasLength = field.value.length>0;
	if(!hasLength) {
		field.focus();
		alert(MSG_PLEASE_SPECIFY_VALUE + fieldName);
	}
	return hasLength;
}

function validateLogin(frm) {
	if (typeof(racecard) != "undefined" && racecard != null) {
		
		if (typeof(racecard.selectionString) != "undefined")
		{
		    racecard.zeroPlaceBet();
		    racecard.zeroWinBet();
		    frm.action = addParamToUrl
			    (frm.action, "bet", racecard.selectionString());
		}
			    			    
		if ((typeof(commingled) != "undefined") && !commingled)
			frm.action = addParamToUrl
				(frm.action, "meetingId"
				, document.getElementById("meetings").value);
				
		//for all up bets
		if (document.getElementById("legSelect1") != null) {
			
			for (var i=1;i<5;++i)
				frm.action = addParamToUrl
				(frm.action, "legSelect" + i
				, document.getElementById("legSelect" + i).value.split(",")[0]);
		}
				
	} else if (typeof(betString) == "function") {
		frm.action = addParamToUrl
			(frm.action, "selections", betString(_selections));
	}
	
	return (notEmpty(frm["account"], MSG_ACCOUNT)
		&& notEmpty(frm["PIN"], MSG_PIN)
		&& notEmpty(frm["surname"], MSG_SURNAME));
}