if(typeof bfDialog=="undefined")var bfDialog={};if(!("hDialog"in bfDialog))bfDialog.hDialog={};bfDialog.cssWidth=0;bfDialog.bGhostEver=0;bfDialog.iWindowScrollTop=0;bfDialog.getDlgById=function(a){var b=null;if(a.length>7){a=a.substr(8);if(typeof bfDialog.hDialog[a]!="undefined")b=a}return b};
bfDialog.add=function(a){var b="_dialog_"+a.data.key;a.data.key in bfDialog.hDialog||(bfDialog.hDialog[a.data.key]={childs:[],name:a.data.key,file:a.data.file,module:a.data.mod,centered:a.data.centered||0,active:0,onresize:[],intervals:[]});if(document.getElementById(b))b=null;else{var c=document.getElementById("_page");b=bfPage.createElement("div",{className:"dialog dialog_"+a.data.color,id:b,style:{display:"none"}});c.parentNode.insertBefore(b,c);if(typeof a.data.width!="undefined"&&a.data.width)b.style.width=
a.data.width+"px"}return b};bfDialog._add=function(a,b,c,d,f){b=b||null;c=c||"green";d=d||"dialog";f=f||{display:"none"};if(typeof f.display=="undefined")f.display="none";var e=document.getElementById("_page"),i=a?"_"+a:"";c=bfPage.createElement("div",{id:"_dialog"+i,className:"dialog dialog_"+c,style:f});e.parentNode.insertBefore(c,e);bfDialog.hDialog[a]={name:a,parent:b,childs:[],centered:0,active:0,visible:0,id:"_dialog"+i,mode:d,oDlg:c,onresize:[]};b!=null&&bfDialog.addChild(b,a);return c};
bfDialog.addChild=function(a,b){a&&a in bfDialog.hDialog&&bfDialog.hDialog[a].childs.push(bfDialog.hDialog[b])};bfDialog.setActive=function(a){for(var b in bfDialog.hDialog)bfDialog.hDialog[b].active=0;bfDialog.hDialog[a?a:"default"].active=1;sActDialogSuf=a?"_"+a:"";sActDialog=a?a:""};bfDialog.setInterval=function(a,b,c){return bfDialog.hDialog[a].intervals.push(window.setInterval(b,c))};
bfDialog.fixScrollContainer=function(a){var b=bfPage.getElementsByClassName(a,"scroll");if(b.length)for(var c=0;c<b.length;c++){b[c].style.width=a.style.width;bfPage.fixHScroll(b[c])}};bfDialog.onresize=function(a,b){b=b||a.oDlg;bfDialog.fixScrollContainer(b);for(var c=0;c<a.onresize.length;c++)a.onresize[c]()};
bfDialog.setDefSize=function(a,b,c){if(!a.maxed){c=c||0;var d=b.style.display=="none"?1:0;if(d)b.style.display="";var f=jsHelper.getRealStyle(b,"width"),e=jsHelper.getRealStyle(b,"height");if(!jsHelper.arrayKeyExists(["def_size","width"],a)||a.def_size.width!=f||a.def_size.height!=e){if(!c||!jsHelper.arrayKeyExists(["def_size","width"],a))bfDialog.onresize(a,b);a.def_size={width:f,height:e}}if(d)b.style.display="none"}};
bfDialog.show=function(a,b,c,d,f){b=b||null;f=f||0;var e=b?b:"default",i=typeof d=="string"?new Function("sDialog",d):typeof d=="function"?d:null;if(e in bfDialog.hDialog&&"parent"in bfDialog.hDialog[e]&&(bfDialog.hDialog[e].parent==null||f)){bfDialog.hDialog[e].visible=a;bfDialog.hDialog[e].active=a;if(typeof c=="undefined")c=bfDialog.hDialog[e].mode;else bfDialog.hDialog[e].mode=c;d=bfDialog.hDialog[e].oDlg}else{c=typeof c!="undefined"?c:"dialog";if(typeof d=="undefined"&&jsHelper.arrayKeyExists([e,
"onClose"],bfDialog.hDialog)){i=bfDialog.hDialog[e].onClose;onCloseContext=bfDialog.hDialog[e].onCloseContext}else onCloseContext=this;d={name:b,parent:null,childs:[],visible:a,active:a,id:"_dialog"+(b?"_"+b:""),mode:c,onClose:i,onCloseContext:onCloseContext};if(e in bfDialog.hDialog)jQuery.extend(bfDialog.hDialog[e],d);else bfDialog.hDialog[e]=d;"onresize"in bfDialog.hDialog[e]||(bfDialog.hDialog[e].onresize=[]);d=document.getElementById(bfDialog.hDialog[e].id);bfDialog.hDialog[e].oDlg=d;bfDialog.setDefSize(bfDialog.hDialog[e],
d,1);jsHelper.setEvent(d,"onmousedown","bfDialog.setActive("+(b?"'"+b+"'":"null")+")","bfDialog::show")}if(a){c!="widget"&&bfDialog.showGhost(1);bfDialog.setActive(b);d.style.display="";if(c=="dialog"){if(typeof d.marginCache=="undefined")d.marginCache=jsHelper.getRealStyle(d,"margin-top",1);if(bfDialog.cssWidth==0)for(b=0;b<document.styleSheets.length;b++){try{var g=document.styleSheets[b][sRules],o=g.length}catch(p){continue}for(var h=0;h<o;h++)if(g[h].selectorText==".dialog"){bfDialog.cssWidth=
g[h].style.width;bfDialog.cssWidth=parseInt(bfDialog.cssWidth.substr(0,bfDialog.cssWidth.length-2))}}h=parseInt(d.style.width.substr(0,d.style.width.length-2));if(isNaN(h)||bfDialog.cssWidth>h){d.style.width=bfDialog.cssWidth+"px";delete bfDialog.hDialog[e].def_size.width;bfDialog.setDefSize(bfDialog.hDialog[e],d,1)}h=Math.floor(($(window).height()-$(d).outerHeight(true))/2);if(h<0)h=0;else if(h>100)h=100;d.style.top=h+jsHelper.getBodyScrollTop()+"px";d.style.left=(document.documentElement.offsetWidth-
d.offsetWidth)/2+"px"}if(c=="widget"){if(typeof d.style.zIndex=="undefined")d.style.zIndex=2;if(typeof d.style.position=="undefined"||d.style.position.length==0)d.style.position="fixed";if(typeof d.style.width=="undefined"||d.style.width.length==0){d.style.width="240px";delete bfDialog.hDialog[e].def_size.width;bfDialog.setDefSize(bfDialog.hDialog[e],d,1)}if(typeof d.style.top=="undefined"||d.style.top.length==0){d.style.top="0px";d.style.right="0px"}}bfDialog.hasXClose(d)&&jsHelper.getEvent(document,
"onkeydown","bfDialog::closeByEsc").length==0&&jsHelper.setEvent(document,"onkeydown",bfDialog.closeByEsc,"bfDialog::closeByEsc")}else{g=bfDialog.hDialog[e];"maxed"in g&&g.maxed&&bfDialog.max(e);if(typeof g.onClose=="function")var m=g.onClose.apply(g.onCloseContext,[b]);if(!(typeof m!="undefined"&&!m)){c!="widget"&&bfDialog.showGhost(0);d.style.display="none";for(b=0;b<g.childs.length;b++){c=g.childs[b];c.visible&&bfDialog.sub.close(c.name)}if(g.parent){bfDialog.setActive(bfDialog.hDialog[g.parent.length>
0?g.parent:"default"].name);bfDialog.enable(sActDialog);e=c=0;for(h in bfDialog.hDialog)if(bfDialog.hDialog[h].visible&&bfDialog.hDialog[h].mode!="widget")e=1}else{c=1;e=0;for(h in bfDialog.hDialog)if(bfDialog.hDialog[h].visible){c=0;if(bfDialog.hDialog[h].mode!="widget")e=1;var n=h}c||bfDialog.setActive(n)}if(c)sActDialog=sActDialogSuf="";else e&&bfDialog.showGhost(1);document.body.style.cursor=="help"&&bfInfo.switchHelpMode()}}};
bfDialog.close=function(a,b){if(typeof a=="undefined")a=sActDialog;typeof b!="undefined"&&b==1&&shStatus.reset();jsHelper.arrayKeyExists(["hDialog",a,"parent"],bfDialog)&&bfDialog.hDialog[a].parent!=null?this.show(0,a,undefined,undefined,1):this.show(0,a);if(a in bfDialog.hDialog&&"intervals"in bfDialog.hDialog[a]&&bfDialog.hDialog[a].intervals.length)for(;interval=bfDialog.hDialog[a].intervals.shift();)window.clearInterval(interval)};
bfDialog.enable=function(a){if(oGhost=document.getElementById(a+"_ghost_dlg"))oGhost.style.display="none"};
bfDialog.disable=function(a){var b,c=this.get(a);if(!(b=document.getElementById(a+"_ghost_dlg"))){b=document.createElement("div");b.className="ghost_layer";b.id=a+"_ghost_dlg";b.style.position="absolute"}b.style.top=c.style.top;b.style.left=c.style.left;b.style.zIndex=jsHelper.getRealStyle(c,"z-index",1)+1;c.parentNode.insertBefore(b,c);b.style.display="block";a=2*jsHelper.getRealStyle(c,"border-left-width",1)+2*jsHelper.getRealStyle(c,"padding-left",1);b.style.width=jsHelper.getRealStyle(c,"width",
1)+a+"px";var d=jsHelper.getRealStyle(c,"height",1);b.style.height=d==0&&c.offsetHeight>0?c.offsetHeight+"px":d+a+"px"};bfDialog.recalcGhostHeight=function(){var a=document.getElementById("ghost");a.style.height=$(window).height()+"px";a.style.width=$(window).width()+"px"};
bfDialog.showGhost=function(a,b){if(bfDialog.getTop(0)!="_rpc_timeout"){a=typeof a=="undefined"?1:a;bfDialog.bGhostEver=typeof b=="undefined"?bfDialog.bGhostEver:b;if(!(bfDialog.bGhostEver&&!a)){var c=document.getElementById("ghost");if(a){c.style.display="block";bfDialog.recalcGhostHeight()}else c.style.display="none"}}};
bfDialog.showLoad=function(a){a=typeof a=="undefined"?1:a;oGhost=document.getElementById("ghost");if(typeof bfDialog.bGhostWasOn=="undefined")bfDialog.bGhostWasOn=oGhost.style.display=="block"?1:0;if(a)bfDialog.bGhostWasOn||bfDialog.showGhost(1);else{bfDialog.bGhostWasOn||bfDialog.showGhost(0);bfDialog.bGhostWasOn=undefined}oGhost.style.zIndex=a?"1000":""};
bfDialog.hasXClose=function(a){var b=0;if(a){var c=a.getElementsByTagName("table"),d=null;for(a=0;a<c.length;a++)if(c[a].lang&&c[a].lang=="dialog_head"){d=c[a];break}if(d){c=d.getElementsByTagName("div");for(a=0;a<c.length;a++)if(c[a].className&&c[a].className.match(/close_button/)){b=1;break}}}return b};
bfDialog.closeByEsc=function(a){if(!a&&window.event)a=window.event;if(a.type=="keydown"&&(a.which==27||a.keyCode==27)){if(a.preventDefault)a.preventDefault();else a.returnValue=false;a=document.getElementById("_dialog"+sActDialogSuf);if(bfDialog.hasXClose(a)){bfPage.layerAutoClose.markOpenLayers();bfPage.layerAutoClose.closeOpenLayers(1,1);bfDialog.close(sActDialog,1);bfInfo.closeHelp()}}};bfDialog.hide=function(a){document.getElementById("_dialog"+(a?"_"+a:"")).style.display="none"};
bfDialog.unhide=function(a){if(bfDialog.getTop(0)!="_rpc_timeout"){document.getElementById("_dialog"+(a?"_"+a:"")).style.display="";bfDialog.bGhostEver&&bfDialog.disable(a)}};bfDialog.getTop=function(a){a=typeof a=="undefined"||a?1:0;var b="",c;for(c in bfDialog.hDialog)if(bfDialog.hDialog[c].active)b=a?bfDialog.hDialog[c].oDlg:c;return b};
bfDialog.setTitel=function(a,b){for(var c=document.getElementById("_dialog"+(a?"_"+a:"")).getElementsByTagName("table"),d=null,f=0;f<c.length;f++)if(c[f].lang&&c[f].lang=="dialog_head"){d=c[f];break}if(d){c=d.getElementsByTagName("td")[0];(c.getElementsByTagName("span").length?c.getElementsByTagName("span")[0]:c).innerHTML=b}};
bfDialog.getDates=function(a){a=document.getElementById("_dialog"+(a?"_"+a:"")).getElementsByTagName("table");for(var b=null,c={},d=0;d<a.length;d++)if(a[d].lang&&a[d].lang=="dialog_header"){b=a[d];break}if(b){c.gen_date=b.rows[2].cells[0].innerHTML;c.upd_date=b.rows[2].cells[1].innerHTML}return c};
bfDialog.setDates=function(a,b){for(var c=document.getElementById("_dialog"+(a?"_"+a:"")).getElementsByTagName("table"),d=null,f=0;f<c.length;f++)if(c[f].lang&&c[f].lang=="dialog_header"){d=c[f];break}if(d&&d.rows.length>2){d.rows[2].cells[0].innerHTML=b.gen_date;d.rows[2].cells[1].innerHTML=b.upd_date}};bfDialog.setSpan=function(a,b,c){if(typeof c=="undefined")c=0;document.getElementById("_dialog_"+a).getElementsByTagName("span")[c].innerHTML=b};
bfDialog.get=function(a){return document.getElementById("_dialog_"+a)};
bfDialog.titleDrag=function(a,b){function c(j){if(!j)j=window.event;var l=j.clientX-e,k=j.clientY-i;if(l<n)l=n;else if(l+a.offsetWidth>=n+h)l=n+h-a.offsetWidth;else if(l<0)l=0;else if(l+a.offsetWidth>=o)l=o-a.offsetWidth;if(f)if(k<m)k=m;else if(k+r>=m+p)k=m+p-r;else if(k<0)k=0;else{if(k+a.offsetHeight>=g)k=g-a.offsetHeight}else if(k<0)k=0;a.style.left=l+"px";a.style.right="";a.style.top=k+"px";if(j.stopPropagation)j.stopPropagation();else j.cancelBubble=true}function d(j){if(!j)j=window.event;if(document.removeEventListener){document.removeEventListener("mouseup",
d,true);document.removeEventListener("mousemove",c,true)}else if(document.detachEvent){a.detachEvent("onlosecapture",d);a.detachEvent("onmouseup",d);a.detachEvent("onmousemove",c);a.releaseCapture()}if(j.stopPropagation)j.stopPropagation();else j.cancelBubble=true}var f=document.getElementById("ghost").style.display=="block"?1:0,e=b.clientX-a.offsetLeft,i=b.clientY-a.offsetTop,g=document.documentElement.scrollHeight,o=document.documentElement.scrollWidth,p=document.documentElement.offsetHeight,h=
document.documentElement.offsetWidth,m=a.style.position=="fixed"?0:jsHelper.getBodyScrollTop(),n=a.style.position=="fixed"?0:jsHelper.getBodyScrollLeft(),q=a.getElementsByTagName("table"),r=q.length>0&&q[0].lang&&q[0].lang=="dialog_header"?a.getElementsByTagName("td")[0].offsetHeight+jsHelper.getRealStyle(a,"padding-top",1)+jsHelper.getRealStyle(a.getElementsByTagName("table")[0],"margin-top",1):jsHelper.getRealStyle(a,"padding-top",1);if(document.addEventListener){document.addEventListener("mousemove",
c,true);document.addEventListener("mouseup",d,true)}else if(document.attachEvent){a.setCapture();a.attachEvent("onmousemove",c);a.attachEvent("onmouseup",d);a.attachEvent("onlosecapture",d)}bfDialog.setActive(a.id.replace(/^_dialog_/,""));if(b.stopPropagation)b.stopPropagation();else b.cancelBubble=true;if(b.preventDefault)b.preventDefault();else b.returnValue=false};bfDialog.getParent=function(a){for(;a!=null&&(a.id==null||a.id.substr(0,7)!="_dialog");)a=a.parentNode;return a};bfDialog.sub={};
bfDialog.sub.show=function(a,b,c,d,f){c=typeof c!="undefined"?c:1;var e=typeof f=="string"?new Function("sDialog",f):typeof f=="function"?f:null;if(!(b in bfDialog.hDialog)||!("parent"in bfDialog.hDialog[b])||bfDialog.hDialog[b].parent==null){var i=sActDialog,g=document.getElementById("_dialog"+sActDialogSuf);d=d||"dialog";if(typeof f=="undefined"&&jsHelper.arrayKeyExists([b,"onClose"],bfDialog.hDialog)){e=bfDialog.hDialog[b].onClose;f=bfDialog.hDialog[b].onCloseContext}else f=this;e={name:b,parent:i,
childs:[],visible:a,id:"_dialog"+(b?"_"+b:""),mode:d,onClose:e,onCloseContext:f};if(b in bfDialog.hDialog)jQuery.extend(bfDialog.hDialog[b],e);else bfDialog.hDialog[b]=e;if(!("onresize"in bfDialog.hDialog[b]))bfDialog.hDialog[b].onresize=[];e=document.getElementById(bfDialog.hDialog[b].id);bfDialog.hDialog[b].oDlg=e;bfDialog.setDefSize(bfDialog.hDialog[b],e,1);bfDialog.addChild(i,b)}else{e=bfDialog.hDialog[b].oDlg;i=bfDialog.hDialog[b].parent;g=bfDialog.hDialog[i].oDlg;if(typeof d=="undefined")d=
bfDialog.hDialog[b].mode}f=typeof d=="string"&&d=="widget"?1:0;bfDialog.show(a,b,d,null,1);f||(a?bfDialog.disable(i):bfDialog.enable(i));if(a){g.parentNode.insertBefore(e,g.nextSibling);e.style.zIndex=jsHelper.getRealStyle(g,"z-index",1)+1;if(!f&&!bfDialog.hDialog[b].centered){a=$(window);d=$(e);e.style.top=a.height()+a.scrollTop()<d.height()+20+$(g).offset().top?a.height()/2+a.scrollTop()-d.height()/2+"px":g.offsetTop+20+"px";e.style.left=g.offsetLeft+25+"px"}if(c&&g.offsetWidth-100+"px"!=bfDialog.hDialog[b].def_size.width&&
g.offsetWidth+"px"==bfDialog.hDialog[b].def_size.width){e.style.width=g.offsetWidth-100+"px";delete bfDialog.hDialog[b].def_size.width;bfDialog.setDefSize(bfDialog.hDialog[b],e,1)}}};bfDialog.sub.close=function(a,b){typeof b!="undefined"&&b==1&&shStatus.reset();bfDialog.show(0,a,undefined,null,1)};
bfDialog.max=function(a,b){var c=bfDialog.hDialog[a],d=!("maxed"in c)||!c.maxed?0:1;"max_data"in c||(c.max_data={});var f=c.max_data;if(typeof b!="undefined"&&!("on_max"in f))f.on_max=b;else if(typeof b=="undefined"&&"on_max"in f)b=f.on_max;if(d){document.body.style.height="";$(window).scrollTop(bfDialog.iWindowScrollTop);c.oDlg.style.left=f.last_pos.left;c.oDlg.style.top=f.last_pos.top;c.oDlg.style.width=f.def_size.width;c.oDlg.style.height=f.def_size.height}else{"def_size"in f||bfDialog.setDefSize(f,
c.oDlg);f.last_pos={left:c.oDlg.style.left,top:c.oDlg.style.top};bfDialog.iWindowScrollTop=$(window).scrollTop();document.body.style.overflow="hidden";document.body.style.height=$(window).height()+"px";c.oDlg.style.left="0";c.oDlg.style.top="0";f=$(window).width()-2*jsHelper.getRealStyle(c.oDlg,"padding-left",1)-2*jsHelper.getRealStyle(c.oDlg,"border-left-width",1);var e=$(window).height()-2*jsHelper.getRealStyle(c.oDlg,"padding-top",1)-2*jsHelper.getRealStyle(c.oDlg,"border-top-width",1);c.oDlg.style.width=
f+"px";c.oDlg.style.height=e+"px";bfDialog.onresize(c)}c.maxed=!d;b&&eval(b)};

