List.types.input=function(a){a[0].listdata=this;this.p=a;var b=this.input=$("<input></input>").addClass("valinput");this.label=$("<span></span>").addClass("valdisp");this.label.click(function(){setTimeout(function(){b.focus()},10)});this.input.focus(function(){b.select()});this.input.keypress(function(){a.trigger("change")});this.input.keyup(function(){a.trigger("change")});this.input.change(function(){a.trigger("change")});a.append(this.input).append(this.label)};
List.types.input.prototype.__defineSetter__("value",function(a){this.input.val(a);this.label.text(a)});List.types.input.prototype.__defineGetter__("value",function(){return this.input.val()});
List.types.select=function(a,b){a[0].listdata=this;this.p=a;var c=this.input=$("<select></select>").addClass("valinput");this.label=$("<span></span>").addClass("valdisp");"static"==b.option&&this.loadOptions(b.options);var d=this;this.input.change(function(){a.hasClass("readonly")?d.value=d.lastval:a.trigger("change")});this.label.click(function(){setTimeout(function(){c.focus()},10)});a.append(this.input).append(this.label)};
List.types.select.prototype.loadOptions=function(a){this.options=a;this.mapping={};this.input.html("");for(var b=0;b<a.length;++b){this.mapping[a[b].value]=a[b].text;var c=$("<option></option>").val(a[b].value).text(a[b].text);this.input.append(c)}};List.types.select.prototype.__defineGetter__("value",function(){return this.input.val()});List.types.select.prototype.__defineSetter__("value",function(a){this.lastval=a;this.input.val(a);this.label.text(this.mapping[a])});
List.types.checkbox=function(a){a[0].listdata=this;this.p=a;this.input=$('<input type="checkbox">').addClass("valcheck");var b=this;this.input.change(function(){a.hasClass("readonly")?b.value=b.lastval:a.trigger("change")});a.append(this.input)};List.types.checkbox.prototype.__defineGetter__("value",function(){return this.input[0].checked});List.types.checkbox.prototype.__defineSetter__("value",function(a){this.lastval=a;this.input[0].checked=a});
List.types.button=function(a,b){a[0].listdata=this;this.p=a;var c=this.input=$("<button>");b.caption&&c.text(b.caption);c.click(function(){a.trigger("command");return!1});a.append(this.input)};List.types.button.prototype.__defineGetter__("value",function(){});
