var editing=true;var WBe=new Object();WBe.edT='Unsaved changes will not be saved.';WBe.editd=Array();WBe.PS=function(a){var b=dc.forms[a];if(typeof(b)=='undefined')return;var c=b.action;b.action=WBx.reqUrl(b.action,'cmd=save');b.target="WBhistory";WB.hist=1;WBm.SB();b.submit();WB.TO(function(){WB.RSr(b,c);},100);WBe.set(false,a);}
WBe.set=function(b,c){try{if(!c){if(!WB.f||!WB.f.id){err('WBe.set error');return;}
c=WB.f.id;}
if(b){WBe.editd[c]=true;}else{WBe.editd[c]=false;}}
catch(m){err(m,'WBe.set');}}
WBe.check=function(e){if(!WB.compat)return;e=getE(e);var warn=false;var t=WBe.edT;for(var i in WBe.editd){if(WBe.editd[i]){warn=true;}}
if(warn){e.returnValue=t;return t;}}
WBe.check2=function(a){try{if(!WB.compat)return true;if(!WB.f||!WB.f.id)return true
if(WBe.editd[WB.f.id]){var r=confirm('Are you sure you want to '+a+' this tab? \n\n'+WBe.edT+' \n\n Press OK to continue, or Cancel to keep the current tab.');if(r){WBe.set(false);}
return r;}
return true}
catch(m){err(m,'WBe.check2');return true}}
window.onbeforeunload=WBe.check;WBe.tme=false;WBe.create=function(el,own){if(el.value==el.title){el.value='';}
WBe.elmt=el;var c=dcg('WBautoSelectKeys');if(!c){c=dcc('div');c.id='WBautoSelectKeys';dcg('WBextras').appendChild(c);c.style.cssText='padding:5px;font-size:90%;position:absolute;z-index:1000;border:1px #cccccc solid;background-color:#f1f1f1;';}
WB.DS(c);var txt=el.form.keyList.value;WBe.keys=txt.split(',');WBe.selectBox=c;WBe.show();}
WBe.blur=function(){WBe.tme=WB.TO('WBe.end()',200);}
WBe.end=function(){if(WBe.elmt.value==''){WBe.elmt.value=WBe.elmt.title;}
WBe.elmt=null;WBe.selectBox=null;var c=dcg('WBautoSelectKeys');WB.DS(c,'none');}
WBe.next=function(){WB.CT(WBe.tme);WBe.elmt.value=WBe.elmt.value+',';WBe.elmt.focus();WBe.show();}
WBe.add=function(a){WB.CT(WBe.tme);var txt=WBe.elmt.value;var res='';while(txt.search(',')!=-1){var pos=txt.search(',');res+=txt.substr(0,pos+1)+' ';txt=txt.substr(pos+1);}
var re=RegExp("\\s+",'g');if(a.search(':')==-1){res+=a;}else{res+=a+', ';}
WBe.elmt.value=res.replace(re,' ');WBe.elmt.focus();WBe.show();}
WBe.getList=function(){var txt=WBe.elmt.value.toLowerCase();var arr=txt.split(',');if(arr.length==0){arr=Array('');}
txt=arr[(arr.length-1)];while(txt.substr(0,1)==' '){txt=txt.substr(1);}
if(txt.search(':')!=-1){WBe.simple=false;}
var len=txt.length;var prev;var curr;var lowKey;var lst=Array();for(var i=0;i<WBe.keys.length;i++){curr=WBe.keys[i];if((len>0)&&(curr.substr(0,len).toLowerCase()!=txt)){continue;}
if(WBe.simple){pos=curr.search(':');if(pos !=-1){curr=curr.substr(0,pos);}
if(curr==prev){continue;}}
lst.push(curr);prev=curr;}
if(WBe.simple && lst.length<3){WBe.simple=false;return WBe.getList();}
return lst;}
WBe.show=function(){WBe.simple=true;var lst=WBe.getList();var res='';for(var i=0;i<lst.length;i++){if(lst[i]==''){continue;}
res+='<a href="javascript:void(0)" style="white-space:nowrap;font-size:90%;text-decoration:none;display:block" onclick="WBe.add(\''+lst[i]+'\')">'+lst[i]+'</a>';}
if(res==''){WBe.selectBox.innerHTML='';WB.DS(WBe.selectBox,'none');return;}
if(!WBe.simple){res+='<a href="javascript:void(0)" style="white-space:nowrap;font-size:90%;text-decoration:none;display:block" onclick="WBe.next()"> ... '+lg[32]+'</a>';}
WB.DS(WBe.selectBox);WBe.selectBox.innerHTML=res;var c=WB.FL(WBe.elmt);var y=(c.y-WBe.selectBox.clientHeight);if(y<0){y=(c.y+WBe.elmt.clientHeight+6);}
if(WB.sc=='On'){var sa=dcg('WB_SCROLLAREA');if(sa)y=y-sa.scrollTop;}
WBe.selectBox.style.top=(y-3)+'px';WBe.selectBox.style.left=c.x+'px';}
