var counters=new Array();
function SelectorItem(_1,_2,_3){
this.text=_1;
this.identifier=_2;
this.key=_2;
this.itemData=_3;
}
function SelectorTable(_4){
this.name=_4;
this.editable=false;
this.selectable=false;
this.navigatable=false;
this.bottom_navigation=false;
this.columns=new Object();
this.items=new Object();
this.selectCallback=null;
this.deleteCallback=null;
this.navCallback=null;
this.sortCallback=null;
this.addCallback=null;
this.selectedItem=null;
this.navInfo={offset:null,limit:null,maxNum:null};
this.sortInfo={col:"",id:null,dir:0};
this.leftNav=false;
this.rightNav=false;
this.updateUI();
}
SelectorTable.prototype.setSelectCallback=function(_5){
this.selectCallback=_5;
};
SelectorTable.prototype.setDeleteCallback=function(_6){
this.deleteCallback=_6;
};
SelectorTable.prototype.setSortCallback=function(_7){
this.sortCallback=_7;
};
SelectorTable.prototype.setNavCallback=function(_8){
this.navCallback=_8;
};
SelectorTable.prototype.setAddCallback=function(_9){
this.addCallback=_9;
};
SelectorTable.prototype.setShowAddCallback=function(_a){
this.showAddCallback=_a;
};
SelectorTable.prototype.addItem=function(_b){
for(var _c in this.items){
if(this.items[_c].identifier==_b.identifier){
return false;
}
}
this.items[_b.key]=_b;
this.addItemToUI(_b);
this.updateUI();
};
SelectorTable.prototype.updateItem=function(_d){
if(!this.items[_d.identifier]){
return false;
}
this.items[_d.identifier]=_d;
this.updateItemInUI(_d);
};
SelectorTable.prototype.setItems=function(_e){
this.clear();
for(var _f in _e){
this.addItem(_e[_f]);
}
};
SelectorTable.prototype.addItemToUI=function(_10){
var tr=document.createElement("tr");
var _12=this;
if(this.editable||this.selectable){
tr.onclick=function(e){
_12.select(_10.key);
};
}
tr.setAttribute("id","tr_"+this.name+"_"+_10.key);
for(var i=0;i<_10.text.length;i++){
var td=document.createElement("td");
td.className="input selectorTableItem";
td.setAttribute("id","td_"+this.name+"_"+_10.key+"_"+i);
td.style.cssText=this.columns[i+1].style;
td.innerHTML=_10.text[i];
tr.appendChild(td);
}
$((this.bottom_navigation)?"tr_"+this.name+"_nav2":"tr_"+this.name+"_foot").parentNode.insertBefore(tr,$((this.bottom_navigation)?"tr_"+this.name+"_nav2":"tr_"+this.name+"_foot"));
};
SelectorTable.prototype.updateItemInUI=function(_16){
for(var i=0;i<_16.text.length;i++){
td=$("td_"+this.name+"_"+_16.key+"_"+i);
td.innerHTML=td.innerHTML=_16.text[i];
td.style.cssText=this.columns[i+1].style;
}
};
SelectorTable.prototype.deleteItemFromUI=function(key){
if($("tr_"+this.name+"_"+key)){
$("tr_"+this.name+"_"+key).remove();
}
};
SelectorTable.prototype.checkEmpty=function(){
var i=0;
for(var _1a in this.items){
i++;
}
if((i==0)){
if(!($("tr_"+this.name+"_empty"))){
var tr=document.createElement("tr");
tr.setAttribute("id","tr_"+this.name+"_empty");
var td=document.createElement("td");
td.className="input";
td.setAttribute("colSpan",$("td_"+this.name+"_foot").getAttribute("colSpan"));
var txt=document.createTextNode(txtEmptyList);
td.appendChild(txt);
tr.appendChild(td);
$("tr_"+this.name+"_foot").parentNode.insertBefore(tr,$("tr_"+this.name+"_foot"));
}
}else{
if($("tr_"+this.name+"_empty")){
$("tr_"+this.name+"_empty").remove();
}
}
};
SelectorTable.prototype.clear=function(){
this.select(null);
this.clearUI();
this.items=new Object();
this.updateUI();
};
SelectorTable.prototype.clearUI=function(){
for(var _1e in this.items){
this.deleteItemFromUI(this.items[_1e].key);
}
};
SelectorTable.prototype.select=function(_1f){
this.selectedItem=_1f;
this.highlight(_1f);
if(_1f!=null){
this.cancelNewItemDialog();
if(this.selectCallback){
this.selectCallback(this.items[_1f]);
}
}else{
if(this.selectCallback){
this.selectCallback(null);
}
}
this.updateUI();
};
SelectorTable.prototype.saveNewItem=function(){
if(!this.addCallback){
alert("Keine Zuf\ufffdge-Operation definiert!");
}
return this.addCallback($(this.name+"_text_new").value);
};
SelectorTable.prototype.deleteItem=function(_20){
if(this.deleteCallback){
if(!this.deleteCallback(this.items[_20])){
return false;
}
}
if(this.selectedItem==_20){
this.select(null);
}
this.deleteItemFromUI(_20);
delete this.items[_20];
this.updateUI();
};
SelectorTable.prototype.highlight=function(_21){
for(var _22 in this.items){
for(var i=0;i<this.items[_22].text.length;i++){
if($("td_"+this.name+"_"+_22+"_"+i)){
$("td_"+this.name+"_"+_22+"_"+i).removeClassName("highlight");
}
}
}
if(_21!=null){
for(var i=0;i<this.items[_21].text.length;i++){
$("td_"+this.name+"_"+_21+"_"+i).addClassName("highlight");
}
}
};
SelectorTable.prototype.deleteCurrentItem=function(){
if(this.selectedItem!=null){
this.deleteItem(this.selectedItem);
}else{
alert("Momentan ist kein Eintrag ausgew\ufffdhlt");
}
};
SelectorTable.prototype.newItemDialog=function(){
showAdd=true;
if(this.showAddCallback){
showAdd=false;
if(this.showAddCallback()){
showAdd=true;
}
}
if(showAdd){
$(this.name+"_new").style.display="block";
$(this.name+"_edit").style.display="none";
}
};
SelectorTable.prototype.cancelNewItemDialog=function(){
if(this.editable){
$(this.name+"_text_new").value="";
$(this.name+"_new").style.display="none";
$(this.name+"_edit").style.display="block";
}
};
SelectorTable.prototype.sortByColumn=function(_25){
var _26=this.columns[_25];
if(_26.sortable){
if(this.sortCallback){
var _27=0;
if((this.sortInfo.id==_25)&&(this.sortInfo.dir==0)){
_27=1;
}
this.sortInfo.id=_25;
this.sortInfo.dir=_27;
this.sortInfo.col=_26.name;
this.sortCallback(_26,_27);
}else{
alert("Sortierung in dieser Spalte nicht m\ufffdglich!");
}
}
};
SelectorTable.prototype.setNavParams=function(_28,max,_2a){
this.navInfo.offset=_28;
this.navInfo.maxNum=max;
this.navInfo.limit=_2a;
if(this.navInfo.offset>0){
this.leftNav=true;
}else{
this.leftNav=false;
}
this.updateUI();
};
SelectorTable.prototype.setSortParams=function(_2b,_2c){
this.sortInfo={id:_2b,dir:_2c,col:this.columns[_2b].name};
this.updateUI();
};
SelectorTable.prototype.updateUI=function(){
if(this.navigatable){
if(this.navInfo.offset!=null){
var i=0;
for(itemKey in this.items){
i++;
}
if(parseInt(this.navInfo.offset)+i<parseInt(this.navInfo.maxNum)){
this.rightNav=true;
}else{
this.rightNav=false;
}
if(i>0){
$(this.name+"_nav_numbers").innerHTML=(parseInt(this.navInfo.offset)+1)+" - "+(i+parseInt(this.navInfo.offset))+" ("+this.navInfo.maxNum+")";
if(this.bottom_navigation){
$(this.name+"_nav_numbers2").innerHTML=(parseInt(this.navInfo.offset)+1)+" - "+(i+parseInt(this.navInfo.offset))+" ("+this.navInfo.maxNum+")";
}
}else{
$(this.name+"_nav_numbers").innerHTML="Keine Elemente";
if(this.bottom_navigation){
$(this.name+"_nav_numbers2").innerHTML="Keine Elemente";
}
}
if(this.rightNav){
$(this.name+"_nav_btn_right").className="nav_button";
$(this.name+"_nav_btn_right_max").className="nav_button";
if(this.bottom_navigation){
$(this.name+"_nav_btn_right2").className="nav_button";
$(this.name+"_nav_btn_right_max2").className="nav_button";
}
}else{
$(this.name+"_nav_btn_right").className="inactive_nav_button";
$(this.name+"_nav_btn_right_max").className="inactive_nav_button";
if(this.bottom_navigation){
$(this.name+"_nav_btn_right2").className="inactive_nav_button";
$(this.name+"_nav_btn_right_max2").className="inactive_nav_button";
}
}
if(this.leftNav){
$(this.name+"_nav_btn_left").className="nav_button";
$(this.name+"_nav_btn_left_max").className="nav_button";
if(this.bottom_navigation){
$(this.name+"_nav_btn_left2").className="nav_button";
$(this.name+"_nav_btn_left_max2").className="nav_button";
}
}else{
$(this.name+"_nav_btn_left").className="inactive_nav_button";
$(this.name+"_nav_btn_left_max").className="inactive_nav_button";
if(this.bottom_navigation){
$(this.name+"_nav_btn_left2").className="inactive_nav_button";
$(this.name+"_nav_btn_left_max2").className="inactive_nav_button";
}
}
}
}
if(this.editable){
if(this.selectedItem!=null){
if($(this.name+"_button_own")){
$(this.name+"_button_own").disabled=false;
}
$(this.name+"_button_remove").disabled=false;
}else{
if($(this.name+"_button_own")){
$(this.name+"_button_own").disabled=true;
}
$(this.name+"_button_remove").disabled=true;
}
}
if(this.sortInfo.col!=""){
for(var col in this.columns){
var _2f=this.columns[col];
if(_2f.sortable==true){
$(this.name+"_col_"+_2f.id+"_sort").src="/images/own/tbl_sort_none.png";
}
}
if(this.sortInfo.dir==1){
$(this.name+"_col_"+this.sortInfo.id+"_sort").src="/images/own/tbl_sort_desc.png";
}else{
$(this.name+"_col_"+this.sortInfo.id+"_sort").src="/images/own/tbl_sort_asc.png";
}
}
this.checkEmpty();
};
SelectorTable.prototype.navigate=function(_30){
if(!this.navigatable){
alert("Dieses Steuereleent ist nicht navigierbar!");
return;
}
switch(_30){
case 0:
if(!this.leftNav){
return false;
}
if(this.navCallback){
var _31=0;
this.navCallback(_31);
}else{
alert("Keine Navigationsfunktion definiert!");
}
break;
case 1:
if(!this.leftNav){
return false;
}
if(this.navCallback){
var _32=parseInt(this.navInfo.offset)-parseInt(this.navInfo.limit);
if(_32<0){
_32=0;
}
this.navCallback(_32);
}else{
alert("Keine Navigationsfunktion definiert!");
}
break;
case 2:
if(!this.rightNav){
return false;
}
if(this.navCallback){
var _33=parseInt(this.navInfo.offset)+parseInt(this.navInfo.limit);
this.navCallback(_33);
}else{
alert("Keine Navigationsfunktion definiert!");
}
break;
case 3:
if(!this.rightNav){
return false;
}
if(this.navCallback){
var _34=parseInt(this.navInfo.maxNum)-parseInt(this.navInfo.limit);
this.navCallback(_34);
}else{
alert("Keine Navigationsfunktion definiert!");
}
break;
}
};
function clearItemDetailsTbl(){
var _35=$("tbl_itemdetails").getElementsByTagName("input");
for(var i=0;i<_35.length;i++){
var _37=_35[i];
if(_37.getAttribute("id").match(/itemdetail_.*/)){
_37.value="";
}
}
}


