www/js/global.js

changeset 465
dc3e14b976be
parent 463
0efdafd23753
child 475
c34d71572023
--- a/www/js/global.js	Thu Sep 05 21:25:13 2019 +0200
+++ b/www/js/global.js	Fri Sep 06 13:14:52 2019 +0200
@@ -36,42 +36,42 @@
 	{ id: 9,  en: "Taste",       nl: "Proeven" },
 	{ id: 10, en: "Ready",       nl: "Gereed" },
 	{ id: 11, en: "Closed",      nl: "Afgesloten" }
-];
-var StageSource = {
+],
+StageSource = {
 	localdata: StageData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var StageAdapter = new $.jqx.dataAdapter(StageSource);
+},
+StageAdapter = new $.jqx.dataAdapter(StageSource),
 
-var MaterialData = [
+MaterialData = [
 	{ id: 0,  en: "Stainless Steel", nl: "RVS",       sh: 0.11 },
 	{ id: 1,  en: "Aluminium",       nl: "Aluminium", sh: 0.22 },
 	{ id: 2,  en: "Plastics",        nl: "Kunststof", sh: 0.46 },
 	{ id: 3,  en: "Copper",          nl: "Koper",     sh: 0.092 }
-];
-var MaterialSource = {
+],
+MaterialSource = {
 	localdata: MaterialData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'sh' }]
-};
-var MaterialAdapter = new $.jqx.dataAdapter(MaterialSource);
+},
+MaterialAdapter = new $.jqx.dataAdapter(MaterialSource),
 
-var FermentableTypeData = [
+FermentableTypeData = [
 	{ id: 0, en: 'Grain',       nl: 'Mout' },
 	{ id: 1, en: 'Sugar',       nl: 'Suiker' },
 	{ id: 2, en: 'Extract',     nl: 'Vloeibaar extract' },
 	{ id: 3, en: 'Dry extract', nl: 'Droog extract' },
 	{ id: 4, en: 'Adjunct',     nl: 'Ongemout graan' }
-];
-var FermentableTypeSource = {
+],
+FermentableTypeSource = {
 	localdata: FermentableTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var FermentableTypeAdapter = new $.jqx.dataAdapter(FermentableTypeSource);
+},
+FermentableTypeAdapter = new $.jqx.dataAdapter(FermentableTypeSource),
 
-var GrainTypeData = [
+GrainTypeData = [
 	{ id: 0, en: 'Base',      nl: 'Basismout' },
 	{ id: 1, en: 'Roast',     nl: 'Geroosterde mout' },
 	{ id: 2, en: 'Crystal',   nl: 'Cara- of crystalmout' },
@@ -79,71 +79,71 @@
 	{ id: 4, en: 'Sour malt', nl: 'Zuurmout' },
 	{ id: 5, en: 'Special',   nl: 'Speciale mout' },
 	{ id: 6, en: 'No malt',   nl: 'Geen mout' }
-];
-var GrainTypeSource = {
+],
+GrainTypeSource = {
 	localdata: GrainTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var GrainTypeAdapter = new $.jqx.dataAdapter(GrainTypeSource);
+},
+GrainTypeAdapter = new $.jqx.dataAdapter(GrainTypeSource),
 
-var AddedData = [
+AddedData = [
 	{ id: 0, en: 'Mash', nl: 'Maischen' },
 	{ id: 1, en: 'Boil', nl: 'Koken' },
 	{ id: 2, en: 'Fermentation', nl: 'Vergisten' },
 	{ id: 3, en: 'Lagering', nl: 'Nagisten/lageren' },
 	{ id: 4, en: 'Bottle', nl: 'Bottelen' },
 	{ id: 5, en: 'Kegs', nl: 'Fust' }
-];
-var AddedSource = {
+],
+AddedSource = {
 	localdata: AddedData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var AddedAdapter = new $.jqx.dataAdapter(AddedSource);
+},
+AddedAdapter = new $.jqx.dataAdapter(AddedSource),
 
-var HopTypeData = [
+HopTypeData = [
 	{ id: 0, en: 'Bittering', nl: 'Bitterhop' },
 	{ id: 1, en: 'Aroma',     nl: 'Aromahop' },
 	{ id: 2, en: 'Both',      nl: 'Beide' }
-];
-var HopTypeSource = {
+],
+HopTypeSource = {
 	localdata: HopTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var HopTypeAdapter = new $.jqx.dataAdapter(HopTypeSource);
+},
+HopTypeAdapter = new $.jqx.dataAdapter(HopTypeSource),
 
-var HopFormData = [
+HopFormData = [
 	{ id: 0, en: 'Pellet',   nl: 'Pellets' },
 	{ id: 1, en: 'Plug',     nl: 'Plugs' },
 	{ id: 2, en: 'Leaf',     nl: 'Bloemen' },
 	{ id: 3, en: 'Leaf wet', nl: 'Hop nat' },
 	{ id: 4, en: 'Cryo',     nl: 'Cryo' }
-];
-var HopFormSource = {
+],
+HopFormSource = {
 	localdata: HopFormData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 
-};
-var HopFormAdapter = new $.jqx.dataAdapter(HopFormSource);
+},
+HopFormAdapter = new $.jqx.dataAdapter(HopFormSource),
 
-var HopUseData = [
+HopUseData = [
 	{ id: 0, en: 'Mash',       nl: 'Maischhop' },
 	{ id: 1, en: 'First wort', nl: 'First wort hop' },
 	{ id: 2, en: 'Boil',       nl: 'Koken' },
 	{ id: 3, en: 'Aroma',      nl: 'Vlamuit' },
 	{ id: 4, en: 'Whirlpool',  nl: 'Whirlpool' },
 	{ id: 5, en: 'Dry hop',    nl: 'Koudhop' }
-];
-var HopUseSource = {
+],
+HopUseSource = {
 	localdata: HopUseData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var HopUseAdapter = new $.jqx.dataAdapter(HopUseSource);
+},
+HopUseAdapter = new $.jqx.dataAdapter(HopUseSource),
 
-var YeastTypeData = [
+YeastTypeData = [
 	{ id: 0, en: 'Lager',     nl: 'Ondergist' },
 	{ id: 1, en: 'Ale',       nl: 'Bovengist' },
 	{ id: 2, en: 'Wheat',     nl: 'Tarwegist' },
@@ -154,68 +154,68 @@
 //	{ id: 7, en: 'Mixed',     nl: 'Mixed' },
 //      { id: 8, en: 'Spontaneous', nl: 'Spontaan' },
 //	{ id: 9, en: 'Other',       nl: 'Overig' }
-];
-var YeastTypeSource = {
+],
+YeastTypeSource = {
 	localdata: YeastTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var YeastTypeAdapter = new $.jqx.dataAdapter(YeastTypeSource);
+},
+YeastTypeAdapter = new $.jqx.dataAdapter(YeastTypeSource),
 
-var YeastFormData = [
+YeastFormData = [
 	{ id: 0, en: 'Liquid',  nl: 'Vloeibaar',    cells: 100000000000 },
 	{ id: 1, en: 'Dry',     nl: 'Korrel',       cells: 15000000000 },
 	{ id: 2, en: 'Slant',   nl: 'Schuine buis', cells: 1700000000 },
 	{ id: 3, en: 'Culture', nl: 'Slurry',       cells: 1700000000 },
 	{ id: 4, en: 'Frozen',  nl: 'Ingevroren',   cells: 1700000000 },
 	{ id: 5, en: 'Bottle',  nl: 'Depot',        cells: 1700000000 }
-];
-var YeastFormSource = {
+],
+YeastFormSource = {
 	localdata: YeastFormData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'cells' }]
-};
-var YeastFormAdapter = new $.jqx.dataAdapter(YeastFormSource);
+},
+YeastFormAdapter = new $.jqx.dataAdapter(YeastFormSource),
 
-var YeastUseData = [
+YeastUseData = [
 	{ id: 0, en: 'Primary',   nl: 'Hoofdgisting' },
 	{ id: 1, en: 'Secondary', nl: 'Nagisting' },
 	{ id: 2, en: 'Tertiary',  nl: 'Lagering' },
 	{ id: 3, en: 'Bottle',    nl: 'Bottelen' }
-];
-var YeastUseSource = {
+],
+YeastUseSource = {
 	localdata: YeastUseData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }, { name: 'cells' }]
-};
-var YeastUseAdapter = new $.jqx.dataAdapter(YeastUseSource);
+},
+YeastUseAdapter = new $.jqx.dataAdapter(YeastUseSource),
 
-var FlocculationData = [
+FlocculationData = [
 	{ id: 0, en: 'Low',       nl: 'Laag' },
 	{ id: 1, en: 'Medium',    nl: 'Medium' },
 	{ id: 2, en: 'High',      nl: 'Hoog' },
 	{ id: 3, en: 'Very high', nl: 'Zeer hoog' }
-];
-var FlocculationSource = {
+],
+FlocculationSource = {
 	localdata: FlocculationData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 
-};
-var FlocculationAdapter = new $.jqx.dataAdapter(FlocculationSource);
+},
+FlocculationAdapter = new $.jqx.dataAdapter(FlocculationSource),
 
-var StarterTypeData = [
+StarterTypeData = [
 	{ id: 0, en: 'Stirred', nl: 'Geroerd' },
 	{ id: 1, en: 'Shaken',  nl: 'Geschud' },
 	{ id: 2, en: 'Simple',  nl: 'Simpel' }
-];
-var StarterTypeSource = {
+],
+StarterTypeSource = {
 	localdata: StarterTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var StarterTypeAdapter = new $.jqx.dataAdapter(StarterTypeSource);
+},
+StarterTypeAdapter = new $.jqx.dataAdapter(StarterTypeSource),
 
-var MiscTypeData = [
+MiscTypeData = [
 	{ id: 0, en: 'Spice',          nl: 'Specerij' },
 	{ id: 1, en: 'Herb',           nl: 'Kruid' },
 	{ id: 2, en: 'Flavor',         nl: 'Smaakstof' },
@@ -223,198 +223,198 @@
 	{ id: 4, en: 'Water agent',    nl: 'Brouwzout' },
 	{ id: 5, en: 'Yeast nutrient', nl: 'Gistvoeding' },
 	{ id: 6, en: 'Other',          nl: 'Overig' }
-];
-var MiscTypeSource = {
+],
+MiscTypeSource = {
 	localdata: MiscTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var MiscTypeAdapter = new $.jqx.dataAdapter(MiscTypeSource);
+},
+MiscTypeAdapter = new $.jqx.dataAdapter(MiscTypeSource),
 
-var MiscUseData = [
+MiscUseData = [
 	{ id: 0, en: 'Starter',   nl: 'Starter' },
 	{ id: 1, en: 'Mash',      nl: 'Maischen' },
 	{ id: 2, en: 'Boil',      nl: 'Koken' },
 	{ id: 3, en: 'Primary',   nl: 'Hoofdvergisting' },
 	{ id: 4, en: 'Secondary', nl: 'Nagisting/lagering' },
 	{ id: 5, en: 'Bottling',  nl: 'Bottelen' }
-];
-var MiscUseSource = {
+],
+MiscUseSource = {
 	localdata: MiscUseData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var MiscUseAdapter = new $.jqx.dataAdapter(MiscUseSource);
+},
+MiscUseAdapter = new $.jqx.dataAdapter(MiscUseSource),
 
-var StyleTypeData = [
+StyleTypeData = [
 	{ id: 0, en: 'Lager', nl: 'Ondergistend bier' },
 	{ id: 1, en: 'Ale',   nl: 'Bovengistend bier' },
 	{ id: 2, en: 'Mead',  nl: 'Mede' },
 	{ id: 3, en: 'Wheat', nl: 'Tarwebier' },
 	{ id: 4, en: 'Mixed', nl: 'Gemengd' },
 	{ id: 5, en: 'Cider', nl: 'Cider' }
-];
-var StyleTypeSource = {
+],
+StyleTypeSource = {
 	localdata: StyleTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var StyleTypeAdapter = new $.jqx.dataAdapter(StyleTypeSource);
+},
+StyleTypeAdapter = new $.jqx.dataAdapter(StyleTypeSource),
 
-var MashStepTypeData = [
+MashStepTypeData = [
 	{ id: 0, en: 'Infusion',    nl: 'Infusie' },
 	{ id: 1, en: 'Temperature', nl: 'Verwarming' },
 	{ id: 2, en: 'Decoction',   nl: 'Decoctie' }
-];
-var MashStepTypeSource = {
+],
+MashStepTypeSource = {
 	localdata: MashStepTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var MashStepTypeAdapter = new $.jqx.dataAdapter(MashStepTypeSource);
+},
+MashStepTypeAdapter = new $.jqx.dataAdapter(MashStepTypeSource),
 
-var RecipeTypeData = [
+RecipeTypeData = [
 	{ id: 0, en: 'Extract',      nl: 'Extract' },
 	{ id: 1, en: 'Partial Mash', nl: 'Deelmaisch' },
 	{ id: 2, en: 'All Grain',    nl: 'Mout' }
-];
-var RecipeTypeSource = {
+],
+RecipeTypeSource = {
 	localdata: RecipeTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var RecipeTypeAdapter = new $.jqx.dataAdapter(RecipeTypeSource);
+},
+RecipeTypeAdapter = new $.jqx.dataAdapter(RecipeTypeSource),
 
-var IBUmethodData = [
+IBUmethodData = [
 	{ id: 0, en: 'Tinseth', nl: 'Tinseth' },
 	{ id: 1, en: 'Rager',   nl: 'Rager' },
 	{ id: 2, en: 'Daniels', nl: 'Daniels' }
 //	{ id: 3, en: 'Garetz',  nl: 'Garetz' },	// Not yet supported.
 //	{ id: 4, en: 'Mosher',  nl: 'Mosher' },
 //	{ id: 5, en: 'Noonan',  nl: 'Noonan' }
-];
-var IBUmethodSource = {
+],
+IBUmethodSource = {
 	localdata: IBUmethodData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var IBUmethodAdapter = new $.jqx.dataAdapter(IBUmethodSource);
+},
+IBUmethodAdapter = new $.jqx.dataAdapter(IBUmethodSource),
 
-var ColorMethodData = [
+ColorMethodData = [
 	{ id: 0, en: 'Morey',       nl: 'Morey' },
 	{ id: 1, en: 'Mosher',      nl: 'Mosher' },
 	{ id: 2, en: 'Daniels',     nl: 'Daniels' },
 	{ id: 3, en: 'Halberstadt', nl: 'Halberstadt' },
 	{ id: 4, en: 'Naudts',      nl: 'Naudts' }
-];
-var ColorMethodSource = {
+],
+ColorMethodSource = {
 	localdata: ColorMethodData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var ColorMethodAdapter = new $.jqx.dataAdapter(ColorMethodSource);
+},
+ColorMethodAdapter = new $.jqx.dataAdapter(ColorMethodSource),
 
-var CoolingTypeData = [
+CoolingTypeData = [
 	{ id: 0, en: '-',                   nl: '-' },
 	{ id: 1, en: 'Emersion chiller',    nl: 'Dompelkoeler' },
 	{ id: 2, en: 'Counterflow chiller', nl: 'Tegenstroomkoeler' },
 	{ id: 3, en: 'Au bain marie',       nl: 'Au bain marie' },
 	{ id: 4, en: 'Natural',             nl: 'Laten afkoelen' }
-];
-var CoolingTypeSource = {
+],
+CoolingTypeSource = {
 	localdata: CoolingTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var CoolingTypeAdapter = new $.jqx.dataAdapter(CoolingTypeSource);
+},
+CoolingTypeAdapter = new $.jqx.dataAdapter(CoolingTypeSource),
 
-var AerationTypeData = [
+AerationTypeData = [
 	{ id: 0, en: 'None',   nl: 'Geen' },
 	{ id: 1, en: 'Air',    nl: 'Lucht' },
 	{ id: 2, en: 'Oxygen', nl: 'Zuurstof' }
-];
-var AerationTypeSource = {
+],
+AerationTypeSource = {
 	localdata: AerationTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }] 
-};
-var AerationTypeAdapter = new $.jqx.dataAdapter(AerationTypeSource);
+},
+AerationTypeAdapter = new $.jqx.dataAdapter(AerationTypeSource),
 
-var AcidTypeData = [
+AcidTypeData = [
 	{ id: 0, en: 'Lactic',       nl: 'Melkzuur' },
 	{ id: 1, en: 'Hydrochloric', nl: 'Zoutzuur' },
 	{ id: 2, en: 'Phosphoric',   nl: 'Fosforzuur' },
 	{ id: 3, en: 'Sulfuric',     nl: 'Zwavelzuur' }
-];
-var AcidTypeSource = {
+],
+AcidTypeSource = {
 	localdata: AcidTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var AcidTypeAdapter = new $.jqx.dataAdapter(AcidTypeSource);
+},
+AcidTypeAdapter = new $.jqx.dataAdapter(AcidTypeSource),
 
-var BaseTypeData = [
+BaseTypeData = [
 	{ id: 0, en: 'Sodiumbicarbonate', nl: 'NaHCO3' },
 	{ id: 1, en: 'Sodiumcarbonate',   nl: 'Na2CO3' },
 	{ id: 2, en: 'Calciumcarbonate',  nl: 'CaCO3' },
 	{ id: 3, en: 'Calciumhydroxide',  nl: 'Ca(OH)2' }
-];
-var BaseTypeSource = {
+],
+BaseTypeSource = {
 	localdata: BaseTypeData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var BaseTypeAdapter = new $.jqx.dataAdapter(BaseTypeSource);
+},
+BaseTypeAdapter = new $.jqx.dataAdapter(BaseTypeSource),
 
-var SpargeSourceData = [
+SpargeSourceData = [
 	{ id: 0, en: 'Source 1', nl: 'Bron 1' },
 	{ id: 1, en: 'Source 2', nl: 'Bron 2' },
 	{ id: 2, en: 'Mixed',    nl: 'Gemengd' }
-];
-var SpargeSourceSource = {
+],
+SpargeSourceSource = {
 	localdata: SpargeSourceData,
 	datatype: "array",
 	datafields: [{ name: 'id' }, { name: 'en' }, { name: 'nl' }]
-};
-var SpargeSourceAdapter = new $.jqx.dataAdapter(SpargeSourceSource);
+},
+SpargeSourceAdapter = new $.jqx.dataAdapter(SpargeSourceSource),
 
 
 // options for editors
 
-var Show1wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 1, readOnly: true };
-var Show2wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 2, readOnly: true };
-var Show3wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 3, readOnly: true };
-var Smal0dec = { inputMode: 'simple', theme: theme, width:  50, height: 23, decimalDigits: 0, readOnly: true };
-var Smal1dec = { inputMode: 'simple', theme: theme, width:  50, height: 23, decimalDigits: 1, readOnly: true };
-var Show0dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 0 };
-var Show1dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 1 };
-var Show2dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 2 };
-var Show3dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 3 };
-var SGopts   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.990, max: 1.199, decimalDigits: 3, spinButtons: true };
-var Spin1dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true };
-var Spin2dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true };
-var Spin3dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 3, spinButtons: true };
-var SpinpH   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true };
-var Spin2pH  = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 2, spinButtons: true };
-var YeastT   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true };
-var PosInt   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 0, spinButtons: true };
-var Perc1dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 1, spinButtons: true };
-var Perc0    = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true };
-var Dateopts = {
+Show1wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 1, readOnly: true },
+Show2wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 2, readOnly: true },
+Show3wat = { inputMode: 'simple', theme: theme, width:  74, height: 23, decimalDigits: 3, readOnly: true },
+Smal0dec = { inputMode: 'simple', theme: theme, width:  50, height: 23, decimalDigits: 0, readOnly: true },
+Smal1dec = { inputMode: 'simple', theme: theme, width:  50, height: 23, decimalDigits: 1, readOnly: true },
+Show0dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 0 },
+Show1dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 1 },
+Show2dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 2 },
+Show3dec = { inputMode: 'simple', theme: theme, width:  90, height: 23, readOnly: true, decimalDigits: 3 },
+SGopts   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.990, max: 1.199, decimalDigits: 3, spinButtons: true },
+Spin1dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true },
+Spin2dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true },
+Spin3dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 3, spinButtons: true },
+SpinpH   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true },
+Spin2pH  = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 2, spinButtons: true },
+YeastT   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 40, decimalDigits: 1, spinButtons: true },
+PosInt   = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 0, spinButtons: true },
+Perc1dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 1, spinButtons: true },
+Perc0    = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 100, decimalDigits: 0, spinButtons: true },
+Dateopts = {
 	theme: theme, width: 150, height: 23, allowNullDate: true, todayString: 'Vandaag', clearString: 'Wissen', showFooter: true,
 	formatString: 'yyyy-MM-dd', enableBrowserBoundsDetection: true
-};
-var DateTimeopts = {
+},
+DateTimeopts = {
 	theme: theme, width: 230, height: 23, allowNullDate: true, todayString: 'Vandaag', clearString: 'Wissen', showFooter: true,
 	formatString: 'yyyy-MM-dd HH:mm:ss', enableBrowserBoundsDetection: true, showTimeButton: true
-};
+},
 
 
-var	sugardensity = 1.611; //kg/l in solution
+sugardensity = 1.611, //kg/l in solution
 
 // Styles dropdown list
-var stylesUrl = "includes/db_profile_styles.php";
-var stylesSource = {
+stylesUrl = "includes/db_profile_styles.php",
+stylesSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -442,12 +442,12 @@
 		{ name: 'examples', type: 'string' }
 	],
 	url: stylesUrl
-};
-var styleslist = new $.jqx.dataAdapter(stylesSource);
+},
+styleslist = new $.jqx.dataAdapter(stylesSource),
 
 // Equipemnt dropdown list
-var equipmentUrl = "includes/db_inventory_equipments.php";
-var equipmentSource = {
+equipmentUrl = "includes/db_inventory_equipments.php",
+equipmentSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'name', type: 'string' },
@@ -476,11 +476,11 @@
 		{ name: 'efficiency', type: 'float' }
 	],
 	url: equipmentUrl
-};
-var equipmentlist = new $.jqx.dataAdapter(equipmentSource);
+},
+equipmentlist = new $.jqx.dataAdapter(equipmentSource),
 
 // dropdownlist datasource from inventory_fermentables
-var fermentableInvSource = {
+fermentableInvSource = {
 	datatype: "json",
         datafields: [
                 { name: 'record', type: 'number' },
@@ -505,13 +505,13 @@
         	{ name: 'cost', type: 'float' }
         ],
         url: "getfermentablesources.php"
-};
-var fermentableinstock = false;
-var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource, {
+},
+fermentableinstock = false,
+fermentablelist = new $.jqx.dataAdapter(fermentableInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-			var row = records[i];
+		var row, i, data = new Array();
+		for (i = 0; i < records.length; i++) {
+			row = records[i];
 			if (row.inventory || ! fermentableinstock)
 				data.push(row);
 		}
@@ -520,12 +520,12 @@
         loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
-var fermentablesugars = new $.jqx.dataAdapter(fermentableInvSource, {
+}),
+fermentablesugars = new $.jqx.dataAdapter(fermentableInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-			var row = records[i];
+		var row, i, data = new Array();
+		for (i = 0; i < records.length; i++) {
+			row = records[i];
 			if (row.type == 1 || row.type == 3)	// Sugars or dry extract
 				data.push(row);
 		}
@@ -534,10 +534,10 @@
 	loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
+}),
 
 // dropdownlist datasource from inventory_hops
-var hopInvSource = {
+hopInvSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -558,13 +558,13 @@
 		{ name: 'cost', type: 'float' }
 	],
 	url: "gethopsources.php"
-};
-var hopinstock = false;
-var hoplist = new $.jqx.dataAdapter(hopInvSource, {
+},
+hopinstock = false,
+hoplist = new $.jqx.dataAdapter(hopInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-			var row = records[i];
+		var row, i, data = new Array();
+		for (i = 0; i < records.length; i++) {
+			row = records[i];
 			if (row.inventory || ! hopinstock)
 				data.push(row);
 		}
@@ -573,10 +573,10 @@
         loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
+}),
 
 // dropdownlist datasource from inventory_miscs
-var miscInvSource = {
+miscInvSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -589,13 +589,13 @@
 		{ name: 'cost', type: 'float' }
 	],
 	url: "getmiscsources.php"
-};
-var miscinstock = false;
-var misclist = new $.jqx.dataAdapter(miscInvSource, {
+},
+miscinstock = false,
+misclist = new $.jqx.dataAdapter(miscInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-		var row = records[i];
+		var row, i, data = new Array();
+		for (i = 0; i < records.length; i++) {
+		row = records[i];
 			if (row.inventory || ! miscinstock)
 				data.push(row);
 		}
@@ -604,10 +604,10 @@
         loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
+}),
 
 // dropdownlist datasource from inventory_yeasts
-var yeastInvSource = {
+yeastInvSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -626,13 +626,13 @@
 		{ name: 'tolerance', type: 'float' }
 	],
 	url: "getyeastsources.php"
-};
-var yeastinstock = false;
-var yeastlist = new $.jqx.dataAdapter(yeastInvSource, {
+},
+yeastinstock = false,
+yeastlist = new $.jqx.dataAdapter(yeastInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-			var row = records[i];
+		var row, i, data = new Array();
+		for (i = 0; i < records.length; i++) {
+			row = records[i];
 			if (row.inventory || ! yeastinstock)
 				data.push(row);
 		}
@@ -641,10 +641,10 @@
 	loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
+}),
 
 // dropdownlist datasource from inventory_waters
-var waterInvSource = {
+waterInvSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -661,13 +661,14 @@
 		{ name: 'cost', type: 'float' },
 	],
 	url: "getwatersources.php"
-};
-var waterinstock = false;
-var waterlist = new $.jqx.dataAdapter(waterInvSource, {
+},
+waterinstock = false,
+waterlist = new $.jqx.dataAdapter(waterInvSource, {
 	beforeLoadComplete: function (records) {
-		var data = new Array();
-		for (var i = 0; i < records.length; i++) {
-			var row = records[i];
+		var data, i, row;
+		data = new Array();
+		for (i = 0; i < records.length; i++) {
+			row = records[i];
 			if (row.inventory || row.unlimited_stock || ! waterinstock)
 				data.push(row);
 		}
@@ -676,10 +677,10 @@
         loadError: function(jqXHR, status, error) {
 		console.log(status + ' ' + error);
 	},
-});
+}),
 
 // dropdownlist datasource from profile_water
-var waterProfileSource = {
+waterProfileSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -694,11 +695,11 @@
 		{ name: 'total_alkalinity', type: 'float' },
 	],
 	url: "includes/db_profile_water.php"
-};
-var waterprofiles = new $.jqx.dataAdapter(waterProfileSource);
+},
+waterprofiles = new $.jqx.dataAdapter(waterProfileSource),
 
 // dropdownlist datasource from profile_mash
-var mashProfileSource = {
+mashProfileSource = {
 	datatype: "json",
 	datafields: [
 		{ name: 'record', type: 'number' },
@@ -706,42 +707,24 @@
 		{ name: 'steps', type: 'array' }
 	],
 	url: "includes/db_profile_mash.php"
-};
-var mashlist = new $.jqx.dataAdapter(mashProfileSource);
-
-
-
+},
+mashlist = new $.jqx.dataAdapter(mashProfileSource),
 
-$(document).ready(function(){
-$("#jqxMenu").jqxMenu({width:1280,height:'30px',autoOpen:false,clickToOpen:true,theme:theme});
-$("#jqxWidget").css('visibility','visible');
-});
-
-
-
-function Round(n,d){for(var i=0,m=1;i<d;i++,m*=10);return Math.round(n*m)/m;}
 
 
 /*
  * From "Rekenen aan bier" by Hans Halberstadt.
  */
-var K1s = 0.384;
-var K1a = -0.177;
-var K1e = 0.241;
-var K1g = 0.247;
-var Ks  = 0.1415;
-var Ka1 = 0.058;
-var Ka2 = 0.078;
-var Ke  = 0.174;
-var Kg  = 0.109;
+K1s = 0.384, K1a = -0.177, K1e = 0.241, K1g = 0.247, Ks  = 0.1415, Ka1 = 0.058, Ka2 = 0.078, Ke  = 0.174, Kg  = 0.109;
 
 // =E2/E6+(E3/E6)*$B$24/$B$23+(E3/E6)*(E3/E6)*$B$25/$B$23+E4/E6*$B$26/$B$23+E5/E6*$B$27/$B$23
 // For Brix
 function A(sugar, volume, alc, eiwit, glycerol) {
 
-	var vol = volume * 1000;
-	var A = sugar/vol + (alc/vol)*Ka1/Ks + (alc/vol)*(alc/vol) * Ka2/Ks + eiwit/vol * Ke/Ks + glycerol/vol * Kg/Ks;
+	var vol, A;
 
+	vol = volume * 1000;
+	A = sugar/vol + (alc/vol)*Ka1/Ks + (alc/vol)*(alc/vol) * Ka2/Ks + eiwit/vol * Ke/Ks + glycerol/vol * Kg/Ks;
 	console.log("A("+sugar+"."+volume+","+alc+","+eiwit+","+glycerol+"):"+A);
 	return A;
 }
@@ -750,21 +733,54 @@
 // for Plato
 function B(sugar, volume, alc, eiwit, glycerol) {
 
-	var vol = volume * 1000;
-	var B = sugar/vol + (alc/vol)*K1a/K1s + eiwit/vol*K1e/K1s + glycerol/vol*K1g/K1s;
+	var vol, B;
 
+	vol = volume * 1000;
+	B = sugar/vol + (alc/vol)*K1a/K1s + eiwit/vol*K1e/K1s + glycerol/vol*K1g/K1s;
 	console.log("B("+sugar+"."+volume+","+alc+","+eiwit+","+glycerol+"):"+B);
         return B;
 }
 
 
-function ebc_to_srm(ebc){
-var srm = -1.32303E-12*Math.pow(ebc,4)-0.00000000291515*Math.pow(ebc,3)+0.00000818515*Math.pow(ebc,2)+0.372038*ebc+0.596351;
-if(srm<0)srm=0;return srm;
+
+$(document).ready(function(){
+
+        $("#jqxMenu").jqxMenu({
+                width:1280,
+                height:'30px',
+                autoOpen:false,
+                clickToOpen:true,
+                theme:theme
+        });
+        $("#jqxWidget").css('visibility','visible');
+});
+
+
+
+function Round(n,d){
+
+        for (var i=0,m=1; i<d; i++,m*=10);
+        return Math.round(n*m)/m;
 }
+
+
+
+function ebc_to_srm(ebc){
+
+	var srm = -1.32303E-12*Math.pow(ebc,4) - 0.00000000291515*Math.pow(ebc,3) + 0.00000818515*Math.pow(ebc,2) + 0.372038*ebc + 0.596351;
+	if(srm<0)
+		srm=0;
+	return srm;
+}
+
+
+
 function srm_to_ebc(srm){
-var ebc=Math.round(0.000000000176506*Math.pow(srm,4)+0.000000154529*Math.pow(srm,3)-0.000159428*Math.pow(srm,2)+2.68837*srm-1.6004);
-if(ebc<0)ebc=0;return ebc;
+
+	var ebc = Math.round(0.000000000176506*Math.pow(srm,4) + 0.000000154529*Math.pow(srm,3) - 0.000159428*Math.pow(srm,2) + 2.68837*srm - 1.6004);
+	if(ebc<0)
+		ebc=0;
+	return ebc;
 }
 
 
@@ -772,225 +788,306 @@
 /* Return incremented color by the boil and yeast.
  * https://www.hobbybrouwen.nl/forum/index.php/topic,19020.msg281132.html#msg281132 */
 function get_kt(ebc){
-var kt=1;
-if(ebc<3)kt=3.5;else if(ebc<6)kt=3;else if(ebc<8)kt=2.75;else if(ebc<10)kt=2.5;else if(ebc<20)kt=1.8;
-else if(ebc<30)kt=1.6;else if(ebc<60)kt=1.3;else if(ebc<100)kt=1.2;else if(ebc<300)kt=1.1;return kt;
+
+	var kt=1;
+	if(ebc<3)
+		kt=3.5;
+	else if(ebc<6)
+		kt=3;
+	else if(ebc<8)
+		kt=2.75;
+	else if(ebc<10)
+		kt=2.5;
+	else if(ebc<20)
+		kt=1.8;
+	else if(ebc<30)
+		kt=1.6;
+	else if(ebc<60)
+		kt=1.3;
+	else if(ebc<100)
+		kt=1.2;
+	else if(ebc<300)
+		kt=1.1;
+	return kt;
 }
+
+
+
 function abvol(og,fg){
-if(((og-fg)<0)||(fg<0.9))return 0;
-var factor=og*3157*Math.pow(10,-5)+9.716*Math.pow(10,-2);
-return (og*1000-fg*1000)*factor;
+
+	if(((og-fg)<0)||(fg<0.9))
+		return 0;
+	var factor = og*3157*Math.pow(10,-5) + 9.716*Math.pow(10,-2);
+	return (og*1000-fg*1000)*factor;
 }
 
 
 
 /* Kleurwerking naar SRM. Niet voor Halberstadt, Naudts */
 function kw_to_srm(colormethod,c){
-if(colormethod==0)return 1.4922*Math.pow(c,0.6859);//Morey
-if(colormethod==1)return 0.3*c+4.7;//Mosher
-if(colormethod==2)return 0.2*c+8.4;//Daniels
-return 0;//Halberstadt,Naudts
+	if(colormethod==0)
+		return 1.4922*Math.pow(c,0.6859);//Morey
+	if(colormethod==1)
+		return 0.3*c+4.7;//Mosher
+	if(colormethod==2)
+		return 0.2*c+8.4;//Daniels
+	return 0;//Halberstadt,Naudts
 }
-function kw_to_ebc(colormethod, c){return srm_to_ebc(kw_to_srm(colormethod,c));}
+
+
+
+function kw_to_ebc(colormethod, c){
+
+	return srm_to_ebc(kw_to_srm(colormethod,c));
+}
 
 
 
 /*
  * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464
  */
-function toIBU(Use,Form,SG,Volume,Amount,Boiltime,Alpha,Method){
-var gravity=parseFloat(SG);
-var liters=parseFloat(Volume);
-var alpha=parseFloat(Alpha)/100;
-var mass=parseFloat(Amount)*1000;
-var time=parseFloat(Boiltime);
-var fmoment=1.0;
-var pfactor=1.0;
-var ibu=0;
+function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method) {
+
+	var gravity, liters, alpha, mass, time, fmoment=1.0, pfactor=1.0, ibu=0, boilfactor, sgfactor,
+	    AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation;
+
+	gravity = parseFloat(SG);
+	liters = parseFloat(Volume);
+	alpha = parseFloat(Alpha)/100;
+	mass = parseFloat(Amount)*1000;
+	time = parseFloat(Boiltime);
+
+	if ((Use==3) || (Use==4) || (Use==5)) {	// Aroma, Whirlpool or Dry hop.
+		fmoment=0.0;
+	} else if (Use==0) {			// Mash
+		fmoment+=my_factor_mashhop/100;	// Brouwhulp
+	} else if (Use==1) {			// First wort
+		fmoment+=my_factor_fwh/100;	// Brouwhulp, Louis, Ozzie
+	}
+
+	if (Form==0){ 				// Pellet
+		pfactor+=my_factor_pellet/100;
+	} else if (Form==1) {			// Plug
+		pfactor+=my_factor_plug/100;
+	} else if (Form==3) {			// Wet leaf
+		pfactor+=my_factor_wethop/100;	// From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
+	} else if (Form==4) {			// Cryo hop
+		pfactor+=my_factor_cryohop/100;
+	}
 
-if((Use==3)||(Use==4)||(Use==5)){// Aroma, Whirlpool or Dry hop.
-fmoment=0.0;
-}else if(Use==0){// Mash
-fmoment+=my_factor_mashhop/100;// Brouwhulp
-}else if(Use==1){// First wort
-fmoment+=my_factor_fwh/100;// Brouwhulp, Louis, Ozzie
-}
+	if(Method==0){// Tinseth
+		/* http://realbeer.com/hops/research.html */
+		AddedAlphaAcids=(alpha*mass*1000)/liters;
+		Bigness_factor=1.65*Math.pow(0.000125,gravity-1);
+		BoilTime_factor=((1-Math.exp(-0.04*time))/4.15);
+		utiisation=Bigness_factor*BoilTime_factor;
+		ibu=Round(utiisation*AddedAlphaAcids*fmoment*pfactor,1);
+	}
+	if(Method==2){// Daniels
+		if (Form == 2)// Leaf
+			boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779;
+		else
+			boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348;
+		if (gravity < 1050)
+			sgfactor=0;
+		else
+			sgfactor=(gravity-1050)/200;
+		ibu = Round(fmoment*((mass*(alpha*100)*boilfactor* 0.1)/(liters*(1+sgfactor))),1);
+	}
+	if(Method==1){// Rager
+		boilfactor = fmoment*18.11 + 13.86*Math.tanh((time*31.32)/18.27);
+		if (gravity < 1050)
+			sgfactor=0;
+		else
+			sgfactor=(gravity-1050)/200;
+		ibu = Round((mass*(alpha*100)*boilfactor*0.1)/(liters*(1+sgfactor)),1);
+	}
 
-if(Form==0){// Pellet
-pfactor+=my_factor_pellet/100;
-}
-if(Form==1){// Plug
-pfactor+=my_factor_plug/100;
-}
-if(Form==3){// Wet leaf
-pfactor+=my_factor_wethop/100;// From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
-}
-if(Form==4){// Cryo hop
-pfactor+=my_factor_cryohop/100;
+	//console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor);
+	return ibu;
 }
 
-if(Method==0){// Tinseth
-/* http://realbeer.com/hops/research.html */
-var AddedAlphaAcids=(alpha*mass*1000)/liters;
-var Bigness_factor=1.65*Math.pow(0.000125,gravity-1);
-var BoilTime_factor=((1-Math.exp(-0.04*time))/4.15);
-var utiisation=Bigness_factor*BoilTime_factor;
-ibu=Round(utiisation*AddedAlphaAcids*fmoment*pfactor,1);
-}
-if(Method==2){// Daniels
-var boilfactor;
-var sgfactor;
-if(Form==2)// Leaf
-boilfactor=-(0.0041*time*time)+(0.6162*time)+1.5779;
-else
-boilfactor=-(0.0051*time*time)+(0.7835*time)+1.9348;
-if(gravity<1050)
-sgfactor=0;
-else
-sgfactor=(gravity-1050)/200;
-ibu = Round(fmoment*((mass*(alpha*100)*boilfactor* 0.1)/(liters*(1+sgfactor))),1);
-}
-if(Method==1){// Rager
-var sgfactor;
-var boilfactor=fmoment*18.11+13.86*Math.tanh((time*31.32)/18.27);
-if(gravity<1050)
-sgfactor=0;
-else
-sgfactor=(gravity-1050)/200;
-ibu = Round((mass*(alpha*100)*boilfactor*0.1)/(liters*(1+sgfactor)),1);
-}
+
 
-//console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor);
-return ibu;
+function ebc_to_color(ebc){
+
+	return srm_to_color(ebc_to_srm(ebc));
 }
 
 
 
-function ebc_to_color(ebc){return srm_to_color(ebc_to_srm(ebc));}
 function srm_to_color(srm){
-var i = Math.round(srm * 10);
-if(i<0)i=0;
-if(i>299)i=299;
-/* Table copied from Brouwhulp/BrewBuddy */
-var R=[
-250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,//0
-250,250,250,250,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,//2
-234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,//4
-214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,200,199,199,198,198,//6
-197,197,196,196,195,195,194,194,193,193,192,192,192,192,192,192,192,192,192,192,//8
-192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,//10
-192,192,192,192,192,192,192,192,191,190,189,188,187,186,185,184,183,182,181,180,//12
-179,178,177,175,174,172,171,169,168,167,195,164,162,161,159,158,157,155,154,152,//14
-151,149,148,147,145,144,142,141,139,138,137,135,134,132,131,129,128,127,125,124,//16
-122,121,119,118,117,115,114,112,111,109,108,107,105,104,102,101,99,98,97,95,//18
-94,92,91,89,88,87,85,84,82,81,79,78,77,75,74,72,71,69,68,67,//20
-65,64,62,61,59,58,57,55,54,52,51,49,48,47,45,44,43,41,39,38,//22
-37,37,36,36,35,35,34,34,33,33,32,32,31,31,30,30,29,29,28,28,//24
-27,27,26,26,25,25,24,24,23,23,22,22,21,21,20,20,19,19,18,18,//26
-17,17,16,16,15,15,14,14,13,13,12,12,11,11,10,10,9,9,8,8];
-var G=[
-250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
-250,250,250,250,250,250,249,248,247,246,245,244,242,240,238,236,234,232,230,228,
-226,224,222,220,218,216,214,212,210,208,206,204,202,200,198,196,194,192,190,188,
-186,184,182,180,178,176,174,172,170,168,166,164,162,160,158,156,154,152,150,148,
-146,144,142,141,140,139,139,138,137,136,136,135,134,133,133,132,131,130,130,129,
-128,127,127,126,125,124,124,123,122,121,121,120,119,118,118,117,116,115,115,114,
-113,112,112,111,110,109,109,108,107,106,106,105,104,103,103,102,101,100,100,99,
-98,97,97,96,95,94,94,93,92,91,91,90,89,88,88,87,86,85,85,84,
-83,82,82,81,80,79,78,77,76,75,75,74,73,72,72,71,70,69,69,68,
-67,66,66,65,64,63,63,62,61,60,60,59,58,57,57,56,55,54,54,53,
-52,51,51,50,49,48,48,47,46,45,45,44,43,42,42,41,40,39,39,38,
-37,36,36,35,34,33,33,32,31,30,30,29,28,27,27,26,25,24,24,23,
-22,22,22,21,21,21,20,20,20,19,19,19,18,18,18,17,17,17,16,16,
-16,15,15,15,14,14,14,13,13,13,12,12,12,11,11,11,10,10,10,9,
-9,9,8,8,8,7,7,7,6,6,6,5,5,5,4,4,4,3,3,3];
-var B=[
-210,204,199,193,188,182,177,171,166,160,155,149,144,138,133,127,122,116,111,105,
-100,94,89,83,78,72,67,61,56,50,45,45,45,46,46,46,46,47,47,47,
-47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,
-52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,56,56,56,
-56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
-56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
-56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
-56,56,56,55,55,55,55,54,54,54,54,53,53,53,53,52,52,52,52,51,
-51,51,51,50,50,50,50,49,49,48,47,47,46,45,45,44,43,43,42,41,
-41,40,39,39,38,37,37,36,35,34,33,32,31,29,28,27,26,25,24,23,
-21,20,19,18,17,16,15,13,12,11,10,9,8,9,9,10,10,11,11,12,
-12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,
-21,21,21,20,20,20,19,19,19,18,18,18,17,17,17,17,16,16,15,15,
-15,14,14,14,13,13,13,12,12,12,11,11,11,10,10,10,9,9,9,8,
-8,8,7,7,7,6,6,6,5,5,5,4,4,4,3,3,3,2,2,2];
-var color=R[i]*65536+G[i]*256+B[i];
-var result=color.toString(16).toUpperCase();
-if(result.length<6)result='0'+result;
-return '#'+result;
+
+	var i, R, G, B, color, result;
+
+	i = Math.round(srm * 10);
+	if (i < 0)
+		i=0;
+	if (i > 299)
+		i=299;
+
+	/* Table copied from Brouwhulp/BrewBuddy */
+	R=[
+	250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,//0
+	250,250,250,250,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,//2
+	234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,//4
+	214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,200,199,199,198,198,//6
+	197,197,196,196,195,195,194,194,193,193,192,192,192,192,192,192,192,192,192,192,//8
+	192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,//10
+	192,192,192,192,192,192,192,192,191,190,189,188,187,186,185,184,183,182,181,180,//12
+	179,178,177,175,174,172,171,169,168,167,195,164,162,161,159,158,157,155,154,152,//14
+	151,149,148,147,145,144,142,141,139,138,137,135,134,132,131,129,128,127,125,124,//16
+	122,121,119,118,117,115,114,112,111,109,108,107,105,104,102,101,99,98,97,95,//18
+	94,92,91,89,88,87,85,84,82,81,79,78,77,75,74,72,71,69,68,67,//20
+	65,64,62,61,59,58,57,55,54,52,51,49,48,47,45,44,43,41,39,38,//22
+	37,37,36,36,35,35,34,34,33,33,32,32,31,31,30,30,29,29,28,28,//24
+	27,27,26,26,25,25,24,24,23,23,22,22,21,21,20,20,19,19,18,18,//26
+	17,17,16,16,15,15,14,14,13,13,12,12,11,11,10,10,9,9,8,8];
+
+	G=[
+	250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
+	250,250,250,250,250,250,249,248,247,246,245,244,242,240,238,236,234,232,230,228,
+	226,224,222,220,218,216,214,212,210,208,206,204,202,200,198,196,194,192,190,188,
+	186,184,182,180,178,176,174,172,170,168,166,164,162,160,158,156,154,152,150,148,
+	146,144,142,141,140,139,139,138,137,136,136,135,134,133,133,132,131,130,130,129,
+	128,127,127,126,125,124,124,123,122,121,121,120,119,118,118,117,116,115,115,114,
+	113,112,112,111,110,109,109,108,107,106,106,105,104,103,103,102,101,100,100,99,
+	98,97,97,96,95,94,94,93,92,91,91,90,89,88,88,87,86,85,85,84,
+	83,82,82,81,80,79,78,77,76,75,75,74,73,72,72,71,70,69,69,68,
+	67,66,66,65,64,63,63,62,61,60,60,59,58,57,57,56,55,54,54,53,
+	52,51,51,50,49,48,48,47,46,45,45,44,43,42,42,41,40,39,39,38,
+	37,36,36,35,34,33,33,32,31,30,30,29,28,27,27,26,25,24,24,23,
+	22,22,22,21,21,21,20,20,20,19,19,19,18,18,18,17,17,17,16,16,
+	16,15,15,15,14,14,14,13,13,13,12,12,12,11,11,11,10,10,10,9,
+	9,9,8,8,8,7,7,7,6,6,6,5,5,5,4,4,4,3,3,3];
+
+	B=[
+	210,204,199,193,188,182,177,171,166,160,155,149,144,138,133,127,122,116,111,105,
+	100,94,89,83,78,72,67,61,56,50,45,45,45,46,46,46,46,47,47,47,
+	47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,
+	52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,56,56,56,
+	56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
+	56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
+	56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,
+	56,56,56,55,55,55,55,54,54,54,54,53,53,53,53,52,52,52,52,51,
+	51,51,51,50,50,50,50,49,49,48,47,47,46,45,45,44,43,43,42,41,
+	41,40,39,39,38,37,37,36,35,34,33,32,31,29,28,27,26,25,24,23,
+	21,20,19,18,17,16,15,13,12,11,10,9,8,9,9,10,10,11,11,12,
+	12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22,
+	21,21,21,20,20,20,19,19,19,18,18,18,17,17,17,17,16,16,15,15,
+	15,14,14,14,13,13,13,12,12,12,11,11,11,10,10,10,9,9,9,8,
+	8,8,7,7,7,6,6,6,5,5,5,4,4,4,3,3,3,2,2,2];
+
+	color = R[i]*65536 + G[i]*256 + B[i];
+	result = color.toString(16).toUpperCase();
+	if (result.length < 6)
+		result = '0'+result;
+	return '#'+result;
 }
 
 
 
-function sg_to_plato(sg){return ((135.997*sg-630.272)*sg+1111.14)*sg-616.868;}
-function plato_to_sg(plato){return 1+(plato/(258.6-((plato/258.2)*227.1)));}
-function brix_to_sg(brix){if(my_brix_correction>0)return plato_to_sg(brix/my_brix_correction);else return plato_to_sg(brix);}
-function sg_to_brix(sg){return sg_to_plato(sg)*my_brix_correction;}
+function sg_to_plato(sg){
+	return ((135.997*sg - 630.272) * sg + 1111.14) * sg - 616.868;
+}
+
+
+
+function plato_to_sg(plato){
+	return 1 + (plato / (258.6-((plato/258.2)*227.1)));
+}
+
+
+
+function brix_to_sg(brix){
+	if(my_brix_correction>0)
+		return plato_to_sg(brix/my_brix_correction);
+	else 
+		return plato_to_sg(brix);
+}
+
+
+
+function sg_to_brix(sg){
+	return sg_to_plato(sg)*my_brix_correction;
+}
+
+
 
 function estimate_sg(sugars,batch_size){
-var plato=100*sugars/batch_size;
-var sg=plato_to_sg(plato);
-for(var i=0;i<20;i++){if(sg>0)plato=100*sugars/(batch_size*sg);sg=plato_to_sg(plato);}
-return Round(sg,4);
+
+	var plato, sg, i;
+
+	plato = 100*sugars / batch_size;
+	sg = plato_to_sg(plato);
+	for (i = 0; i < 20; i++) {
+		if (sg > 0)
+			plato = 100*sugars / (batch_size*sg);
+		sg = plato_to_sg(plato);
+	}
+	return Round(sg,4);
 }
 
 
 
 function estimate_fg(percSugar,percCara,WGratio,TotTme,Temp,attenuation,og){
 
-var BD;
+	var BD, AttBeer, fg;
 
-if(percSugar>40)percSugar=0;
-if(percCara>50)percCara=0;
-if((WGratio>0)&&(TotTme>0)){
-BD=WGratio;
-if(BD<2)BD=2;
-if(BD>5.5)BD=5.5;
-if(Temp<60)Temp=60;
-if(Temp>72)Temp=72;
-}else{
-BD=3.5;
-Temp=67;
-TotTme=75;
-}
-if(attenuation<30)attenuation=77;
+	if (percSugar > 40)
+		percSugar = 0;
+	if (percCara > 50)
+		percCara = 0;
+	if ((WGratio > 0) && (TotTme > 0)) {
+		BD = WGratio;
+		if(BD < 2)
+			BD=2;
+		if(BD > 5.5)
+			BD=5.5;
+		if(Temp < 60)
+			Temp=60;
+		if(Temp > 72)
+			Temp=72;
+	} else {
+		BD=3.5;
+		Temp=67;
+		TotTme=75;
+	}
+	if (attenuation < 30)
+		attenuation=77;
 
-// 0.00825 Attenuation factor yeast
-// 0.00817 Attenuation factor water/grain ration
-// -0.00684 Attenuation factor mash temperature
-// 0.00026 Attenuation factor total mash time  (at some places this is 0.0026 this is wrong!)
-// -0.00356 Attenuation factor percentage crystal malt
-// 0.00553 Attenuation factor percentage simple sugars
-// 0.547 Attenuation factor constant
-var AttBeer=0.00825*attenuation+0.00817*BD-0.00684*Temp+0.00026*TotTme-0.00356*percCara+0.00553*percSugar+0.547;
-var fg=Round(1+(1-AttBeer)*(og-1),4);
+	// 0.00825 Attenuation factor yeast
+	// 0.00817 Attenuation factor water/grain ration
+	// -0.00684 Attenuation factor mash temperature
+	// 0.00026 Attenuation factor total mash time  (at some places this is 0.0026 this is wrong!)
+	// -0.00356 Attenuation factor percentage crystal malt
+	// 0.00553 Attenuation factor percentage simple sugars
+	// 0.547 Attenuation factor constant
+	AttBeer = 0.00825*attenuation + 0.00817*BD - 0.00684*Temp + 0.00026*TotTme - 0.00356*percCara + 0.00553*percSugar + 0.547;
+	fg = Round(1 + (1 - AttBeer) * (og - 1), 4);
 
-console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") AttBeer:"+AttBeer+" fg:"+fg);
-return fg;
+	console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") AttBeer:"+AttBeer+" fg:"+fg);
+	return fg;
 }
 
 
 
 function CalcFrac(TpH, pK1, pK2, pK3) {
 
-	var r1d = Math.pow(10, TpH - pK1);
-	var r2d = Math.pow(10, TpH - pK2);
-	var r3d = Math.pow(10, TpH - pK3);
-	var dd = 1/(1 + r1d + r1d*r2d + r1d*r2d*r3d);
-	var f1d = dd;
-	var f2d = r1d*dd;
-	var f3d = r1d*r2d*dd;
-	var f4d = r1d*r2d*r3d*dd;
+	var r1d, r2d, r3d, dd, f2d, f3d, f4d;
+
+	r1d = Math.pow(10, TpH - pK1);
+	r2d = Math.pow(10, TpH - pK2);
+	r3d = Math.pow(10, TpH - pK3);
+	dd = 1/(1 + r1d + r1d*r2d + r1d*r2d*r3d);
+	f2d = r1d*dd;
+	f3d = r1d*r2d*dd;
+	f4d = r1d*r2d*r3d*dd;
 	return f2d + 2*f3d + 3*f4d;
 }
 
 
+
 function lintner_to_kolbach(lintner) {
 
 	return (3.5 * lintner) - 16;

mercurial