ordersprinter/webapp/elements/product.js

485 lines
21 KiB
JavaScript
Raw Normal View History

2020-11-19 22:47:44 +01:00
/**
*
*/
function createProdTableHeaderLine() {
var txt = "<tr><th>Name"
+ "<th>Typ&nbsp;&nbsp;"
2020-11-19 22:52:43 +01:00
+ "<th>Durchlauf Küche"
2020-11-19 23:00:31 +01:00
+ "<th>Durchlauf Bereitst."
2020-11-19 22:47:44 +01:00
+ "<th>Drucker" +
"<th id=shortnameheader class='prodheader'>Kurzname<th>Preis (A)" +
"<th class='prodheader'>Preis (B)" +
"<th class='prodheader'>Preis (C)" +
2020-11-19 23:02:49 +01:00
"<th class='prodheader'>Einheit" +
2020-11-19 23:10:06 +01:00
"<th class='prodheader'>Anzeige" +
2020-11-19 23:02:49 +01:00
"<th class='prodheader'>Tage" +
2020-11-19 22:47:44 +01:00
"<th class='prodheader'>Steuersatz" +
2020-11-19 23:00:31 +01:00
"<th class='prodheader'>Steuersatz Österreich" +
2020-11-19 22:47:44 +01:00
"<th class='prodheader'>Audio" +
2020-11-19 22:52:43 +01:00
"<th class='prodheader'>Verfügbar";
2020-11-19 22:47:44 +01:00
return txt;
}
function ident(depth) {
var txt = "";
var i=0;
for (i=0;i<depth;i++) {
txt += "&#9658;";
}
return txt;
}
2020-11-19 23:10:06 +01:00
function newProduct(id, longname, shortname,priceA,priceB,priceC,unit,display,days,tax,taxaustria,amount,available,audio,favorite) {
2020-11-19 22:47:44 +01:00
var product = {
id:id,
longname:longname,
shortname:shortname,
priceA: priceA,
priceB: priceB,
priceC: priceC,
2020-11-19 23:02:49 +01:00
unit: unit,
2020-11-19 23:10:06 +01:00
display: display,
2020-11-19 23:02:49 +01:00
days: days,
2020-11-19 22:47:44 +01:00
tax: tax,
2020-11-19 23:00:31 +01:00
taxaustria: taxaustria,
amount: amount,
2020-11-19 22:47:44 +01:00
available: available,
audio: audio,
favorite: favorite,
createTableStructureLine:function (depth,audiofiles) {
//var depthstr = " ".substring(0, depth);
var depthstr = ident(depth);
var trline = "<tr id='prodleaf_" + this.id + "'>"
+ "<td>" + depthstr + "<input type='text' class='prodlongname'></input>"
+ "<td colspan=3>"
+ "<td><input type='text' class='prodshortname'></input>"
+ "<td><input type='text' class='prodpriceA'></input>"
+ "<td><input type='text' class='prodpriceB'></input>"
+ "<td><input type='text' class='prodpriceC'></input>"
2020-11-19 23:02:49 +01:00
+ "<td><input type='text' class='produnit'></input>"
2020-11-19 23:10:06 +01:00
+ "<td><input type='text' class='proddisplay'></input>"
2020-11-19 23:02:49 +01:00
+ "<td><input type='text' class='proddays'></input>"
2020-11-19 22:47:44 +01:00
+ "<td><input type='text' class='prodtax'></input>"
2020-11-19 23:00:31 +01:00
+ "<td>" + this.createTaxAustriaSelection("prodtaxaustriasel_" + this.id)
+ "<td><input type='text' class='prodamount'></input>"
2020-11-19 22:47:44 +01:00
+ "<td>" + this.createAudioSelection(audiofiles,"audiosel_" + this.id)
+ "<td>" + this.createAvailSelection("prodavail_" + this.id,PROD_NO,PROD_YES)
+ "<td>" + this.createAvailSelection("prodfav_" + this.id,PROD_NO,PROD_YES)
+ "</tr>";
return trline;
},
insertValuesIntoMenuTable:function() {
$("#prodleaf_" + this.id + " input.prodlongname").val(this.longname);
$("#prodleaf_" + this.id + " input.prodshortname").val(this.shortname);
$("#prodleaf_" + this.id + " input.prodpriceA").val(this.priceA);
$("#prodleaf_" + this.id + " input.prodpriceB").val(this.priceB);
$("#prodleaf_" + this.id + " input.prodpriceC").val(this.priceC);
2020-11-19 23:02:49 +01:00
$("#prodleaf_" + this.id + " input.produnit").val(this.unit);
2020-11-19 23:10:06 +01:00
$("#prodleaf_" + this.id + " input.proddisplay").val(this.display);
2020-11-19 23:02:49 +01:00
if (this.days == '0123456') {
$("#prodleaf_" + this.id + " input.proddays").val('');
} else {
$("#prodleaf_" + this.id + " input.proddays").val(this.days);
}
2020-11-19 22:47:44 +01:00
$("#prodleaf_" + this.id + " input.prodtax").val(this.tax);
2020-11-19 23:00:31 +01:00
$("#prodleaf_" + this.id + " input.prodamount").val(this.amount);
2020-11-19 22:47:44 +01:00
},
createAudioSelection:function(audiofiles,id) {
var txt = "<select id='" + id + "'><option></option>";
var i=0;
for (i=0;i<audiofiles.length;i++) {
var audiofile = audiofiles[i];
if (this.audio == audiofile) {
txt += "<option selected>" + audiofile + "</option>";
} else {
txt += "<option>" + audiofile + "</option>";
}
}
txt += "</select>";
return txt;
},
2020-11-19 23:00:31 +01:00
2020-11-19 22:47:44 +01:00
createAvailSelection:function(id,text0,text1) {
2020-11-19 23:00:31 +01:00
if (this.available == 1) {
2020-11-19 22:47:44 +01:00
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
},
2020-11-19 23:00:31 +01:00
createOption:function(value,selected,txt) {
if (value == selected) {
return "<option value='" +value + "' selected>" + txt + "</option>";
} else {
return "<option value='" +value + "'>" + txt + "</option>";
}
},
createTaxAustriaSelection:function(id) {
var txt = "<select id='" + id + "'>";
if ((this.taxaustria == 0) || (this.taxaustria == 'null')) {
this.taxaustria = 1;
}
txt += this.createOption(1,this.taxaustria,"Steuersatz 'Normal'");
txt += this.createOption(2,this.taxaustria,"Steuersatz 'Ermäßigt 1'");
txt += this.createOption(3,this.taxaustria,"Steuersatz 'Ermäßigt 2'");
txt += this.createOption(4,this.taxaustria,"Steuersatz 'Besonders'");
txt += "</select>";
return txt;
},
2020-11-19 22:47:44 +01:00
2020-11-19 23:02:49 +01:00
createUnitSelection:function(id) {
var txt = "<select id='" + id + "'>";
if ((this.unit == 0) || (this.unit == 'null')) {
this.unit = 0;
}
txt += this.createOption(0,this.unit,"Stück");
txt += this.createOption(1,this.unit,"Eingabe");
txt += "</select>";
return txt;
},
2020-11-19 23:10:06 +01:00
createDisplaySelection:function(id) {
var txt = "<select id='" + id + "'>";
if ((this.display == 0) || (this.display == 'null') || (this.display == 'KG')) {
this.display = 'KG';
}
if ((this.display != 'KG') && (this.display != 'K') && (this.display != 'G')) {
this.display = 'KG';
}
txt += this.createOption('KG',this.display,"Kellner- und Gastbestellansicht");
txt += this.createOption('K',this.display,"Kellnerbestellansicht");
txt += this.createOption('G',this.display,"Gastbestellansicht");
txt += "</select>";
return txt;
},
2020-11-19 23:00:31 +01:00
createTaxAustriaSel:function(id) {
var visi = ""
if (austria == 0) {
visi = " style='display:none;' ";
}
var txt = '<p><div data-role="fieldcontain" ' + visi + '>'
+ '<label for="' + id + '">Steuersatz Österreich:</label>'
+ this.createTaxAustriaSelection(id)
+ '</div></p>';
return txt;
},
2020-11-19 23:02:49 +01:00
createUnitField:function(id) {
var txt = '<p><div data-role="fieldcontain" >'
+ '<label for="' + id + '">Einheit:</label>'
+ this.createUnitSelection(id)
+ '</div></p>';
return txt;
},
2020-11-19 23:10:06 +01:00
createDisplayField:function(id) {
var txt = '<p><div data-role="fieldcontain" >'
+ '<label for="' + id + '">Anzeige:</label>'
+ this.createDisplaySelection(id)
+ '</div></p>';
return txt;
},
2020-11-19 22:47:44 +01:00
createFavoriteSelection:function(id,text0,text1) {
if (this.favorite == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
},
createMobileAudioSel:function(audiofiles,id) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">Audiofile:</label>'
+ this.createAudioSelection(audiofiles,id)
+ '</div></p>';
return txt;
},
createMobileAvail:function(id,label) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label + '</label>'
+ this.createAvailSelection(id,PROD_NO,PROD_YES)
+ '</div></p>';
return txt;
},
createMobileFavorite:function(id,label) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label + '</label>'
+ this.createFavoriteSelection(id,PROD_NO,PROD_YES)
+ '</div></p>';
return txt;
},
createListStructureLine:function (audiofiles) {
var theme="e";
if (this.id.indexOf("n") == 0) {
theme="f";
}
var line = '<div id="cont_' + this.id + '" data-role="collapsible" data-content-theme="a" data-theme="' + theme + '">'
+'<h3><span id=prodheader_' + this.id + '>Test</span></h3>'
+ '<p><input type="hidden" name="prodid" value="' + this.id + '"></input></p>'
+ createInputField("prodlong_" + this.id,"prodlong_input_" + this.id,"longname")
+ createInputField("prodshort_" + this.id,"prodshort_input_" + this.id,"shortname")
+ '<p><div data-role="fieldcontain">'
+ createInputField("prodpriceA_" + this.id,"prodpriceA_input_" + this.id,"priceA")
+ createInputField("prodpriceB_" + this.id,"prodpriceB_input_" + this.id,"priceB")
+ createInputField("prodpriceC_" + this.id,"prodpriceC_input_" + this.id,"priceC")
2020-11-19 23:02:49 +01:00
+ "<div id=unitcont_" + this.id + ">"
+ this.createUnitField("produnit_input_" + this.id)
+ "</div>"
2020-11-19 23:10:06 +01:00
+ "<div id=displaycont_" + this.id + ">"
+ this.createDisplayField("proddisplay_input_" + this.id)
+ "</div>"
2020-11-19 23:02:49 +01:00
+ createInputField("proddays_" + this.id,"proddays_input_" + this.id,"days")
2020-11-19 22:47:44 +01:00
+ createInputField("prodtax_" + this.id,"prodtax_input_" + this.id,"tax")
+ '</div></p>'
2020-11-19 23:00:31 +01:00
+ createInputField("prodamount_" + this.id,"prodamount_input_" + this.id,"amount")
+ "<div id=prodtaxaustriadiv_" + this.id + ">"
+ this.createTaxAustriaSel("taxaustriasel_" + this.id)
+ "</div>"
2020-11-19 22:47:44 +01:00
+ "<div id=audiocont_" + this.id + ">"
+ this.createMobileAudioSel(audiofiles,"audiosel_" + this.id)
+ "</div>"
+ "<div id=availcont_" + this.id + ">"
+ this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang])
+ "</div>"
+ "<div id=favcont_" + this.id + ">"
+ this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang])
+ "</div>"
if (theme != "f") {
line += this.createProdNavArea();
line += createInputOsCmdField("prodextra_" + this.id,"prodextrainput_" + this.id,"extra");
line += "<div id=assextralist_" + this.id + " class='assextralist'></div>";
line += createResetApplyArea("prodapply_" + this.id,"prodcancel_" + this.id,null) + '</div>';
} else {
line += this.createApplyArea("prodnew_" + this.id) + '</div>';
}
2020-11-19 23:00:31 +01:00
2020-11-19 22:47:44 +01:00
return line;
},
insertValuesIntoMenuList:function() {
if (this.id.indexOf("n") != 0) {
$("#prodheader_" + this.id).html(toHtml(this.longname));
} else {
$("#prodheader_" + this.id).html(PROD_NEW_PROD[lang]);
}
$("#prodlong_" + this.id).html(PROD_LONG_NAME[lang]);
$("#prodlong_input_" + this.id).val(this.longname);
$("#prodshort_" + this.id).html(PROD_SHORTNAME[lang]);
$("#prodshort_input_" + this.id).val(this.shortname);
$("#prodpriceA_" + this.id).html(PROD_PRICE[lang] + ' (A)');
$("#prodpriceB_" + this.id).html(PROD_PRICE[lang] + ' (B)');
$("#prodpriceC_" + this.id).html(PROD_PRICE[lang] + ' (C)');
2020-11-19 23:02:49 +01:00
$("#produnit_" + this.id).html(PROD_UNIT[lang]);
2020-11-19 23:10:06 +01:00
$("#proddisplay_" + this.id).html(PROD_DISPLAY[lang]);
2020-11-19 23:02:49 +01:00
$("#proddays_" + this.id).html(PROD_DAYS[lang]);
2020-11-19 22:47:44 +01:00
$("#prodtax_" + this.id).html(PROD_TAX[lang]);
2020-11-19 23:00:31 +01:00
$("#prodtaxaustria_" + this.id).html(PROD_TAXAUSTRIA[lang]);
$("#prodamount_" + this.id).html(PROD_AMOUNT[lang]);
2020-11-19 22:47:44 +01:00
$("#prodpriceA_input_" + this.id).val(this.priceA.toString().replace(".",decpoint));
$("#prodpriceB_input_" + this.id).val(this.priceB.toString().replace(".",decpoint));
$("#prodpriceC_input_" + this.id).val(this.priceC.toString().replace(".",decpoint));
2020-11-19 23:11:42 +01:00
$("#unitcont_" + this.id).html(this.createUnitField("produnit_input_" + this.id));
$("#displaycont_" + this.id).html(this.createDisplayField("proddisplay_input_" + this.id));
2020-11-19 23:10:06 +01:00
$("#proddisplay_input_" + this.id).val(this.display);
if ((this.days == '0123456') || (this.days == null) || (this.days == 'null')) {
2020-11-19 23:02:49 +01:00
$("#proddays_input_" + this.id).val('');
} else {
$("#proddays_input_" + this.id).val(this.days);
}
2020-11-19 22:47:44 +01:00
if (this.tax != "null") {
$("#prodtax_input_" + this.id).val(this.tax.toString().replace(".",decpoint));
2020-11-19 23:11:42 +01:00
} else {
$("#prodtax_input_" + this.id).val('');
}
2020-11-19 23:00:31 +01:00
if (this.amount != "null") {
$("#prodamount_input_" + this.id).val(this.amount.toString().replace(".",decpoint));
2020-11-19 23:11:42 +01:00
} else {
$("#prodamount_input_" + this.id).val('');
}
2020-11-19 22:47:44 +01:00
$("#availcont_" + this.id).html(this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang]));
$("#favcont_" + this.id).html(this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang]));
$("#audiocont_" + this.id).html(this.createMobileAudioSel(audiofiles,"audiosel_" + this.id));
$("#prodextra_" + this.id).html(PROD_ASS_EXTRAS[lang]);
$("#prodextra_" + this.id).data("orig_assignedextras",null);
$("#prodextra_" + this.id).data("assignedextras",null);
},
createApplyArea:function(idApply) {
var txt = '<p><fieldset>'
+ '<div><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
return txt;
},
createProdNavArea:function() {
var buttonUp = '<button id="produp_' + this.id + '" type="submit" data-theme="c" class="oscmd">&uarr;</button>';
var buttonDown = '<button id="proddown_' + this.id + '" type="submit" data-theme="c" class="oscmd">&darr;</button>';
var buttonDel = '<button id="proddel_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_DEL[lang] + '</button>';
var aText = '';
aText += '<p><fieldset class="ui-grid-b">';
aText += ' <div class="ui-block-a delProd">' + buttonDel + '</div>';
aText += ' <div class="ui-block-b prodUp">' + buttonUp + '</div>';
aText += ' <div class="ui-block-c prodDown">' + buttonDown + '</div>';
aText += '</fieldset></p>';
return aText;
}
};
return product;
}
function createInputField(idForNameOfField,idForInputField,nameOfInputField) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + idForInputField + '"><span id="' + idForNameOfField + '"></span></label>'
2020-11-19 23:11:29 +01:00
+ '<input type="text" name="' + nameOfInputField + '" id="' + idForInputField + '" style="background:white;color:black;" /></div></p>';
2020-11-19 22:47:44 +01:00
return txt;
}
function createInputOsCmdField(idForNameOfField,idForInputField,nameOfInputField) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + idForInputField + '"><span id="' + idForNameOfField + '"></span></label>'
+ '<input type="button" name="' + nameOfInputField + '" id="' + idForInputField + '" class="oscmd" value="' + PROD_DO_ASS[lang] + '" data-theme="c" /></div></p>';
return txt;
}
function createResetApplyArea(idApply,idCancel,idDel) {
var txt = '<p><fieldset class="ui-grid-';
if (idDel == null) {
txt += 'a">'
+ '<div class="ui-block-a"><button id="' + idCancel + '" type="submit" data-theme="c" class="oscmd" data-icon="back">' + PROD_CANCEL[lang] + '</button></div>'
+ '<div class="ui-block-b"><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
} else {
txt += 'b">'
+ '<div class="ui-block-a"><button id="' + idCancel + '" type="submit" data-theme="c" class="oscmd" data-icon="back">' + PROD_CANCEL[lang] + '</button></div>'
+ '<div class="ui-block-b"><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '<div class="ui-block-c"><button id="' + idDel + '" type="submit" data-theme="d" class="oscmd" data-icon="delete">' + PROD_DEL[lang] + '</button></div>'
+ '</fieldset></p>';
}
return txt;
}
function createProdType(id,name,kind,usekitchen,usesupplydesk,printer) {
var prodtype = {
id:id,
name: name,
usekitchen:usekitchen,
usesupplydesk:usesupplydesk,
kind:kind,
printer:printer,
createTableStructureLine: function (depth) {
var depthstr = ident(depth);
var trline = "<tr class='prodtype' id='prodtype_" + this.id + "'>"
2020-11-19 23:11:29 +01:00
+ "<td>" + depthstr + "<input type='text' class='typename whiteinput'></input>"
2020-11-19 22:47:44 +01:00
+ "<td class='type_kind'>" + this.createTwoValSelection(kind,PROD_FOOD,PROD_DRINKS)
+ "<td class='type_usekitchen'>" + this.createTwoValSelection(usekitchen,PROD_NO,PROD_YES)
+ "<td class='type_usesupply'>" + this.createTwoValSelection(usesupplydesk,PROD_NO,PROD_YES)
+ "<td class='type_printer'>" + this.createTwoValSelection(printer,PROD_PRINTER_1,PROD_PRINTER_2)
+ "<td colspan=6>"
+ "</tr>";
return trline;
},
insertValuesIntoMenuTable:function() {
$("#prodtype_" + id + " input.typename").val(name);
},
createTwoValSelection:function(theVal,text0,text1) {
if (theVal == 1) {
return "<select><option val=0 class='no'>" + text0[lang] + "</option><option val=1 selected class='yes'>" + text1[lang] + "</option></selected>";
} else {
return "<select><option val=0 selected>" + text0[lang] + "</option><option val=1>" + text1[lang] + "</option></selected>";
}
},
createUpperMenuTypeStructure: function() {
2020-11-19 23:03:20 +01:00
var txt = '<h3>' + this.name + '</h3><p>'
+ '<button id="toggleprodtype_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_TYPEPROPS[lang] + '</button>'
2020-11-19 22:47:44 +01:00
2020-11-19 23:03:20 +01:00
+ '<div id="typepropertiespart_' + this.id + '" style="display:none;" >'
+ "<div id=dtypekind_" + this.id + " ></div>"
+ "<div id=dtypeuk_" + this.id + " ></div>"
+ "<div id=dtypeus_" + this.id + " ></div>"
+ "<div id=dtypeprinter_" + this.id + " ></div>"
2020-11-19 22:47:44 +01:00
+ createInputField("typename_" + this.id,"typename_input_" + this.id,"typename_input_" + this.id)
2020-11-19 23:03:20 +01:00
2020-11-19 22:47:44 +01:00
+ createResetApplyArea("typeapply_" + this.id,"typecancel_" + this.id,"typedel_" + this.id)
2020-11-19 23:03:20 +01:00
+ '</div>'
2020-11-19 22:47:44 +01:00
+ '</p>';
return txt;
},
createLowerMenuTypeStructure: function() {
2020-11-19 22:53:50 +01:00
var style = ' style="background-color: white;" ';
var newTypeName = '<p><input type="text" name="newtypename" id="newtypename_' + this.id + '" placeholder="' + PROD_PLACEHOLDER_NEW_PRODTYPE[lang] + '"' + style + '/></p>';
2020-11-19 22:47:44 +01:00
var newTypeBtn = '<p><button id="newtype_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_NEW_CAT[lang] + '</button></p>';
var assignBtn = '<p><button id="assignprod_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_ASSIGN[lang] + ' &#10155; </button></p>';
2020-11-19 23:03:10 +01:00
var sortAlphaBtn = '<p><button id="sortalphaprod_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_SORT_ALPHA[lang] + '</button></p>';
return newTypeName + newTypeBtn + assignBtn + sortAlphaBtn;
2020-11-19 22:47:44 +01:00
},
insertValuesIntoMenuList:function() {
$("#typename_" + this.id).html(PROD_NAME[lang]);
$("#typename_input_" + this.id).val(this.name);
$("#dtypekind_" + this.id).html(this.createMobileSel("kind_" + this.id,this.kind,PROD_TYPE,PROD_FOOD,PROD_DRINKS));
$("#dtypeuk_" + this.id).html(this.createMobileSel("usekitchen_" + this.id,this.usekitchen,PROD_KITCHEN_BAR,PROD_NO_PASS_KITCHEN,PROD_PASS_KITCHEN));
$("#dtypeus_" + this.id).html(this.createMobileSel("usesupply_" + this.id,this.usesupplydesk,PROD_SUPPLY,PROD_NO_PASS_SUPPLY,PROD_PASS_SUPPLY));
$("#dtypeprinter_" + this.id).html(this.createMobileSel("printer_" + this.id,this.printer-1,PROD_PRINTER,PROD_PRINTER_1,PROD_PRINTER_2));
},
createMobileSel:function(id,theVal,label,text0,text1) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label[lang] + '</label>'
+ this.createSelection(id,theVal,text0,text1)
+ '</div></p>';
return txt;
},
createSelection:function(id,theVal,text0,text1) {
if (theVal == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
}
};
return prodtype;
}