
function hideLoggingResults(){$('#loggingResult').hide();}
function hideAllOpenComponents(){if($('#size .editingSection').is(':visible')){hidePanelComponent('size');}
if($('#amount .editingSection').is(':visible')){hidePanelComponent('amount');}
if($('#time .editingSection').is(':visible')){hidePanelComponent('time');}}
function showPanelComponent(nodeKey,component){hideAllOpenComponents();$('#'+component+' .editingSection').show();$('#'+component+' a.edit').hide();$('#'+component+' a.hide').show();}
function hidePanelComponent(component){$('#'+component+' .editingSection').hide();$('#'+component+' a.edit').show();$('#'+component+' a.hide').hide();}
function updateValue(component,value,label){$('#'+component+' input:hidden').val(value);if(label!==undefined){$('#'+component+' span.currentValue').html(label);}
if(component=='drinks'){$('div#drinks label').css({'font-weight':'normal'});$('div#drinks input:checked ~ label').css({'font-weight':'bold'});}}
function checkText(component,el,textToAppend,isInt,maxValue){if(isInt){var expr=/\D/g;}else{var expr=/([^\d|\.])/g;}
var val=el.value;var inError=false;if(val.match(expr)){val=val.replace(expr,'');inError=true;}else{if(parseFloat(val)>maxValue){inError=true;val=val.slice(0,-1);while(parseFloat(val)>maxValue&&val!=''){val=val.slice(0,-1);}}}
if(inError){el.value=val;$('#'+component+' .textDiv').addClass('error');}else{$('#'+component+' .textDiv').removeClass('error');}
if(val!=undefined&&val!=''){$('#'+component+' input:hidden').val(val);$('#'+component+' span.currentValue').html(val+textToAppend);$('#'+component+' .textDiv input:radio').attr({'checked':true});}else{if($('#'+component+' .textDiv input:radio:selected').val()==undefined){$('#'+component+' input:radio:first').attr({'checked':true});val=$('#'+component+' input:radio:first').val();$('#'+component+' input:hidden').val(val);var label=$('#'+component+' input:radio:first + label').html();$('#'+component+' span.currentValue').html(label);}}}
function recordDrink(formName){if(typeof(submitChecker)=='undefined'||submitChecker==false){submitChecker=true;}else{return false;}
if(formName=='recentPanel'||formName=='savedPanel'){var checkResult=checkDrinkSelection();if(!checkResult){submitChecker=false;return false;}}
return true;}
function checkDrinkSelection(){if($('#drinks input:hidden:first').val()==''){$('#drinks').addClass('error');return false;}
return true;}