var DropDown=Class.create({duration:0.2,open:false,initialize:function($trigger,$dropdown,options){this.$trigger=$trigger;this.$dropdown=$dropdown;this.options=Object.extend({offsetX:null,offsetY:null,keepX:false},options||{});this.$trigger.on('click',this.openDropDown.bind(this));document.body.on('click',this.checkCloseCondition.bind(this));this.$trigger.on('popup:open',this.openDropDown.bind(this));document.body.on('popup:close',this.closeDropDown.bind(this));},getPulldownPosition:function(){return{top:this.options.offsetY===null?this.$trigger.offsetTop+this.$trigger.offsetHeight:this.options.offsetY,left:this.options.offsetX===null?this.$trigger.offsetLeft:this.options.offsetX};},openDropDown:function(ev){if(this.open){return;}
const position=this.getPulldownPosition();const initialStyle={top:(position.top-4)+'px',opacity:0,display:null}
if(!this.options.keepX){initialStyle.left=position.left+'px';}
this.$dropdown.setStyle(initialStyle).removeClassName('hide');new Effect.Morph(this.$dropdown,{style:'opacity: 1; top: '+(position.top+4)+'px',duration:this.duration,afterFinish:function(){this.open=true;}.bind(this)});},closeDropDown:function(){new Effect.Morph(this.$dropdown,{style:'opacity: 0; top: '+(this.getPulldownPosition().top-4)+'px',duration:this.duration,afterFinish:function(){this.$dropdown.addClassName('hide');}.bind(this)});this.open=false;},checkCloseCondition:function(ev){const $clickedElement=ev.findElement();const parentList=Element.ancestors($clickedElement);if(!this.open||$clickedElement===this.$dropdown||parentList.indexOf(this.$dropdown)>=0){return;}
this.closeDropDown();}});var dragBar=Class.create({options:{},initialize:function(options){this.options=Object.extend({dragContainer:'',leftContainer:'',rightContainer:'',moveInfoBox:false,dragType:'col-resize',dragActive:0,defaultTop:'',defaultWidth:'',minWidth:10},options||{});$(this.options.dragContainer).className='draggableBar';if(this.options.defaultWidth!=''){$(this.options.leftContainer).setStyle({'width':this.options.defaultWidth+'px'});if(this.options.rightContainer!=''){$(this.options.rightContainer).setStyle({'left':(parseInt(this.options.defaultWidth))+'px'})}
$(this.options.dragContainer).setStyle({'left':(this.options.defaultWidth-1)+'px'});if(this.options.moveInfoBox&&$('infoBox')){$('infoBox').setStyle({'left':(parseInt(this.options.defaultWidth)+1)+'px'});}}
var shadow_bar_ident='shadowBar_'+Math.floor((Math.random()*100)+1);while($(shadow_bar_ident)){shadow_bar_ident='shadowBar_'+Math.floor((Math.random()*100)+1);}
var shadow_bar=new Element('div',{id:shadow_bar_ident}).setStyle({zIndex:1000,display:'none',background:'#000',position:'absolute',top:'48px',bottom:0,width:$(this.options.dragContainer).getStyle('width'),left:$(this.options.dragContainer).getStyle('left')});$('content').insert(shadow_bar);$(this.options.dragContainer).on('mouseover',function(){$('content').style.cursor=this.options.dragType;}.bind(this));$(this.options.dragContainer).on('mouseout',function(){$('content').style.cursor='';});$(this.options.dragContainer).on('mousedown',function(e){this.options.dragActive=1;if(e.preventDefault){e.preventDefault();}
else{e.returnValue=false;}
shadow_bar.show();}.bind(this));$('content').on('mouseup',function(e){if(this.options.dragActive==1){var left_position=(e.pageX>this.options.minWidth)?(((document.body.offsetWidth-(this.options.minWidth*2))>e.pageX)?e.pageX:document.body.offsetWidth-(this.options.minWidth*2)):this.options.minWidth;var new_left_width=left_position;if(this.options.rightContainer!=''){$(this.options.rightContainer).setStyle({'left':left_position+'px'});}
$(this.options.dragContainer).setStyle({'left':(left_position-1)+'px'});$(this.options.leftContainer).setStyle({'width':new_left_width+'px'});if(this.options.moveInfoBox&&$('infoBox')){$('infoBox').setStyle({'left':(new_left_width+1)+'px'});}
shadow_bar.hide();this.callback_save();idoit.callbackManager.triggerCallback('idoit-dragbar-update');}
this.options.dragActive=0;$('content').style.cursor='';}.bind(this));$('content').on('mousemove',function(e){if(this.options.dragActive==1){$('content').style.cursor=this.options.dragType;shadow_bar.setStyle({'left':((e.pageX>this.options.minWidth)?(((document.body.offsetWidth-
(this.options.minWidth*2))>e.pageX)?e.pageX:document.body.offsetWidth-(this.options.minWidth*2)):this.options.minWidth)+'px'});}}.bind(this));},callback_save:function(){},deactivateBar:function(){$(this.options.dragContainer).hide();},activateBar:function(){$(this.options.dragContainer).show();}});var BrowserSelectionSorter=Class.create({initialize:function(element,options){if($(element+'_SELECTION_SORTER')){this.destruct(element);return null;}
this.element=$(element);this.hidden_element=this.element.next('input[type="hidden"]');if(options.hasOwnProperty('hidden')){this.hidden_element=$(options.hidden);}
this.options=Object.extend({values:[],ajax_url:'?ajax=1&call=json&action=load_object_data'},options||{});this.positions=this.element.positionedOffset();this.positions.height=this.element.getHeight();this.positions.width=this.element.getWidth();this.element.insert({after:new Element('div',{id:element+'_SELECTION_SORTER',className:'browser-selection-sorter border'}).setStyle({position:'absolute',left:this.positions.left+'px',top:(this.positions.top+this.positions.height-1)+'px',width:(this.positions.width-2)+'px',display:'none'})});this.sorting_div=this.element.next('#'+element+'_SELECTION_SORTER');this.load_selection();},load_selection:function(){new Ajax.Request(this.options.ajax_url,{parameters:{objects:this.options.values},method:'post',onSuccess:function(transport){var json=transport.responseJSON,objects=[],object;if(json.success){for(i in json.data){if(json.data.hasOwnProperty(i)){object=json.data[i];objects.push(new Element('li',{'data-obj-id':object.id}).update(new Element('span',{className:'handle mr5'}).update('&nbsp;&nbsp;&nbsp;')).insert(new Element('span').update(object.title+' ('+object.type_title+')')).outerHTML);}}
this.sorting_div.update(new Element('ul',{id:this.element.id+'_SELECTION_SORTABLE'}).update(objects.join(''))).insert(new Element('div',{className:'controls'}).update(new Element('button',{className:'btn btn-small m5 accept',type:'button'}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-ok.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC_UNIVERSAL__ACCEPT')))).insert(new Element('button',{className:'btn btn-small m5 abort',type:'button'}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-cancel.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC_UNIVERSAL__ABORT')))));}else{this.sorting_div.update(new Element('div',{className:'p5 m5 box-red'}).update(json.message));}
Effect.BlindDown(this.sorting_div,{duration:0.4});this.set_observer();}.bind(this)});},set_observer:function(){Sortable.destroy(this.element.id+'_SELECTION_SORTABLE');Sortable.create(this.element.id+'_SELECTION_SORTABLE',{handle:'handle'});this.sorting_div.down('button.accept').on('click',function(){var view=[],hidden=[];this.sorting_div.select('li').each(function(el){view.push(el.down('span',1).innerHTML);hidden.push(parseInt(el.readAttribute('data-obj-id')));}.bind(this));this.element.setValue(view.join(', '));this.hidden_element.setValue(Object.toJSON(hidden));this.destruct(this.element.id);}.bind(this));this.sorting_div.down('button.abort').on('click',function(){this.destruct(this.element.id);}.bind(this));return this;},destruct:function(element){Effect.BlindUp(element+'_SELECTION_SORTER',{duration:0.4,afterFinish:function(){$(element+'_SELECTION_SORTER').remove();}});return this;}});if(!Prototype.Browser.IE){HTMLElement.prototype.click=function(){var evt=this.ownerDocument.createEvent('MouseEvents');evt.initMouseEvent('click',true,true,this.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);this.dispatchEvent(evt);};}
(function(){var eventMatchers={'HTMLEvents':/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,'MouseEvents':/^(?:click|mouse(?:down|up|over|move|out))$/},defaultOptions={pointerX:0,pointerY:0,button:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,bubbles:true,cancelable:true};Event.simulate=function(element,eventName){var options=Object.extend(defaultOptions,arguments[2]||{}),oEvent,eventType=null;element=$(element);for(var name in eventMatchers){if(eventMatchers[name].test(eventName)){eventType=name;break;}}
if(!eventType){throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');}
if(document.createEvent){oEvent=document.createEvent(eventType);if(eventType=='HTMLEvents'){oEvent.initEvent(eventName,options.bubbles,options.cancelable);}else{oEvent.initMouseEvent(eventName,options.bubbles,options.cancelable,document.defaultView,options.button,options.pointerX,options.pointerY,options.pointerX,options.pointerY,options.ctrlKey,options.altKey,options.shiftKey,options.metaKey,options.button,element);}
element.dispatchEvent(oEvent);}else{options.clientX=options.pointerX;options.clientY=options.pointerY;oEvent=Object.extend(document.createEventObject(),options);element.fireEvent('on'+eventName,oEvent);}
return element;};Element.addMethods({simulate:Event.simulate});})();document.observe('dom:loaded',function(){'use strict';idoit.Notify=Class.create({initialize:function(options){var opt=options||{};this.notification_options={header:'',life:3,sticky:false,className:'',width:'250px',created:Prototype.emptyFunction,destroyed:Prototype.emptyFunction};this.element=new Element('div',{className:'Notify',id:'Notify',style:'position: fixed; padding: 10px; z-index: 50000; bottom: 15px; right: 5px;'});this.element.wrap(document.body);},render:function(msg,options){var opt=Object.extend(Object.clone(this.notification_options),options||{}),notice,notify=this.element;opt.className=(opt.hasOwnProperty('className')?'item '+opt.className:'item');notice=new Element('div',{'class':opt.className}).setStyle({display:'block',opacity:0}).observe('notify:created',opt.created).observe('notify:destroyed',opt.destroyed).insert(new Element('div',{'class':'exit'}).update('&times;')).insert(new Element('div',{'class':'head'}).update(opt.header)).insert(new Element('div',{'class':'body'}).update(msg));notice.down('.exit').on('click',function(){this.remove(notice,opt);}.bind(this));if(opt.width){notice.setStyle({width:isNumeric(opt.width)?opt.width+'px':opt.width});}
notify.insert(notice);var opacity=new Effect.Opacity(notice,{to:0.85,duration:0.3});if(!opt.sticky){this.remove.delay(opt.life,notice,opt);}
notice.fire('notify:created');return notice;},remove:function(notice,options){var opt=Object.extend(Object.clone(this.notification_options),options||{});var morph=new Effect.Morph(notice,{duration:0.3,style:'margin-right:'+(notice.getWidth()*-1)+'px; opacity:0;',afterFinish:function(){try{notice.fire('notify:destroyed');notice.stopObserving().remove();}catch(e){}}});},message:function(message,options){options=Object.extend({header:idoit.Translate.get('LC__NOTIFY__MESSAGE')},options||{});options.className=(options.hasOwnProperty('className')?options.className+' box-neutral-400':'box-neutral-400');this.render(message,options);},success:function(message,options){options=Object.extend({header:idoit.Translate.get('LC__NOTIFY__SUCCESS')},options||{});options.className=(options.hasOwnProperty('className')?options.className+' box-green':'box-green');this.render(message,options);},error:function(message,options){options=Object.extend({life:10,header:idoit.Translate.get('LC__NOTIFY__ERROR')},options||{});options.className=(options.hasOwnProperty('className')?options.className+' box-red':'box-red');this.render(message,options);},info:function(message,options){options=Object.extend({header:idoit.Translate.get('LC__NOTIFY__INFO')},options||{});options.className=(options.hasOwnProperty('className')?options.className+' box-blue':'box-blue');this.render(message,options);},warning:function(message,options){options=Object.extend({header:idoit.Translate.get('LC__NOTIFY__WARNING')},options||{});options.className=(options.hasOwnProperty('className')?options.className+' box-yellow':'box-yellow');this.render(message,options);},renderNotification:function(notification){switch(notification.type){default:case 0:idoit.Notify.message(notification.message,notification.options);break;case 1:idoit.Notify.success(notification.message,notification.options);break;case 2:idoit.Notify.error(notification.message,notification.options);break;case 3:idoit.Notify.info(notification.message,notification.options);break;case 4:idoit.Notify.warning(notification.message,notification.options);break;}},test:function(){this.error('error',{sticky:true});this.success('success',{sticky:true});this.info('info',{sticky:true});this.warning('warning',{sticky:true});this.message('message',{sticky:true});}});idoit.Notify=new idoit.Notify();Ajax.Responders.register({onComplete:function(ev){var notification,cnt=0;while(notification=ev.getHeader('X-i-doit-Notification-'+cnt)){cnt++;idoit.Notify.renderNotification(JSON.parse(notification));}}});});var PropertySelector=Class.create();PropertySelector.prototype={initialize:function(name,options){this.name=name;this.options=options;this.$selectionList=$(this.name+'_selection_field');this.$selectionBox=this.$selectionList.up('div');this.$sortCanceler=new Element('img',{src:window.dir_images+'icons/silk/cross.png',className:'fr mr5 mouse-pointer hide',title:idoit.Translate.get('LC__UNIVERSAL__DESELECT')});this.options=Object.extend({url:'?call=get_category_data&ajax=1',provides:null,group:true,sortable:false,max_items:38,dynamic_properties:false,allow_sorting:false,default_sorting:null,check_sorting:false,report:false,custom_fields:false,allowed_prop_types:[],consider_rights:true,hidden_field_name:'lvls_raw',lvl:1,catg_selection:null,cats_selection:null,catg_custom_selection:null,parent_prop:null,selector_size:'',dialog_width:'',complete_selection:null,replace_dynamic_properties:false,searchable:false,obj_type_id:null,completePath:{}},options||{});if(this.options.catg_selection==null&&$(this.name+'_catg_selection')){this.options.catg_selection=$(this.name+'_catg_selection').clone(true);}
if(this.options.cats_selection==null&&$(this.name+'_cats_selection')){this.options.cats_selection=$(this.name+'_cats_selection').clone(true);}
if(this.options.complete_selection==null){this.options.complete_selection=this.name+'__COMPLETE';if($(this.options.complete_selection)){if(typeof this.options.completePath==='object'){$(this.options.complete_selection).value=JSON.stringify(this.options.completePath);}else{$(this.options.complete_selection).value=this.options.completePath;}}}
$(this.name+'_catg_selection').on('change',function(){this.load_properties('g');}.bind(this));$(this.name+'_cats_selection').on('change',function(){this.load_properties('s');}.bind(this));if(this.options.searchable){$(this.name+'_search_button').on('click',function(){this.search_properties($(this.name+'_search_input').getValue());}.bind(this));$(this.name+'_search_input').on('keypress',function(evt){if($(this.name+'_search_input').getValue().length>2){$(this.name+'_search_button').removeAttribute('disabled');if(evt.keyCode==13){this.search_properties($(this.name+'_search_input').getValue());}}else{$(this.name+'_search_button').setAttribute('disabled','disabled');$(this.name+'_search_input').highlight();}
if(evt.keyCode==13){evt.preventDefault();}}.bind(this));this.search_properties('');}
if(this.options.allow_sorting){this.$selectionBox.down('div').insert(this.$sortCanceler);this.$sortCanceler.on('click',function(){var $checked=this.$selectionBox.down(':checked');if($checked){$checked.setValue(0);this.$sortCanceler.addClassName('hide');}}.bind(this));this.$selectionBox.on('change','input',function(){this.$sortCanceler.removeClassName('hide');}.bind(this));}
this.load_properties('g');this.load_properties('s');if(this.options.custom_fields){if(this.options.catg_custom_selection==null&&$(this.name+'_catg_custom_selection')){this.options.catg_custom_selection=$(this.name+'_catg_custom_selection').clone(true);}
$(this.name+'_catg_custom_selection').on('change',function(){this.load_properties('g_custom');}.bind(this));this.load_properties('g_custom');}},load_properties:function(cat_type){var cat_const=$(this.name+'_cat'+cat_type+'_selection').value;new Ajax.Request(this.options.url+'&func=get_properties_by_database',{parameters:{'cat_const':cat_const,'cat_type':cat_type,'provide':this.options.provides,'dynamic_properties':this.options.dynamic_properties,'consider_rights':this.options.consider_rights,'replace_dynamic_properties':this.options.replace_dynamic_properties},method:'post',onSuccess:function(transport){var arr=transport.responseJSON,i,propertyType,$prop_box=$(this.name+'_cat'+cat_type+'_properties').update('');if(Object.keys(arr).length===0){$prop_box.insert(new Element('div',{className:'category-field'}).update(idoit.Translate.get('LC__REPORT__NO_ATTRIBUTES_FOUND')));}else{for(i in arr){if(arr.hasOwnProperty(i)){propertyType=i.split('#')[2];if(Object.isArray(this.options.allowed_prop_types)&&this.options.allowed_prop_types.length&&!this.options.allowed_prop_types.in_array(propertyType)){continue;}
var $add_button=new Element('span',{className:'plus'}),$property=new Element('div',{className:'category-field','data-cattype':cat_type,'data-catconst':cat_const,'data-propkey':i.split('#')[0],'data-propid':i.split('#')[1],'data-proptype':propertyType,'data-multi':i.split('#')[3],'data-indexed':i.split('#')[4]}).update(new Element('span').update(arr[i]||'<span class="text-neutral-400">('+idoit.Translate.get('LC__UNIVERSAL__EMPTY')+')</span>')).insert($add_button);if(this.property_already_selected(i.split('#')[1])){$add_button.addClassName('hide');}
$add_button.on('click',this.add.bindAsEventListener(this));$prop_box.insert($property);}}}}.bind(this)});},search_properties:function(property_name){if(property_name.length>2){new Ajax.Request(this.options.url+'&func=get_filtered_properties_by_database',{parameters:{filter:property_name,provide:this.options.provides,dynamic_properties:this.options.dynamic_properties,consider_rights:this.options.consider_rights,replace_dynamic_properties:this.options.replace_dynamic_properties,custom_fields:this.options.custom_fields,obj_type_id:this.options.obj_type_id},method:'post',onLoading:function(){$(this.name+'_search_button').childElements()[0].toggle();$(this.name+'_search_button').childElements()[1].toggle();}.bind(this),onSuccess:function(transport){var arr=transport.responseJSON,i,$search_box=$(this.name+'_search_result_container').update(''),$search_count=$(this.name+'_search_count_container');if(Object.keys(arr).length===0){$search_count.hide();$search_box.insert(new Element('div',{className:'category-field'}).update(idoit.Translate.get('LC__REPORT__NO_ATTRIBUTES_FOUND')));}else{for(i in arr){if(arr.hasOwnProperty(i)){var $add_button=new Element('span',{className:'plus'}),$property=new Element('div',{className:'category-field','data-cattype':arr[i].cat_type,'data-catconst':arr[i].cat_const,'data-cattitle':arr[i].cat_title,'data-propkey':i.split('#')[0],'data-propid':i.split('#')[1],'data-proptype':i.split('#')[2],'data-multi':i.split('#')[3]}).update(new Element('span').update(arr[i].title)).insert($add_button);$add_button.on('click',this.add.bindAsEventListener(this));$search_box.insert($property);}}
$(this.name+'_search_count').show().update(Object.keys(arr).length);$search_count.show();}}.bind(this),onComplete:function(){$(this.name+'_search_button').childElements()[0].toggle();$(this.name+'_search_button').childElements()[1].toggle();}.bind(this)});}else{$(this.name+'_search_count').update('0');$(this.name+'_search_result_container').update(new Element('div',{className:'category-field'}).update(idoit.Translate.get('LC__REPORT__NO_ATTRIBUTES_FOUND')));}},add:function(ev){var $button=ev.findElement('span'),el=$button.up('div'),cat_type=el.readAttribute('data-cattype'),cat_const=el.readAttribute('data-catconst'),cat_name=(el.hasAttribute('data-cattitle')?el.readAttribute('data-cattitle'):$$('select#'+this.name+'_cat'+cat_type+'_selection option[value="'+$(this.name+'_cat'+cat_type+'_selection').value+'"]')[0].innerHTML),property=el.readAttribute('data-propkey'),property_id=el.readAttribute('data-propid'),property_type=el.readAttribute('data-proptype'),property_multi=el.readAttribute('data-multi'),property_indexed=el.readAttribute('data-indexed'),property_name=el.down().innerHTML.replace(/<span class="removeable-addon">(.)*<\/span>/,'');if(this.options.max_items>0&&this.count_items()>=this.options.max_items){$(this.name+'_attr_error').update((idoit.Translate.get('LC__REPORT__FORM__ATTRIBUTE_COUNT_ERROR')).replace('%i',this.options.max_items));Effect.Appear(this.name+'_attr_error',{duration:0.5});return;}
$button.addClassName('hide');if(this.property_already_selected(property_id)){return;}
if(this.options.group){this.add_with_grouping(cat_type,cat_const,cat_name,property,property_name,property_id,property_type,(property_indexed=='1'),property_multi);}else{this.add_without_grouping(cat_type,cat_const,cat_name,property,property_name,property_id,property_type,(property_indexed=='1'),property_multi);}
this.update_hiddenfield();if(this.options.sortable){this.make_sortable();}
this.callback_add();},add_with_grouping:function(cat_type,cat_const,cat_name,property,property_name,property_id,property_type,property_sortable,property_multi){$(this.name+'_attribute_remover').setStyle({display:'none'});var cat_div,prop_checked,remove_button,minus_style={},reference_style={},remove_method=this.remove.bindAsEventListener(this),translation=idoit.Translate.get('LC__UNIVERSAL__GLOBAL');if(cat_type=='s'){translation=idoit.Translate.get('LC__UNIVERSAL__SPECIFIC');}
cat_div=this.$selectionList.down('div.cat'+cat_type+'-'+cat_const);if(typeof cat_div=='undefined'){cat_div=new Element('div',{className:'selected-field cat'+cat_type+'-'+cat_const}).update(cat_name+' ('+translation+')');this.$selectionList.insert({bottom:cat_div});}
if(this.options.allow_sorting){minus_style={right:'25px'};reference_style={right:'45px'};}
remove_button=new Element('span',{className:'minus'}).observe('click',remove_method).setStyle(minus_style);prop_div=new Element('div',{className:'property','data-cattype':cat_type,'data-catconst':cat_const,'data-propkey':property,'data-propid':property_id,'data-proptype':property_type});if(this.options.report&&property_type=='object_browser'&&property_multi==0){reference_button=new Element('span',{className:'reference'}).setStyle(reference_style);reference_button.on('click',function(e){Element.childElements(e.findElement().up().up().up()).each(function(el){Element.childElements(el).each(function(el1){if(el1.hasClassName('selected-field-focus')){el1.removeClassName('selected-field-focus');}});});e.findElement().up().addClassName('selected-field-focus');var selector_name=e.findElement().up().readAttribute('data-propid');this.build_property_selector(cat_const+'-'+property,this.options.lvl);}.bind(this));cat_div.insert(prop_div.update(new Element('span').insert(' - '+property_name)).insert(reference_button).insert(remove_button));}else{cat_div.insert(prop_div.update(new Element('span').insert(' - '+property_name)).insert(remove_button));}
if(this.options.allow_sorting){if(this.options.check_sorting){if(property_sortable){this.add_radio_button(cat_div,(this.options.default_sorting==property_id),property_id,false);}else if(property_sortable==undefined){this.add_radio_button(cat_div,false,property_id,true);}}else{this.add_radio_button(cat_div,(this.options.default_sorting==property_id),property_id,false);}}},add_without_grouping:function(cat_type,cat_const,cat_name,property,property_name,property_id,property_type,property_sortable,property_multi){$(this.name+'_attribute_remover').setStyle({display:'none'});var remove_method=this.remove.bindAsEventListener(this),prop,minus_style={},reference_style={},remove_button;if(!this.property_already_selected(property_id)){if(this.options.allow_sorting){minus_style={right:'25px'};reference_style={right:'45px'};}
remove_button=new Element('span',{className:'minus'}).observe('click',remove_method).setStyle(minus_style);if(this.options.report&&['object_browser','n2m'].includes(property_type)){var reference_button=new Element('span',{className:'reference'}).setStyle(reference_style);reference_button.on('click',function(e){Element.childElements(e.findElement().up().up().up()).each(function(el){Element.childElements(el).each(function(el1){if(el1.hasClassName('selected-field-focus')){el1.removeClassName('selected-field-focus');}});});e.findElement().up().addClassName('selected-field-focus');var selector_name=e.findElement().up().readAttribute('data-propid');this.build_property_selector(cat_const+'-'+property,this.options.lvl);}.bind(this));prop=new Element('div',{className:'selected-field property','data-cattype':cat_type,'data-catconst':cat_const,'data-propkey':property,'data-propid':property_id,'data-proptype':property_type}).update(new Element('span').insert(property_name+' ('+cat_name+')')).insert(reference_button).insert(remove_button);}else{prop=new Element('div',{className:'selected-field property','data-cattype':cat_type,'data-catconst':cat_const,'data-propkey':property,'data-propid':property_id,'data-proptype':property_type}).update(new Element('span').insert(property_name+' ('+cat_name+')')).insert(remove_button);}
if(this.options.allow_sorting){if(this.options.check_sorting){if(property_sortable){this.add_radio_button(prop,(this.options.default_sorting==property_id),property_id,false);}else if(property_sortable==undefined){this.add_radio_button(prop,false,property_id,true);}}else{this.add_radio_button(prop,(this.options.default_sorting==property_id),property_id,false);}}
this.$selectionList.insert({bottom:prop});}},remove:function(e){Effect.Fade(this.name+'_attr_error',{duration:0.5});var el=e.findElement().up(),parent=el.up(),data_prop_id=el.readAttribute('data-propid'),data_cat_type=el.readAttribute('data-cattype'),data_const=el.readAttribute('data-catconst'),data_type=el.readAttribute('data-proptype'),data_prop_key=el.readAttribute('data-propkey');el.remove();var $propertyList=$(this.name+'_cat'+data_cat_type+'_properties');if($propertyList.down('[data-propid="'+data_prop_id+'"]')){$propertyList.down('[data-propid="'+data_prop_id+'"]').down('span.plus').removeClassName('hide');}
if(this.options.report&&data_type=='object_browser'){if(this.options.parent_prop!=null){var parent_prop_arr=this.options.parent_prop.split('--');var check_parent_prop=[];var check_prop='';if(parent_prop_arr.length>=1){for(a=0;a<parent_prop_arr.length;a++){check_parent_prop.push(parent_prop_arr[a]);}
check_prop=check_parent_prop.join('--')+'--'+data_const+'-'+data_prop_key;}else{check_prop=data_const+'-'+data_prop_key;}
if($(check_prop+'__HIDDEN')){this.remove_hidden_fields(check_prop,true);}}else if($(data_const+'-'+data_prop_key+'__HIDDEN')){this.remove_hidden_fields(data_const+'-'+data_prop_key,true);}}
if(this.options.group&&parent.down()==null){parent.remove();}
if(this.$selectionList.select('.property').length==0){$(this.name+'_attribute_remover').setStyle({display:'block'});}
this.update_hiddenfield();this.callback_remove();},remove_hidden_fields:function(p_parent_key,p_delete){if($(p_parent_key+'__HIDDEN')){if($(p_parent_key+'__HIDDEN').value!=''){var hidden_field_value=JSON.parse($(p_parent_key+'__HIDDEN').value);hidden_field_value.each(function(ele){if(ele.g){for(var a in ele.g){if(ele.g.hasOwnProperty(a)){ele.g[a].each(function(ele2){this.remove_hidden_fields(p_parent_key+'--'+a+'-'+ele2,true);}.bind(this));}}}
if(ele.s){for(var a in ele.s){if(ele.s.hasOwnProperty(a)){ele.s[a].each(function(ele2){this.remove_hidden_fields(p_parent_key+'--'+a+'-'+ele2,true);}.bind(this));}}}
if(ele.g_custom){for(var a in ele.g_custom){if(ele.g_custom.hasOwnProperty(a)){ele.g_custom[a].each(function(ele2){this.remove_hidden_fields(p_parent_key+'--'+a+'-'+ele2,true);}.bind(this));}}}}.bind(this));if($(p_parent_key+'__HIDDEN')){if($(p_parent_key+'__HIDDEN').next('td')){$(p_parent_key+'__HIDDEN').next('td').remove();$(p_parent_key+'__HIDDEN').next('td').remove();$(p_parent_key+'__HIDDEN').next('td').remove();}
if(p_delete){$(p_parent_key+'__HIDDEN').remove();if($(p_parent_key+'__HIDDEN_IDS')){$(p_parent_key+'__HIDDEN_IDS').remove();}}}
var selection=JSON.parse($(this.options.complete_selection).value);var new_selection={};for(a in selection){if(a!=p_parent_key){new_selection[a]=selection[a];}}
$(this.options.complete_selection).value=Object.toJSON(new_selection);}}},update_hiddenfield:function(){var property_elements=this.$selectionList.select('.property'),selection=[],selection_complete=[],selection_ids=[];if(this.options.group){var c_cat_type='',c_cat_const='',tmp_selection=null,tmp_selection_complete=null;property_elements.each(function(el){var cat_type=el.readAttribute('data-cattype'),cat_const=el.readAttribute('data-catconst'),prop_key=el.readAttribute('data-propkey'),prop_title=el.down('span').innerHTML,prop_id=el.readAttribute('data-propid');if(c_cat_type==cat_type&&c_cat_const==cat_const){tmp_selection[cat_type][cat_const].push(prop_key);}else{if(tmp_selection!=null){selection.push(tmp_selection);}
tmp_selection={};tmp_selection[cat_type]={};tmp_selection[cat_type][cat_const]=[prop_key];tmp_selection_complete={};tmp_selection_complete[cat_type]={};tmp_selection_complete[cat_type][cat_const]=[prop_id,prop_key,prop_title];}
c_cat_type=cat_type;c_cat_const=cat_const;selection_ids.push(prop_id);}.bind(this));if(tmp_selection!=null){selection.push(tmp_selection);selection_complete.push(tmp_selection_complete);}}else{property_elements.each(function(el){var cat_type=el.readAttribute('data-cattype'),cat_const=el.readAttribute('data-catconst'),prop_key=el.readAttribute('data-propkey'),prop_id=el.readAttribute('data-propid'),prop_title=el.down('span').innerHTML,tmp_selection={},tmp_selection_complete={};tmp_selection[cat_type]={};tmp_selection[cat_type][cat_const]=[prop_key];tmp_selection_complete[cat_type]={};tmp_selection_complete[cat_type][cat_const]=[prop_id,prop_key,prop_title];selection.push(tmp_selection);selection_ids.push(prop_id);selection_complete.push(tmp_selection_complete);}.bind(this))}
var selection_complete_ele=$(this.options.complete_selection);$(this.name+'__HIDDEN').setValue(Object.toJSON(selection));$(this.name+'__HIDDEN_IDS').setValue(Object.toJSON(selection_ids));if(selection_complete_ele.value==''){var prop_hash={'root':selection_complete};}else{var prop_hash=JSON.parse(selection_complete_ele.value);if(this.options.parent_prop==null){prop_hash['root']=selection_complete;}else{prop_hash[this.options.parent_prop]=selection_complete;}}
selection_complete_ele.value=Object.toJSON(prop_hash);},count_items:function(){return this.$selectionList.select('.property').length;},handle_preselection:function(json){if(this.options.group){json.each(function(i){this.add_with_grouping(i.cat_type,i.cat_const,i.cat_title,i.prop_key,i.prop_title,i.prop_id,i.prop_type,i.prop_sortable,i.prop_multi);}.bind(this));}else{json.each(function(i){this.add_without_grouping(i.cat_type,i.cat_const,i.cat_title,i.prop_key,i.prop_title,i.prop_id,i.prop_type,i.prop_sortable,i.prop_multi);}.bind(this));}
this.update_hiddenfield();if(this.options.sortable){this.make_sortable();}},handle_preselection_lvls:function(json){var lvls=$H(json);lvls.each(function(el){var lvl=parseInt(el.key);var content=$H(el.value);if($('spacer_lvl_'+lvl)){var tr_spacer=$('spacer_lvl_'+lvl);var next_tr_spacer=new Element('tr',{className:'selector-spacer mt5',style:'min-width:30px',id:'spacer_lvl_'+(lvl+1)});tr_spacer.up().insert(next_tr_spacer);content.each(function(el2){var hidden_field=new Element('input',{type:'hidden',name:'lvls_raw['+lvl+']['+el2.key+']',id:el2.key+'__HIDDEN'});hidden_field.value=JSON.stringify(el2.value);tr_spacer.insert(hidden_field);});}});},make_sortable:function(){Position.includeScrollOffsets=true;Sortable.create(this.$selectionList,{tag:'div',onChange:function(){this.update_hiddenfield();}.bind(this)});if(!this.$selectionList.hasClassName('draggable')){this.$selectionList.addClassName('draggable');}
Element.makePositioned(this.$selectionList);},property_already_selected:function(prop_id){return!!this.$selectionList.select('.property').filter(function(i){return(i.readAttribute('data-propid')==prop_id);}).length;},add_radio_button:function(prop,prop_checked,property_id,property_sortable_check){var $checkbox=new Element('input',{type:'radio',style:'margin-top:-1px',name:'default_sorting',value:property_id,checked:prop_checked});if(property_sortable_check===false){prop.insert(new Element('span',{style:'float:right'}).insert($checkbox));if(prop_checked){this.$sortCanceler.removeClassName('hide');}
return prop;}else{new Ajax.Request(this.options.url+'&func=is_property_sortable',{parameters:{prop_id:property_id},method:'post',onSuccess:function(transport){var check=transport.responseJSON;if(check===true){prop.insert(new Element('span',{style:'float:right'}).insert($checkbox));if(prop_checked){this.$sortCanceler.removeClassName('hide');}
return prop;}}.bind(this)});return prop;}},build_property_selector:function(p_id,p_lvl,p_data){var tr_spacer=$('spacer_lvl_'+p_lvl);if(p_lvl==1){var parent_prop=p_id;}else{var parent_prop=this.options.parent_prop+'--'+p_id;}
if(typeof tr_spacer.down('td')!='undefined'){if(typeof tr_spacer.down('td').next('td')!='undefined'){tr_spacer.down('td').remove();tr_spacer.down('td').remove();tr_spacer.down('td').remove();var i=1;while($('spacer_lvl_'+(parseInt(p_lvl)+i))){if(!$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('input')){$('spacer_lvl_'+(parseInt(p_lvl)+i)).remove();}else{if($('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td')){$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();}}
i++;}}}
if(!$(parent_prop+'__HIDDEN')){tr_spacer.insert(new Element('input',{type:'hidden',id:parent_prop+'__HIDDEN',name:this.options.hidden_field_name+'['+p_lvl+']['+parent_prop+']'}));}
if(!$(parent_prop+'__HIDDEN_IDS')){tr_spacer.insert(new Element('input',{type:'hidden',id:parent_prop+'__HIDDEN_IDS',name:this.options.hidden_field_name+'__IDS['+p_lvl+']['+parent_prop+']'}));}
if(typeof tr_spacer.down('td')=='undefined'){var selector_left=new Element('td',{className:'vat pt5'});var selector_right=new Element('td',{className:'vat pt5'});}else{var selector_left=tr_spacer.down('td');var selector_right=tr_spacer.down('td').next('td');}
switch(this.options.selector_size){case'small':var min_width='305px';break;case'normal':default:var min_width='400px';break;}
var div_content_left=new Element('div',{className:'border fl mr20',style:'width:'+min_width});var ul_headline_left=new Element('ul',{className:'m0 gradient rowser-tabs',id:parent_prop+'_tabs'});var li_global=new Element('li').insert(new Element('a',{href:'#'+parent_prop+'_catg_list'}).insert(idoit.Translate.get('LC__UNIVERSAL__GLOBAL')));var div_catg=new Element('div',{id:parent_prop+'_catg_list',className:'m10 browser-tab-content'});var li_specific=new Element('li').insert(new Element('a',{href:'#'+parent_prop+'_cats_list'}).insert(idoit.Translate.get('LC__UNIVERSAL__SPECIFIC')));var div_cats=new Element('div',{id:parent_prop+'_cats_list',className:'m10 browser-tab-content',style:'display:none;'});if(this.options.catg_custom_selection!==null){var li_custom=new Element('li').insert(new Element('a',{href:'#'+parent_prop+'_catg_custom_list'}).insert(idoit.Translate.get('LC__CMDB__CATG__CUSTOM')));var div_custom=new Element('div',{id:parent_prop+'_catg_custom_list',className:'m10 browser-tab-content'});}
var div_error=new Element('div',{id:parent_prop+'_attr_error',className:'box-red m10 p5',style:'display:none;'});if(this.options.catg_custom_selection!==null){selector_left.insert(div_content_left.insert(ul_headline_left.insert(li_global).insert(li_specific).insert(li_custom)).insert(div_catg).insert(div_cats).insert(div_custom).insert(div_error));}else{selector_left.insert(div_content_left.insert(ul_headline_left.insert(li_global).insert(li_specific)).insert(div_catg).insert(div_cats).insert(div_error));}
var div_content_right=new Element('div',{className:'border fl',style:'width:'+min_width});var div_headline_right=new Element('div',{className:'m0 p10 gradient browser-tabs',style:'box-sizing: border-box; height:33px; border-bottom:1px solid #888;'});var span_headline_right=new Element('span').insert(new Element('b',{style:'color:#333333;font-size:10px;'}).insert(idoit.Translate.get('LC__REPORT__INFO__CHOSEN_PROPERTIES_TEXT')));var div_selection_right=new Element('div',{className:'m10',id:parent_prop+'_selection_field'});var div_remover_right=new Element('div',{className:'category-field',id:parent_prop+'_attribute_remover'}).insert(idoit.Translate.get('LC__REPORT__NO_ATTRIBUTES_ADDED'));selector_right.insert(div_content_right.insert(div_headline_right.insert(span_headline_right)).insert(div_selection_right.insert(div_remover_right)));tr_spacer.insert(selector_left).insert(selector_right);if(!$('spacer_lvl_'+this.options.lvl+1)){var remover=new Element('span',{className:'property-remover'}).observe('click',function(){var delete_all=false,i=1;$('spacer_lvl_'+p_lvl).down('td').remove();$('spacer_lvl_'+p_lvl).down('td').remove();$('spacer_lvl_'+p_lvl).down('td').remove();this.remove_hidden_fields(parent_prop,true);if(!$('spacer_lvl_'+p_lvl).down('input')){delete_all=true;}
while($('spacer_lvl_'+(parseInt(p_lvl)+i))){if(delete_all){$('spacer_lvl_'+(parseInt(p_lvl)+i)).remove();}else{if($('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td')){$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();$('spacer_lvl_'+(parseInt(p_lvl)+i)).down('td').remove();}}
i++;}}.bind(this));var td_remover=new Element('td',{className:'vat pt5 pl5'}).insert(remover);tr_spacer.insert(td_remover);if(!$('spacer_lvl_'+(parseInt(this.options.lvl)+1))){var td_next_spacer=new Element('tr',{id:'spacer_lvl_'+(parseInt(this.options.lvl)+1),style:'min-width:30px',className:'selector-spacer mt5'});tr_spacer.up().insert(td_next_spacer);}}
var catg_select=this.options.catg_selection.clone(true);catg_select.id=parent_prop+'_catg_selection';catg_select.name=parent_prop+'_catg_selection';var cats_select=this.options.cats_selection.clone(true);cats_select.id=parent_prop+'_cats_selection';cats_select.name=parent_prop+'_cats_selection';catg_select.selectedIndex=0;cats_select.selectedIndex=0;var div_properties_catg_left=new Element('div',{id:parent_prop+'_catg_properties'});var div_properties_cats_left=new Element('div',{id:parent_prop+'_cats_properties'});$(parent_prop+'_catg_list').insert(catg_select).insert(div_properties_catg_left);new Chosen(catg_select,{disable_search_threshold:10,width:'100%',height:'20px',search_contains:true});$(parent_prop+'_cats_list').insert(cats_select).insert(div_properties_cats_left);new Chosen(cats_select,{disable_search_threshold:10,width:'100%',height:'20px',search_contains:true});if(this.options.catg_custom_selection!==null){var catg_custom_select=this.options.catg_custom_selection.clone(true);catg_custom_select.id=parent_prop+'_catg_custom_selection';catg_custom_select.name=parent_prop+'_catg_custom_selection';catg_custom_select.selectedIndex=0;var div_properties_catg_custom_left=new Element('div',{id:parent_prop+'_catg_custom_properties'});$(parent_prop+'_catg_custom_list').insert(catg_custom_select).insert(div_properties_catg_custom_left);new Chosen(catg_custom_select,{disable_search_threshold:10,width:'100%',height:'20px',search_contains:true});}
var new_options={url:this.options.url,provides:this.options.provides,group:this.options.group,sortable:this.options.sortable,max_items:this.options.max_items,dynamic_properties:this.options.dynamic_properties,default_sorting:this.options.default_sorting,allow_sorting:false,check_sorting:false,report:this.options.report,custom_fields:this.options.custom_fields,consider_rights:this.options.consider_rights,hidden_field_name:this.options.hidden_field_name,lvl:this.options.lvl+1,catg_selection:this.options.catg_selection,cats_selection:this.options.cats_selection,catg_custom_selection:this.options.catg_custom_selection,parent_prop:parent_prop,selector_size:this.options.selector_size,dialog_width:this.options.dialog_width,complete_selection:this.options.complete_selection,replace_dynamic_properties:this.options.replace_dynamic_properties};var new_selector=new PropertySelector(parent_prop,new_options);if($(parent_prop+'__HIDDEN').value!=''){new Ajax.Request(this.options.url+'&func=format_preselection',{parameters:{'data':$(parent_prop+'__HIDDEN').value},method:'post',onSuccess:function(transport){new_selector.handle_preselection(transport.responseJSON);}.bind(new_selector)});}
window.category_tabs=new Tabs(parent_prop+'_tabs',{wrapperClass:'browser-tabs',contentClass:'browser-tab-content',tabClass:'mouse-pointer'});},callback_add:Prototype.emptyFunction,callback_remove:Prototype.emptyFunction};var DatePickerFormatter=Class.create();DatePickerFormatter.prototype={initialize:function(format,separator){if(Object.isUndefined(format)){format=["yyyy","mm","dd"];}
if(Object.isUndefined(separator)){separator="-";}
this._format=format;this.separator=separator;this._format_year_index=format.indexOf("yyyy");this._format_month_index=format.indexOf("mm");this._format_day_index=format.indexOf("dd");this._year_regexp=/^\d{4}$/;this._month_regexp=/^0\d|1[012]|\d$/;this._day_regexp=/^0\d|[12]\d|3[01]|\d$/;},match:function(str){var d=str.split(this.separator);if(d.length<3)return false;var year=d[this._format_year_index].match(this._year_regexp);if(year){year=year[0]}else{return false}
var month=d[this._format_month_index].match(this._month_regexp);if(month){month=month[0]}else{return false}
var day=d[this._format_day_index].match(this._day_regexp);if(day){day=day[0]}else{return false}
return[year,month,day];},current_date:function(){var d=new Date;return this.date_to_string(d.getFullYear(),d.getMonth()+1,d.getDate());},date_to_string:function(year,month,day,separator){if(Object.isUndefined(separator))
separator=this.separator;var a=[0,0,0];a[this._format_year_index]=year;a[this._format_month_index]=new Number(month).toPaddedString(2);a[this._format_day_index]=new Number(day).toPaddedString(2);return a.join(separator);}};var DatePicker=Class.create();DatePicker.prototype={Version:'0.9.4',_relative:null,_hidden:null,_time:null,_div:null,_zindex:1,_wrongFormatMessage:null,_keepFieldEmpty:false,_daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],_dateFormat:[["dd","mm","yyyy"],"."],_hiddenFormat:[["yyyy","mm","dd"],"-"],_language:'en',_language_month:$H({'fr':['Janvier','F&#233;vrier','Mars','Avril','Mai','Juin','Juillet','Aout','Septembre','Octobre','Novembre','D&#233;cembre'],'en':['January','February','March','April','May','June','July','August','September','October','November','December'],'sp':['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],'it':['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],'de':['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],'pt':['Janeiro','Fevereiro','Mar&#231;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],'hu':['Janu&#225;r','Febru&#225;r','M&#225;rcius','&#193;prilis','M&#225;jus','J&#250;nius','J&#250;lius','Augusztus','Szeptember','Okt&#243;ber','November','December'],'lt':['Sausis','Vasaris','Kovas','Balandis','Gegu&#382;&#279;','Bir&#382;elis','Liepa','Rugj&#363;tis','Rus&#279;jis','Spalis','Lapkritis','Gruodis'],'nl':['januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december'],'dk':['Januar','Februar','Marts','April','Maj','Juni','Juli','August','September','Oktober','November','December'],'no':['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],'lv':['Janv&#257;ris','Febru&#257;ris','Marts','Apr&#299;lis','Maijs','J&#363;nijs','J&#363;lijs','Augusts','Septembris','Oktobris','Novembris','Decemberis'],'ja':['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;','7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],'fi':['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&#228;kuu','Hein&#228;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],'ro':['Ianuarie','Februarie','Martie','Aprilie','Mai','Junie','Julie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],'zh':['1&#32;&#26376;','2&#32;&#26376;','3&#32;&#26376;','4&#32;&#26376;','5&#32;&#26376;','6&#32;&#26376;','7&#32;&#26376;','8&#32;&#26376;','9&#32;&#26376;','10&#26376;','11&#26376;','12&#26376;'],'sv':['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],'pl':['Stycze&#324;','Luty','Marzec','Kwiecie&#324;','Maj','Czerwiec','Lipiec','Sierpie&#324;','Wrzesie&#324;','Pa&#378;dziernik','Listopad','Grudzie&#324;'],'ru':['&#1071;&#1085;&#1074;&#1072;&#1088;&#1100;','&#1060;&#1077;&#1074;&#1088;&#1072;&#1083;&#1100;','&#1052;&#1072;&#1088;&#1090;','&#1040;&#1087;&#1088;&#1077;&#1083;&#1100;','&#1052;&#1072;&#1081;','&#1048;&#1102;&#1085;&#1100;','&#1048;&#1102;&#1083;&#1100;','&#1040;&#1074;&#1075;&#1091;&#1089;&#1090;','&#1057;&#1077;&#1085;&#1090;&#1103;&#1073;&#1088;&#1100;','&#1054;&#1082;&#1090;&#1103;&#1073;&#1088;&#1100;','&#1053;&#1086;&#1103;&#1073;&#1088;&#1100;','&#1044;&#1077;&#1082;&#1072;&#1073;&#1088;&#1100;'],'el':['&#921;&#945;&#957;&#959;&#973;&#945;&#961;&#953;&#959;&#962;',' &#934;&#949;&#946;&#961;&#959;&#965;&#940;&#961;&#953;&#959;&#962;',' &#924;&#940;&#961;&#964;&#953;&#959;&#962;',' &#913;&#960;&#961;&#943;&#955;&#953;&#959;&#962;',' &#924;&#940;&#953;&#959;&#962;',' &#921;&#959;&#973;&#957;&#953;&#959;&#962;',' &#921;&#959;&#973;&#955;&#953;&#959;&#962;',' &#913;&#973;&#947;&#959;&#965;&#963;&#964;&#959;&#962;',' &#931;&#949;&#960;&#964;&#941;&#956;&#946;&#961;&#953;&#959;&#962;',' &#927;&#954;&#964;&#974;&#946;&#961;&#953;&#959;&#962;',' &#925;&#959;&#941;&#956;&#946;&#961;&#953;&#959;&#962;',' &#916;&#949;&#954;&#941;&#956;&#946;&#961;&#953;&#959;&#962;']}),_language_day:$H({'fr':['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'],'en':['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],'sp':['Lun','Mar','Mie','Jue','Vie','S&#225;b','Dom'],'it':['Lun','Mar','Mer','Gio','Ven','Sab','Dom'],'de':['Mon','Die','Mit','Don','Fre','Sam','Son'],'pt':['Seg','Ter','Qua','Qui','Sex','S&#225;b','Dom'],'hu':['H&#233;','Ke','Sze','Cs&#252;','P&#233;','Szo','Vas'],'lt':['Pir','Ant','Tre','Ket','Pen','&Scaron;e&scaron;','Sek'],'nl':['ma','di','wo','do','vr','za','zo'],'dk':['Man','Tir','Ons','Tor','Fre','L&#248;r','S&#248;n'],'no':['Man','Tir','Ons','Tor','Fre','L&#248;r','Sun'],'lv':['P','O','T','C','Pk','S','Sv'],'ja':['&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;','&#26085;'],'fi':['Ma','Ti','Ke','To','Pe','La','Su'],'ro':['Lun','Mar','Mie','Joi','Vin','Sam','Dum'],'zh':['&#21608;&#19968;','&#21608;&#20108;','&#21608;&#19977;','&#21608;&#22235;','&#21608;&#20116;','&#21608;&#20845;','&#21608;&#26085;'],'sv':['M&#229;n','Tis','Ons','Tor','Fre','L&#246;r','S&#246;n'],'pl':['Pn','Wt','&#346;r','Czw','Pt','Sob','Ndz'],'ru':['&#1055;&#1085;','&#1042;&#1090;','&#1057;&#1088;','&#1063;&#1090;','&#1055;&#1090;','&#1057;&#1073;','&#1042;&#1089;'],'el':['&#916;&#949;&#965;','&#932;&#961;&#953;','&#932;&#949;&#964;','&#928;&#949;&#956;','&#928;&#945;&#961;','&#931;&#945;&#946;','&#922;&#965;&#961;']}),_language_close:$H({'fr':'fermer','en':'close','sp':'cerrar','it':'fine','de':'schliessen','pt':'fim','hu':'bez&#225;r','lt':'udaryti','nl':'sluiten','dk':'luk','no':'lukk','lv':'aizv&#275;rt','ja':'&#38281;&#12376;&#12427;','fi':'sulje','ro':'inchide','zh':'&#20851;&#32;&#38381','sv':'st&#228;ng','pl':'zamknij','ru':'&#1047;&#1072;&#1082;&#1088;&#1099;&#1090;&#1100;','el':'&#954;&#955;&#949;&#943;&#963;&#953;&#956;&#959;'}),_todayDate:new Date(),_current_date:null,_clickCallback:Prototype.emptyFunction,_cellCallback:Prototype.emptyFunction,_id_datepicker:null,_disablePastDate:false,_disableFutureDate:true,_enableYearBrowse:false,_oneDayInMs:24*3600*1000,_topOffset:30,_leftOffset:0,_isPositionned:false,_relativePosition:true,_setPositionTop:0,_setPositionLeft:0,_bodyAppend:false,_contentAppend:'',_showEvent:'click',_showEffect:"appear",_showDuration:0.2,_closeOnBlurDelay:4,_enableShowEffect:true,_closeEffect:"fade",_closeEffectDuration:0.3,_enableCloseEffect:true,_closeTimer:null,_enableCloseOnBlur:false,_afterClose:Prototype.emptyFunction,getMonthLocale:function(month){return this._language_month.get(this._language)[month];},getLocaleClose:function(){return this._language_close.get(this._language);},_initCurrentDate:function(){this._df=new DatePickerFormatter(this._dateFormat[0],this._dateFormat[1]);this._hf=new DatePickerFormatter(this._hiddenFormat[0],this._hiddenFormat[1]);this._current_date=$F(this._relative);if(!this._df.match(this._current_date)){this._current_date=this._df.current_date();if(!this._keepFieldEmpty)
$(this._relative).value=this._current_date;}
var a_date=this._df.match(this._current_date);this._current_year=Number(a_date[0]);this._current_mon=Number(a_date[1])-1;this._current_day=Number(a_date[2]);},initialize:function(h_p){this._relative=h_p["relative"];this._hidden=h_p["hidden"];this._time=h_p["time"];this._zindex=(h_p["zindex"])?parseInt(Number(h_p["zindex"])):1;this._setPositionTop=(h_p["setPositionTop"])?parseInt(Number(h_p["setPositionTop"])):0;this._setPositionLeft=(h_p["setPositionLeft"])?parseInt(Number(h_p["setPositionLeft"])):0;if(h_p["language"])this._language=h_p["language"];if(!Object.isUndefined(h_p["keepFieldEmpty"]))this._keepFieldEmpty=h_p["keepFieldEmpty"];if(Object.isFunction(h_p["clickCallback"]))this._clickCallback=h_p["clickCallback"];if(!Object.isUndefined(h_p["leftOffset"]))this._leftOffset=parseInt(h_p["leftOffset"]);if(!Object.isUndefined(h_p["topOffset"]))this._topOffset=parseInt(h_p["topOffset"]);if(!Object.isUndefined(h_p["relativePosition"]))this._relativePosition=h_p["relativePosition"];if(!Object.isUndefined(h_p["showEvent"]))this._showEvent=h_p["showEvent"];if(!Object.isUndefined(h_p["showEffect"]))this._showEffect=h_p["showEffect"];if(!Object.isUndefined(h_p["contentAppend"]))this._contentAppend=h_p["contentAppend"];if(!Object.isUndefined(h_p["enableShowEffect"]))this._enableShowEffect=h_p["enableShowEffect"];if(!Object.isUndefined(h_p["showDuration"]))this._showDuration=h_p["showDuration"];if(!Object.isUndefined(h_p["closeEffect"]))this._closeEffect=h_p["closeEffect"];if(!Object.isUndefined(h_p["enableCloseEffect"]))this._enableCloseEffect=h_p["enableCloseEffect"];if(!Object.isUndefined(h_p["closeEffectDuration"]))this._closeEffectDuration=h_p["closeEffectDuration"];if(Object.isFunction(h_p["afterClose"]))this._afterClose=h_p["afterClose"];if(!Object.isUndefined(h_p["externalControl"]))this._externalControl=h_p["externalControl"];if(!Object.isUndefined(h_p["dateFormat"]))this._dateFormat=h_p["dateFormat"];if(Object.isFunction(h_p["cellCallback"]))this._cellCallback=h_p["cellCallback"];if(h_p["closeOnBlurDelay"])this._closeOnBlurDelay=parseInt(Number(h_p["closeOnBlurDelay"]));if(this._closeOnBlurDelay<2)this._closeOnBlurDelay=2;if(h_p["enableCloseOnBlur"])this._enableCloseOnBlur=true;if(!Object.isUndefined(h_p["disablePastDate"])&&h_p["disablePastDate"])this._disablePastDate=true;if(!Object.isUndefined(h_p["disableFutureDate"]))this._disableFutureDate=(h_p["disableFutureDate"])?true:false;if(!Object.isUndefined(h_p["enableYearBrowse"]))this._enableYearBrowse=true;if(!Object.isUndefined(h_p["wrongFormatMessage"]))this._wrongFormatMessage=h_p["wrongFormatMessage"];if(!Object.isUndefined(h_p["observeScrollingParent"])){this._observeScrollingParent=h_p["observeScrollingParent"];}
this._id_datepicker='datepicker-'+this._relative;this._id_datepicker_prev=this._id_datepicker+'-prev';this._id_datepicker_next=this._id_datepicker+'-next';this._id_datepicker_prev_year=this._id_datepicker_prev+'-year';this._id_datepicker_next_year=this._id_datepicker_next+'-year';this._id_datepicker_hdr=this._id_datepicker+'-header';this._id_datepicker_ftr=this._id_datepicker+'-footer';this._div=new Element('div',{id:this._id_datepicker,className:'datepicker',style:'display: none; z-index:'+this._zindex});this._div.innerHTML='<table cellpadding="0">'+'<thead>'+'<tr>'+
((this._enableYearBrowse)?'<th id="'+this._id_datepicker_prev_year+'" class="btn btn-small">&laquo;</th>':'')+'<th id="'+this._id_datepicker_prev+'" class="btn btn-small">&lsaquo;</th>'+'<th id="'+this._id_datepicker_hdr+'" colspan="'+((this._enableYearBrowse)?3:5)+'" class="btn btn-small"></th>'+'<th id="'+this._id_datepicker_next+'" class="btn btn-small">&rsaquo;</th>'+
((this._enableYearBrowse)?'<th id="'+this._id_datepicker_next_year+'" class="btn btn-small">&raquo;</th>':'')+'</tr>'+'</thead>'+'<tbody id="'+this._id_datepicker+'-tbody"></tbody>'+'<tfoot>'+'<td colspan="7" id="'+this._id_datepicker_ftr+'" class="btn btn-small"></td>'+'</tfoot></table>';$(this._relative).writeAttribute('placeholder',this._dateFormat[0].join(this._dateFormat[1]));Event.observe(this._relative,this._showEvent,this.click.bindAsEventListener(this),false);Event.observe(this._relative,'change',this.updateHidden.bindAsEventListener(this),false);if($(this._time)){Event.observe($(this._time),'change',this.updateHidden.bindAsEventListener(this),false);}
document.observe('dom:loaded',this.load.bindAsEventListener(this),false);if(this._enableCloseOnBlur){Event.observe(this._relative,'blur',function(e){this.updateHidden();this._closeTimer=this.close.bind(this).delay(this._closeOnBlurDelay);}.bindAsEventListener(this));Event.observe(this._div,'click',function(e){if(this._closeTimer){window.clearTimeout(this._closeTimer);this._closeTimer=null;}});}
document.observe('click',function(ev){if(this.visible()&&!ev.findElement('.datepicker')){this.close();}}.bind(this));if(this._relativePosition&&!Object.isUndefined(h_p["observeScrollingParent"])){var $scrollingParent=$(h_p["observeScrollingParent"]);if($scrollingParent){$scrollingParent.on('scroll',function(){if(!this.visible()){return;}
var scrollOffset=Element.cumulativeScrollOffset($(this._relative));var a_pos=Element.cumulativeOffset($(this._relative));var parentScrollPosition=this.getAbsoluteOffsetFromParent($(this._relative));var positionTop=a_pos[1]-scrollOffset[1];var positionLeft=a_pos[0]-scrollOffset[0];if(parentScrollPosition.top>0){positionTop=a_pos[1];}
if(parentScrollPosition.left<0){positionLeft=a_pos[0]-(scrollOffset[0]+parentScrollPosition.left);}
if(positionLeft<($('contentArea').offsetLeft-20)){this.close();return;}
if(positionLeft>($('contentArea').getStyle('width').toInt()+20)){this.close();return;}
this.setPosition(positionTop,positionLeft);}.bind(this));}}},load:function(){if(this._externalControl)
Event.observe(this._externalControl,'click',this.click.bindAsEventListener(this),false);if(this._relativeAppend){if($(this._relative).parentNode){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);$(this._relative).parentNode.appendChild(this._div);}}else{var body=(this._contentAppend)?$(this._contentAppend):document.getElementsByTagName("body").item(0);if(body){this._div.innerHTML=this._wrap_in_iframe(this._div.innerHTML);body.appendChild(this._div);}
if(this._relativePosition){var scrollOffset=Element.cumulativeScrollOffset($(this._relative));var a_pos=Element.cumulativeOffset($(this._relative));this.setPosition(a_pos[1]-scrollOffset[1],a_pos[0]-scrollOffset[0]);}else{if(this._setPositionTop||this._setPositionLeft)
this.setPosition(this._setPositionTop,this._setPositionLeft);}}
this._initCurrentDate();$(this._id_datepicker_ftr).innerHTML=this.getLocaleClose();Event.observe($(this._id_datepicker_prev),'click',this.prevMonth.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next),'click',this.nextMonth.bindAsEventListener(this),false);if(this._enableYearBrowse){Event.observe($(this._id_datepicker_prev_year),'click',this.prevYear.bindAsEventListener(this),false);Event.observe($(this._id_datepicker_next_year),'click',this.nextYear.bindAsEventListener(this),false);}
Event.observe($(this._id_datepicker_ftr),'click',this.close.bindAsEventListener(this),false);},_wrap_in_iframe:function(content){return(Prototype.Browser.IE)?"<div style='height:180px;width:280px;background-color:white;align:left'><iframe width='100%' height='100%' marginwidth='0' marginheight='0' frameborder='0' src='about:blank' style='filter:alpha(Opacity=50);'></iframe><div style='position:absolute;background-color:white;top:2px;left:2px;'>"+content+"</div></div>":content;},visible:function(){return($(this._id_datepicker))?$(this._id_datepicker).visible():false;},getAbsoluteOffsetFromParent:function(el){var _x=0;var _y=0;while(el!==null&&el.offsetParent!==null&&!isNaN(el.offsetLeft)&&!isNaN(el.offsetTop)){el=el.offsetParent;if(typeof getComputedStyle==='function'){valString=getComputedStyle(el,null).getPropertyValue('position');}else{valString=el.currentStyle['position'];}
if(valString==='absolute'){_x=el.offsetLeft-el.scrollLeft+el.clientLeft;_y=el.offsetTop-el.scrollTop+el.clientTop;el=null;}
if(el&&el.tagName.toLowerCase()=='div'&&el.id=='contentBottom'){_x=0;_y=0;el=null;}}
return{top:_y,left:_x};},click:function(){if($(this._id_datepicker)==null)this.load();if(this._relativePosition){var scrollOffset=Element.cumulativeScrollOffset($(this._relative));var a_pos=Element.cumulativeOffset($(this._relative));var parentScrollPosition=this.getAbsoluteOffsetFromParent($(this._relative));var positionTop=a_pos[1]-scrollOffset[1];var positionLeft=a_pos[0]-scrollOffset[0];if(parentScrollPosition.top>0){positionTop=a_pos[1];}
if(parentScrollPosition.left<0){positionLeft=a_pos[0]-(scrollOffset[0]+parentScrollPosition.left);}
this.setPosition(positionTop,positionLeft);}
if(!this.visible()){this._initCurrentDate();this._redrawCalendar();}
eval(this._clickCallback());if(this._enableShowEffect){new Effect.toggle(this._id_datepicker,this._showEffect,{duration:this._showDuration,afterFinish:function(){$(this._id_datepicker).setStyle({opacity:1});}.bind(this)});}else{$(this._id_datepicker).show().setStyle({opacity:1});}
Element.makePositioned($(this._id_datepicker));if(this._closeTimer){window.clearTimeout(this._closeTimer);this._closeTimer=null;}},close:function(){if(this._enableCloseEffect){switch(this._closeEffect){case'puff':new Effect.Puff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'blindUp':new Effect.BlindUp(this._id_datepicker,{duration:this._closeEffectDuration});break;case'dropOut':new Effect.DropOut(this._id_datepicker,{duration:this._closeEffectDuration});break;case'switchOff':new Effect.SwitchOff(this._id_datepicker,{duration:this._closeEffectDuration});break;case'squish':new Effect.Squish(this._id_datepicker,{duration:this._closeEffectDuration});break;case'fold':new Effect.Fold(this._id_datepicker,{duration:this._closeEffectDuration});break;case'shrink':new Effect.Shrink(this._id_datepicker,{duration:this._closeEffectDuration});break;default:new Effect.Fade(this._id_datepicker,{duration:this._closeEffectDuration});break;}}else{$(this._id_datepicker).hide();}
eval(this._afterClose());},updateHidden:function(){var _self=this,date=$F(_self._relative),matchedDate,time='';if(!_self.df)_self._initCurrentDate();if(_self._df){if(date!==''&&date!=='-'){matchedDate=_self._df.match(date);if(matchedDate){if($(_self._time)){time=' '+$F(_self._time);}
$(_self._hidden).setValue(_self._hf.date_to_string(matchedDate[0],matchedDate[1],matchedDate[2],_self._hf.separator)+time);$(_self._relative).setValue(_self._df.date_to_string(matchedDate[0],matchedDate[1],matchedDate[2],_self._df.separator));}else{if(_self._wrongFormatMessage){idoit.Notify.warning(date+': '+_self._wrongFormatMessage,{life:5});}}}
else{$(_self._hidden).setValue('');$(_self._relative).setValue('');}}},setDateFormat:function(format,separator){if(Object.isUndefined(format))
format=this._dateFormat[0];if(Object.isUndefined(separator))
separator=this._dateFormat[1];this._dateFormat=[format,separator];$(this._relative).writeAttribute('placeholder',this._dateFormat[0].join(this._dateFormat[1]));},setHiddenFormat:function(format,separator){if(Object.isUndefined(format))
format=this._dateFormat[0];if(Object.isUndefined(separator))
separator=this._dateFormat[1];this._hiddenFormat=[format,separator];},setPosition:function(t,l){var h_pos={'top':'0px','left':'0px'};if(!Object.isUndefined(t))
h_pos['top']=Number(t)+this._topOffset+'px';if(!Object.isUndefined(l))
h_pos['left']=Number(l)+this._leftOffset+'px';$(this._id_datepicker).setStyle(h_pos);this._isPositionned=true;},_getMonthDays:function(year,month){if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&(month==1))
return 29;return this._daysInMonth[month];},_buildCalendar:function(){var _self=this;var tbody=$(this._id_datepicker+'-tbody');try{while(tbody.hasChildNodes()){tbody.removeChild(tbody.childNodes[0]);}}catch(e){};var trDay=new Element('tr');this._language_day.get(this._language).each(function(item){var td=new Element('td');td.innerHTML=item;td.className='wday';trDay.appendChild(td);});tbody.appendChild(trDay);var a_d=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];var d=new Date(this._current_year,this._current_mon,1,12);var startIndex=(!d.getDay())?6:d.getDay()-1;var nbDaysInMonth=this._getMonthDays(this._current_year,this._current_mon);var daysIndex=1;for(var j=startIndex;j<7;j++){a_d[0][j]={d:daysIndex,m:this._current_mon,y:this._current_year,c:(((daysIndex==this._todayDate.getDate())&&(this._current_mon==this._todayDate.getMonth())&&(this._current_year==this._todayDate.getFullYear()))?'today':null)};daysIndex++;}
var a_prevMY=this._prevMonthYear();var nbDaysInMonthPrev=this._getMonthDays(a_prevMY[1],a_prevMY[0]);for(var j=0;j<startIndex;j++){a_d[0][j]={d:Number(nbDaysInMonthPrev-startIndex+j+1),m:Number(a_prevMY[0]),y:a_prevMY[1],c:'outbound'};}
var switchNextMonth=false;var currentMonth=this._current_mon;var currentYear=this._current_year;for(var i=1;i<6;i++){for(var j=0;j<7;j++){a_d[i][j]={d:daysIndex,m:currentMonth,y:currentYear,c:(switchNextMonth)?'outbound':(((daysIndex==this._todayDate.getDate())&&(this._current_mon==this._todayDate.getMonth())&&(this._current_year==this._todayDate.getFullYear()))?'today':null)};daysIndex++;if(daysIndex>nbDaysInMonth){daysIndex=1;switchNextMonth=true;if(this._current_mon+1>11){currentMonth=0;currentYear+=1;}else{currentMonth+=1;}}}}
for(var i=0;i<6;i++){var tr=new Element('tr');for(var j=0;j<7;j++){var h_ij=a_d[i][j];var td=new Element('td');var id=$A([this._relative,this._df.date_to_string(h_ij["y"],h_ij["m"]+1,h_ij["d"],'-')]).join('-');td.setAttribute('id',id);if(h_ij["c"])
td.className=h_ij["c"];var _curDate=new Date();_curDate.setFullYear(h_ij["y"],h_ij["m"],h_ij["d"]);if(this._disablePastDate||this._disableFutureDate){if(this._disablePastDate){var _res=(_curDate>=this._todayDate)?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}
if(this._disableFutureDate){var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;this._bindCellOnClick(td,true,_res,h_ij["c"]);}}else{this._bindCellOnClick(td,false);}
td.innerHTML=h_ij["d"];tr.appendChild(td);}
tbody.appendChild(tr);}
return tbody;},_bindCellOnClick:function(td,wcompare,compareresult,h_ij_c){var doBind=false;if(wcompare){if(compareresult){doBind=true;}else{td.className=(h_ij_c)?'nclick_outbound':'nclick';}}else{doBind=true;}
if(doBind){var _self=this;td.onclick=function(){$(_self._relative).value=String($(this).readAttribute('id')).replace(_self._relative+'-','').replace(/-/g,_self._df.separator);_self.updateHidden();if(_self._cellCallback)
_self._cellCallback(this);_self.close();};}},_nextMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon+1>11){c_mon=0;c_year+=1;}else{c_mon+=1;}
return[c_mon,c_year];},nextMonth:function(){var a_next=this._nextMonthYear();var _nextMon=a_next[0];var _nextYear=a_next[1];var _curDate=new Date();_curDate.setFullYear(_nextYear,_nextMon,1);var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;if(this._disableFutureDate&&!_res)
return;this._current_mon=_nextMon;this._current_year=_nextYear;this._redrawCalendar();},_prevMonthYear:function(){var c_mon=this._current_mon;var c_year=this._current_year;if(c_mon-1<0){c_mon=11;c_year-=1;}else{c_mon-=1;}
return[c_mon,c_year];},prevMonth:function(){var a_prev=this._prevMonthYear();var _prevMon=a_prev[0];var _prevYear=a_prev[1];var _curDate=new Date();_curDate.setFullYear(_prevYear,_prevMon,1);var _res=(_curDate>=this._todayDate)?true:false;if(this._disablePastDate&&!_res&&(_prevMon!=this._todayDate.getMonth()))
return;this._current_mon=_prevMon;this._current_year=_prevYear;this._redrawCalendar();},_prevYear:function(){var c_mon=this._current_mon;var c_year=(this._current_year-1);return[c_mon,c_year];},prevYear:function(){var a_next=this._prevYear();var _nextMon=a_next[0];var _nextYear=a_next[1];var _curDate=new Date();_curDate.setFullYear(_nextYear,_nextMon,1);var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;if(this._disableFutureDate&&!_res)
return;this._current_mon=_nextMon;this._current_year=_nextYear;this._redrawCalendar();},_nextYear:function(){var c_mon=this._current_mon;var c_year=(this._current_year+1);return[c_mon,c_year];},nextYear:function(){var a_next=this._nextYear();var _nextMon=a_next[0];var _nextYear=a_next[1];var _curDate=new Date();_curDate.setFullYear(_nextYear,_nextMon,1);var _res=(this._todayDate.getTime()+this._oneDayInMs>_curDate.getTime())?true:false;if(this._disableFutureDate&&!_res)
return;this._current_mon=_nextMon;this._current_year=_nextYear;this._redrawCalendar();},_redrawCalendar:function(){this._setLocaleHdr();this._buildCalendar();},_setLocaleHdr:function(){var a_next=this._nextMonthYear();$(this._id_datepicker_next).setAttribute('title',this.getMonthLocale(a_next[0])+' '+a_next[1]);var a_prev=this._prevMonthYear();$(this._id_datepicker_prev).setAttribute('title',this.getMonthLocale(a_prev[0])+' '+a_prev[1]);if(this._enableYearBrowse){var a_next_y=this._nextYear();$(this._id_datepicker_next_year).setAttribute('title',this.getMonthLocale(a_next_y[0])+' '+a_next_y[1]);var a_prev_y=this._prevYear();$(this._id_datepicker_prev_year).setAttribute('title',this.getMonthLocale(a_prev_y[0])+' '+a_prev_y[1]);}
$(this._id_datepicker_hdr).update('&nbsp;&nbsp;&nbsp;'+this.getMonthLocale(this._current_mon)+'&nbsp;'+this._current_year+'&nbsp;&nbsp;&nbsp;');}};"use strict";window.TableComponent=Class.create({initialize:function(prefix,options){this.$table=$(prefix);this.$tableHeader=$(prefix+'-header');this.options={scoped:false,routeParams:{},columnWidth:150,extraScrollbarWidth:10,defaultValueField:'',dragDrop:false,dragDropBoxContent:'%count% object(s)',checkboxes:false,resizeColumns:false,resizeColumnAjaxURL:'',resizeTableAjaxURL:'',columnSizes:[],tableSize:0,order:false,orderColumns:[],currentOrderColumn:'',currentOrderDirection:'',rowClick:false,rowClickUrl:'?objID=%id%',keyboardCommands:false,orderAscendingMessage:'',orderDescendingMessage:'',loadingMessage:'',quickInfoActive:true,quickInfoDelay:0.5,replacerOptions:{},translation:{pager:{prompt:'Jump to the page',nanPage:'Invalid page number',notFound:'Page is not found'},filter:{and:' and '}},autocomplete:{active:0,baseUrl:'',placeholder:'Search...',options:{}},ajaxMethod:'get',ajaxParams:{},directEditMode:0,enableMultiselection:false,replacePlaceholdersLength:1000,};Object.extend(this.options,options||{});this.$context=$(prefix+'-container').up(1);this.replaceTablePlaceholders=new ReplacePlaceholders(this.options.replacerOptions);this.progressTablePlaceholders();this.initBase(prefix);this.subscribe('click','[data-column-role="fit"]',this.fitColumns.bind(this));this.subscribe('click','[data-column-role="reset"]',this.resetTable.bind(this));this.subscribe('change','[data-filter-field="rowsPerPage"]',this.onPerPageChange.bind(this));this.subscribe('change','[data-filter-role="field"]',this.onFieldChange.bind(this));this.subscribe('change','select[data-filter-role="value"],[type=radio][data-filter-role="value"]',this.onFilterChange.bind(this));this.subscribe('keyup','input[data-filter-role="value"]',this.onFilterChange.bind(this));this.subscribe('click','.table-footer .dots',this.onPagerJump.bind(this));this.subscribe('click','.table-footer a',this.onPagerClick.bind(this));this.subscribe('click','[data-filter-role="filter"]',this.loadDataWithFilters.bind(this));this.subscribe('keyup','[data-filter-role="default"]',this.onDefaultFieldChange.bind(this));this.subscribe('click','[data-filter-role="default"]',this.onDefaultFieldClick.bind(this));this.subscribe('click','[data-order-field]',this.onOrderBy.bind(this));this.subscribe('keydown','[data-filter-role="value"], [data-filter-role="default"]',function(e){if(e.keyCode===13){e.preventDefault();e.stopPropagation();this.loadDataWithFilters();}}.bind(this));this.subscribe('click','[data-filter-role="reset"]',this.resetFilters.bind(this));this.subscribe('click','[data-toggle-role="toggle"]',this.toggleFilterExpand.bind(this));if(this.options.enableMultiselection===false){this.subscribe('change','[name="id[]"]',this.onSelectionChanged.bind(this,'[name="id[]"]',$('navbar_item_C__NAVMODE__EDIT')));}
this.subscribe('change','[name="table_ids[]"]',this.onSelectionChanged.bind(this,'[name="table_ids[]"]',$('navbar_item_C__NAVMODE__DUPLICATE')));this.initAutocomplete();if(this.$table){this.$table.removeClassName('is-loading');}
if(this.$context.down('[data-filter-default]')&&!this.options.scoped){setTimeout(this.$context.down('[data-filter-default]').focus.bind(this.$context.down('[data-filter-default]')),0);}
this.onFilterChange();$$('.autocomplete.global-search').invoke('hide');this.subscribe("scroll",'.table-body',this.syncColumnSizes.bind(this));this.$context.removeClassName('is-loading');if(!this.$table||this.$table.clientHeight<this.$context.down('.table-container').clientHeight){this.$context.down('.table-container').setStyle({'min-height':(this.$table?this.$table.clientHeight:50)+150+'px'});}
this.subscribe('click','.empty_value_checkbox',this.emptyValueSubscriber.bind(this));},subscribe:function(event,selector,callback){this.$context.select(selector).forEach(function(e){e.on(event,callback);});},initBase:function(prefix){this.$table=$(prefix);if(!this.$table){return;}
this.$cols=this.$table.down('colgroup').select('col');this.$head=this.$tableHeader.down('thead');this.$body=this.$table.down('tbody');this.$header=this.$head.select('th');this.$dragContainer=new Element('div',{className:'mainTableDragContainer'});this.$dragger=new Element('div',{className:'mainTableDragger hide'});this.$lastClickedCheckbox=null;this.$ghost=null;this.$tableHeader.setStyle({minWidth:(this.$cols.length*this.options.columnWidth+this.options.extraScrollbarWidth)+'px'});this.$table.setStyle({minWidth:this.$cols.length*this.options.columnWidth+'px'});this.subscribe("scroll",'.table-body',function(){this.$context.down('.table-header').scrollLeft=this.$context.down('.table-body').scrollLeft;}.bind(this));if(this.options.resizeColumns&&this.options.resizeColumnAjaxURL){this.prepareColumnDrag();}
if(this.options.dragDrop){this.prepareDragDrop();}
if(this.options.order){this.prepareTableOrdering();}
if(!Object.isArray(this.options.columnSizes)){this.options.columnSizes=[];}
if(!Object.isNumber(this.options.tableSize)){this.options.tableSize=0;}
if(this.options.columnSizes.length===this.$header.length){this.setInitialColumnWidths(this.options.columnSizes);}else{this.resetColumns();}
if(this.options.tableSize>0){this.setInitialTableWidth(this.options.tableSize);}
this.onFilterChange();this.callbackManager=new window.TableComponentCallbackManager(this.$head,this.$body,this.options);this.prepareObserver();if(!this.getCached(this.options.routeParams)){this.cache(this.options.routeParams,this.$context.innerHTML)}},initAutocomplete:function(){var autocomplete=this.options.autocomplete,defaultFilter=this.$context.down('[data-filter-default]'),that=this;if(!autocomplete.active||!defaultFilter){return;}
var cachedBackend=new Autocompleter.Cache(function(searchString,suggest){var parameters={suggestion:1,rand:(new Date()).getTime()};parameters[defaultFilter.name]=defaultFilter?defaultFilter.getValue():'';new Ajax.Request(autocomplete.baseUrl,{method:'get',parameters:parameters,onSuccess:function(response){suggest(response.responseJSON);}});},autocomplete.options),cachedLookup=cachedBackend.lookup.bind(cachedBackend),rnd=Math.floor(Math.random()*9999),el_choices='theChoices'+rnd;$('body').insert(new Element('div',{id:el_choices,className:'autocomplete global-search'}));new Autocompleter.Json(defaultFilter,el_choices,cachedLookup,{frequency:.15,choices:85,searchPlaceHolder:autocomplete.placeholder,updateElement:function(li){var link=li.getAttribute('data-link'),search=li.getAttribute('data-search');if(link){that.redirect(encodeURI(link));this.selectedItem=li;}
if(search=='1'){that.loadDataWithFilters();return true;}}});},buildUrl:function(){var params={},i,j;for(i in arguments){Object.extend(params,arguments[i]);}
return window.location.pathname+'?'+Object.toQueryString(params);},updateContext:function(data){this.$context.html(data,{scripts:{selector:'script[data-autoinitialize]'}});},loadData:function(params,force){var i,cached;for(i in this.options.routeParams){if((force&&i.indexOf('tableFilter[')>-1)||['ajax','only_content','scoped'].in_array(i)){delete this.options.routeParams[i];}}
Object.extend(this.options.routeParams,params);if(!this.options.scoped){window.pushState({},'',this.buildUrl(this.options.routeParams));}
cached=this.getCached(this.options.routeParams);this.$context.addClassName('is-loading');if(cached){this.updateContext(cached);}else{if(this.$table){this.$table.addClassName('is-loading');}
new Ajax.Request(this.buildUrl({call:'category'},this.options.routeParams,{ajax:1,only_content:1,scoped:this.options.scoped?1:0}),{method:this.options.ajaxMethod,parameters:this.options.ajaxParams,onComplete:function(xhr){var data=xhr.responseText.trim();this.cache(this.options.routeParams,data);this.updateContext(data);}.bind(this)});}},getCacheKey:function(params){var defaultParams={page:1};return JSON.stringify(Object.extend(defaultParams,params));},getCached:function(params){var key=this.getCacheKey(params);return window.tableCache&&window.tableCache[key];},cache:function(params,data){var key=this.getCacheKey(params);window.tableCache=window.tableCache||{};window.tableCache[key]=data;},loadDataWithFilters:function(){this.loadData(this.retrieveUrlPartsFiltered({page:1,filtered:1}),true);},retrieveUrlPartsFiltered:function(params){var values=this.$context.select('[data-filter-role="value"]:not([readonly])'),i,input,name,value,filter=params;var emptyCheckboxes=this.$context.select('[data-filter-role="empty"]:checked');for(i=0;i<values.length;++i){input=values[i];if(input){name=input.getAttribute('name');value=input.getValue();if(value===''){continue;}
if(input.tagName==='SELECT'&&value<0){continue;}
if(input.type==='radio'&&!input.checked){continue;}
if(value||this.options.routeParams[name]){filter[name]=value;}}}
for(i=0;i<emptyCheckboxes.length;++i){input=emptyCheckboxes[i];if(input){name=input.getAttribute('target');filter[name]='';}}
return filter;},onPagerJump:function(){var page=prompt(this.options.translation.pager.prompt,'1');page=parseInt(page);if(isNaN(page)){idoit.Notify.warning(this.options.translation.pager.nanPage,{life:5});return;}
if(page<1||page>parseInt(this.options.pages)){idoit.Notify.warning(this.options.translation.pager.notFound.replace('%pages%',this.options.pages),{life:5});return;}
this.loadData({page:page});},onPagerClick:function(e){var $page=e.findElement('a'),page=($page.readAttribute('href').toQueryParams().page||1);e.preventDefault();$page.update(new Element('img',{src:window.dir_images+'axialis/user-interface/loading.svg',className:'animation-rotate'}));this.loadData({page:page});},onFilterChange:function(){var fields=this.$context.select('[data-filter-role="value"]'),emptyCheckboxes=this.$context.select('[data-filter-role="empty"]:checked'),i,input,label,name,value,target,filter=this.$context.down('[data-role="search"]'),operationField=this.$context.down('[name="tableFilter[operation]"]:checked'),operationLabel=operationField?this.$context.down('label[for="'+operationField.getAttribute('id')+'"]'):null,operation=(operationLabel?operationLabel.textContent:this.options.translation.filter.and).trim(),key,re,texts={};if(!filter){return;}
if(this.$body){this.$body.select('.searchResult').invoke('removeClassName','searchResult');}
for(i=0;i<emptyCheckboxes.length;++i){input=emptyCheckboxes[i];if(input){target=input.getAttribute('target');texts[target]={text:input.title,value:''};}}
for(i=0;i<fields.length;++i){input=fields[i];if(input){name=input.getAttribute('name');label=this.$context.down('[for="'+name+'"]');key=name.substring('tableFilter['.length,name.length-1);if(!label||key=='operation'||texts[name]){continue;}
label=label.textContent||label.innerText||label.innerHTML;value=input.getValue();if(input.tagName==='SELECT'){if(value<0){continue;}
value=input.down(':selected')||{};value=value.textContent||value.innerText||value.innerHTML;}
if(value){texts[name]={text:label+' = "'+value+'"',value:input.getValue()};re=value.toLowerCase();this.$context.select('[data-property'+(key=='*'?'':'="'+key+'"')+']').filter(function(cell){return cell.textContent.toLowerCase().indexOf(re)>=0;}).invoke('addClassName','searchResult');}}}
var text=Object.values(texts).map(function(a){return a.text;}).join(' '+operation+' ');filter.parentElement.setStyle({display:text?'block':'none'});filter.setValue(text);},toggleFilterExpand:function(){var filterExpandButton=this.$context.down('[data-toggle-role="toggle"]'),id=filterExpandButton.getAttribute('data-toggle-id'),advancedFilter=this.$context.down('[data-toggle-role="area"][data-toggle-id="'+id+'"]'),toggleClass=advancedFilter&&advancedFilter.getAttribute('data-toggle-class');if(!advancedFilter){return;}
advancedFilter.toggleClassName(toggleClass);if(advancedFilter.hasClassName(toggleClass)){advancedFilter.removeClassName('shadow');filterExpandButton.down('img').writeAttribute('src',window.dir_images+'axialis/user-interface/angle-down-small.svg');}else{advancedFilter.addClassName('shadow');filterExpandButton.down('img').writeAttribute('src',window.dir_images+'axialis/user-interface/angle-up-small.svg');advancedFilter.down('input').focus();}},onSelectionChanged:function(selection,element){var isMultiple=$(this.$table).select(selection+':checked').length>1;if(element){if(element.tagName==='BUTTON'){if(isMultiple){element.disable();}else{element.enable();}}
element.toggleClassName('non-clickable',isMultiple).toggleClassName('navbar_item_inactive',isMultiple);}},onFieldChange:function(e){var field=e.findElement('[data-filter-role="field"]'),name=field.getAttribute('data-filter-field'),params={};try{params=JSON.parse(field.getAttribute('data-filter-params'));}catch(e){}
params[name]=e.target.value;this.loadData(params);},onDefaultFieldChange:function(e){var input=e.findElement('input'),name=input.name;this.$context.select('[name="'+name+'"]').forEach(function(a){if(a!=input){a.setValue(input.getValue());}});},onDefaultFieldClick:function(){if(this.$context.down('[data-filter-default][readonly]')){this.toggleFilterExpand();}},onOrderBy:function(e){var field=e.findElement('[data-order-field]').getAttribute('data-order-field'),direction=e.findElement('[data-order-direction]').getAttribute('data-order-direction');direction=direction=='ASC'?'DESC':'ASC';this.options.currentOrderColumn=field;this.options.currentOrderDirection=direction;this.loadData({orderBy:field,orderByDir:direction});},resetFilters:function(){this.$context.select('input[data-filter-role="value"]').invoke('setValue','');this.$context.select('select[data-filter-role="value"]').invoke('setValue','-1');this.$context.select('[data-filter-role="empty"]:checked').forEach(function(element){element.checked=false;});this.loadDataWithFilters();},setInitialColumnWidths:function(columnSizes){for(var i=0;i<columnSizes.length;++i){this.setColumnWidth(i,columnSizes[i]);}},setInitialTableWidth:function(tableSize){this.setTableWidth(tableSize);},progressTablePlaceholders:function(){if(this.$table){var $options=this.options;var $replacePlaceholders=this.replaceTablePlaceholders;this.$table.select('td').forEach(function(td){var innerHtml=td.innerHTML;if(innerHtml.length<$options.replacePlaceholdersLength){td.html($replacePlaceholders.replacePlaceholders(innerHtml));}});this.$table.select('td[data-property="isys_cmdb_dao_category_g_location__location_path"] .dynamic-replacement.quickinfo').forEach(function(a){a.html(a.innerHTML);});}},prepareColumnDrag:function(){var that=this,i;for(i=that.options.checkboxes?1:0;i<that.$header.length;++i){that.$dragContainer.insert(new Element('div',{className:'handle'}).update(new Element('div')).store('th',that.$header[i]));}
that.$tableHeader.insert({before:that.$dragContainer,after:that.$dragger});},prepareDragDrop:function(){this.$ghost=$$('.mainTableDragGhost')[0];if(!this.$ghost){this.$ghost=new Element('div',{className:'mainTableDragGhost box-white'}).hide();$('body').insert(this.$ghost);}
this.$ghost.setAttribute('data-table-id',this.$table.id);},prepareTableOrdering:function(){var that=this,i,j;for(i=0;i<that.$header.length;++i){var currentOrder;j=i-(this.options.checkboxes?1:0);if(!that.$header[i].down('.sort-arrow')){continue;}
if(that.options.orderColumns.hasOwnProperty(j)){currentOrder=(that.options.orderColumns[j]==that.options.currentOrderColumn);that.$header[i].addClassName((currentOrder?'ordered':'')).down('.overflowable').addClassName('mouse-pointer').writeAttribute({'data-order-field':that.options.orderColumns[j],'data-order-direction':(currentOrder?that.options.currentOrderDirection:'ASC')}).next('.sort-arrow').writeAttribute({src:window.dir_images+'axialis/user-interface/arrow-'+((currentOrder&&that.options.currentOrderDirection=='DESC')?'down':'up')+'.svg',className:'sort-arrow mouse-pointer',title:(currentOrder&&that.options.currentOrderDirection=='DESC'?that.options.orderAscendingMessage:that.options.orderDescendingMessage),'data-order-field':that.options.orderColumns[j],'data-order-direction':(currentOrder?that.options.currentOrderDirection:'ASC')});}}},isValidUrl:function(url){if(/^[\w_\d]+\.php/.test(url)||/^(\/[^\?\/\s]+)*\/?\?/.test(url)){return true;}
try{new URL(url);return true;}catch(e){}
return false;},redirect:function(url){if(url==='#'){return;}
if(this.isValidUrl(url)){this.$context.addClassName('is-loading');document.location.href=encodeURI(url);}else{eval(url);}},prepareObserver:function(){var that=this,i;Event.observe(window,'resize',that.responsive.bind(that));that.$table.on('remove:entriesByIds',function(ev){if(!Object.isArray(ev.memo.ids)){return;}
that.$body.select('tr[data-id]').filter(function($tr){return ev.memo.ids.in_array($tr.readAttribute('data-id'));}).invoke('remove');});if(that.options.keyboardCommands){document.on('keydown',function(ev){var $currentRow=that.$body.down('tr.highlightLine'),$checkbox;if($currentRow){$checkbox=$currentRow.down('.mainTableCheckbox input');}
if(!['input','textarea','select','a','button'].in_array(document.activeElement.tagName.toLowerCase())){if([13,32,38,40].in_array(ev.keyCode)){ev.preventDefault();}
switch(ev.keyCode){case 38:if($currentRow.previous('tr')){$currentRow.removeClassName('highlightLine').previous('tr').addClassName('highlightLine');}
break;case 40:if($currentRow.next('tr')){$currentRow.removeClassName('highlightLine').next('tr').addClassName('highlightLine');}
break;case 32:if(that.$lastClickedCheckbox!==null&&window.keyPressedShift){that._selectRange($checkbox,that.$lastClickedCheckbox).invoke('setValue',$checkbox.checked?1:0).invoke('simulate','change');}
$checkbox.simulate('click');break;case 13:$checkbox.setValue('1').simulate('click');$('navbar_item_C__NAVMODE__EDIT').simulate('click');break;}}});if(that.$body.down('tr')){that.$body.down('tr').addClassName('highlightLine');}}
if(that.options.rowClick){that.$body.addClassName('mouse-pointer');that.$body.on('click','tr',function(ev){var $tr=ev.findElement('tr'),$td=ev.findElement('td'),$trLink=$tr.getAttribute('data-link'),$linkTag;$linkTag=$td.down('a,button,select');if(that.options.checkboxes&&$tr.down('td')===$td){return;}else if(that.options.directEditMode==1){$tr.down('input').setValue(1);ev.preventDefault();ev.stopPropagation();if($('navbar_item_C__NAVMODE__EDIT')){$('navbar_item_C__NAVMODE__EDIT').simulate('click');}else if(that.options.rowClickUrl){that.redirect(that.options.rowClickUrl.replace('%id%',$tr.readAttribute('data-id')));}
return;}else if($linkTag){if(!$linkTag.readAttribute('data-object-id')){return;}}else if($trLink){that.redirect($trLink);return;}
if(that.options.rowClickUrl){that.redirect(that.options.rowClickUrl.replace('%id%',$tr.readAttribute('data-id')));}});}
if(that.options.checkboxes){that.$head.on('click','label.mainTableCheckbox input',function(ev){var $checkbox=ev.findElement('input');that.$body.select('label.mainTableCheckbox input').invoke('setValue',$checkbox.checked?1:0).invoke('simulate','change');that.$lastClickedCheckbox=null;});that.$body.on('click','label.mainTableCheckbox input',function(ev){var $checkbox=ev.findElement('input');if(that.$lastClickedCheckbox!==null&&window.keyPressedShift){that._selectRange($checkbox,that.$lastClickedCheckbox).invoke('setValue',$checkbox.checked?1:0).invoke('simulate','change');}
that.$lastClickedCheckbox=$checkbox;});that.$body.on('change','label.mainTableCheckbox input',function(ev){var $checkbox=ev.findElement('input');$checkbox.up('tr')[$checkbox.checked?'addClassName':'removeClassName']('tr-selected');});if(that.options.keyboardCommands){that.$body.on('mouseup','input',function(ev){ev.preventDefault();ev.findElement('input').blur();});}}
if(that.options.resizeColumns&&that.options.resizeColumnAjaxURL){var $handles=that.$dragContainer.select('.handle');for(i=0;i<$handles.length-1;++i){if(!$handles.hasOwnProperty(i)||!$handles[i]){continue;}
new Draggable($handles[i],{constraint:'horizontal',onStart:that._columnDragStart.bind(that),onDrag:that._columnDrag.bind(that),onEnd:that._columnDragEnd.bind(that)});}}
if(this.options.dragDrop){var $tr=that.$body.select('tr');for(i in $tr){if(!$tr.hasOwnProperty(i)){continue;}
new Draggable($tr[i],{handle:$tr[i].down('.drag-handle'),revert:true,ghosting:true,zindex:3,onStart:that._rowDragStart.bind(that),onDrag:that._rowDrag.bind(that),onEnd:that._rowDragEnd.bind(that)});}}
if(this.options.quickInfoActive){var $quickinfo=this.$body.select('.quickinfo');for(i in $quickinfo){if(!$quickinfo.hasOwnProperty(i)){continue;}
new Tip($quickinfo[i],'',{ajax:{url:window.www_dir+'?ajax=1&call=quick_info&objID='+$quickinfo[i].readAttribute('data-object-id')},delay:this.options.quickInfoDelay,className:'objectinfo'});}}},_selectRange:function($checkboxA,$checkboxB){var inRange=false;return this.$body.select('label.mainTableCheckbox input').filter(function($checkbox){if(!inRange&&$checkbox!==$checkboxA&&$checkbox!==$checkboxB){return false;}else if($checkbox===$checkboxA||$checkbox===$checkboxB){inRange=!inRange;return true;}else if(inRange){return true;}})},_columnDragStart:function(drag){var that=this,$handle=drag.element,eOffset=$handle.viewportOffset(),pOffset=that.$table.viewportOffset(),offset=eOffset.relativeTo(pOffset);that.$dragger.removeClassName('hide').setStyle({position:'absolute',top:0,left:(6+offset.left)+'px',height:that.$tableHeader.getHeight()+that.$table.getHeight()+'px'});that.$table.store('leftOriginWidth',$handle.retrieve('th').getWidth()).store('rightOriginWidth',$handle.retrieve('th').next('th').getWidth());},_columnDrag:function(drag){var that=this,scrollOffset=this.$context.down('.table-body').scrollLeft,$handle=drag.element,$th=$handle.retrieve('th'),$thNext=$th.next('th'),left=parseInt($handle.getStyle('left'))+scrollOffset,delta;if(left<30||$th.positionedOffset().left>(left-30)){return;}
if(left>($thNext.positionedOffset().left+$thNext.getWidth()-30)){return;}
delta=(left-$th.positionedOffset().left);that.$table.store('delta',parseInt(delta));var eOffset=$handle.viewportOffset(),pOffset=that.$table.viewportOffset(),offset=eOffset.relativeTo(pOffset);that.$dragger.setStyle({left:(6+offset.left-scrollOffset)+'px'});},_columnDragEnd:function(drag){var that=this,$drag=drag.element;that._setColumnWidth(parseInt(that.$header.indexOf($drag.retrieve('th'))));that.$dragger.addClassName('hide');$drag.setStyle({zIndex:100});delay(function(){that.saveColumnWidths();},1000,'table.save-columns');},_rowDragStart:function(drag){var draggedIDs,that=this;drag.element.addClassName('draggable').addClassName('hide').previous().down('label.mainTableCheckbox input').setValue(1);drag.element.insert({before:new Element('tr',{className:'dummy'})});drag.element.store('wasChecked',drag.element.down('label.mainTableCheckbox input').checked).down('label.mainTableCheckbox input').setValue(1);draggedIDs=that.$body.select('label.mainTableCheckbox input:checked').invoke('getValue').uniq();that.$ghost.writeAttribute('data-ids',draggedIDs.join()).update(this.options.dragDropBoxContent.replace('%count%',draggedIDs.length)).appear({duration:0.5});},_rowDrag:function(){this.$ghost.setStyle({left:(12+window.mouseX)+'px',top:window.mouseY+'px'});},_rowDragEnd:function(drag){drag.element.removeClassName('draggable').removeClassName('hide').previous('.dummy').remove();if(!drag.element.retrieve('wasChecked')){drag.element.down('label.mainTableCheckbox input').setValue(0);}
this.$ghost.fade({duration:0.5});},saveColumnWidths:function(){this.options.columnSizes=this.$cols.invoke('getStyle','width');new Ajax.Request(this.options.resizeColumnAjaxURL,{parameters:{columns:Object.toJSON(this.options.columnSizes)},onSuccess:function(xhr){var json=xhr.responseJSON;if(!json.success){idoit.Notify.error(json.message,{sticky:true});}}});},saveTableWidth:function(){this.options.tableSize=this.$table.getWidth();new Ajax.Request(this.options.resizeTableAjaxURL,{parameters:{table:Object.toJSON(this.options.tableSize)},onSuccess:function(xhr){var json=xhr.responseJSON;if(!json.success){idoit.Notify.error(json.message,{sticky:true});}}});},setColumnWidth:function(index,width){var col=this.$cols[index],style={width:width};if(col){col.setStyle(style);this.syncColumnSizes();}},setTableWidth:function(width){var table=this.$table,tableHeader=this.$tableHeader,style={minWidth:width+'px'};styleHeader={minWidth:width+this.options.extraScrollbarWidth+'px'};if(table){table.setStyle(style);}
if(tableHeader){tableHeader.setStyle(styleHeader);}},syncColumnSizes:function(){if(this._syncColumnsTimeout){clearTimeout(this._syncColumnsTimeout);}
this._syncColumnsTimeout=setTimeout(function(){var td,handle,headerCol,left,i,offset=this.$context.down('.table-body').scrollLeft,width=this.$context.getWidth(),position;for(i=0;i<this.$cols.length;++i){td=this.$body.down('tr td:nth('+i+')');handle=this.$dragContainer.down('.handle:nth('+(i-1)+')');left=td.positionedOffset().left+td.getWidth();headerCol=this.$tableHeader.down('col:nth('+i+')');headerCol.setStyle({width:td.getWidth()+'px'});if(handle){position=left-6-offset;handle.setStyle({left:position+'px',display:position>width?'none':'block'});}}}.bind(this),0);},_setColumnWidth:function(index){var leftOriginWidth=this.$table.retrieve('leftOriginWidth'),rightWidth=this.$table.retrieve('rightOriginWidth'),delta=this.$table.retrieve('delta'),sumWidth=(leftOriginWidth+rightWidth);this.setColumnWidth(index,delta+'px');this.setColumnWidth(index+1,(sumWidth-delta)+'px');this.$table.store('leftOriginWidth',null).store('rightOriginWidth',null).store('delta',null);this.syncColumnSizes();},onPerPageChange:function(e){var element=e.target.up('[data-filter-params]'),value=e.target.value,name=element.getAttribute('data-filter-field'),params={};if(value>=1000&&!window.confirm(this.options.translation.pager.tooMuchPerPage)){e.target.setValue(this.options.routeParams.rowsPerPage||50);e.preventDefault();e.stopPropagation();return;}
try{params=JSON.parse(element.getAttribute('data-filter-params'));}catch(e){}
params[name]=value;this.loadData(params);},fitColumns:function(){this.$table.setStyle({minWidth:'100%'}).setStyle({minWidth:this.$table.offsetWidth+'px'});this.$tableHeader.setStyle({minWidth:this.$table.offsetWidth+this.options.extraScrollbarWidth+'px'});this.resetColumns();this.saveTableWidth();},resetColumns:function(){var cols=this.$cols.length;if(this.options.checkboxes){--cols;}
for(var i=0;i<this.$cols.length;++i){this.setColumnWidth(i,(100 / cols)+'%');}
if(this.options.checkboxes){this.setColumnWidth(0,'40px');}
if(this.options.resizeColumns&&this.options.resizeColumnAjaxURL){this.saveColumnWidths();}
this.syncColumnSizes();},resetTable:function(){this.resetColumns();this.$tableHeader.setStyle({minWidth:(this.$cols.length*this.options.columnWidth+this.options.extraScrollbarWidth)+'px'});this.$table.setStyle({minWidth:this.$cols.length*this.options.columnWidth+'px'});if(this.options.resizeTableAjaxURL){new Ajax.Request(this.options.resizeTableAjaxURL,{parameters:{table:Object.toJSON(0)},onSuccess:function(xhr){var json=xhr.responseJSON;if(!json.success){idoit.Notify.error(json.message,{sticky:true});}}});}},responsive:function(){this.syncColumnSizes();},emptyValueSubscriber:function(e){var targetElement=e.findElement('input').up('td').previous().down('.input');switch(targetElement.type){case"select-one":this.toggleSelectorEmptyValue(targetElement,e.findElement('input'));break;case"text":this.toggleTextEmptyValue(targetElement,e.findElement('input'));break;default:break;}
this.onFilterChange();},toggleSelectorEmptyValue:function(element,checkbox){if(checkbox.checked){element.disable();element.setValue('-');}else{element.enable();element.setValue(-1);}},toggleTextEmptyValue:function(element,checkbox){if(checkbox.checked){element.disable();element.setValue(checkbox.getAttribute('text'));}else{element.enable();element.setValue('');}}});window.ReplacePlaceholders=Class.create({initialize:function(options){var that=this;that.options={memoryUnit:false,currencyUnit:'€',currencySeparator:'.',currencyDecimalSeparator:',',linkObjects:true,linkEmailAddresses:true,};that.callbacks={mem:function(value,unit){if(!isFinite(value)||value<=0){return'-';}
var memoryFactors={B:8,KB:1024,MB:1048576,GB:1073741824,TB:1099511627776},factor=memoryFactors[unit],outputUnit=unit;if(memoryFactors[that.options.memoryUnit]){factor=memoryFactors[that.options.memoryUnit];outputUnit=that.options.memoryUnit;}
return((Math.round((value / factor*100))/ 100)+' '+outputUnit).replace('.',that.options.currencyDecimalSeparator);},currency:function(value){if(!isFinite(value)||value<=0){return'-';}
var rawValue=(Math.round(value*100).floor()),roundValue=rawValue / 100,checkValue=roundValue.floor()+'',newValue=roundValue.toString().replace('.',that.options.currencyDecimalSeparator);if(checkValue.length>3){var $replaceValue=checkValue.replace(/\B(?=(\d{3})+(?!\d))/g,that.options.currencySeparator);newValue=newValue.replace(checkValue,$replaceValue);}
return newValue+' '+that.options.currencyUnit;}};Object.extend(that.options,options||{});},replacePlaceholdersInCell:function(html){var that=this;html=html.replace(/[\w- ]+ \{1\}/g,'<img class="vam" src="'+window.dir_images+'axialis/construction/house-4.svg">');html=html.replace(/([^\{\>]+) \{([0-9]+)\}/g,(this.options.linkObjects?' <a class="dynamic-replacement quickinfo" href="?objID=$2" data-object-id="$2">$1</a>':'$1'));html=html.replace(/\{([a-z]*)\,([0-9a-zA-Z\.]*)\,([0-9a-zA-Z\.]*)\}/g,function(match,param1,param2,param3){if(that.callbacks.hasOwnProperty(param1)){return that.callbacks[param1](param2,param3);}
return match;});if(this.options.linkEmailAddresses){var matches=html.match(/((([^<>()\[\]\.,;\s@\"]+(\.[^<>()\[\]\.,;\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,}))/gi);if(matches){matches=matches.filter(function(match){return match.indexOf('://')===-1;});if(matches.length>0){try{var element=(new DOMParser()).parseFromString(html,'text/html').body.firstChild;element.addClassName('dynamic-replacement email-marker');return element.outerHTML;}catch(e){}}}}
return html.replace(/\{(#[0-9a-fA-F]{3,6})\}/g,'<div class="dynamic-replacement cmdb-marker" style="background-color: $1;"></div>');},replacePlaceholders:function(html){var that=this;html=html.replace(/[\w- ]+ \{1\}/g,'<img class="vam" src="'+window.dir_images+'axialis/construction/house-4.svg">');html=html.replace(/([^\{\>]+) \{([0-9]+)\}/g,(this.options.linkObjects?' <a class="dynamic-replacement quickinfo" href="?objID=$2" data-object-id="$2">$1</a>':'$1'));html=html.replace(/\{([a-z]*)\,([0-9a-zA-Z\.]*)\,([0-9a-zA-Z\.]*)\}/g,function(match,param1,param2,param3){if(that.callbacks.hasOwnProperty(param1)){return that.callbacks[param1](param2,param3);}
return match;});if(this.options.linkEmailAddresses){html=html.replace(/((([^<>()\[\]\.,;\s@\"]+(\.[^<>()\[\]\.,;\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,}))/gi,function(match){if(match.indexOf('://')>0){return match;}
return'<a class="dynamic-replacement email-marker" href="mailto:'+match+'">'+match+'</a>';});}
return html.replace(/\{(#[0-9a-fA-F]{3,6})\}/g,'<div class="dynamic-replacement cmdb-marker" style="background-color: $1;"></div>');}});TableOrderer.prototype.addTableObserver=function(){var that=this,tid=this.table.id;this.table.select('th').invoke('observe','click',this.thClickbfx).invoke('observe','mouseover',this.thOverbfx).invoke('observe','mouseout',this.thOutbfx);this.table.select('tr.data').invoke('observe','click',this.trClick.bindAsEventListener(this)).invoke('observe','mouseover',this.trOver.bindAsEventListener(this)).invoke('observe','mouseout',this.trOut.bindAsEventListener(this));if($(tid+'-add_all')){$(tid+'-add_all').on('click',function(ev){ev.stopPropagation();ev.preventDefault();that.addAll();});}
if($(tid+'-add_page')){$(tid+'-add_page').on('click',function(ev){ev.stopPropagation();ev.preventDefault();that.addPage();});}};TableOrderer.prototype.addAll=function(){var i,data=this.cache||this.data;if(data){for(i in data){if(data.hasOwnProperty(i)&&data[i].hasOwnProperty('__checkbox__')){browserPreselection.select(data[i].__checkbox__);}}
this.updateTable();}};TableOrderer.prototype.addPage=function(){var $buttons=this.table.select('button[onclick*="browserPreselection.select"]');if($buttons.length){$buttons.invoke('simulate','click');}
this.updateTable();};TableOrderer.prototype.orderRule=function(s){var dateRE=/^(\d{2})[\/\.\- ](\d{2})[\/\.\- ](\d{4}|\d{2})/;var exp=new RegExp(dateRE);if(exp.test(s)){s=this.options.dateFormat=='d'?s.replace(dateRE,'$3$2$1'):s.replace(dateRE,'$3$1$2');}
return s;};TableOrderer.prototype.createPager=function(){$(this.table.id+'-pager').insert(new Element('button',{id:this.table.id+'-page-first',type:'button',className:'btn btn-secondary mr5',title:this.msgs.paginationFirst,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/triangle-left.svg',alt:''}))).insert(new Element('button',{id:this.table.id+'-page-prev',type:'button',className:'btn btn-secondary mr5',title:this.msgs.paginationPrev,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/angle-left-small.svg',alt:''}))).insert('<span id="'+this.table.id+'-page-current'+'" class="currentpage">'+this.tools.page+'</span>').insert(new Element('button',{id:this.table.id+'-page-next',type:'button',className:'btn btn-secondary ml5',title:this.msgs.paginationNext,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/angle-right-small.svg',alt:''}))).insert(new Element('button',{id:this.table.id+'-page-last',type:'button',className:'btn btn-secondary ml5',title:this.msgs.paginationLast,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/triangle-right.svg',alt:''}))).insert(this.msgs.paginationOf+' <span id="'+this.table.id+'-page-total'+'" class="totalpages">'+this.tools.pages+'</span> '+this.msgs.paginationPages);};TableOrderer.prototype.trClick=function(e){};TableOrderer.prototype.createFirstRow=function(obj){var row='<thead><tr>';this.tableColumnsName.each(function(i){if(i=='__checkbox__'){var all_button='';if(this.options.multiselection&&!this.options.secondSelection&&!this.options.secondSelectionExists){all_button='<button type="button" id="'+this.table.id+'-add_all" class="btn btn-small mr5" title="'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__ADD_ALL_BY_FILTER')+'">'+'<img src="'+window.dir_images+'axialis/basic/symbol-add.svg" alt="" /><span>'+idoit.Translate.get('LC__UNIVERSAL__ALL')+'</span>'+'</button>'+'<button type="button" id="'+this.table.id+'-add_page" class="btn btn-small" title="'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__ADD_ALL_ON_PAGE')+'">'+'<img src="'+window.dir_images+'axialis/basic/symbol-add.svg" alt="" /><span>'+idoit.Translate.get('LC__UNIVERSAL__PAGE')+'</span>'+'</button>';}
row+='<th id="'+this.table.id+'-id" style="width:80px; text-align:center;">'+all_button+'</th>';}else{row+='<th id="'+this.table.id+'-'+i+'">'+i+'</th>';}}.bind(this));row+='</tr></thead>';return row;};TableOrderer.prototype.updateTable=function(){this.table=$('data-grid-'+this.element);$(this.table.id).update();this.createRows();this.addTableObserver();this.makeUnsort();if(this.options.colgroup)this.table.insert({top:this.options.colgroup});};TableOrderer.prototype.radioButton=function(values,checked){var id=parseInt(values[0]);if(!checked&&(this.options.firstSelection||false)&&(this.options.secondSelectionExists||false)&&Object.isArray(window.browserParentPreselection)){checked=(window.browserParentPreselection.indexOf(id)>=0);}
return'<input type="radio" name="listSelection" '+(checked?'checked="checked" ':' ')+'onclick="'+this.options.objectSelectionCallback+'('+id+');" />';};TableOrderer.prototype.addButton=function(values,view){if((this.options.multiselection&&!this.options.secondSelectionExists)||(this.options.multiselection&&this.options.secondSelectionExists&&view==='r')){var func_string="browserPreselection.select("+parseInt(values[0])+");"+"this.up().update(window.browserList.removeButton("+parseInt(values[0])+", '"+view+"'));";return new Element('button',{type:'button',className:'btn btn-small btn-block',onClick:func_string}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-add.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__ADD')));}else{return this.radioButton(values,false);}};TableOrderer.prototype.removeButton=function(id,view){if((this.options.multiselection&&!this.options.secondSelectionExists)||(this.options.multiselection&&this.options.secondSelectionExists&&view==='r')){var func_string="browserPreselection.remove("+parseInt(id)+");"+"if (this.up()) {this.up().update(window.browserList.addButton("+parseInt(id)+", '"+view+"'));}";return new Element('button',{type:'button',className:'btn btn-small btn-block',onclick:func_string}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-cancel.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__REMOVE')));}
else{return this.radioButton(id,true);}};TableOrderer.prototype.createRow=function(obj,index){var values=Object.values(obj),tmpClassName,tmpContent;var tr=new Element('tr',{'class':'data line'+(index%2),id:this.table.id+'-'+index}).writeAttribute('data-objectid',values[0]);this.tableColumnsName.each(function(s,index){tmpClassName='';if(s=='__checkbox__'){if(!browserPreselection.exists(values[0])){tmpContent=this.addButton(values,'l');}else{tmpContent=this.removeButton(values,'l');}
tmpClassName=this.table.id+'-column-checkbox center';}else{tmpContent=values[index];if(index===1){tmpContent+='<span id="obj-browser-quickinfo-'+values[0]+'" class="fr quickinfo" data-obj-id="'+values[0]+'"><img src="'+window.dir_images+'axialis/basic/button-info.svg" class="vam" /></span>';}}
tr.insert(new Element('td',{className:tmpClassName}).update(tmpContent));}.bind(this));if(Prototype.Browser.IE&&tr.outerHTML){return tr.outerHTML;}else{return tr;}};TableOrderer.prototype.createFilter=function(){var option='';this.tableColumnsName.each(function(i){if(i!='__checkbox__'){option+='\t<option value="'+i+'">'+i.replace(/(_)/g,' ')+'</option>\n';}});$(this.table.id+'-options').insert({bottom:this.msgs.filterLabel}).insert({bottom:'<select id="'+this.table.id+'-filter-column" class="input input-mini">'+option+'</select>'}).insert({bottom:new Element('input',{id:this.table.id+'-filter-data',className:'input input-mini'})});this.tools.filterCol=$F(this.table.id+'-filter-column');this.tools.filterData=$F(this.table.id+'-filter-data');};TableOrderer.prototype.thClick=function(e){if((this.table.id+'-id')==(e.element().id)){return;}
this.defineOrderField(e);this.defineOrder();this.orderData(this.orderField);if(this.order=='desc'){this.cache=this.cache.reverse();}
this.updateTable();};if(!Lists)var Lists={};Lists.Objects=Class.create(TableOrderer,{initialize:function(element,options){this.element=element;this.options=options;this.replaceTablePlaceholders=new ReplacePlaceholders();this.options=Object.extend({data:false,url:false,allowMultiselect:true,unsortedColumn:[],dateFormat:'d',filter:false,pageCount:5,paginate:false,search:false,classPrefix:'mainTable',draggable:false,checkboxes:true,checkedBoxes:[],instanceName:'',max_pages:0,ajax_pager:false,ajax_pager_url:'',ajax_pager_preload:10,tr_click:true,ndo_state_url:'',ndo_state_field:'',livestatus_state_url:'',livestatus_state_field:'',order_direction:'',order_field:'',filter_save_url:''},options||{});this.tools={page:1,pages:1,filterCol:'',filterData:'',searchData:'',requested_offsets:[]};this.msgs={loading:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__LOADING'),emptyResults:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__EMPTY_RESULTS'),errorURL:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__ERROR_URL'),errorData:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__ERROR_DATA'),searchLabel:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__SEARCH_LABEL'),filterLabel:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__FILTER_LABEL'),paginationOf:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__PAGINATEN_OF'),paginationPages:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__PAGINATEN_PAGES'),paginationFirst:idoit.Translate.get('LC__UNIVERSAL__PAGER__FIRST_PAGE'),paginationPrev:idoit.Translate.get('LC__UNIVERSAL__PAGER__PREVIOUS_PAGE'),paginationNext:idoit.Translate.get('LC__UNIVERSAL__PAGER__NEXT_PAGE'),paginationLast:idoit.Translate.get('LC__UNIVERSAL__PAGER__LAST_PAGE')};this.cache=[];this.isCached=false;this.container=$(element);this.orderField=false;this.order='asc';this.thClickbfx=this.thClick.bindAsEventListener(this);this.thOverbfx=this.thOver.bindAsEventListener(this);this.thOutbfx=this.thOut.bindAsEventListener(this);this.ndo_loaded=[];this.livestatus_loaded=[];this.setData();},createTable:function(){this.container.update();this.container.insert({top:'<table cellspacing="0" cellpadding="0" id="data-grid-'+this.element+'" class="'+this.options.classPrefix+' mainTableHover"></table>'});this.table=$('data-grid-'+this.element);this.createTools();this.createRows();this.addToolsObserver();this.addTableObserver();this.makeUnsort();this.updateNDO();this.updateLivestatus();if(this.options.filter){$(this.table.id+'-filter-data').focus();}
if(this.options.tr_click){this.table.addClassName('mouse-pointer');}},addToolsObserver:function($super){var instance=this;$super();if(this.options.filter&&!this.options.filter_save_url.empty()){$(this.table.id+'-filter-data').on('change',this.filterData.bindAsEventListener(this));$(this.table.id+'-filter-data').on('blur',function(){instance.save_filter_to_session();});$(this.table.id+'-filter-column').on('change',function(){instance.save_filter_to_session();});}},save_filter_to_session:function(){new Ajax.Request(this.options.filter_save_url,{parameters:{field:$F(this.table.id+'-filter-column'),value:$F(this.table.id+'-filter-data')},onComplete:function(){}});},createRow:function(obj,index){var values=Object.values(obj);var tr=new Element('tr',{id:this.table.id+'-'+index,className:'data','data-objectid':values[0],'data-listindex':index});var checkedStr=(this.options.checkedBoxes.indexOf(parseInt(values[0]))!==-1)?"checked='checked'":'';this.tableColumnsName.each(function(s,index){if(s=='__id__'&&this.options.checkboxes){var dragger='';if(this.options.draggable){dragger='<span class="drag-handle"></span>';}
tr.insert(new Element('td',{'className':this.table.id+'-column-'+s,'style':'width:30px; text-align:center;'}).update(dragger+'<input class="checkbox obj-selector" type="checkbox" value="'+values[index]+'" name="id[]" title="'+values[index]+'" '+checkedStr+'/>'));}else{tr.insert(new Element('td').update(values[index]));}}.bind(this));return tr;},createFirstRow:function(obj){let row='<thead><tr class="no-drag">';let spanElement='',icon='',orderIcon='';this.tableColumnsName.each(function(i){if(i=='__id__'&&this.options.checkboxes){var checkbox_style='';if(this.options.draggable){checkbox_style='style="margin-left:12px;"';}
row+='<th id="'+this.table.id+'-'+i+'" class="no-sort" style="text-align:center;">'+'<input class="no-sort" id="complete-list-selector" type="checkbox" '+checkbox_style+' /></th>';}else{if(i=='__id__'){i='ID';}
spanElement='<span className="overflowable" data-order-direction="'+this.order+'">'+i+'</span>';icon='axialis/user-interface/arrow-'+(this.order=='asc'?'up':'down')+'.svg';orderIcon='<img src="'+window.dir_images+icon+'" class="sort-arrow mouse-pointer" data-order-direction="'+this.order+'">';row+='<th id="'+this.table.id+'-'+i+'">'+spanElement+orderIcon+'</th>';}}.bind(this));row+='</tr></thead>';return row;},changePage:function(ev){var page=ev.element().value;if(page<=this.tools.pages&&page>0){this.tools.page=page;if(this.options.ajax_pager){this.load_data();}
this.updateTable();}else{if(page!=''){this.updatePager();}}
delete page;},load_data:function(){var offset=0;offset=parseInt((this.tools.page-1)/ this.options.ajax_pager_preload);if(!this.tools.requested_offsets.in_array(offset)&&offset>0){this.tools.requested_offsets.push(offset);new Ajax.Request(this.options.ajax_pager_url,{parameters:{'offset_block':offset},method:"post",onSuccess:function(transport){var json=transport.responseJSON,index_offset=(offset*this.options.pageCount*this.options.ajax_pager_preload);for(var i=0,len=json.length;i<len;++i){this.data[(index_offset+i)]=json[i];}
this.perform();}.bind(this)});}},createPager:function(){if($(this.table.id+'-pager')){$(this.table.id+'-pager').insert(new Element('div',{className:'input-group',style:'width:280px'}).insert(new Element('button',{id:this.table.id+'-page-first',type:'button',className:'btn btn-secondary mr5',title:this.msgs.paginationFirst,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/triangle-left.svg'}))).insert(new Element('button',{id:this.table.id+'-page-prev',type:'button',className:'btn btn-secondary mr5',title:this.msgs.paginationPrev,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/angle-left-small.svg'}))).insert(new Element('input',{id:this.table.id+'-page-current',className:'currentpage input',value:this.tools.page})).insert(new Element('span').update(this.msgs.paginationOf)).insert(new Element('span',{id:this.table.id+'-page-total',className:'totalpages'}).update(this.tools.pages)).insert(new Element('span').update(this.msgs.paginationPages)).insert(new Element('button',{id:this.table.id+'-page-next',type:'button',className:'btn btn-secondary ml5',title:this.msgs.paginationNext,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/angle-right-small.svg'}))).insert(new Element('button',{id:this.table.id+'-page-last',type:'button',className:'btn btn-secondary ml5',title:this.msgs.paginationLast,'data-tooltip':1}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/triangle-right.svg'}))));}
$(this.table.id+'-page-current').on('keydown',function(ev){if(ev.keyCode==Event.KEY_RETURN){ev.preventDefault();}});$(this.table.id+'-page-current').on('keyup',this.changePage.bindAsEventListener(this))},pagerData:function(e,element){var tid=this.table.id;var callerId='';if(element!==null&&Object.isElement(element)){callerId=element.id;}
if(e!==null){callerId=e.findElement('button').id;}
switch(callerId){case tid+'-page-next':this.tools.page=((++this.tools.page)>this.tools.pages)?--this.tools.page:this.tools.page;break;case tid+'-page-prev':this.tools.page=((--this.tools.page)>this.tools.pages)?++this.tools.page:this.tools.page;break;case tid+'-page-last':this.tools.page=this.tools.pages;break;default:this.tools.page=1;}
if(this.options.ajax_pager){this.load_data();}
this.updateTable();},updatePager:function(){var element=$(this.table.id+'-page-current');if(element){element.value=this.tools.page;}},updateTable:function(){this.table=$('data-grid-'+this.element);$(this.table.id).update();this.createRows();this.addTableObserver();this.makeUnsort();this.updatePager();this.updateNDO();this.updateLivestatus();},updateNDO:function(){if($(this.table.id).down('span.ndo_state')){var obj_ids=$$('#'+this.table.id+' tr').invoke('readAttribute','data-objectid').compact();obj_ids=Array.prototype.without.apply(obj_ids,this.ndo_loaded);new Ajax.Request(this.options.ndo_state_url,{method:"post",parameters:{obj_ids:Object.toJSON(obj_ids)},onSuccess:function(transport){var json=transport.responseJSON,item,index,row_index,el;if(json.success&&json.data!==null){for(index in json.data){if(json.data.hasOwnProperty(index)){item=json.data[index];el=$$('tr[data-objectid="'+item.obj_id+'"]');if(el[0]){this.ndo_loaded.push(item.obj_id);row_index=(this.tools.page-1)*this.options.pageCount+parseInt(el[0].readAttribute('data-listindex'));el=el[0].down('.ndo_state');if(!el){continue;}
el=el.up().update(display_monitoring_state(item));this.data[row_index][this.options.ndo_state_field]=el.innerHTML;}}}
$(this.table.id).select('span.ndo_state.loading').invoke('addClassName','red').invoke('update','?');}else{$(this.table.id).select('span.ndo_state').invoke('addClassName','red').invoke('update',(json.message||''));}}.bind(this)});}},updateLivestatus:function(){if($(this.table.id).down('span.livestatus_state')){var obj_ids=$$('#'+this.table.id+' tr').invoke('readAttribute','data-objectid').compact();obj_ids=Array.prototype.without.apply(obj_ids,this.livestatus_loaded);new Ajax.Request(this.options.livestatus_state_url,{method:"post",parameters:{obj_ids:Object.toJSON(obj_ids)},onSuccess:function(transport){var json=transport.responseJSON,item,index,row_index,el;if(json.success&&json.data!==null){for(index in json.data){if(json.data.hasOwnProperty(index)){item=json.data[index];el=$$('tr[data-objectid="'+item.obj_id+'"]');if(el[0]){this.livestatus_loaded.push(item.obj_id);row_index=(this.tools.page-1)*this.options.pageCount+parseInt(el[0].readAttribute('data-listindex'));el=el[0].down('.livestatus_state');if(!el){continue;}
el=el.up().update(display_monitoring_state(item));this.data[row_index][this.options.livestatus_state_field]=el.innerHTML;}}}
$(this.table.id).select('span.livestatus_state.loading').invoke('addClassName','red').invoke('update','?');}else{$(this.table.id).select('span.livestatus_state').invoke('addClassName','red').invoke('update',(json.message||''));}}.bind(this)});}},createFilter:function(){var option='',objectlink_index;this.tableColumnsName.each(function(i){if(i!='__id__'){option+='\t<option value="'+i+'">'+i+'</option>\n';}});var inputFilter=new Element('input',{'id':this.table.id+'-filter-data',className:'input input-mini'});inputFilter.on('keydown',function(ev){if(ev.keyCode==Event.KEY_RETURN){ev.preventDefault();}});if(!this.options.ajax_pager){$(this.table.id+'-options').insert({bottom:this.msgs.filterLabel}).insert({bottom:'<select id="'+this.table.id+'-filter-column" class="input input-mini">'+option+'</select>'}).insert({bottom:inputFilter});}else{$(this.table.id+'-options').insert({bottom:this.msgs.filterLabel}).insert({bottom:'<select id="'+this.table.id+'-filter-column" disabled="disabled" class="input input-mini">'+option+'</select>'}).insert({bottom:new Element('input',{'id':this.table.id+'-filter-data',className:'input input-mini','disabled':'disabled'})});}
if(this.tableColumnsName.in_array(idoit.Translate.get('LC__UNIVERSAL__TITLE_LINK'))){objectlink_index=this.tableColumnsName.indexOf(idoit.Translate.get('LC__UNIVERSAL__TITLE_LINK'));if(this.tableColumnsName.in_array('__id__'))objectlink_index--;$(this.table.id+'-options').down('select').selectedIndex=objectlink_index;}
this.tools.filterCol=$F(this.table.id+'-filter-column');this.tools.filterData=$F(this.table.id+'-filter-data');},addTableObserver:function(){var tid=this.table.id,that=this;if(!this.options.ajax_pager){$(tid).select('th').invoke('observe','click',this.thClickbfx).invoke('observe','mouseover',this.thOverbfx).invoke('observe','mouseout',this.thOutbfx);}
$(tid).select('tr.data').invoke('observe','click',this.trClick.bindAsEventListener(this)).invoke('observe','mouseover',this.trOver.bindAsEventListener(this)).invoke('observe','mouseout',this.trOut.bindAsEventListener(this));if($('complete-list-selector')){$('complete-list-selector').observe('change',function(e){$(tid).select('tr input[name="id[]"]').each(function(es){es.checked=e.element().checked});that.options.checkedBoxes=[];if(e.target.checked){$(tid).select('tr.data').each(function(ele){that.options.checkedBoxes.push(parseInt(ele.down('.checkbox').value));});}});}
if(this.options.draggable){$(this.table.id).select('tr').each(function(el){if(el.hasClassName('no-drag')){return;}
new Draggable(el,{scroll:$('contentWrapper'),handle:el.down('span.drag-handle'),zindex:500,revert:true,onStart:function(){dragging=true;el.addClassName('draggable');if($('ghost')){$('ghost').remove();}
var ghost=new Element('table',{id:'ghost',className:that.options.classPrefix}).setStyle({position:'absolute',opacity:0.7,width:'50%',zIndex:1000}).update(el.clone(true).writeAttribute({id:'ghos-tr'}));$('body').insert(ghost);},onDrag:function(){if($('ghost')){$('ghost').setStyle({left:Position.xcomp+'px',top:Position.ycomp+'px'});}},onEnd:function(){dragging=false;el.removeClassName('draggable');if($('ghost')){$('ghost').remove();}}});});}},trClick:function(e){if(this.options.tr_click){var clicked_element=e.findElement(),clicked_tag=clicked_element.tagName,$tr=clicked_element.up('tr');if(clicked_tag!='A'&&clicked_tag!='INPUT'&&!clicked_element.hasClassName('drag-handle')){if($tr&&window.list_vars&&'tree_view'in window.list_vars){this.objectLink($tr.readAttribute('data-objectid'),window.list_vars.tree_view,window.list_vars.view_mode,'');}}}},thClick:function(e){if(e.element().hasClassName('no-sort')){return;}
this.defineOrderField(e);this.defineOrder();this.orderData(this.orderField);if(this.order=='desc'){this.cache=this.cache.reverse();}
this.updateTable();},removeDataItem:function(obj_id){var tmp_data=[];this.data.each(function(i){var arr=Object.values(i);if(arr[0]!=obj_id){tmp_data.push(i);}}.bind(this));this.data=tmp_data;this.clearCache();},objectLink:function(obj_id,treeview,view_mode,category_id){get_tree_by_object(obj_id,treeview);get_content_by_object(obj_id,view_mode,category_id);},createRows:function(){var line=1;var display,enddisplay,startdisplay,dataView,dat,col,searchStr,row,s;const $tbody=new Element('tbody');this.table.update(this.createFirstRow());dataView=this.cache;if(this.options.filter&&!this.isCached&&this.tools.filterData!==''){col=this.tools.filterCol;dat=this.tools.filterData;dataView=this.cache.inject([],function(array,rec){if(rec[col]){recTest=rec[col].toString().replace(/&nbsp;/gi,'');if((recTest.toUpperCase().include(dat.toUpperCase())||recTest.toUpperCase().include(dat.encodeHTML().toUpperCase()))){array.push(rec);}}
return array;});}
if(this.options.search&&!this.isCached&&this.tools.searchData!==''){dat=this.tools.searchData.toUpperCase();dataView=dataView.inject([],function(array,value){searchStr=Object.values(value).inject('',function(acc,n){return acc+" "+n;});if(searchStr.toUpperCase().include(dat)){array.push(value);}
return array;});}
display=dataView;if(this.options.paginate){this.tools.pages=Math.ceil(dataView.size()/ this.options.pageCount);if(this.tools.filterData.blank()&&this.options.max_pages>0){this.tools.pages=this.options.max_pages;}
if(this.tools.page>this.tools.pages){this.tools.page=this.tools.pages;}
if(this.tools.page<1){this.tools.page=1;}
if(this.tools.pages===0){this.tools.page=0;}
$(this.table.id+'-page-current').setValue(this.tools.page);$(this.table.id+'-page-total').update(this.tools.pages);startdisplay=this.options.pageCount*(this.tools.page-1);enddisplay=this.options.pageCount*this.tools.page;display=dataView.slice(startdisplay,enddisplay);}
display.each(function(i,index){$tbody.insert(this.createRow(i,index));line=(line==1)?2:1;if(this.options.checkboxes){$(this.table.id).select('input:last')[0].observe("change",function(e){this.checkListener(e);}.bind(this));}}.bind(this));this.table.insert($tbody);if(this.table.down('.quickinfo')){this.table.select('span.quickinfo[data-obj-id]').each(function(element){var obj_id=element.readAttribute('data-obj-id');new Tip('obj-browser-quickinfo-'+obj_id,'',{'ajax':{'url':'?ajax=1&call=quick_info&objID='+obj_id},'className':'objectinfo'});});}
if(display.size()===0){s=this.tableColumnsName.size();row='<tr class="data line0" id="'+this.table.id+'-0">\n';if(this.options.ajax_pager){if(typeof window.list_vars==='undefined'){window.list_vars={'image_dir':'images/'};}
row+='\t<td class="'+this.table.id+'-column" colspan="'+s+'"><img src="'+window.list_vars.image_dir+'ajax-loading.gif" class="vam" /> '+this.msgs.loading+'</td>\n';}else{row+='\t<td class="'+this.table.id+'-column" colspan="'+s+'">'+this.msgs.emptyResults+'</td>\n';}
row+='\n</tr>';this.table.insert({bottom:row});}
if(this.orderField){$(this.table.id+'-'+this.orderField).addClassName('ordered');}
if(!this.isCached){this.isCached=true;this.cache=dataView;}},checkListener:function(e){if(e.target.checked&&this.options.checkedBoxes.indexOf(parseInt(e.target.value))==-1){this.options.checkedBoxes.push(parseInt(e.target.value));}else{this.options.checkedBoxes.splice(this.options.checkedBoxes.indexOf(parseInt(e.target.value)),1);}},filterData:function(e){var tid=this.table.id;if($(tid)){if(e.keyCode==Event.KEY_LEFT||e.keyCode==Event.KEY_RIGHT){var l_element=(e.keyCode==Event.KEY_LEFT)?$(this.table.id+'-page-previous'):$(this.table.id+'-page-next');if(e.ctrlKey){this.pagerData(null,l_element);}
return false;}
if(e.keyCode==Event.KEY_RETURN||e.keyCode==Event.KEY_DOWN||e.keyCode==Event.KEY_UP){var l_selected=$(tid).select('tr.highlightLine');if(e.keyCode==Event.KEY_RETURN&&l_selected.length){if(l_selected[0]){if(window.list_vars&&'tree_view'in window.list_vars){this.objectLink(l_selected[0].readAttribute('data-objectid'),window.list_vars.tree_view,window.list_vars.view_mode,'');}
e.stop();}
return false;}
else{if(!l_selected.length){$(tid).select('tr.data')[0].addClassName('highlightLine');}
else{var data=false;l_selected[0].removeClassName('highlightLine');if(e.keyCode==Event.KEY_DOWN){data=l_selected[0].next('tr.data');}
else if(e.keyCode==Event.KEY_UP){data=l_selected[0].previous('tr.data');}
if(data){data.addClassName('highlightLine');}}}
return false;}}
delay(function(e){var caller=Event.element(e);this.tools.filterData=$F(tid+'-filter-data');this.tools.filterCol=$F(tid+'-filter-column');if(caller.id==tid+'-filter-column'&&this.tools.filterData.blank()){return;}
this.clearCache();if(this.options.paginate){this.tools.page=1;this.updateTable();return;}
$(tid).select('td.'+tid+'-column-'+this.tools.filterCol).each(function(i){var str=i.innerHTML.toUpperCase(),search=this.tools.filterData;if(!str.include(search.toUpperCase())&&!str.include(search.encodeHTML().toUpperCase())){i.ancestors()[1].hide();}else{i.ancestors()[1].show();}});}.bind(this,e),250,'table.keypress');},orderRule:function(s){if(typeof(s)!='number'){var dateRE=/^(\d{2})[\/\-\. ](\d{2})[\/\-\. ](\d{4}|\d{2})/;var exp=new RegExp(dateRE);if(exp.test(s)){s=this.options.dateFormat=='d'?s.replace(dateRE,"$3$2$1"):s.replace(dateRE,"$3$1$2");}else{var ipRE=new RegExp(/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/g);if(ipRE.test(s)){s=IPv4.ip2long(s);}
else{var htmlRE=/<a[^>]*>(.*?)<\/a>/i;var matches=htmlRE.exec(s);if(matches!=null&&matches.length>1){return matches[1].toLowerCase();}}}}
return s;},overwriteIDs:function(){var l_length=this.options.checkedBoxes.length,l_selectorContainer=null,l_hiddenFields="";while(l_length--){l_selectorContainer=$$('input[type="checkbox"][value="'+this.options.checkedBoxes[l_length]+'"]');if(l_selectorContainer.length){l_selectorContainer[0].checked=false;}
l_hiddenFields+="<input type='hidden' name='id[]' value='"+this.options.checkedBoxes[l_length]+"' />";}
$('data-grid-'+object_list.element).select('input:checked').each(function(s){s.checked=false;});this.options.checkedBoxes=[];return l_hiddenFields;}});function popup_open(element,width,height,minWidth,minHeight,maxWidth,maxHeight){var widthInPercent,heightInPercent,open_popups=$$('.popup').filter(function($el){return $el.visible();});if(!element){element=$('popup');}else{element=$(element);}
Position.includeScrollOffsets=true;if(!width){width=element.getWidth();}
if(!height){height=element.getHeight();}
show_overlay();widthInPercent=(Object.isString(width)&&width.substr(-1)=='%');heightInPercent=(Object.isString(height)&&height.substr(-1)=='%');element.setStyle({position:"fixed",width:parseInt(width)+'px',minWidth:null,maxWidth:null,height:parseInt(height)+'px',minHeight:null,maxHeight:null,top:"50%",left:"50%",marginLeft:-parseInt(width/2)+'px',marginTop:-parseInt(height/2)+'px',zIndex:(1100+open_popups.length)});if(widthInPercent){element.setStyle({width:width,minWidth:(minWidth?parseInt(minWidth)+'px':null),maxWidth:(maxWidth?parseInt(maxWidth)+'px':null),left:((100-parseInt(width))/ 2)+'%',marginLeft:null});}
if(heightInPercent){element.setStyle({height:height,minHeight:(minHeight?parseInt(minHeight)+'px':null),maxHeight:(maxHeight?parseInt(maxHeight)+'px':null),top:((100-parseInt(height))/ 2)+'%',marginTop:null});}
element.show();setTimeout(function(){$('body').fire('update:tooltips');},500);}
function all_popups_closed(){"use strict";var open_popups=$$('.popup:not(.custom-popup)').filter(function($el){return $el.visible();});return open_popups.length===0;}
function popup_close(element){"use strict";if(!element){element=$('popup');}else{element=$(element);}
var afterFinishHandler=function(){if(all_popups_closed()){window.hide_overlay();}};element.addClassName('slideUp');delay(function(){element.hide().removeClassName('slideUp');afterFinishHandler();},500,'popup.slideup');}
function get_popup(p_popupname,p_urlparams,width,height,parameters,destinationPopup,minWidth,minHeight,maxWidth,maxHeight){var url=window.www_dir+'?mod=cmdb&popup='+p_popupname;destinationPopup=destinationPopup||'popup';if(p_urlparams){url+='&'+p_urlparams;}
$(destinationPopup).update('');new Ajax.Submit(url,destinationPopup,false,{history:false,parameters:parameters});popup_open($(destinationPopup),width,height,minWidth,minHeight,maxWidth,maxHeight);document.on('keydown',function(ev){ev=ev||window.event;if(ev.keyCode==Event.KEY_ESC){popup_close();}});}
function get_commentary(callbackAccept,callbackCancel){get_popup('commentary','editMode=1&callbackAccept='+callbackAccept+'&callbackCancel='+callbackCancel,500,300,null,'popup_commentary');}
function expandEntry(id,p_archive,p_logbookid){if($('logb'+id).innerHTML==''){var l_url='?moduleID='+p_logbookid+'&request=expandLogbookEntry&log_id='+id;if(p_archive){l_url=l_url+'&inArchive=1';}
aj_submit(l_url,'get','logb'+id,null,null,null,null,function(){if(!$('tr'+id).visible()){new Effect.Appear('tr'+id,{duration:0.15});swapExpandCollapse(id);}});}else{if(!$('tr'+id).visible()){new Effect.Appear('tr'+id,{duration:0.15});swapExpandCollapse(id);}}}
function collapseEntry(id){if($('tr'+id).visible()){new Effect.Fade('tr'+id,{duration:0.15});swapExpandCollapse(id);}}
function swapExpandCollapse(id){const $td=$('ec'+id);const $button=$td.down('button');const $buttonImage=$td.down('button img');if($button&&$buttonImage){if($button.hasClassName('pressed')){$buttonImage.writeAttribute('src',window.dir_images+'axialis/user-interface/angle-right-small.svg');$button.removeClassName('pressed').writeAttribute('onclick','expandEntry('+id+')').writeAttribute('title',idoit.Translate.get('LC__UNIVERSAL__EXPAND'));}else{$buttonImage.writeAttribute('src',window.dir_images+'axialis/user-interface/angle-down-small.svg');$button.addClassName('pressed').writeAttribute('onclick','collapseEntry('+id+')').writeAttribute('title',idoit.Translate.get('LC__UNIVERSAL__COLLAPSE'));}}
$('body').fire('update:tooltips');}
function eTree(treeName,treeDataSource,treeCaptionIcon,treeCaption,selectedNodes,imagesFolder,nodeCssClass,selectedNodeCssClass,ajaxAnimation,highlightLocationTypes){this.treeName=treeName;this.treeDataSource=treeDataSource;this.treeCaptionIcon=treeCaptionIcon?treeCaptionIcon:"";this.treeCaption=treeCaption?treeCaption:"";this.imagesFolder=imagesFolder?imagesFolder:"";this.nodeCssClass=nodeCssClass?nodeCssClass:"node";this.selectedNodeCssClass=selectedNodeCssClass?selectedNodeCssClass:"nodeSel";this.ajaxAnimation=ajaxAnimation?ajaxAnimation:this.imagesFolder+"../please_wait.gif";this.highlightLocationTypes=(Object.isUndefined(highlightLocationTypes)?false:highlightLocationTypes);this.selectedNodesArray=selectedNodes.split(",");this.prevSelectedNodeId=-1;this.loadedNodes=[];this.treeLevels=[];this.expandedNodes=[];this.expandedNodeBottom=[];this.parentNodes=[];this.expandingImage=null;this.callback_after_render=this.callback_before_render=this.callback_after_load=this.callback_before_load=Prototype.emptyFunction;this.LoadTree(-1);}
eTree.prototype.LoadTree=function(parentNodeId){var expander=$(this.treeName+"_Expand_"+parentNodeId);this.callback_before_load(parentNodeId);if(expander){this.expandingImage=this.imagesFolder+this.GetExpanderImage(this.expandedNodeBottom[parentNodeId],true);expander.src=this.ajaxAnimation;}
var url=this.treeDataSource.replace(/\{0\}/,parentNodeId);new Ajax.Request(url,{method:'post',parameters:$('isys_form').serialize(true),onSuccess:function(transport){this.callback_after_load(parentNodeId);this.LoadTreeComplete(transport.responseJSON,parentNodeId);}.bind(this),onFailure:function(){}});};eTree.prototype.LoadTreeComplete=function(treeData,parentNodeId){var expander=$(this.treeName+"_Expand_"+parentNodeId),treeLevel,parentNode;if(expander){if(this.expandingImage===null){this.expandingImage=this.imagesFolder+this.GetExpanderImage(true,true,false);}
expander.src=this.expandingImage;this.expandingImage=null;}
if(parentNodeId==-1){parentNode=$(this.treeName);treeLevel=0;if(this.treeCaptionIcon!=""||this.treeCaption!=""){var captionDiv=new Element("div",{className:'node-div root','data-object-id':parentNodeId});if(this.treeCaptionIcon!=''){captionDiv.insert(new Element("img",{src:this.treeCaptionIcon,className:'mr5'}));}
if(this.treeCaption!=''){captionDiv.insert(this.treeCaption);}
parentNode.insert(captionDiv);}}else{parentNode=$(this.treeName+"_ChildNodes_"+parentNodeId);treeLevel=this.treeLevels[parentNodeId];}
this.callback_before_render(parentNodeId,parentNode);for(var i=0;i<treeData.length;i++){if(parentNodeId!=-1){this.parentNodes[treeData[i].id]=parentNodeId;}
var nodeDiv=new Element("div",{id:this.treeName+"_Node_"+treeData[i].id,className:'node-div','data-object-id':treeData[i].id});var bottomNodes=[],nodeId=parentNodeId;if(this.highlightLocationTypes){if(treeData[i].is_logically_assigned){nodeDiv.insert(new Element('div',{className:'cmdb-marker',style:'background:#FFB85C;'}));}else if(treeData[i].is_physically_assigned){nodeDiv.insert(new Element('div',{className:'cmdb-marker',style:'background:#66C1FF;'}));}}
for(var k=0;k<treeLevel;k++){bottomNodes.push(nodeId);if(this.parentNodes[nodeId])nodeId=this.parentNodes[nodeId];else break;}
bottomNodes.pop();for(var j=0,k=bottomNodes.length-1;j<treeLevel;j++,k--){var isLastSibling=this.expandedNodeBottom[bottomNodes[k]]==true;var levelSpacer=new Element("img");levelSpacer.setAttribute("src",this.imagesFolder+this.GetSpacerIcon(isLastSibling,j,treeLevel,i,treeData.length));nodeDiv.insert(levelSpacer);}
var expansionIcon=new Element("img",{id:this.treeName+"_Expand_"+treeData[i].id});if(!treeData[i].is_leaf){expansionIcon.onclick=this.ExpandCollapse.bind(this,treeData[i].id);if(i==treeData.length-1){this.expandedNodeBottom[treeData[i].id]=true;expansionIcon.src=this.imagesFolder+this.GetExpanderImage(true,false,false);}else{this.expandedNodeBottom[treeData[i].id]=false;expansionIcon.src=this.imagesFolder+this.GetExpanderImage(false,false,false);}}else{expansionIcon.src=this.imagesFolder+this.GetExpanderImage(false,false,true);}
nodeDiv.insert(expansionIcon);nodeDiv.insert(new Element("img",{className:'nodeIcon',src:treeData[i].icon?treeData[i].icon:this.imagesFolder+"page.gif"}));var nodeLink=new Element("a",{id:this.treeName+"_Link_"+treeData[i].id,onClick:treeData[i].url,className:this.nodeCssClass});nodeDiv.insert(nodeLink.insert(treeData[i].text));var childNodeDiv=new Element("div",{id:this.treeName+"_ChildNodes_"+treeData[i].id});parentNode.insert(nodeDiv.insert(childNodeDiv));this.treeLevels[treeData[i].id]=treeLevel+1;}
this.loadedNodes[parentNodeId]=true;this.expandedNodes[parentNodeId]=true;if(this.selectedNodesArray.length>1){var expandNode=this.selectedNodesArray.pop();this.LoadTree(expandNode);}else{this.Select(this.selectedNodesArray.pop());}
this.callback_after_render(parentNodeId,(parentNodeId==-1)?parentNode:$(this.treeName+"_Node_"+parentNodeId));};eTree.prototype.ExpandCollapse=function(nodeId){if(this.expandingImage!=null){return;}
var expander=$(this.treeName+"_Expand_"+nodeId);expander.src=this.imagesFolder+this.GetExpanderImage(this.expandedNodeBottom[nodeId],!this.expandedNodes[nodeId]);if(this.expandedNodes[nodeId]){$(this.treeName+"_ChildNodes_"+nodeId).hide();this.expandedNodes[nodeId]=false;}else{if(!this.loadedNodes[nodeId]){this.LoadTree(nodeId);}else{$(this.treeName+"_ChildNodes_"+nodeId).show();this.expandedNodes[nodeId]=true;}}};eTree.prototype.Select=function(nodeId){var $node=$(this.treeName+"_Link_"+nodeId);if(this.prevSelectedNodeId!=-1&&nodeId!=undefined){$(this.treeName+"_Link_"+this.prevSelectedNodeId).removeClassName(this.selectedNodeCssClass);}
if($node){$node.removeClassName(this.nodeCssClass).addClassName(this.selectedNodeCssClass);}
this.prevSelectedNodeId=nodeId;};eTree.prototype.GetSpacerIcon=function(isLastSibling,x,xmax,y,ymax){if(x==xmax-1){if(y==ymax-1){return"joinbottom.gif";}else{return"join.gif";}}
if(isLastSibling){return"empty.gif";}else{return"line.gif";}};eTree.prototype.GetExpanderImage=function(isBottom,isExpanded,isLeaf){if(isLeaf){return"leaf.gif";}else{if(isBottom){if(isExpanded){return"minusbottom.gif";}else{return"plusbottom.gif";}}else{if(isExpanded){return"minus.gif";}else{return"plus.gif";}}}};SVGElement.prototype.exportToString=function(options){var $svgNode=Element.writeAttribute(Element.clone(this,true),{width:null,height:null}),svgData=(new XMLSerializer()).serializeToString($svgNode);if(options.hasOwnProperty('decode')&&options.decode){svgData=btoa(svgData);}
if(options.callback){options.callback(svgData);}
return svgData;};SVGElement.prototype.saveToSvg=function(options){var svg=this;idoit.Require.require('svgToPng',function(){var filename='exported-svg';if(options.hasOwnProperty('filename')&&Object.isString(options.filename)){filename=options.filename;}
saveSvg(svg,filename+'.svg',options);if(options.hasOwnProperty('callback')&&Object.isFunction(options.callback)){options.callback();}});};SVGElement.prototype.saveToPng=function(options){var svg=this;idoit.Require.require('svgToPng',function(){var filename='exported-png';if(options.hasOwnProperty('filename')&&Object.isString(options.filename)){filename=options.filename;}
saveSvgAsPng(svg,filename+'.png',options);if(options.hasOwnProperty('callback')&&Object.isFunction(options.callback)){options.callback();}});};var jscolor={dir:window.dir_images+'jscolor/',bindClass:'jscolor',binding:true,preloading:true,install:function(){jscolor.addEvent(window,'load',jscolor.init);},init:function(){if(jscolor.binding){jscolor.bind();}
if(jscolor.preloading){jscolor.preload();}},getDir:function(){if(!jscolor.dir){var detected=jscolor.detectDir();jscolor.dir=detected!==false?detected:'jscolor/';}
return jscolor.dir;},detectDir:function(){var base=location.href;var e=document.getElementsByTagName('base');for(var i=0;i<e.length;i+=1){if(e[i].href){base=e[i].href;}}
var e=document.getElementsByTagName('script');for(var i=0;i<e.length;i+=1){if(e[i].src&&/(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)){var src=new jscolor.URI(e[i].src);var srcAbs=src.toAbsolute(base);srcAbs.path=srcAbs.path.replace(/[^\/]+$/,'');srcAbs.query=null;srcAbs.fragment=null;return srcAbs.toString();}}
return false;},bind:function(){var matchClass=new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?','i');var e=document.getElementsByTagName('input');for(var i=0;i<e.length;i+=1){var m;if(!e[i].color&&e[i].className&&(m=e[i].className.match(matchClass))){var prop={};if(m[3]){try{prop=(new Function('return ('+m[3]+')'))();}catch(eInvalidProp){}}
e[i].color=new jscolor.color(e[i],prop);}}},preload:function(){for(var fn in jscolor.imgRequire){if(jscolor.imgRequire.hasOwnProperty(fn)){jscolor.loadImage(fn);}}},images:{pad:[181,101],sld:[16,101],cross:[15,15],arrow:[7,11]},imgRequire:{},imgLoaded:{},requireImage:function(filename){jscolor.imgRequire[filename]=true;},loadImage:function(filename){if(!jscolor.imgLoaded[filename]){jscolor.imgLoaded[filename]=new Image();jscolor.imgLoaded[filename].src=jscolor.getDir()+filename;}},fetchElement:function(mixed){return typeof mixed==='string'?document.getElementById(mixed):mixed;},addEvent:function(el,evnt,func){if(el){if(el.addEventListener){el.addEventListener(evnt,func,false);}else if(el.attachEvent){el.attachEvent('on'+evnt,func);}}},fireEvent:function(el,evnt){if(!el){return;}
if(document.createEvent){var ev=document.createEvent('HTMLEvents');ev.initEvent(evnt,true,true);el.dispatchEvent(ev);}else if(document.createEventObject){var ev=document.createEventObject();el.fireEvent('on'+evnt,ev);}else if(el['on'+evnt]){el['on'+evnt]();}},getElementPos:function(e){var e1=e,e2=e;var x=0,y=0;if(e1.offsetParent){do{x+=e1.offsetLeft;y+=e1.offsetTop;}while(e1=e1.offsetParent);}
while((e2=e2.parentNode)&&e2.nodeName.toUpperCase()!=='BODY'){x-=e2.scrollLeft;y-=e2.scrollTop;}
return[x,y];},getElementSize:function(e){return[e.offsetWidth,e.offsetHeight];},getRelMousePos:function(e){var x=0,y=0;if(!e){e=window.event;}
if(typeof e.offsetX==='number'){x=e.offsetX;y=e.offsetY;}else if(typeof e.layerX==='number'){x=e.layerX;y=e.layerY;}
return{x:x,y:y};},getViewPos:function(){if(typeof window.pageYOffset==='number'){return[window.pageXOffset,window.pageYOffset];}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return[document.body.scrollLeft,document.body.scrollTop];}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return[document.documentElement.scrollLeft,document.documentElement.scrollTop];}else{return[0,0];}},getViewSize:function(){if(typeof window.innerWidth==='number'){return[window.innerWidth,window.innerHeight];}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return[document.body.clientWidth,document.body.clientHeight];}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return[document.documentElement.clientWidth,document.documentElement.clientHeight];}else{return[0,0];}},URI:function(uri){this.scheme=null;this.authority=null;this.path='';this.query=null;this.fragment=null;this.parse=function(uri){var m=uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);this.scheme=m[3]?m[2]:null;this.authority=m[5]?m[6]:null;this.path=m[7];this.query=m[9]?m[10]:null;this.fragment=m[12]?m[13]:null;return this;};this.toString=function(){var result='';if(this.scheme!==null){result=result+this.scheme+':';}
if(this.authority!==null){result=result+'//'+this.authority;}
if(this.path!==null){result=result+this.path;}
if(this.query!==null){result=result+'?'+this.query;}
if(this.fragment!==null){result=result+'#'+this.fragment;}
return result;};this.toAbsolute=function(base){var base=new jscolor.URI(base);var r=this;var t=new jscolor.URI;if(base.scheme===null){return false;}
if(r.scheme!==null&&r.scheme.toLowerCase()===base.scheme.toLowerCase()){r.scheme=null;}
if(r.scheme!==null){t.scheme=r.scheme;t.authority=r.authority;t.path=removeDotSegments(r.path);t.query=r.query;}else{if(r.authority!==null){t.authority=r.authority;t.path=removeDotSegments(r.path);t.query=r.query;}else{if(r.path===''){t.path=base.path;if(r.query!==null){t.query=r.query;}else{t.query=base.query;}}else{if(r.path.substr(0,1)==='/'){t.path=removeDotSegments(r.path);}else{if(base.authority!==null&&base.path===''){t.path='/'+r.path;}else{t.path=base.path.replace(/[^\/]+$/,'')+r.path;}
t.path=removeDotSegments(t.path);}
t.query=r.query;}
t.authority=base.authority;}
t.scheme=base.scheme;}
t.fragment=r.fragment;return t;};function removeDotSegments(path){var out='';while(path){if(path.substr(0,3)==='../'||path.substr(0,2)==='./'){path=path.replace(/^\.+/,'').substr(1);}else if(path.substr(0,3)==='/./'||path==='/.'){path='/'+path.substr(3);}else if(path.substr(0,4)==='/../'||path==='/..'){path='/'+path.substr(4);out=out.replace(/\/?[^\/]*$/,'');}else if(path==='.'||path==='..'){path='';}else{var rm=path.match(/^\/?[^\/]*/)[0];path=path.substr(rm.length);out=out+rm;}}
return out;}
if(uri){this.parse(uri);}},color:function(target,prop){this.required=true;this.adjust=true;this.hash=false;this.caps=true;this.slider=true;this.valueElement=target;this.styleElement=target;this.onImmediateChange=null;this.hsv=[0,0,1];this.rgb=[1,1,1];this.minH=0;this.maxH=6;this.minS=0;this.maxS=1;this.minV=0;this.maxV=1;this.pickerOnfocus=true;this.pickerMode='HSV';this.pickerPosition='bottom';this.pickerSmartPosition=true;this.pickerButtonHeight=20;this.pickerClosable=false;this.pickerCloseText='Close';this.pickerButtonColor='ButtonText';this.pickerFace=10;this.pickerFaceColor='ThreeDFace';this.pickerBorder=1;this.pickerBorderColor='ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight';this.pickerInset=1;this.pickerInsetColor='ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow';this.pickerZIndex=10000;for(var p in prop){if(prop.hasOwnProperty(p)){this[p]=prop[p];}}
this.hidePicker=function(){if(isPickerOwner()){removePicker();}};this.showPicker=function(){if(!isPickerOwner()){var tp=jscolor.getElementPos(target);var ts=jscolor.getElementSize(target);var vp=jscolor.getViewPos();var vs=jscolor.getViewSize();var ps=getPickerDims(this);var a,b,c;switch(this.pickerPosition.toLowerCase()){case'left':a=1;b=0;c=-1;break;case'right':a=1;b=0;c=1;break;case'top':a=0;b=1;c=-1;break;default:a=0;b=1;c=1;break;}
var l=(ts[b]+ps[b])/2;if(!this.pickerSmartPosition){var pp=[tp[a],tp[b]+ts[b]-l+l*c];}else{var pp=[-vp[a]+tp[a]+ps[a]>vs[a]?(-vp[a]+tp[a]+ts[a]/2>vs[a]/2&&tp[a]+ts[a]-ps[a]>=0?tp[a]+ts[a]-ps[a]:tp[a]):tp[a],-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c>vs[b]?(-vp[b]+tp[b]+ts[b]/2>vs[b]/2&&tp[b]+ts[b]-l-l*c>=0?tp[b]+ts[b]-l-l*c:tp[b]+ts[b]-l+l*c):(tp[b]+ts[b]-l+l*c>=0?tp[b]+ts[b]-l+l*c:tp[b]+ts[b]-l-l*c)];}
drawPicker(pp[a],pp[b]);}};this.importColor=function(){if(!valueElement){this.exportColor();}else{if(!this.adjust){if(!this.fromString(valueElement.value,leaveValue)){styleElement.style.backgroundImage=styleElement.jscStyle.backgroundImage;styleElement.style.backgroundColor=styleElement.jscStyle.backgroundColor;styleElement.style.color=styleElement.jscStyle.color;this.exportColor(leaveValue|leaveStyle);}}else if(!this.required&&/^\s*$/.test(valueElement.value)){valueElement.value='';styleElement.style.backgroundImage=styleElement.jscStyle.backgroundImage;styleElement.style.backgroundColor=styleElement.jscStyle.backgroundColor;styleElement.style.color=styleElement.jscStyle.color;this.exportColor(leaveValue|leaveStyle);}else if(this.fromString(valueElement.value)){}else{this.exportColor();}}};this.exportColor=function(flags){if(!(flags&leaveValue)&&valueElement){var value=this.toString();if(this.caps){value=value.toUpperCase();}
if(this.hash){value='#'+value;}
valueElement.value=value;}
if(!(flags&leaveStyle)&&styleElement){styleElement.style.backgroundImage="none";styleElement.style.backgroundColor='#'+this.toString();styleElement.style.color=0.213*this.rgb[0]+
0.715*this.rgb[1]+
0.072*this.rgb[2]<0.5?'#FFF':'#000';}
if(!(flags&leavePad)&&isPickerOwner()){redrawPad();}
if(!(flags&leaveSld)&&isPickerOwner()){redrawSld();}};this.fromHSV=function(h,s,v,flags){if(h!==null){h=Math.max(0.0,this.minH,Math.min(6.0,this.maxH,h));}
if(s!==null){s=Math.max(0.0,this.minS,Math.min(1.0,this.maxS,s));}
if(v!==null){v=Math.max(0.0,this.minV,Math.min(1.0,this.maxV,v));}
this.rgb=HSV_RGB(h===null?this.hsv[0]:(this.hsv[0]=h),s===null?this.hsv[1]:(this.hsv[1]=s),v===null?this.hsv[2]:(this.hsv[2]=v));this.exportColor(flags);};this.fromRGB=function(r,g,b,flags){if(r!==null){r=Math.max(0.0,Math.min(1.0,r));}
if(g!==null){g=Math.max(0.0,Math.min(1.0,g));}
if(b!==null){b=Math.max(0.0,Math.min(1.0,b));}
var hsv=RGB_HSV(r===null?this.rgb[0]:r,g===null?this.rgb[1]:g,b===null?this.rgb[2]:b);if(hsv[0]!==null){this.hsv[0]=Math.max(0.0,this.minH,Math.min(6.0,this.maxH,hsv[0]));}
if(hsv[2]!==0){this.hsv[1]=hsv[1]===null?null:Math.max(0.0,this.minS,Math.min(1.0,this.maxS,hsv[1]));}
this.hsv[2]=hsv[2]===null?null:Math.max(0.0,this.minV,Math.min(1.0,this.maxV,hsv[2]));var rgb=HSV_RGB(this.hsv[0],this.hsv[1],this.hsv[2]);this.rgb[0]=rgb[0];this.rgb[1]=rgb[1];this.rgb[2]=rgb[2];this.exportColor(flags);};this.fromString=function(hex,flags){var m=hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);if(!m){return false;}else{if(m[1].length===6){this.fromRGB(parseInt(m[1].substr(0,2),16)/ 255,parseInt(m[1].substr(2,2),16)/ 255,parseInt(m[1].substr(4,2),16)/ 255,flags);}else{this.fromRGB(parseInt(m[1].charAt(0)+m[1].charAt(0),16)/ 255,parseInt(m[1].charAt(1)+m[1].charAt(1),16)/ 255,parseInt(m[1].charAt(2)+m[1].charAt(2),16)/ 255,flags);}
return true;}};this.toString=function(){return((0x100|Math.round(255*this.rgb[0])).toString(16).substr(1)+
(0x100|Math.round(255*this.rgb[1])).toString(16).substr(1)+
(0x100|Math.round(255*this.rgb[2])).toString(16).substr(1));};function RGB_HSV(r,g,b){var n=Math.min(Math.min(r,g),b);var v=Math.max(Math.max(r,g),b);var m=v-n;if(m===0){return[null,0,v];}
var h=r===n?3+(b-g)/m:(g===n?5+(r-b)/m:1+(g-r)/m);return[h===6?0:h,m/v,v];}
function HSV_RGB(h,s,v){if(h===null){return[v,v,v];}
var i=Math.floor(h);var f=i%2?h-i:1-(h-i);var m=v*(1-s);var n=v*(1-s*f);switch(i){case 6:case 0:return[v,n,m];case 1:return[n,v,m];case 2:return[m,v,n];case 3:return[m,n,v];case 4:return[n,m,v];case 5:return[v,m,n];}}
function removePicker(){delete jscolor.picker.owner;document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);}
function drawPicker(x,y){if(!jscolor.picker){jscolor.picker={box:document.createElement('div'),boxB:document.createElement('div'),pad:document.createElement('div'),padB:document.createElement('div'),padM:document.createElement('div'),sld:document.createElement('div'),sldB:document.createElement('div'),sldM:document.createElement('div'),btn:document.createElement('div'),btnS:document.createElement('span'),btnT:document.createTextNode(THIS.pickerCloseText)};for(var i=0,segSize=4;i<jscolor.images.sld[1];i+=segSize){var seg=document.createElement('div');seg.style.height=segSize+'px';seg.style.fontSize='1px';seg.style.lineHeight='0';jscolor.picker.sld.appendChild(seg);}
jscolor.picker.sldB.appendChild(jscolor.picker.sld);jscolor.picker.box.appendChild(jscolor.picker.sldB);jscolor.picker.box.appendChild(jscolor.picker.sldM);jscolor.picker.padB.appendChild(jscolor.picker.pad);jscolor.picker.box.appendChild(jscolor.picker.padB);jscolor.picker.box.appendChild(jscolor.picker.padM);jscolor.picker.btnS.appendChild(jscolor.picker.btnT);jscolor.picker.btn.appendChild(jscolor.picker.btnS);jscolor.picker.box.appendChild(jscolor.picker.btn);jscolor.picker.boxB.appendChild(jscolor.picker.box);}
var p=jscolor.picker;p.box.onmouseup=p.box.onmouseout=function(){target.focus();};p.box.onmousedown=function(){abortBlur=true;};p.box.onmousemove=function(e){if(holdPad||holdSld){holdPad&&setPad(e);holdSld&&setSld(e);if(document.selection){document.selection.empty();}else if(window.getSelection){window.getSelection().removeAllRanges();}
dispatchImmediateChange();}};if('ontouchstart'in window){var handle_touchmove=function(e){var event={'offsetX':e.touches[0].pageX-touchOffset.X,'offsetY':e.touches[0].pageY-touchOffset.Y};if(holdPad||holdSld){holdPad&&setPad(event);holdSld&&setSld(event);dispatchImmediateChange();}
e.stopPropagation();e.preventDefault();};p.box.removeEventListener('touchmove',handle_touchmove,false);p.box.addEventListener('touchmove',handle_touchmove,false)}
p.padM.onmouseup=p.padM.onmouseout=function(){if(holdPad){holdPad=false;jscolor.fireEvent(valueElement,'change');}};p.padM.onmousedown=function(e){switch(modeID){case 0:if(THIS.hsv[2]===0){THIS.fromHSV(null,null,1.0);}
break;case 1:if(THIS.hsv[1]===0){THIS.fromHSV(null,1.0,null);}
break;}
holdSld=false;holdPad=true;setPad(e);dispatchImmediateChange();};if('ontouchstart'in window){p.padM.addEventListener('touchstart',function(e){touchOffset={'X':e.target.offsetParent.offsetLeft,'Y':e.target.offsetParent.offsetTop};this.onmousedown({'offsetX':e.touches[0].pageX-touchOffset.X,'offsetY':e.touches[0].pageY-touchOffset.Y});});}
p.sldM.onmouseup=p.sldM.onmouseout=function(){if(holdSld){holdSld=false;jscolor.fireEvent(valueElement,'change');}};p.sldM.onmousedown=function(e){holdPad=false;holdSld=true;setSld(e);dispatchImmediateChange();};if('ontouchstart'in window){p.sldM.addEventListener('touchstart',function(e){touchOffset={'X':e.target.offsetParent.offsetLeft,'Y':e.target.offsetParent.offsetTop};this.onmousedown({'offsetX':e.touches[0].pageX-touchOffset.X,'offsetY':e.touches[0].pageY-touchOffset.Y});});}
var dims=getPickerDims(THIS);p.box.style.width=dims[0]+'px';p.box.style.height=dims[1]+'px';p.boxB.style.position='absolute';p.boxB.style.clear='both';p.boxB.style.left=x+'px';p.boxB.style.top=y+'px';p.boxB.style.zIndex=THIS.pickerZIndex;p.boxB.style.border=THIS.pickerBorder+'px solid';p.boxB.style.borderColor=THIS.pickerBorderColor;p.boxB.style.background=THIS.pickerFaceColor;p.pad.style.width=jscolor.images.pad[0]+'px';p.pad.style.height=jscolor.images.pad[1]+'px';p.padB.style.position='absolute';p.padB.style.left=THIS.pickerFace+'px';p.padB.style.top=THIS.pickerFace+'px';p.padB.style.border=THIS.pickerInset+'px solid';p.padB.style.borderColor=THIS.pickerInsetColor;p.padM.style.position='absolute';p.padM.style.left='0';p.padM.style.top='0';p.padM.style.width=THIS.pickerFace+2*THIS.pickerInset+jscolor.images.pad[0]+jscolor.images.arrow[0]+'px';p.padM.style.height=p.box.style.height;p.padM.style.cursor='crosshair';p.sld.style.overflow='hidden';p.sld.style.width=jscolor.images.sld[0]+'px';p.sld.style.height=jscolor.images.sld[1]+'px';p.sldB.style.display=THIS.slider?'block':'none';p.sldB.style.position='absolute';p.sldB.style.right=THIS.pickerFace+'px';p.sldB.style.top=THIS.pickerFace+'px';p.sldB.style.border=THIS.pickerInset+'px solid';p.sldB.style.borderColor=THIS.pickerInsetColor;p.sldM.style.display=THIS.slider?'block':'none';p.sldM.style.position='absolute';p.sldM.style.right='0';p.sldM.style.top='0';p.sldM.style.width=jscolor.images.sld[0]+jscolor.images.arrow[0]+THIS.pickerFace+2*THIS.pickerInset+'px';p.sldM.style.height=p.box.style.height;try{p.sldM.style.cursor='pointer';}catch(eOldIE){p.sldM.style.cursor='hand';}
function setBtnBorder(){var insetColors=THIS.pickerInsetColor.split(/\s+/);var pickerOutsetColor=insetColors.length<2?insetColors[0]:insetColors[1]+' '+insetColors[0]+' '+insetColors[0]+' '+insetColors[1];p.btn.style.borderColor=pickerOutsetColor;}
p.btn.style.display=THIS.pickerClosable?'block':'none';p.btn.style.position='absolute';p.btn.style.left=THIS.pickerFace+'px';p.btn.style.bottom=THIS.pickerFace+'px';p.btn.style.padding='0 15px';p.btn.style.height='18px';p.btn.style.border=THIS.pickerInset+'px solid';setBtnBorder();p.btn.style.color=THIS.pickerButtonColor;p.btn.style.font='12px sans-serif';p.btn.style.textAlign='center';try{p.btn.style.cursor='pointer';}catch(eOldIE){p.btn.style.cursor='hand';}
p.btn.onmousedown=function(){THIS.hidePicker();};p.btnS.style.lineHeight=p.btn.style.height;switch(modeID){case 0:var padImg='hs.png';break;case 1:var padImg='hv.png';break;}
p.padM.style.backgroundImage="url('"+jscolor.getDir()+"cross.gif')";p.padM.style.backgroundRepeat="no-repeat";p.sldM.style.backgroundImage="url('"+jscolor.getDir()+"arrow.gif')";p.sldM.style.backgroundRepeat="no-repeat";p.pad.style.backgroundImage="url('"+jscolor.getDir()+padImg+"')";p.pad.style.backgroundRepeat="no-repeat";p.pad.style.backgroundPosition="0 0";redrawPad();redrawSld();jscolor.picker.owner=THIS;document.getElementsByTagName('body')[0].appendChild(p.boxB);}
function getPickerDims(o){var dims=[2*o.pickerInset+2*o.pickerFace+jscolor.images.pad[0]+
(o.slider?2*o.pickerInset+2*jscolor.images.arrow[0]+jscolor.images.sld[0]:0),o.pickerClosable?4*o.pickerInset+3*o.pickerFace+jscolor.images.pad[1]+o.pickerButtonHeight:2*o.pickerInset+2*o.pickerFace+jscolor.images.pad[1]];return dims;}
function redrawPad(){switch(modeID){case 0:var yComponent=1;break;case 1:var yComponent=2;break;}
var x=Math.round((THIS.hsv[0]/6)*(jscolor.images.pad[0]-1));var y=Math.round((1-THIS.hsv[yComponent])*(jscolor.images.pad[1]-1));jscolor.picker.padM.style.backgroundPosition=(THIS.pickerFace+THIS.pickerInset+x-Math.floor(jscolor.images.cross[0]/2))+'px '+
(THIS.pickerFace+THIS.pickerInset+y-Math.floor(jscolor.images.cross[1]/2))+'px';var seg=jscolor.picker.sld.childNodes;switch(modeID){case 0:var rgb=HSV_RGB(THIS.hsv[0],THIS.hsv[1],1);for(var i=0;i<seg.length;i+=1){seg[i].style.backgroundColor='rgb('+
(rgb[0]*(1-i/seg.length)*100)+'%,'+
(rgb[1]*(1-i/seg.length)*100)+'%,'+
(rgb[2]*(1-i/seg.length)*100)+'%)';}
break;case 1:var rgb,s,c=[THIS.hsv[2],0,0];var i=Math.floor(THIS.hsv[0]);var f=i%2?THIS.hsv[0]-i:1-(THIS.hsv[0]-i);switch(i){case 6:case 0:rgb=[0,1,2];break;case 1:rgb=[1,0,2];break;case 2:rgb=[2,0,1];break;case 3:rgb=[2,1,0];break;case 4:rgb=[1,2,0];break;case 5:rgb=[0,2,1];break;}
for(var i=0;i<seg.length;i+=1){s=1-1/(seg.length-1)*i;c[1]=c[0]*(1-s*f);c[2]=c[0]*(1-s);seg[i].style.backgroundColor='rgb('+
(c[rgb[0]]*100)+'%,'+
(c[rgb[1]]*100)+'%,'+
(c[rgb[2]]*100)+'%)';}
break;}}
function redrawSld(){switch(modeID){case 0:var yComponent=2;break;case 1:var yComponent=1;break;}
var y=Math.round((1-THIS.hsv[yComponent])*(jscolor.images.sld[1]-1));jscolor.picker.sldM.style.backgroundPosition='0 '+(THIS.pickerFace+THIS.pickerInset+y-Math.floor(jscolor.images.arrow[1]/2))+'px';}
function isPickerOwner(){return jscolor.picker&&jscolor.picker.owner===THIS;}
function blurTarget(){if(valueElement===target){THIS.importColor();}
if(THIS.pickerOnfocus){THIS.hidePicker();}}
function blurValue(){if(valueElement!==target){THIS.importColor();}}
function setPad(e){var mpos=jscolor.getRelMousePos(e);var x=mpos.x-THIS.pickerFace-THIS.pickerInset;var y=mpos.y-THIS.pickerFace-THIS.pickerInset;switch(modeID){case 0:THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)),1-y/(jscolor.images.pad[1]-1),null,leaveSld);break;case 1:THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)),null,1-y/(jscolor.images.pad[1]-1),leaveSld);break;}}
function setSld(e){var mpos=jscolor.getRelMousePos(e);var y=mpos.y-THIS.pickerFace-THIS.pickerInset;switch(modeID){case 0:THIS.fromHSV(null,null,1-y/(jscolor.images.sld[1]-1),leavePad);break;case 1:THIS.fromHSV(null,1-y/(jscolor.images.sld[1]-1),null,leavePad);break;}}
function dispatchImmediateChange(){if(THIS.onImmediateChange){var callback;if(typeof THIS.onImmediateChange==='string'){callback=new Function(THIS.onImmediateChange);}else{callback=THIS.onImmediateChange;}
callback.call(THIS);}}
var THIS=this;var modeID=this.pickerMode.toLowerCase()==='hvs'?1:0;var abortBlur=false;var
valueElement=jscolor.fetchElement(this.valueElement),styleElement=jscolor.fetchElement(this.styleElement);var
holdPad=false,holdSld=false,touchOffset={};var
leaveValue=1<<0,leaveStyle=1<<1,leavePad=1<<2,leaveSld=1<<3;jscolor.addEvent(target,'focus',function(){if(THIS.pickerOnfocus){THIS.showPicker();}});jscolor.addEvent(target,'blur',function(){if(!abortBlur){window.setTimeout(function(){abortBlur||blurTarget();abortBlur=false;},0);}else{abortBlur=false;}});if(valueElement){var updateField=function(){THIS.fromString(valueElement.value,leaveValue);dispatchImmediateChange();};jscolor.addEvent(valueElement,'keyup',updateField);jscolor.addEvent(valueElement,'input',updateField);jscolor.addEvent(valueElement,'blur',blurValue);valueElement.setAttribute('autocomplete','off');}
if(styleElement){styleElement.jscStyle={backgroundImage:styleElement.style.backgroundImage,backgroundColor:styleElement.style.backgroundColor,color:styleElement.style.color};}
switch(modeID){case 0:jscolor.requireImage('hs.png');break;case 1:jscolor.requireImage('hv.png');break;}
jscolor.requireImage('cross.gif');jscolor.requireImage('arrow.gif');this.importColor();}};"use strict";window.TableComponentCallbackManager=Class.create({initialize:function($head,$body,options){this.$head=$head;this.$body=$body;this.options={rowClick:false,loadingMessage:''};Object.extend(this.options,options||{});this.prepareObserver();this.$body.select('.autostart').invoke('simulate','click');},prepareObserver:function(){if(this.options.order){this.$head.on('click','[data-action]',this.dispatch.bindAsEventListener(this));}
if(this.options.rowClick){this.$body.select('[data-action]').invoke('on','click',this.dispatch.bindAsEventListener(this));}
else{this.$body.on('click','[data-action]',this.dispatch.bindAsEventListener(this));}},dispatch:function(ev){var $element=ev.findElement('[data-action]');ev.stopPropagation();switch($element.readAttribute('data-action')){case'order-by-column':this.orderByColumn($element);break;case'load-ndo-state':this.loadNDOState($element);break;case'load-livestatus-state':this.loadLivestatusState($element);break;}},orderByColumn:function($el){var urlParts=document.location.href.parseQuery();if($el.tagName=='IMG'){$el=$el.next();}
urlParts.orderBy=$el.readAttribute('data-order-field');urlParts.orderByDir=($el.readAttribute('data-order-direction')=='ASC'?'DESC':'ASC');document.location.href=window.www_dir+'?'+Object.toQueryString(urlParts);},loadNDOState:function($button){var $parent=$button.up(),objectID=$button.readAttribute('data-object-id');$button.disable().update(new Element('img',{src:window.dir_images+'ajax-loading.gif',className:'mr5'})).insert(new Element('span').update(this.options.loadingMessage));new Ajax.Request('?call=monitoring_ndo&ajax=1&func=load_ndo_state',{method:'post',parameters:{objID:objectID},onSuccess:function(xhr){var json=xhr.responseJSON;if(json.success){if(json.data){$parent.update(display_monitoring_state(json.data));}
else{$parent.addClassName('text-neutral-400').update('-');}}
else{$parent.addClassName('text-red').update(json.message||'-');}}.bind(this)});},loadLivestatusState:function($button){var $parent=$button.up(),objectID=$button.readAttribute('data-object-id');$button.disable().update(new Element('img',{src:window.dir_images+'ajax-loading.gif',className:'mr5'})).insert(new Element('span').update(this.options.loadingMessage));new Ajax.Request('?call=monitoring_livestatus&ajax=1&func=load_livestatus_state',{method:'post',parameters:{objID:objectID},onSuccess:function(xhr){var json=xhr.responseJSON;if(json.success){if(json.data){$parent.update(display_monitoring_state(json.data));}
else{$parent.addClassName('text-neutral-400').update('-');}}
else{$parent.addClassName('text-red').update(json.message||'-');}}.bind(this)});}});"use strict";function getWindowWidth(){return(self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0);}
function getWindowHeight(){return(self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0);}
function getDocumentWidth(){return Math.min(document.body.scrollWidth,getWindowWidth());}
function getDocumentHeight(){return Math.max(document.body.scrollHeight,getWindowHeight());}
function show_content_overlay(){}
function hide_overlay(){$('overlay').hide();}
function show_overlay(){var $overlay=$('overlay');if($overlay){if(Prototype.Browser.IE){$overlay.show().writeAttribute('style','opacity:0.4;filter:alpha(opacity=40);');}else{$overlay.show().setStyle({opacity:0.4});}}}
if(!Date.hasOwnProperty('is_leap_year')){Date.prototype.is_leap_year=function(){var year=this.getFullYear();return((year%4===0&&year%100!==0)||year%400===0);};}
if(!Date.hasOwnProperty('get_days_in_month')){Date.prototype.get_days_in_month=function(){return[31,(this.is_leap_year()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];};}
if(!String.hasOwnProperty('linkMailtosInString')){String.prototype.linkMailtosInString=function(){return this.replace(/(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b)/ig,'<a href="mailto:$1">$1</a>');};}
if(!String.hasOwnProperty('clean')){String.prototype.clean=function(){return this.replace(/\W/ig,'');};}
if(!String.hasOwnProperty('stripNonNumeric')){String.prototype.stripNonNumeric=function(){return this.replace(/([^,\.\d])*/ig,'');};}
if(!String.hasOwnProperty('toNumber')){String.prototype.toNumber=function(){var number=this.trim(),minus=(number.substr(0,1)==='-');number=number.stripNonNumeric();if(number.empty()){return 0;}
if(number.split('.').length>2){number=number.replace(/\./g,'');}
if(number.split(',').length>2){number=number.replace(/,/g,'');}
if(number.indexOf('.')>=0||number.indexOf(',')>=0){if(number.indexOf('.')>number.indexOf(',')){number=number.replace(',','');}else if(number.indexOf('.')<number.indexOf(',')){number=number.replace('.','');number=number.replace(',','.');}else if(number.indexOf('.')===-1&&number.indexOf(',')>=0){number=number.replace(',','.');}}
number=parseFloat(number.replace(',','.'));if(isNaN(number)){return 0;}
if(minus){number*=-1;}
number=number.toFixed(4);return number;}}
function $N(name){return $('body').select('[name="'+name+'"]');}
Element.prototype.html=function(html,config){while(this.lastChild){this.removeChild(this.lastChild);}
this.innerHTML=html;this.initScripts(config&&config.scripts);};Element.prototype.initScripts=function(config){var selector=typeof config==='string'?config:((config&&config.selector)||'script');if(config&&config.skip){return;}
this.select(selector).forEach(function(script){if(script.hasAttribute('src')){document.body.insert(script);}else if(script.innerHTML){eval(script.innerHTML);}else{console.err('Cannot initialize script',script);}});};Array.prototype.in_array=function(needle){for(var i=0;i<this.length;i++){if(this[i]===needle){return true;}}
return false;};if(!Array.prototype.hasOwnProperty('sum')){Array.prototype.sum=function(){for(var total=0,l=this.length;l--;total+=this[l]){}
return total;}}
if(!Element.prototype.hasOwnProperty('getDataAttributes')){Element.prototype.getDataAttributes=function(){var i,attributes={};for(i in this.attributes){if(Object.isString(this.attributes[i].localName)&&this.attributes[i].localName.startsWith('data-')){attributes[this.attributes[i].localName.substring(5)]=this.attributes[i].nodeValue;}}
return attributes;}}
if(!String.prototype.hasOwnProperty('repeat')){String.prototype.repeat=function(count){if(count<1){return'';}
var result='',pattern=this.valueOf();while(count>1){if(count&1){result+=pattern;}
count>>=1,pattern+=pattern;}
return result+pattern;};}
if(!String.prototype.hasOwnProperty('encodeHTML')){String.prototype.encodeHTML=function(){return this.replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/ä/g,'&auml;').replace(/ö/g,'&ouml;').replace(/ü/g,'&uuml;').replace(/Ä/g,'&Auml;').replace(/Ö/g,'&Ouml;').replace(/Ü/g,'&Uuml;');};}
if(!String.prototype.hasOwnProperty('decodeHTML')){String.prototype.decodeHTML=function(){return this.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&auml;/g,'ä').replace(/&ouml;/g,'ö').replace(/&uuml;/g,'ü').replace(/&Auml;/g,'Ä').replace(/&Ouml;/g,'Ö').replace(/&Uuml;/g,'Ü');};}
if(!String.prototype.hasOwnProperty('toInt')){String.prototype.toInt=function(base){return parseInt(this,base||10);};}
if(!String.prototype.hasOwnProperty('toFloat')){String.prototype.toFloat=function(){return parseFloat(this);};}
function load_ndo_state_in_list(el){var obj_id=el.up('tr').readAttribute('data-objectid'),url=el.readAttribute('data-url'),td=el.up('td').update(new Element('img',{className:'vam mr5',src:window.dir_images+'ajax-loading.gif'}));new Ajax.Request(url,{method:'post',parameters:{objID:obj_id},onSuccess:function(transport){var json=transport.responseJSON;if(json.success&&json.data){td.update(display_monitoring_state(json.data));}else{td.addClassName('text-red').update(json.message||'-');}}});}
function load_livestatus_state_in_list(el){var obj_id=el.up('tr').readAttribute('data-objectid'),url=el.readAttribute('data-url'),td=el.up('td').update(new Element('img',{className:'vam mr5',src:window.dir_images+'ajax-loading.gif'}));new Ajax.Request(url,{method:'post',parameters:{objID:obj_id},onSuccess:function(transport){var json=transport.responseJSON,img=new Element('img',{className:'ml5 vam'});if(json.success&&json.data){td.update(display_monitoring_state(json.data));}else{td.addClassName('text-red').update(json.message||'-');}}});}
function display_monitoring_state(data,el){var $el=el;if(Object.isUndefined($el)){$el=new Element('p');}
if(data===null){return $el}
if(data.hasOwnProperty('host_state')&&data.host_state!==null){$el.addClassName(data.host_state.color||'').update(new Element('span',{className:'vam'}).update(data.host_state.state));if(data.host_state.hasOwnProperty('icon')){$el.insert({top:new Element('img',{className:'vam mr5',src:window.dir_images+data.host_state.icon})});}}else if(data.hasOwnProperty('state')&&data.state!==null){$el.addClassName(data.state.color||'').update(new Element('span',{className:'vam'}).update(data.state.state));if(data.state.hasOwnProperty('icon')){$el.insert({top:new Element('img',{className:'vam mr5',src:window.dir_images+data.state.icon})});}}else if(data.state===null||data.host_state===null){$el.update(new Element('img',{className:'vam mouse-help',src:window.dir_images+'axialis/basic/button-help.svg',title:'No data found...'}));}
return $el;}
function is_json_response(response,notify){var is_json=response.hasOwnProperty('responseJSON')&&!Object.isUndefined(response.responseJSON);if(!!notify&&!is_json){idoit.Notify.error('The request did not answer with proper JSON:'+response.responseText,{sticky:true});}
return is_json;}
function isNumeric(n){return!isNaN(parseFloat(n))&&isFinite(n);}
function checkipv6(str){return(/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(str));}
function isys_glob_disable_save(){const $button=$('navbar_item_C__NAVMODE__SAVE');if($button){$button.disable();const onClick=$button.readAttribute('onclick');if(onClick){$button.writeAttribute('data-onclick',onClick);$button.writeAttribute('onclick',null);}}}
function isys_glob_enable_save(){const $button=$('navbar_item_C__NAVMODE__SAVE');if($button){$button.enable();const onClick=$button.readAttribute('data-onclick');if(onClick){$button.writeAttribute('onclick',onClick);$button.writeAttribute('data-onclick',null);}}}
function ip2long(ip_address){var ip_arr=ip_address.split('.'),iplong=0;with(Math){iplong=ip_arr[0]*pow(256,3)+ip_arr[1]*pow(256,2)+ip_arr[2]*pow(256,1)+ip_arr[3]*pow(256,0);}
return iplong;}
function long2ip(iplong){with(Math){var ip1=floor(iplong / pow(256,3));var ip2=floor((iplong%pow(256,3))/ pow(256,2));var ip3=floor(((iplong%pow(256,3))%pow(256,2))/ pow(256,1));var ip4=floor((((iplong%pow(256,3))%pow(256,2))%pow(256,1))/ pow(256,0));}
return ip1+'.'+ip2+'.'+ip3+'.'+ip4;}
function validate_ipv4(ip){var parts=ip.split('.'),bad_ip=false;if(parts.length!=4){bad_ip=true;}
if(!(parts[0]>=0&&parts[0]<=255)){bad_ip=true;}
if(!(parts[1]>=0&&parts[1]<=255)){bad_ip=true;}
if(!(parts[2]>=0&&parts[2]<=255)){bad_ip=true;}
if(!(parts[3]>=0&&parts[3]<=255)){bad_ip=true;}
return!bad_ip;}
function purge_object(navmode,ajax,message){var objects=list_selection();if(objects.length==0){toggleButton('navbar_item_C__NAVMODE__QUICK_PURGE','axialis/industry-manufacturing/waste-bin.svg');toggleButton('navbar_item_C__NAVMODE__PURGE','axialis/industry-manufacturing/waste-bin.svg');return false;}
var jsonClient=new idoit.JSONClient();jsonClient.getRelationsByObjectId(objects.join(';'),function(response){var json=response.responseJSON,output='';if(response.responseText!='[]'){output+='\n'+json.join('\n');if(confirm(message+'\n'+output)){document.isys_form.navMode.value=navmode;replace_listSelection();if(ajax){form_submit();}else{$('isys_form').submit();}}else{toggleButton('navbar_item_C__NAVMODE__QUICK_PURGE','axialis/industry-manufacturing/waste-bin.svg');}}else{document.isys_form.navMode.value=navmode;replace_listSelection();if(ajax){form_submit();}else{$('isys_form').submit();}}},{});}
function toggleButton(button,icon){const $button=$(button);if($button){if(icon&&$button.down('img')){$button.down('img').removeClassName('animation-rotate').setAttribute('src',window.dir_images+icon);}
$button.toggleClassName('navbar_item_inactive');if($button.tagName==='BUTTON'){if($button.hasClassName('navbar_item_inactive')){$button.disable();}else{$button.enable();}}}}
function updateDialogList(p_fromID,p_toID){$(p_toID).value=$(p_fromID).getValue().join(',');}
function list_selection(){var $tableIds=$$('[name="table_ids[]"]');return $tableIds.filter(function($input){return $input.checked}).invoke('getValue');}
function replace_listSelection(id){var $container=$(id||'scroller'),selection=list_selection(),i;$container.select('.entry-selection').invoke('remove');for(i in selection){if(selection.hasOwnProperty(i)){$container.insert(new Element('input',{type:'hidden',className:'entry-selection',name:'id[]',value:selection[i]}));}}}
function get_listSelection4Submit(){var l_result=[];var l_selection=list_selection();var l_selection4Submit={};if(l_selection.length){l_result['id[]']=l_selection;}
return l_result;}
function get_current_page(){var queryParams=document.location.href.toQueryParams();if(queryParams.hasOwnProperty('page')){return parseInt(queryParams.page);}
if($('current_page')){return $F('current_page');}
if($('data-grid-mainList-page-current')){return $F('data-grid-mainList-page-current');}
return 1;}
function get_current_filter(){var filter={},filterFields=$$('[name^="tableFilter"]:not([readonly])'),i;if(typeof retrieveUrlPartsFiltered==='function'){var urlParts=retrieveUrlPartsFiltered();Object.keys(urlParts).forEach(function(index){if(index.indexOf('tableFilter[')>-1){filter[index]=urlParts[index];}});}
if(filterFields.length){for(i in filterFields){if(!filterFields.hasOwnProperty(i)){continue;}
if(!filterFields[i].getValue()||filterFields[i].getValue().blank()){continue;}
filter[filterFields[i].name]=filterFields[i].getValue().trim();}}
return Object.toQueryString(filter);}
var delay=(function(){var timer={};return function(callback,ms,context){context=context||'';clearTimeout(timer[context]);timer[context]=setTimeout(callback,ms);};})();var queue=function(funcs,scope){(function next(){if(funcs.length>0){funcs.shift().apply(scope||{},[next].concat(Array.prototype.slice.call(arguments,0)));}})();};window.get_shares_from_object=function get_shares_from_object(obj_id,receiver){if(obj_id.blank()){$(receiver).update(new Element('option',{value:'-1',selected:true}).insert('-'));}
new Ajax.Request('?call=share&func=get_shares_by_obj&ajax=1',{parameters:{'objID':obj_id},method:'post',onComplete:function(response){var i,json=response.responseJSON,share=$(receiver).update(new Element('option',{value:'-1',selected:true}).insert('-'));if(json.success&&is_json_response(response)){for(i in json.data){if(json.data.hasOwnProperty(i)){share.insert(new Element('option',{value:json.data[i].id}).update(json.data[i].val));}}}else{idoit.Notify.error(json.message||response.responseText,{sticky:true});}}});};window.toggle_nagios_service_inheritance=function($button,host_obj_id,service_obj_id){$button.removeClassName('text-red').removeClassName('text-green').down('img').writeAttribute('src',window.dir_images+'ajax-loading.gif').next('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__LOADING'));new Ajax.Request('?call=nagios&func=toggle_inherited_service&ajax=1',{parameters:{'host':host_obj_id,'service':service_obj_id},method:'post',onComplete:function(response){var json=response.responseJSON;if(json.success&&is_json_response(response)){if(json.data.will_be_exported){$button.addClassName('text-green').down('img').writeAttribute('src',window.dir_images+'icons/silk/tick.png').next('span').update(idoit.Translate.get('LC__UNIVERSAL__YES'));}else{$button.addClassName('text-red').down('img').writeAttribute('src',window.dir_images+'icons/silk/cross.png').next('span').update(idoit.Translate.get('LC__UNIVERSAL__NO'));}}else{idoit.Notify.error(json.message||response.responseText,{sticky:true});}}});};window.toggle_primary_contact=function($button,cat_row_id,obj_id){$button.up('table').select('button.primary-button').invoke('removeClassName','text-green').invoke('addClassName','text-red').invoke('down','img').invoke('writeAttribute','src',window.dir_images+'axialis/basic/symbol-cancel.svg').invoke('next','span').invoke('update',idoit.Translate.get('LC__UNIVERSAL__NO'));$button.removeClassName('text-red').removeClassName('text-green').down('img').addClassName('animation-rotate').writeAttribute('src',window.dir_images+'axialis/user-interface/loading.svg').next('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__LOADING'));new Ajax.Request('?call=update_contact_primary&ajax=1',{parameters:{'id':cat_row_id,'objID':obj_id},method:'post',onSuccess:function(transport){var json=transport.responseJSON;if(json.success){if(json.data.is_primary){$button.removeClassName('text-red').addClassName('text-green').down('img').removeClassName('animation-rotate').writeAttribute('src',window.dir_images+'axialis/basic/symbol-ok.svg').next('span').update(idoit.Translate.get('LC__UNIVERSAL__YES'));}else{$button.removeClassName('text-green').addClassName('text-red').down('img').removeClassName('animation-rotate').writeAttribute('src',window.dir_images+'axialis/basic/symbol-cancel.svg').next('span').update(idoit.Translate.get('LC__UNIVERSAL__NO'));}}else{$button.addClassName('text-red').down('img').removeClassName('animation-rotate').writeAttribute('src',window.dir_images+'icons/silk/error.png').next('span').update('-');idoit.Notify.error(json.message);}}});};function run_prefix_method(obj,method){var p=0,m,t,browser_prefixes=['webkit','moz','ms','o',''];while(p<browser_prefixes.length&&!obj[m]){m=method;if(browser_prefixes[p]==''){m=m.substr(0,1).toLowerCase()+m.substr(1);}
m=browser_prefixes[p]+m;t=typeof obj[m];if(t!='undefined'){browser_prefixes=[browser_prefixes[p]];return(t=='function'?obj[m]():obj[m]);}
p++;}}
function request_fullscreen($el){if(run_prefix_method(document,'FullScreen')||run_prefix_method(document,'IsFullScreen')){run_prefix_method(document,'CancelFullScreen');}else{run_prefix_method($el,'RequestFullScreen');}}
function fillObject(obj,keys,value){var currentKey;if(Object.isString(keys)){keys=keys.split('.');}
currentKey=keys.shift();if(!obj.hasOwnProperty(currentKey)){obj[currentKey]={};}
if(keys.length>0){obj[currentKey]=fillObject(obj[currentKey],keys,value);}else{obj[currentKey]=value;}
return obj;}
function openFullscreenPopup(tpl,params){var $popup=$('popup'),$overlay=$('overlay'),width=$overlay.getWidth()-100,height=$overlay.getHeight()-100;if(width<200){width=200;}
if(height<200){height=200;}
if(!$popup.visible()){get_popup('fullscreen','',width,height,{tpl:tpl,parameters:Object.toJSON(params)},null);}}
window.slugify=function(str){if(typeof str==='string'||str instanceof String){return str.toLowerCase().replaceAll(/[\W|\s]+/g,'-').replace(/(^-|-$)/,'');}
return'';}
Placeholder={counter_regex:/##COUNT(:-?\d+)?(:\d+)?##/g,iteration:0,process_counter_string:function(string,iteration){if(!this.counter_regex.test(string)){return string;}
if(!iteration){iteration=this.iteration++;}
iteration=parseInt(iteration);return string.replace(this.counter_regex,function(match,start,zeroes){var result,minus;if(!start){start=0;}else{start=parseInt(start.substr(1));}
result=iteration+start;minus=(result<0);if(zeroes){if(minus){result=Math.abs(result);}
zeroes=parseInt(zeroes.substr(1))+1;if(zeroes>(result+'').length){zeroes='0'.repeat(zeroes);result=(zeroes+result).slice(-zeroes.length);}
if(minus){result='-'+result;}}
return result;});}};Color={calc_rgb_from_hex:function calc_rgb_from_hex(hex,alpha){hex=hex.replace(/#/,'');if(hex.length!==6){return false;}
if(Object.isUndefined(alpha)){alpha=0;}
var red=hex.slice(0,2),green=hex.slice(2,4),blue=hex.slice(4);return[parseInt(red,16),parseInt(green,16),parseInt(blue,16),(alpha / 100.0)];},calc_hex_from_rgb:function calc_hex_from_rgb(red,green,blue,prepend){if(Object.isUndefined(prepend)){prepend='#';}
return prepend+('0'+red.toString(16)).substr(-2)+('0'+green.toString(16)).substr(-2)+('0'+blue.toString(16)).substr(-2);},render_rgb_from_hex:function render_rgb_from_hex(hex,alpha){if(Object.isUndefined(alpha)){alpha=null;}
var rgba=this.calc_rgb_from_hex(hex,alpha);if(rgba===false){return'';}
if(alpha===null){return'rgb('+rgba[0]+', '+rgba[1]+', '+rgba[2]+')';}
return'rgba('+rgba[0]+', '+rgba[1]+', '+rgba[2]+', '+rgba[3]+')';},retrieve_color_by_percent:function retrieve_color_by_percent(percent,prepend){if(Object.isUndefined(prepend)){prepend='#';}
var hue=percent*1.2 / 360;var rgb=this.hsl_to_rgb(hue,1,.5);return this.calc_hex_from_rgb(rgb[0],rgb[1],rgb[2],prepend);},hsl_to_rgb:function hsl_to_rgb(hue,saturation,lightness){var r,g,b;if(saturation==0){r=g=b=lightness;}else{var q=lightness<0.5?lightness*(1+saturation):lightness+saturation-lightness*saturation;var p=2*lightness-q;r=this.hue_to_rgb(p,q,hue+1 / 3);g=this.hue_to_rgb(p,q,hue);b=this.hue_to_rgb(p,q,hue-1 / 3);}
return[Math.floor(r*255),Math.floor(g*255),Math.floor(b*255)];},get_random_by_spectrum:function get_random_by_spectrum(colorname,as_hex){var hue,rgb;if(Object.isUndefined(as_hex)){as_hex=true;}
switch(colorname){case'red':hue=0;break;case'orange':hue=30;break;case'yellow':hue=60;break;case'yellowgreen':hue=90;break;case'green':hue=120;break;case'cyan':hue=150;break;case'babyblue':hue=180;break;case'skyblue':hue=210;break;case'blue':hue=240;break;case'purple':hue=270;break;case'magenta':hue=300;break;case'orchid':hue=330;break;}
rgb=this.hsl_to_rgb((((hue-10)+Math.random()*20)/ 360),((Math.random()*0.25)+0.5),((Math.random()*0.25)+0.3));if(as_hex){return this.calc_hex_from_rgb.apply(null,rgb);}else{return rgb;}},hue_to_rgb:function hue_to_rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1 / 6)return p+(q-p)*6*t;if(t<1 / 2)return q;if(t<2 / 3)return p+(q-p)*(2 / 3-t)*6;return p;},calc_color_light:function calc_color_light(hex){var rgb=this.calc_rgb_from_hex(hex);if(rgb===false){return false;}
return(Math.max(rgb[0],rgb[1],rgb[2])+Math.min(rgb[0],rgb[1],rgb[2]))/ 5.1;},random_rgb:function random_rgb(prepend){if(Object.isUndefined(prepend)){prepend='#';}
return prepend+('0'+(Math.random()*255).toString(16)).substr(-2)+
('0'+(Math.random()*255).toString(16)).substr(-2)+
('0'+(Math.random()*255).toString(16)).substr(-2);}};var rpool_callback=Prototype.emptyFunction,remove_from_pool=Prototype.emptyFunction,relpool_observer=Prototype.emptyFunction,changeCount=Prototype.emptyFunction,checkNeg=Prototype.emptyFunction,checkNaN=Prototype.emptyFunction;if(!Prototype.Browser.IE){Prototype.Browser.IE=/Trident\/|MSIE /.test(window.navigator.userAgent);}
var isWhitespaceChar=Prototype.emptyFunction,isDigitChar=Prototype.emptyFunction,compareRight=Prototype.emptyFunction,natcompare=Prototype.emptyFunction;var isys_ajax_queue={_sim_requests:15,_urls:[],_targets:[],_options:[],set_sim_requests:function(reqs){if(!isNaN(reqs))this._sim_requests=reqs;},push:function(p_url,p_options,p_target){this._urls.push(p_url);this._options.push(p_options);if(p_target==null||typeof p_target=='undefined')this._targets.push("__REQUEST_ONLY");else this._targets.push(p_target);this._next();},clear:function(){this._urls=[];this._targets=[];this._options=[];},_next:function(){if(Ajax.activeRequestCount<isys_ajax_queue._sim_requests){if(isys_ajax_queue._targets.first()=="__REQUEST_ONLY"){var junk=isys_ajax_queue._targets.shift();return new Ajax.Request(isys_ajax_queue._urls.shift(),isys_ajax_queue._options.shift());}else
return new Ajax.Updater(isys_ajax_queue._targets.shift(),isys_ajax_queue._urls.shift(),isys_ajax_queue._options.shift());}}};isys_ajax_=Class.create(Ajax.Base,{_method:'get',_asynchronous:true,_form:'isys_form',_url:'',_last:'',_ajax:function(){return(this._url.match(/^.*[\?].*$/))?'&ajax=1':'?ajax=1';},initialize:function(p_method,p_encoding,p_async){if(p_method)this._method=p_method;if(p_async)this._asynchronous=p_async;this._url=String(document.location);},initOptions:function(p_options){var options={history:{cache:true,onStateChange:function(state){}},asynchronous:this._asynchronous,evalScripts:true,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),onComplete:this.onComplete.bind(this)};Object.extend(options,p_options||{});return options;},method:function(p_method){_method=p_method;},add:function(p_url,p_target){this._url=p_url;if(!Object.isUndefined(History)){History.add([p_url,p_target,new Date()]);}},last:function(){if(!Object.isUndefined(History)){return History.last();}else return false;},_updater:function(p_target,p_url,p_options){if(!p_url||p_url==''){p_url=String(document.location);}
this._target=p_target;return isys_ajax_queue.push(p_url+this._ajax(),p_options,this._target);},_request:function(p_url,p_options){if(!p_url||p_url==''){p_url=String(document.location);}
return isys_ajax_queue.push(p_url+this._ajax(),p_options,null);},call:function(p_url,p_options){this._request(p_url,p_options);},_history:function(p_url,p_target,p_options){if(Object.isUndefined(p_options.history.id)){var id=(Object.isString(p_target))?p_target:p_target.id;}else{var id=p_options.history.id;}
var tmpOpt=Object.clone(Ajax.History.Features);Object.extend(tmpOpt,p_options.history);options.history=tmpOpt;options.history.__url=p_url+this._ajax();options.container=p_target;History.set(id,Ajax.History.observe('Updater',id,p_options.history.__url,p_options));},onSuccess:function(){if(p_reset_form&&$(p_form)){$(p_form).reset();}
if($(p_fade_out)){$(p_fade_out).disabled='disabled';new Effect.Fade($(p_fade_out),{duration:0.4});}},onComplete:Prototype.emptyFunction,onFailure:function(){$(this._target).update('Error.');}});Ajax.Submit=Class.create(isys_ajax_,{initialize:function(p_url,p_target,p_form,p_options){if(!p_url||p_url=='')p_url=this._url;this.add(p_url);if(!p_form||p_form=='')p_form=this._form;var l_params={};if(p_form&&$(p_form)){if(!p_options.parameters)p_options.parameters={};l_params=Object.extend(p_options.parameters,$(p_form).serialize(true));}
if(typeof p_options=='object'&&typeof p_options.method!='undefined'){Object.extend(p_options,{method:'post',history:false});}
var options=this.initOptions(p_options);options.parameters=l_params;return this._updater(p_target,p_url,options);}});Ajax.Call=Class.create(isys_ajax_,{initialize:function(p_url,p_options){var options=this.initOptions(p_options);this.add(p_url);options.history=false;return this._request(p_url,options);}});Ajax.Get=Class.create(isys_ajax_,{initialize:function(p_target,p_url,p_options){options=this.initOptions(p_options);Object.extend(options,p_options);this._url=p_url;if(options.history){return this._history(p_url,p_target,options);}
else{if(Object.isArray(p_target)){this._updater(p_target[1],p_target[0],options);if(!Object.isUndefined(History))History.back();}
else{return this._updater(p_target,p_url,options);}}}});Ajax.Effect=Class.create(isys_ajax_,{initialize:function(p_effect,p_target,p_url,p_options){this.add(p_url,p_target);this._options={duration:0.2};Object.extend(this._options,p_options||{});if(Object.isString(p_effect)){this._effect=p_effect;}
else return false;if(Object.isString(p_target)&&$(p_target))
this._target=p_target;options=this.initOptions(p_options);this._updater(p_target,p_url,options);},onComplete:function(transport){if(this._target){if(!$(this._target).visible()){new Effect[this._effect](this._target,this._options);}}}});var History={__altered:false,__currentHash:null,__previousHash:null,__iframe:false,__title:false,hash:new Hash(),maximum:25,setMaximum:function(p_max){if(Object.isNumber(p_max))
this.maximum=p_max;},back:function(){if(this._urls.length>2){this._urls.pop();this._urls.pop();return true;}else return false;},all:function(){return this._urls;},get:function(i){return this._urls[i];},go:function(i){var l_go=(this._urls.length>=i)?this._urls[this._urls.length+i]:false;if(l_go){return new Ajax.Get(l_go);}else return false;},prev:function(){return(this._urls.length>=2)?this._urls[this._urls.length-2]:false;},last:function(){return this._urls.last();},add:function(req){if(Object.isArray(req)&&Object.isString(req[0])){this._urls.push(req);if(this.maximum&&this.num()>this.maximum){this._urls.splice(0,1);}}},num:function(){return this._urls.size();},init:function(){var inst=this;var hash=location.hash.substring(1);this.hash=$H(hash.toQueryParams());this.__currentHash=hash;this.__previousHash=hash;this._urls=[];this.__title=document.title;if(Prototype.Browser.IE){document.observe('dom:loaded',function(e){if(!$('px-historyframe')){History.__iframe=new Element('iframe',{name:'px-historyframe',id:'px-historyframe',src:'',width:'0',height:'0',style:{visibility:'hidden'}});document.body.appendChild(History.__iframe);History.setHashOnIframe(inst.hash.toQueryString());}});}},add:function(){},set:function($name,$value){this.__previousHash=this.hash.toQueryString();this.hash.set($name,$value);this.apply();},get:function($name){return this.hash.get($name);},unset:function($name){this.hash.unset($name);this.apply();},update:function(){this.__previousHash=this.hash.toQueryString();var hash=window.location.hash.substring(1);if(Prototype.Browser.IE&&this.__iframe){var hashInFrame=this.getHashOnIframe();if(hashInFrame!=hash){hash=hashInFrame;}}
this.hash=$H(hash.toQueryParams());this.__currentHash=hash;},apply:function(){var newHash=this.hash.toQueryString();window.location.hash=newHash;if(Prototype.Browser.IE&&this.__iframe){if(this.__currentHash!=newHash){this.setHashOnIframe(newHash);}
else if(newHash!=this.getHashOnIframe()){this.setHashOnIframe(newHash);}}},isAltered:function(){if(this.__altered==true){return true;}
this.__altered=false;return(History.__currentHash!=History.__previousHash);},setHashOnIframe:function(hash){try{var doc=History.__iframe.contentWindow.document;doc.open();doc.write('<html><body id="history">'+hash+'</body></html>');doc.close();}catch(e){}},getHashOnIframe:function(){var doc=this.__iframe.contentWindow.document;if(doc&&doc.body.id=='history'){return doc.body.innerText;}else{return this.hash.toQueryString();}},setTitle:function(title){if(document.title){document.title=title;}},getTitle:function(){return this.__title;}};History.Registry={hash:new Hash(),set:function($config){if(typeof($config)!='object'){throw('History.Registry.set : $config must be a javascript object');}
if(!$config.id||!Object.isString($config.id)){throw('History.Registry.set : $config.id must be a string');}
if(!$config.onStateChange||!Object.isFunction($config.onStateChange)){throw('History.Registry.set : $config.onStateChange '
+'must be a javascript callback function');}
if(!$config.defaultValue||!Object.isString($config.defaultValue)){$config.defaultValue='';}
this.hash.set($config.id,$config);},get:function($id){return this.hash.get($id);},unset:function($id){this.hash.unset($id);}};History.Observer={delay:0.2,interval:null,started:false,start:function(){if(this.started)return;this.interval=new PeriodicalExecuter(History.Observer.dispatch,this.delay);this.started=true;},stop:function(){if(!this.started)return;this.interval.stop();this.started=false;},dispatch:function(){History.update();if(History.isAltered()){History.hash.each(function(pair){var registry=History.Registry.get(pair.key);if(registry){registry.onStateChange.bind(History)(pair.value);}});}}};Ajax.History={types:['Request','Updater','Appear'],observe:function($type,$id,$url,$options){var getter=Ajax.History.Registry.get($id);var currentVersion=0;var output=false;if(this.types.indexOf($type)==-1){throw('Ajax.History.observer() -> type '+$type+' is invalid !');}
if(getter==undefined){currentVersion=($options.history.state)?$options.history.state:0;var hash=new Hash();hash.set(currentVersion,$options);Ajax.History.Registry.set($id,hash);}else{currentVersion=($options.history.state)?$options.history.state:this.getCurrentVersion($id);getter.set(currentVersion,$options);}
this.addCallback($type,$id);return currentVersion;},addCallback:function($type,$id){History.Observer.start();History.__altered=true;if(!Object.isUndefined(History.Registry.get($id)))return;History.Registry.set({id:$id,onStateChange:function(state){var options=Ajax.History.Registry.get($id).get(state.toString());var request=null;if(Object.isUndefined(options))return;if(options.history.cache==true&&options.history.__request!=null){new Ajax.Cache(options.history.__request);}else{if($type=='Request'){request=isys_ajax_queue.push(options.history.__url,options,null);}else if($type=='Updater'){request=isys_ajax_queue.push(options.history.__url,options,options.container);}else if($type=='Appear'){request=new Ajax.Effect('appear',options.container,options.history.__url,options);}
options.history.__request=request;}
History.__altered=false;if(Object.isFunction(options.history.onStateChange)){options.history.onStateChange(state);}}});},getCurrentVersion:function($id){var getter=Ajax.History.Registry.get($id);return Object.isUndefined(getter)?0:getter.keys().length;}};Ajax.History.Registry=new Hash();Ajax.History.Features={id:null,state:false,cache:false,onStateChange:null,__url:null,__request:null};Ajax.Cache=Class.create(Ajax.Base,{_complete:false,initialize:function($super,request){$super(request.options);request._complete=false;this.transport=request.transport;this.request(request.url);return this;},request:function(url){this.url=url;this.method=this.options.method;var params=Object.clone(this.options.parameters);try{var response=new Ajax.Response(this);if(this.options.onCreate)this.options.onCreate(response);Ajax.Responders.dispatch('onCreate',this,response);if(this.options.asynchronous)this.respondToReadyState.bind(this).defer(1);this.onStateChange();}
catch(e){this.dispatchException(e);}}});Object.extend(Ajax.Cache.prototype,{respondToReadyState:Ajax.Request.prototype.respondToReadyState,onStateChange:Ajax.Request.prototype.onStateChange,success:Ajax.Request.prototype.getStatus,getStatus:Ajax.Request.prototype.getStatus,isSameOrigin:Ajax.Request.prototype.isSameOrigin,getHeader:Ajax.Request.prototype.getHeader,evalResponse:Ajax.Request.prototype.evalResponse,dispatchException:Ajax.Request.prototype.dispatchException});Ajax.Request=Class.create(Ajax.Request,{initialize:function($super,url,options){$super(url,options);return this;},abort:function(){if(this.transport.readyState===4){return;}
this.transport.onreadystatechange=Prototype.emptyFunction;this.transport.abort();if(Ajax.activeRequestCount<0){Ajax.activeRequestCount=0;}
else{Ajax.activeRequestCount--;}}});Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Updater=Class.create(Ajax.Updater,{initialize:function($super,container,url,options){$super(container,url,options);return this;}});Ajax.Responders.register({onCreate:function(response){if(!response.options){response.options={};}
if(!response.options.requestHeaders){response.options.requestHeaders={};}
if(C__TENANT_ID){response.options.requestHeaders['X-i-doit-Tenant-Id']=C__TENANT_ID;}},onComplete:isys_ajax_queue._next});Ajax.Responders.register({onComplete:function(response){if(window.C__AUTHORIZED&&response.transport){var authorized=response.transport.getResponseHeader('i-doit-Authorized');if(authorized!==null&&!authorized){window.location='?timeout';return;}}}});function aj_submit(p_url,p_method,p_target,p_form,p_fade_out,p_reset_form,p_success,p_complete,p_failure){var l_params='';if(!p_url||p_url=='')p_url=String(document.location);if(!p_method)p_method='get';if($(p_form)||p_method=='get'){if($(p_form)){l_params=$(p_form).serialize(true);}
if(p_url.search('^.*[\?].*$')!=-1)l_ajax='&ajax=1';else l_ajax='?ajax=1';isys_ajax_queue.push(p_url+l_ajax,{method:p_method,evalScripts:true,evalJS:true,onComplete:p_complete,onSuccess:function(transport){if(typeof p_success!='undefined')p_success(transport);if(!$(p_target).visible())$(p_target).show();if(p_reset_form&&$(p_form)){$(p_form).reset();}
if($(p_fade_out)){$(p_fade_out).disabled='disabled';new Effect.Fade($(p_fade_out),{duration:0.4});}},onFailure:function(){if(p_failure!='undefined')p_failure();$(p_target).innerHTML='Error.';},parameters:l_params},p_target);}}'use strict';if(!idoit){var idoit={};}
idoit.Require={params:{paths:{},debug:false,lastChange:''},loaded:[],config:function(config){this.params=config;return this;},addModule:function(moduleName,script){this.params.paths[moduleName]=script;return this;},require:function(modulesToLoad,onload){var i;if(typeof modulesToLoad==='string'){modulesToLoad=[modulesToLoad];}
for(i=0;i<modulesToLoad.length;++i){if(this.loaded.indexOf(modulesToLoad[i])!==-1){modulesToLoad.splice(i,1);i-=1;}}
if(!this.modulesLoaded(modulesToLoad,onload)){for(i=0;i<modulesToLoad.length;++i){var moduleName=modulesToLoad[i];if(this.params.paths.hasOwnProperty(moduleName)){var hasQuery=!new Element('a',{href:this.params.paths[moduleName]}).search.blank();var $script=document.createElement('script');$script.setAttribute('data-module',moduleName);$script.src=this.params.paths[moduleName]+(hasQuery?'&':'?')+this.params.lastChange;$script.async=true;$script.onload=this.onLoad.bind(this,moduleName,i,modulesToLoad,onload);document.head.appendChild($script);}}}},requireQueue:function(modulesToLoad,onload){function load(queue,results){if(queue.length){idoit.Require.require([queue.shift()],function(result){results.push(result);load(queue,results);});}else{if(Object.isFunction(onload)){onload();}}}
load(modulesToLoad,[]);},onLoad:function(moduleName,moduleIndex,modulesToLoad,onload,ev){if(this.params.debug){console.log('Module loaded: '+moduleName+' ('+Math.round(ev.timeStamp / 1000)+'ms; '+ev.path[0].src+')');}
modulesToLoad.splice(modulesToLoad.indexOf(moduleName),1);this.loaded.push(moduleName);this.modulesLoaded(modulesToLoad,onload);},modulesLoaded:function(modulesToLoad,onloadCallback){if(modulesToLoad.length===0){if(this.params.debug){console.log('Modules loaded:',this.loaded);}
if(Object.isFunction(onloadCallback)){onloadCallback();}
return true;}
return false;}};function CheckAllBoxes(me,classname){if(typeof classname=='undefined')classname='checkbox';if($('savedCheckboxes')){$('savedCheckboxes').value="";var data_container=$('savedCheckboxes').readAttribute("data-container");eval(data_container+"=[];");$$('input.'+classname).each(function(el){if(me.checked==""){el.checked="";}
else{el.checked="checked";eval(data_container+".push('"+el.value+"');");}});$('savedCheckboxes').value=JSON.stringify(eval(data_container));}
else{$$('input.'+classname).each(function(el){if(me.checked=="")el.checked="";else el.checked="checked";});}}
function mydoit_trigger(){const $myDoit=$('mydoitArea');const treeContentWidth=$('menuTreeOn').getWidth()+2;if($('contentArea').getStyle('left')==='0px'){new dragBar({dragContainer:'draggableBar',leftContainer:'menuTreeOn',rightContainer:'contentArea',moveInfoBox:true,defaultWidth:$('contentArea').readAttribute('data-default-width')}).activateBar();}
if(!$myDoit.loaded){aj_submit('index.php?request=mydoit','get','mydoitArea');$myDoit.loaded=true;}
if($myDoit.hasClassName('hide')){new Effect.Morph('mydoitArea',{style:'left:0px;',duration:0.5,beforeStart:function(){$myDoit.removeClassName('hide').setStyle('width:'+treeContentWidth+'px; left: -'+treeContentWidth+'px;');}});}else{new Effect.Morph('mydoitArea',{style:'left:-'+treeContentWidth+'px;',duration:0.5,afterFinish:function(){$myDoit.addClassName('hide');}});}}
function close_mydoit(){const $myDoit=$('mydoitArea');const treeContentWidth=$('menuTreeOn').getWidth();if($myDoit.loaded){new Effect.Morph('mydoitArea',{style:'left:-'+treeContentWidth+'px;',duration:0.5,afterFinish:function(){$myDoit.addClassName('hide');}});}}
function mydoit_addBookmark(){$('mydoitAction').setValue('add');var url_params=Object.toQueryString(String(document.location).parseQuery());new Ajax.Submit(window.www_dir+'?request=mydoit_addBookmark&call=mydoit'+'&'+url_params,'mydoitArea','isys_form',{'history':false});}
function mydoit_deleteBookmark(){$('mydoitAction').setValue('delete');aj_submit('?request=mydoit_deleteBookmark','post','mydoitArea','isys_form',null,null);}
function mydoit_openSearchModul(ModuleConst,ModuleID,Searchfavorites){if(ModuleConst&&ModuleConst.length>0&&ModuleID&&ModuleID.length>0){window.location.href="?"+ModuleConst+"="+ModuleID+"&searchfavorites="+Searchfavorites;}}
function mysearch_delCriterion(){aj_submit('?request=mysearch_delCriterion','post','mydoitArea','isys_form',null,null);}
if(!Number.hasOwnProperty('roundWithDecimals')){Number.prototype.roundWithDecimals=function(decimals){return Number((Math.round(this+"e"+decimals)+"e-"+decimals));};}
if(!idoit)var idoit={};idoit.Translate=new Hash();idoit.callbackManager={callbacks:{},registerCallback:function(name,callback,context){if(Object.isFunction(callback)){this.callbacks[name]=[callback,context||null];}
return this;},triggerCallback:function(name){if(this.callbacks.hasOwnProperty(name)){try{this.callbacks[name][0].apply(this.callbacks[name][1],Array.prototype.slice.call(arguments,1));}catch(e){idoit.Notify.error(e.message);}}
return this;}};idoit.Suggest=Class.create({suggestion:null,initialize:function(method,el,el_hidden,p_options){if(document.getElementsByName(el)[0]||$(el)){var element=($(el))?$(el):document.getElementsByName(el)[0];var rnd=Math.floor(Math.random()*9999),el_choices='l_choices'+rnd,url='?ajax=1&call=suggest&method='+method;element.up().insert(new Element('div',{id:el_choices,className:'autocomplete'})).insert(new Element('span',{id:'indicator'+rnd,className:'indicator',style:'display:none'}).update(new Element('img',{src:window.dir_images+'axialis/user-interface/loading.svg',className:'animation-rotate',alt:'Loading'})));var options={paramName:'search',minChars:2,indicator:'indicator'+rnd,$indicatorElement:element,afterUpdateElement:function(text,li){if(el_hidden&&document.getElementsByName(el_hidden)[0]){document.getElementsByName(el_hidden)[0].value=li.id;}
if(typeof p_options.selectCallback=='function'){p_options.selectCallback(text,li);}
else if(p_options.selectCallback){eval(p_options.selectCallback);}}};Object.extend(options,p_options||{});options.parameters=$H(options.parameters).toQueryString();this.suggestion=new Ajax.Autocompleter(element,el_choices,url,options);}
else{throw new Error('Element '+el+' not found.')}}});idoit.JSONClient=Class.create({jsonGetString:'?call=json',initialize:function(parameters){this.parameters={};Object.extend(this.parameters,parameters||{useAuth:false});this.useAuth(this.parameters.useAuth);},useAuth:function(auth){this.parameters.useAuth=!!auth;this.jsonGetString=(this.parameters.useAuth?'?call=json&useAuth=1':'?call=json');},post:function(url,parameters,callback){return this.call(url,callback,{parameters:parameters,method:'post'});},call:function(url,callback,options){if(!callback)callback=Prototype.emptyFunction;Object.extend(this.parameters,options.parameters||{});this.options={method:'get',evalJSON:true,parameters:this.parameters,requestHeaders:{Accept:'application/json'},onSuccess:callback};Object.extend(this.options,options||{});if(options&&'select'in options){this.options.parameters.select=Object.toJSON(options.select);delete options.select;}
new Ajax.Call(url,this.options);return true;},getObjectsByCustomBrowserRequest:function(request,callback,options){return this.call(this.jsonGetString+'&action=getObjectsByCustomBrowserRequest&request='+Object.toJSON(request),callback,options);},getRelationsByObjectId:function(request,callback,options){if(request){Object.extend(options,{'request':request});}
return this.post(this.jsonGetString+'&action=getRelationsByObjectId',options,callback);},createObject:function(p_objectTitle,p_objectTypeID,p_callback,useDefaultTemplate){return this.post(this.jsonGetString+'&action=createObject',{objectTitle:p_objectTitle,objectTypeID:p_objectTypeID,useDefaultTemplate:(useDefaultTemplate?1:0)},p_callback);},createObjectGroup:function(p_objectGroupTitle,p_objectIDs,p_forceOverwrite,p_callback){return this.post(this.jsonGetString+'&action=createObjectGroup',{objectTitle:p_objectGroupTitle,forceOverwrite:p_forceOverwrite,objects:p_objectIDs},p_callback);},getRightsByObjectTypeId:function(p_objectTypeID,p_right,p_callback){return this.post(this.jsonGetString+'&action=hasEditRightsByObjectType',{objTypeID:p_objectTypeID,right:p_right},p_callback);}});window.idoitJSON=new idoit.JSONClient({raw:true});if(!String.prototype.format){String.prototype.format=function(){var args=arguments;return this.replace(/{(\d+)}/g,function(match,number){return typeof args[number]!='undefined'?args[number]:match;});};}
document.observe('keydown',function(ev){window.keyPressed=ev.keyCode;if(ev.keyCode===16){window.keyPressedShift=true;}else if(ev.keyCode===13){window.keyPressedEnter=true;}});document.observe('keyup',function(ev){window.keyPressed=null;if(ev.keyCode===16){window.keyPressedShift=false;}else if(ev.keyCode===13){window.keyPressedEnter=false;}});document.observe('mousemove',function(ev){window.mouseX=ev.pageX;window.mouseY=ev.pageY;});if(!Browser)var Browser={};Browser.objectList=Class.create(TableOrderer,{parameters:{form:'browser',minLen:2},searchString:'',initialize:function(element,params){this.element=element;this.defaultSelection=new Hash({isys_obj__id:'__checkbox__',isys_obj__title:idoit.Translate.get('LC__CMDB__LOGBOOK__TITLE'),isys_obj_type__title:idoit.Translate.get('LC__CMDB__CATG__TYPE'),isys_obj__sysid:idoit.Translate.get('LC__CMDB__CATG__SYSID')});Object.extend(this.parameters,params||{cmdb_filter:'',browserFilter:{},customFilter:{},urlBase:'/',returnElement:'',objectBrowserName:''});if(!this.parameters.jsonClient){this.parameters.jsonClient=new idoit.JSONClient();}
this.options=Object.extend({data:[],url:false,allowMultiselect:false,unsortedColumn:[],dateFormat:'d',filter:'top',pageCount:25,paginate:'top',search:false,objectSelectionCallback:'browserPreselection.select',firstSelection:false,secondSelection:false,secondSelectionExists:false,classPrefix:'prototools',instanceName:'objectList',useAuth:false,quickinfo:{active:true,delay:0.5}},this.parameters.listOptions||{});this.tools={page:1,pages:1,filterCol:'',filterData:'',searchData:''};this.msgs={loading:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__LOADING'),emptyResults:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__EMPTY_RESULTS'),errorURL:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__ERROR_URL'),errorData:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__ERROR_DATA'),searchLabel:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__SEARCH_LABEL'),filterLabel:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__FILTER_LABEL'),paginationOf:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__PAGINATEN_OF'),paginationPages:idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__PAGINATEN_PAGES'),paginationFirst:idoit.Translate.get('LC__UNIVERSAL__PAGER__FIRST_PAGE'),paginationPrev:idoit.Translate.get('LC__UNIVERSAL__PAGER__PREVIOUS_PAGE'),paginationNext:idoit.Translate.get('LC__UNIVERSAL__PAGER__NEXT_PAGE'),paginationLast:idoit.Translate.get('LC__UNIVERSAL__PAGER__LAST_PAGE'),minLen:'Bitte mehr als {0} Zeichen eingeben.'};this.cache=[];this.isCached=false;this.container=$(this.element);this.orderField=false;this.order='asc';this.thClickbfx=this.thClick.bindAsEventListener(this);this.thOverbfx=this.thOver.bindAsEventListener(this);this.thOutbfx=this.thOut.bindAsEventListener(this);if(this.options.useAuth){this.parameters.jsonClient.useAuth(this.options.useAuth);}},performDataMatch:function(header,data){var i,j,object,map=[],result=[],replaceTablePlaceholders=new ReplacePlaceholders({linkObjects:false});for(i in header){if(!header.hasOwnProperty(i)){continue;}
if(map.indexOf(header[i])===-1){map.push(header[i]);}else{header[i]+=' ';while(map.indexOf(header[i])!==-1){header[i]+=' ';}
map.push(header[i])}}
for(i in data){if(!data.hasOwnProperty(i)){continue;}
object={};for(j in data[i]){if(!data[i].hasOwnProperty(j)){continue;}
if(Object.isString(data[i][j])){data[i][j]=replaceTablePlaceholders.replacePlaceholdersInCell(data[i][j]||"");}
object[header[j]]=data[i][j];}
result.push(object);}
return result;},performingRequest:null,performRequest:function(url,additionalData){if($('portList')){$('portList').update('');}
$(this.element).update(new Element('p',{className:'emptyPageMessage text-neutral-200'}).update(idoit.Translate.get('LC__UNIVERSAL__LOADING')));if(this.performingRequest){this.performingRequest.abort();}
this.performingRequest=new Ajax.Request(this.parameters.urlBase+url,{parameters:{filter:JSON.stringify(this.parameters.browserFilter),customFilter:JSON.stringify(this.parameters.customFilter),additionalData:JSON.stringify(additionalData),output:'objects',key:(this.parameters.objectBrowserName||this.parameters.returnElement.replace(/__HIDDEN$/,''))},onComplete:function(xhr){var json=xhr.responseJSON;if(json.success){this.data=this.performDataMatch(json.data.header,json.data.data);if(this.data&&this.data.length>0){if(this.parameters.defaultSortingField!==null&&Object.isNumber(this.parameters.defaultSortingField)){this.orderField=json.data.header[1+parseInt(this.parameters.defaultSortingField)];this.order=this.parameters.defaultSortingDirection;}
this.perform();if($$(':focus').length===0&&$(this.table.id+'-filter-data')){$(this.table.id+'-filter-data').focus();}
if(this.options.colgroup){this.table.insert({top:this.options.colgroup});}}else{this.showError(this.msgs.emptyResults);}}else{this.showError(json.message||xhr.responseText);}}.bind(this)});},searchByType:function(objectTypeID){objectTypeID=parseInt(objectTypeID);if(isNaN(objectTypeID)||parseInt(objectTypeID)<=0){this.showError(this.msgs.emptyResults);return;}
this.performRequest('cmdb/browse/objectType/'+objectTypeID);},searchByGroup:function(objID){objID=parseInt(objID);if(isNaN(objID)||parseInt(objID)<=0){this.showError(this.msgs.emptyResults);return;}
this.performRequest('cmdb/browse/objectGroup/'+objID);},searchByPersonGroup:function(objID){objID=parseInt(objID);if(isNaN(objID)||parseInt(objID)<=0){this.showError(this.msgs.emptyResults);return;}
this.performRequest('cmdb/browse/personGroup/'+objID);},searchByRelationType:function(relationType){relationType=parseInt(relationType);if(isNaN(relationType)||parseInt(relationType)<=0){this.showError(this.msgs.emptyResults);return;}
this.performRequest('cmdb/browse/relationType/'+relationType);},searchByTimeCondition:function(condition){if(condition==='-1'){this.showError(this.msgs.emptyResults);return;}
this.performRequest('cmdb/browse/date/'+condition);},searchByCustomCondition:function(condition,additionalData){this.performRequest('cmdb/browse/customCondition/'+condition,additionalData);},search:function($searchField){var searchString;if(!$searchField){return;}
searchString=$searchField.getValue();if(searchString.length>this.parameters.minLen){if(this.searchString===searchString){return;}
this.searchString=searchString;this.performRequest('cmdb/browse/search/'+encodeURIComponent(encodeURIComponent(this.searchString)));}else{this.showError(this.msgs.minLen.replace('{0}',this.parameters.minLen));}},showError:function(message){$(this.element).update(new Element('p',{className:'emptyPageMessage text-neutral-200'}).update(new Element('img',{src:window.dir_images+'outlet.png'})).insert(' '+message));},initList:function(r){if(r.responseJSON){this.data=r.responseJSON;if(this.data&&this.data.length>0){this.perform();if($(this.table.id+'-filter-data')){$(this.table.id+'-filter-data').focus();}
if(this.options.colgroup){this.table.insert({top:this.options.colgroup});}}else{this.showError(this.msgs.emptyResults);}}}});Browser.preselection=Class.create({selectedObjects:[],options:{preselection:[],ajaxURL:'',afterRemove:Prototype.emptyFunction,afterFinish:Prototype.emptyFunction,instanceName:'preselection',urlBase:'',multiselection:false,$selectionCounter:null},initialize:function(element,options){this.$element=$(element);this.secondElement=('secondElement'in options)?$(options.secondElement):false;this.secondList=('secondList'in options)?options.secondList:false;Object.extend(this.options,options||{});this.options.$selectionCounter=$(this.options.$selectionCounter);},setSelection:function(selection){if(!Object.isArray(selection)){selection=[selection];}
if(!this.options.multiselection){selection=selection.slice(0,1);}
this.selectedObjects=selection.map(function(id){return parseInt(id);});this.updateCounter();this.renderTable();if(this.selectedObjects.length){this.log(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__PRESELECTED_OBJECTS').replace('{0}',this.selectedObjects.length));}
return this;},getSelection:function(){return this.selectedObjects;},isMultiselection:function(){return!!this.options.multiselection;},select:function(id){id=parseInt(id);if(this.options.multiselection&&!this.exists(id)){this.selectedObjects.push(id);this.log(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__OBJECT_HAS_BEEN_ADDED').replace('{0}','#'+id));}else{this.selectedObjects=[id];this.log(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__OBJECT_SELECTED').replace('{0}','#'+id));}
this.updateCounter();delay(this.renderTable.bind(this),1000,'object-browser.render');return this;},exists:function(id){return this.selectedObjects.in_array(parseInt(id));},remove:function(id){var $row=this.$element.down('[data-id="'+id+'"]');this.selectedObjects=this.selectedObjects.without(parseInt(id));this.updateCounter();if(this.selectedObjects.length===0){this.renderTable();}else if($row){$row.remove();}
this.options.afterRemove();},remove_all:function(){this.selectedObjects=[];this.updateCounter();this.renderTable();this.options.afterRemove();},renderTable:function(){if(!(this.options.multiselection&&this.getSelection().length||!this.options.multiselection&&this.getSelection()>0)){this.log(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__NO_PRESELECTION'));this.$element.update(new Element('p',{className:'box-blue p5 m5'}).update(new Element('img',{src:window.dir_images+'axialis/basic/button-info.svg',className:'mr5 vam'})).insert(new Element('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__NO_PRESELECTION'))));if(this.options.afterFinish){this.options.afterFinish(this);}
return;}
this.$element.update(new Element('p',{className:'p5 m5 box-blue'}).update(new Element('img',{src:window.dir_images+'ajax-loading.gif',className:'mr5 vam'})).insert(new Element('span').update(idoit.Translate.get('LC__UNIVERSAL__LOADING'))));new Ajax.Request(this.options.urlBase+'cmdb/browse/get-'+(!this.options.secondListPreselectionCallback||this.options.secondListPreselectionCallback.empty()?'object':'selection')+'-data',{parameters:{objects:JSON.stringify(this.getSelection()),key:(this.options.objectBrowserName||this.options.returnElement.replace(/__HIDDEN$/,'')),secondListPreselectionCallback:this.options.secondListPreselectionCallback},onComplete:function(xhr){var json=xhr.responseJSON,$table=new Element('table',{className:'mainTable'}),$colgroup=new Element('colgroup').update(new Element('col',{style:'width:110px;'})).insert(new Element('col')),$thead=new Element('thead'),$tbody=new Element('tbody'),$tr=new Element('tr'),replaceTablePlaceholders=new ReplacePlaceholders({linkObjects:false}),$removeButton='',i,j;if(this.options.multiselection){$removeButton=new Element('button',{type:'button',id:'remove_all',className:'btn btn-small btn-block',onClick:'browserPreselection.remove_all();'}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-cancel.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC__UNIVERSAL__ALL')));}
for(i in json.data.header){if(!json.data.header.hasOwnProperty(i)){continue;}
if(i==='0'){$tr.update(new Element('th',{className:'p5'}).update($removeButton));}else{$tr.insert(new Element('th').update(json.data.header[i]));}}
$thead.update($tr);for(i in json.data.data){if(!json.data.data.hasOwnProperty(i)){continue;}
$tr=new Element('tr',{'data-id':json.data.data[i][0]});for(j in json.data.data[i]){if(!json.data.data[i].hasOwnProperty(j)){continue;}
if(j==='0'){var onclick="browserPreselection.remove("+parseInt(json.data.data[i][j])+");";$tr.update(new Element('td',{className:'p5'}).update(new Element('button',{className:'btn btn-small btn-block',type:'button',onclick:onclick}).update(new Element('img',{src:window.dir_images+'axialis/basic/symbol-cancel.svg',alt:''})).insert(new Element('span').update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__REMOVE')))));}else{$tr.insert(new Element('td').update(replaceTablePlaceholders.replacePlaceholdersInCell(json.data.data[i][j]||"")));}}
$tbody.insert($tr);}
$table.update($colgroup).insert($thead).insert($tbody);this.$element.update($table);if(this.options.afterFinish){this.options.afterFinish(this);}}.bind(this)});},updateCounter:function(){if(Object.isElement(this.options.$selectionCounter)){this.options.$selectionCounter.update(this.selectedObjects.length)}},log:function(string){if(this.options.latestLogElement){$(this.options.latestLogElement).update(string);}},getObjectMetaData:function(objId,callback){new Ajax.Request('?ajax=1&call=get_category_data&func=get_data',{parameters:{objID:objId,catgID:'C__CATG__GLOBAL'},onComplete:function(xhr){callback(xhr.responseJSON[0]);}});},getData:function(){return JSON.stringify(this.getSelection());},secondSelectionCall:function(id){this.secondElement.update(new Element('p',{className:'emptyPageMessage text-neutral-200'}).update(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT_JS__LOADING')));idoitJSON.call(this.options.ajaxURL+'&objID='+id,function(json){if(this.secondList){this.secondElement.update('');this.secondList.initList(json);}}.bind(this),{select:new Hash({isys_obj__id:'__checkbox__',isys_obj__port:idoit.Translate.get('LC__CMDB__CATG__CONNECTORS'),isys_obj__connected_with:idoit.Translate.get('LC__CMDB__CATG__UI_ASSIGNED_UI'),isys_obj__category:idoit.Translate.get('LC__CMDB__CATG__CATEGORY'),isys_obj__in_out:idoit.Translate.get('LC__CMDB__CATS__PRT_TYPE')})});},add:function(object,fromButton){this.select(object[0]);}});var IPv4={valid_ip:function(ip){if(Object.isString(ip)){var parts=ip.split('.'),bad_ip=false;if(parts.length!=4)bad_ip=true;if(!(parts[0]>=0&&parts[0]<=255))bad_ip=true;if(!(parts[1]>=0&&parts[1]<=255))bad_ip=true;if(!(parts[2]>=0&&parts[2]<=255))bad_ip=true;if(!(parts[3]>=0&&parts[3]<=255))bad_ip=true;return!bad_ip;}
return false;},long2ip:function(iplong){var pow=Math.pow,floor=Math.floor;return floor(iplong / pow(256,3))+'.'+
floor((iplong%pow(256,3))/ pow(256,2))+'.'+
floor(((iplong%pow(256,3))%pow(256,2))/ pow(256,1))+'.'+
floor((((iplong%pow(256,3))%pow(256,2))%pow(256,1))/ pow(256,0));},ip2long:function(ip_address){if(this.valid_ip(ip_address)){var ip_arr=ip_address.split('.');return(parseInt(ip_arr[0])*Math.pow(256,3))+(parseInt(ip_arr[1])*Math.pow(256,2))+(parseInt(ip_arr[2])*256)+parseInt(ip_arr[3]);}else{return 0;}}};var menu_tree=null;var drops=[];function dNode(id,pid,name,url,title,target,icon,iconOpen,open,action,backSrc,class_name){this.id=id;this.pid=pid;this.name=name;this.url=url;this.title=title;this.target=target;this.icon=icon;this.iconOpen=iconOpen;this.backSrc=backSrc;this._io=open||false;this._is=false;this._ls=false;this._hc=false;this._ai=0;this._p;this.class_name=class_name||'';if(typeof action!=='undefined'){this.action=action;}else{this.action='';}}
function dTree(objName){this.config={target:null,folderLinks:true,useSelection:true,useCookies:false,useLines:true,useIcons:true,useStatusText:false,closeSameLevel:false,inOrder:false,searcheable:true};const iconDirectory=window.www_dir+'images/'+(window.tree_compact?'dtree':'tree-structure')+'/';this.icon={root:window.www_dir+'images/axialis/construction/house-4.svg',folder:window.www_dir+'images/axialis/documents-folders/folder-filled.svg',folderOpen:window.www_dir+'images/axialis/documents-folders/folder-open-filled.svg',node:window.www_dir+'images/axialis/documents-folders/document-color-grey.svg',empty:iconDirectory+'empty.gif',line:iconDirectory+'line.gif',join:iconDirectory+'join.gif',joinBottom:iconDirectory+'joinbottom.gif',plus:iconDirectory+'plus.gif',plusBottom:iconDirectory+'plusbottom.gif',minus:iconDirectory+'minus.gif',minusBottom:iconDirectory+'minusbottom.gif',nlPlus:iconDirectory+'nolinesplus.gif',nlMinus:iconDirectory+'nolinesminus.gif',eye:[window.www_dir+'images/axialis/basic/eye.svg',window.www_dir+'images/axialis/basic/eye-no.svg']};this.obj=objName;this.aNodes=[];this.aIndent=[];this.root=new dNode(-1);this.selectedNode=null;this.selectedFound=false;this.completed=false;}
dTree.prototype.add=function(id,pid,name,url,title,target,icon,iconOpen,open,action,p_selected,backSrc,class_name){this.aNodes[this.aNodes.length]=new dNode(id,pid,name,url,title,target,icon,iconOpen,open,action,backSrc,class_name);if(p_selected!=0){this.selectedNode=this.aNodes.length-1;this.selectedFound=true;}};dTree.prototype.openAll=function(){this.oAll(true);};dTree.prototype.closeAll=function(){this.oAll(false);};dTree.prototype.toString=function(){var str;if(this.config.useCookies){this.selectedNode=this.getSelected();}
str='<div class="dtree">'+this.addNode(this.root,'')+'</div>';if(!this.selectedFound){this.selectedNode=null;}
this.completed=true;return str;};dTree.prototype.addNode=function(pNode){var str='',n=0,cn;if(this.config.inOrder){n=pNode._ai;}
for(n;n<this.aNodes.length;n++){if(this.aNodes[n].pid==pNode.id){cn=this.aNodes[n];cn._p=pNode;cn._ai=n;this.setCS(cn);if(!cn.target&&this.config.target){cn.target=this.config.target;}
if(cn._hc&&!cn._io&&this.config.useCookies){cn._io=this.isOpen(cn.id);}
if(!this.config.folderLinks&&cn._hc){cn.url=null;}
if(this.config.useSelection&&cn.id==this.selectedNode&&!this.selectedFound){cn._is=true;this.selectedNode=n;this.selectedFound=true;}
str+=this.node(cn,n);if(cn._ls){break;}}}
return str;};dTree.prototype.node=function(node,nodeId){var str='<div class="node '+(node.class_name||'')+'" data-nodeid="'+node.id+'" >'+this.indent(node,nodeId),class_name;if(this.config.useIcons){if(!node.icon){node.icon=(this.root.id==node.pid)?this.icon.root:((node._hc)?this.icon.folder:this.icon.node);}
if(!node.iconOpen){node.iconOpen=(node._hc)?this.icon.folderOpen:this.icon.node;}
str+='<img id="i'+this.obj+nodeId+'" src="'+((node._io)?node.iconOpen:node.icon)+'" class="nodeIcon" />';}
if(node.url){if(nodeId==this.selectedNode){class_name='nodeSel';}else{class_name='node';}
if(node.url==='javascript:;'){class_name='nodeDisabled';}
if(nodeId==0){class_name='rootNode';}
str+='<a id="s'+this.obj+nodeId+'" class="'+class_name+'" href="'+node.url+'"';if(node.title){str+=' title="'+node.title+'"';}
if(node.target){str+=' target="'+node.target+'"';}
if(this.config.useStatusText){str+=' onmouseover="window.status=\''+node.name+'\';return true;" onmouseout="window.status=\'\';return true;" ';}
if(this.config.useSelection&&((node._hc&&this.config.folderLinks)||!node._hc)){if(node.url!='javascript:;'){str+=' onclick="javascript: '+this.obj+'.s('+nodeId+');"';}}
str+='>';if(typeof node.id==='number'){drops.push({nodeid:nodeId,id:node.id});}}else if((!this.config.folderLinks||!node.url)&&node._hc&&node.pid!=this.root.id){if(node.action!=''){str+='<a href="javascript: '+this.obj+'.o('+nodeId+');'+node.action+'" class="node">';}else{str+='<a href="javascript: '+this.obj+'.o('+nodeId+');" class="node">';}}
str+=node.name;if(node.url||((!this.config.folderLinks||!node.url)&&node._hc)){str+='</a>';}
str+='</div>';if(node._hc){str+='<div id="d'+this.obj+nodeId+'" class="clip" style="display:'+((this.root.id==node.pid||node._io)?'block':'none')+';">';str+=this.addNode(node);str+='</div>';}
this.aIndent.pop();return str;};dTree.prototype.indent=function(node,nodeId){var str='';var backSrc='';if(node.backSrc.length>0){backSrc='background-image:url('+node.backSrc+');';}
if(this.root.id!=node.pid){for(var n=0;n<this.aIndent.length;n++){str+='<img src="'+((this.aIndent[n]==1&&this.config.useLines)?this.icon.line:this.icon.empty)+'" alt="" />';}
this.aIndent.push(node._ls?0:1);if(node._hc){str+='<a href="javascript: '+this.obj+'.o('+nodeId+');"><img ';str+='style="'+backSrc+'" ';str+='id="j'+this.obj+nodeId+'" src="';if(!this.config.useLines){str+=(node._io)?this.icon.nlMinus:this.icon.nlPlus;}else{str+=((node._io)?((node._ls&&this.config.useLines)?this.icon.minusBottom:this.icon.minus):((node._ls&&this.config.useLines)?this.icon.plusBottom:this.icon.plus));}
str+='" alt="" /></a>';}else{str+='<img style="'+backSrc+'" src="'+((this.config.useLines)?((node._ls)?this.icon.joinBottom:this.icon.join):this.icon.empty)+'" alt="" />';}}
return str;};dTree.prototype.setCS=function(node){var lastId;for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].pid==node.id){node._hc=true;}
if(this.aNodes[n].pid==node.pid){lastId=this.aNodes[n].id;}}
if(lastId==node.id){node._ls=true;}};dTree.prototype.getSelected=function(){var sn=this.getCookie('cs'+this.obj);return(sn)?sn:null;};dTree.prototype.s=function(id){if(!this.config.useSelection){return;}
var cn=this.aNodes[id];if(cn._hc&&!this.config.folderLinks){return;}
if(this.selectedNode!=id){if(this.selectedNode||this.selectedNode==0){eOld=document.getElementById('s'+this.obj+this.selectedNode);if(eOld){eOld.className='node';}}
eNew=$('s'+this.obj+id);if(eNew){eNew.className='nodeSel';}
this.selectedNode=id;if(this.config.useCookies){this.setCookie('cs'+this.obj,cn.id);}}};dTree.prototype.o=function(id){var cn=this.aNodes[id];if(cn){this.nodeStatus(!cn._io,id,cn._ls);cn._io=!cn._io;if(this.config.closeSameLevel){this.closeLevel(cn);}
if(this.config.useCookies){this.updateCookie();}}};dTree.prototype.getNodeIdByName=function(name){for(var n=0;n<this.aNodes.length;n++){if(name==this.aNodes[n].name){return this.aNodes[n].id;}}
return null;};dTree.prototype.getNodeIdsByName=function(name,fuzzy){var foundNodes=[];for(var n=0;n<this.aNodes.length;n++){if(name==this.aNodes[n].name){foundNodes.push(this.aNodes[n].id);}}
return foundNodes;};dTree.prototype.oAll=function(status){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n]._hc&&this.aNodes[n].pid!=this.root.id){this.nodeStatus(status,n,this.aNodes[n]._ls);this.aNodes[n]._io=status;}}
if(this.config.useCookies){this.updateCookie();}};dTree.prototype.openTo=function(nId,bSelect,bFirst){if(!bFirst){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].id==nId){nId=n;break;}}}
var cn=this.aNodes[nId];if(cn){if(cn.pid==this.root.id||!cn._p){return;}
cn._io=true;cn._is=bSelect;if(this.completed&&cn._hc){this.nodeStatus(true,cn._ai,cn._ls);}
if(this.completed&&bSelect){this.s(cn._ai);}else if(bSelect){this._sn=cn._ai;}
this.openTo(cn._p._ai,false,true);}};dTree.prototype.closeLevel=function(node){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].pid==node.pid&&this.aNodes[n].id!=node.id&&this.aNodes[n]._hc){this.nodeStatus(false,n,this.aNodes[n]._ls);this.aNodes[n]._io=false;this.closeAllChildren(this.aNodes[n]);}}};dTree.prototype.closeAllChildren=function(node){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].pid==node.id&&this.aNodes[n]._hc){if(this.aNodes[n]._io){this.nodeStatus(false,n,this.aNodes[n]._ls);}
this.aNodes[n]._io=false;this.closeAllChildren(this.aNodes[n]);}}};dTree.prototype.nodeStatus=function(status,id,bottom){var eDiv=document.getElementById('d'+this.obj+id),eJoin=document.getElementById('j'+this.obj+id);if(this.config.useIcons){eIcon=document.getElementById('i'+this.obj+id);eIcon.src=(status)?this.aNodes[id].iconOpen:this.aNodes[id].icon;}
eJoin.src=(this.config.useLines)?((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):((status)?this.icon.nlMinus:this.icon.nlPlus);eDiv.style.display=(status)?'block':'none';};dTree.prototype.clearCookie=function(){var now=new Date(),yesterday=new Date(now.getTime()-1000*60*60*24);this.setCookie('co'+this.obj,'cookieValue',yesterday);this.setCookie('cs'+this.obj,'cookieValue',yesterday);};dTree.prototype.setCookie=function(cookieName,cookieValue,expires,path,domain,secure){document.cookie=escape(cookieName)+'='+escape(cookieValue)+
(expires?'; expires='+expires.toGMTString():'')+
(path?'; path='+path:'')+
(domain?'; domain='+domain:'')+
(secure?'; secure':'');};dTree.prototype.getCookie=function(cookieName){var cookieValue='',posName=document.cookie.indexOf(escape(cookieName)+'='),posValue,endPos;if(posName!=-1){posValue=posName+(escape(cookieName)+'=').length;endPos=document.cookie.indexOf(';',posValue);if(endPos!=-1){cookieValue=unescape(document.cookie.substring(posValue,endPos));}else{cookieValue=unescape(document.cookie.substring(posValue));}}
return(cookieValue);};dTree.prototype.updateCookie=function(){var str='';for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n]._io&&this.aNodes[n].pid!=this.root.id){if(str){str+='.';}
str+=this.aNodes[n].id;}}
this.setCookie('co'+this.obj,str);};dTree.prototype.isOpen=function(id){var aOpen=this.getCookie('co'+this.obj).split('.');for(var n=0;n<aOpen.length;n++){if(aOpen[n]==id){return true;}}
return false;};dTree.prototype.addSearchCapabilities=function(){var $rootNodeContainer=$(this.obj).down('div[data-nodeid=0]');if($rootNodeContainer&&$(this.obj).down('div[data-nodeid=0] > a')){var $search_icon=new Element('img',{src:window.dir_images+'axialis/basic/zoom.svg',id:'treeSearchIcon',className:'treeSearchIcon greyscale'});var $search_field=new Element('input',{type:'search',id:'treeSearchInput',placeholder:'Suche..',style:'display:none;border-radius:0;'});$rootNodeContainer.insert($search_field).insert($search_icon);$('treeSearchIcon').on('click',function(ev){$(this.obj).down('div[data-nodeid=0] > a').hide();$('treeSearchInput').show().focus();ev.findElement('img').hide();}.bind(this));$search_field.on('blur',this.hideSearchBox.bindAsEventListener(this));$search_field.on('keyup',this.keyInput.bindAsEventListener(this));$search_field.on('click',this.keyInput.bindAsEventListener(this));$search_field.on('keypress',function(e){if(e.keyCode==Event.KEY_RETURN){Event.stop(e);}});}};dTree.prototype.hideSearchBox=function(){$('treeSearchIcon').show();$(this.obj).down('div[data-nodeid=0] > a').show();$('treeSearchInput').hide();$(this.obj).select('div.highlightSearch').each(function($el){$el.removeClassName('highlightSearch');});};dTree.prototype.o=function(id){var cn=this.aNodes[id];if(cn){this.nodeStatus(!cn._io,id,cn._ls);cn._io=!cn._io;if(this.config.closeSameLevel){this.closeLevel(cn);}
if(this.config.useCookies){this.updateCookie();}
$$('#dmenu_tree'+id+' > div.node').each(function(p_element){p_element.writeAttribute('style',null);});}};dTree.prototype.keyInput=function(ev){var $tree=$('dmenu_tree0'),$filter=ev.findElement('input'),value=$filter.getValue().toLowerCase(),controlKeys=[Event.KEY_RETURN,Event.KEY_DOWN,Event.KEY_UP,Event.KEY_ESC],unwantedKeys=[Event.KEY_LEFT,Event.KEY_RIGHT],hide=($('nodeVisibilityIcon').readAttribute('data-hide')==1),highlight=$tree.select('div.highlightSearch');if(unwantedKeys.indexOf(ev.keyCode)!==-1){return false;}
if(controlKeys.indexOf(ev.keyCode)!==-1){if(ev.keyCode==Event.KEY_RETURN){if(highlight.length>0){$tree.down('div.highlightSearch > a').simulate('click');}}
if(ev.keyCode==Event.KEY_ESC){this.hideSearchBox();$filter.setValue('');$tree.select('div.node:not(.hide)').each(function($node){$node.removeClassName('treeSearchResult');if(!$node.down('span')){$node.show();}});return;}else{var $visible_elements=$tree.select('div.node:not(.hide)').findAll(function(el){return el.up().visible()&&el.visible();});if(highlight.length>0){var l_highlightedElement=highlight[0],l_highlightedElementIndex=$visible_elements.indexOf(l_highlightedElement),l_indexOfNext=0;l_highlightedElement.removeClassName('highlightSearch');if(ev.keyCode==Event.KEY_DOWN){l_indexOfNext=l_highlightedElementIndex+1;}else if(ev.keyCode==Event.KEY_UP){l_indexOfNext=l_highlightedElementIndex-1;}
if(!$visible_elements[l_indexOfNext]){l_indexOfNext=0;}
$visible_elements[l_indexOfNext].addClassName('highlightSearch');ev.stop();}else{$tree.down('div.node:not(.hide)').addClassName('highlightSearch');}}
return false;}
if(value.length>=2){this.oAll();$tree.select('div.node:not(.hide) > a').each(function($link){var i=0;if($link.innerHTML.toLowerCase().indexOf(value)!==-1){$link.up().addClassName('treeSearchResult').show();while($link.up('.clip',i)){$link.up('.clip',i).writeAttribute('style','display: block').previous().writeAttribute('style','display: block');if($link.up('.clip',i).previous().down('a > img[src*="plus.gif"]')){$link.up('.clip',i).previous().down('a').simulate('click');}
i++;}}else{$link.up().removeClassName('treeSearchResult').hide();}});}else{$tree.select('div.node').invoke('show');this.processVisibility();}};dTree.prototype.addNodesVisibility=function(hide){var $root_node_container=$(this.obj).down('div[data-nodeid="0"]'),$visibility_icon=new Element('img',{src:this.icon.eye[hide],id:'nodeVisibilityIcon',className:'greyscale','data-hide':hide});if($root_node_container){$root_node_container.insert($visibility_icon);$visibility_icon.on('click',function(){this.toggleVisibility();}.bind(this));this.processVisibility();}};dTree.prototype.toggleVisibility=function(){var $node_container=$('dmenu_tree0'),$toggler=$('nodeVisibilityIcon'),params={},hide=($toggler.readAttribute('data-hide')==1);$toggler.writeAttribute('data-hide',(hide?0:1)).writeAttribute('src',this.icon.eye[$toggler.readAttribute('data-hide')]);if($node_container){$node_container.select('span.noentries,span.obj_noentries').invoke('up','div').invoke((hide?'addClassName':'removeClassName'),'hide');}
if($node_container.down('.noentries')){params.categories=hide?0:1;}else{params.objtype=hide?0:1;}
new Ajax.Request('?call=menu&ajax=1&func=save_tree_visibility',{parameters:params});this.processVisibility();};dTree.prototype.processVisibility=function(){var $node_container=$('dmenu_tree0'),$toggler=$('nodeVisibilityIcon'),hide=($toggler.readAttribute('data-hide')==1);if($node_container){$node_container.select('div.clip div.node a').each(function(el){var $nodeFolder;if(!el.down('span.noentries')){$nodeFolder=el.up('div.clip').previous().down('a span.noentries');if($nodeFolder){$nodeFolder.up().update($nodeFolder.innerHTML);}}});$node_container.select('span.noentries,span.obj_noentries').invoke('up','div').invoke((hide?'addClassName':'removeClassName'),'hide');if(!hide){$node_container.select('div.node.hide').invoke('removeClassName','hide');}}};function breadcrumb(p_url,suppressPushState){var l_url=p_url.replace(/#.*/g,''),pushUrl;l_url+=(l_url.match(/^.*[\?].*$/))?'&':'?';pushUrl=l_url.parseQuery();delete pushUrl.call;new Ajax.Updater('breadcrumb',l_url+'request=breadcrumb&ajax=1',{method:'get',onComplete:function(){document.title='i-doit - '+$('breadcrumb').select('li').map(function($li){return $li.innerText;}).filter(function(text){return text;}).join(' > ');if(!suppressPushState){window.pushState({url:l_url,content:'main_content'},document.title,window.www_dir+'?'+Object.toQueryString(pushUrl));}
$('body').fire('update:tooltips');}});}
var g_params=[];function glob(key){return g_params[key];}
function globalize(param,val){if(val){g_params[param]=val;}}
function change_action_parameter(key,value){const getParameters=$('isys_form').readAttribute('action').toQueryParams();getParameters[key]=value;$('isys_form').writeAttribute('action',window.www_dir+'?'+Object.toQueryString(getParameters));}
function save_via_ajax(el,callback){el=$(el);if(el){var btn=$('navbar_item_C__NAVMODE__SAVE');if(btn){if(btn.hasClassName('navbar_item_inactive')||btn.disabled){return;}
btn.disable();}
$('contentArea').setOpacity(0.4);change_action_parameter('call','category_update');new Ajax.Updater(el.id,$('isys_form').action+($('isys_form').action.match(/^.*[\?].*$/)?'&ajax=1':'?ajax=1'),{method:'post',evalScripts:true,onComplete:function(response){$('contentArea').setOpacity(1);$('navMode').value='';reset_use_template_hidden_field();$('isys_form').fire('form:saved',{'response':response});if(btn){btn.enable();}
if(Object.isFunction(callback)){callback();}},parameters:$('isys_form').serialize(true)});}}
function form_submit(p_url,p_method,p_content,p_no_breadcrumb,successCallback,p_data){var addition,l_params=(!p_method||p_method=='post')?$('isys_form').serialize(true):{};document.isys_form.target='';if(p_data){for(var attrname in p_data){if(p_data.hasOwnProperty(attrname)){l_params[attrname]=p_data[attrname];}}}
if(!Object.isUndefined(p_url)&&p_url){$('isys_form').action=p_url;}else{change_action_parameter('call','category');}
addition=(($('isys_form').action.search('\\?')!=-1)?'&ajax=1':'?ajax=1');var contentAjax=(!Object.isUndefined(p_content)&&p_content)?p_content:'main_content';new Ajax.Request($('isys_form').action+addition,{method:p_method?p_method:'post',onComplete:function(response){var $obj=$(contentAjax);if($obj){$obj.html(response.responseText);}
if(!p_no_breadcrumb){breadcrumb($('isys_form').action);}
if(successCallback&&typeof successCallback==='function'){successCallback(response);}else if(successCallback){setTimeout(function(){eval(successCallback);},500);}
delay(function(){Event.fire(document,'form:submitted',{'url':p_url,'method':p_method,'response':response,'data':p_data});},150,'form.submit');},parameters:l_params});}
function get_content_by_group(p_group_id,p_viewMode,successCallback){var l_link=window.www_dir+'?call=object_list&'+C__CMDB__GET__OBJECTGROUP+'='+p_group_id+'&'+C__CMDB__GET__VIEWMODE+'='+p_viewMode+'&ajax=1';if(window.object_list){delete window.object_list;}
new Ajax.Updater('main_content',l_link,{method:'get',evalScripts:true,onSuccess:function(){breadcrumb(l_link);if(successCallback){eval(successCallback);}}});}
function get_tree(p_link){close_mydoit();document.isys_form.target='';globalize(C__CMDB__GET__OBJECT,$H(p_link.parseQuery()).get(C__CMDB__GET__OBJECT));new Ajax.Updater('tree_content',p_link+((p_link.match(/^.*[\?].*$/))?'&ajax=1':'?ajax=1'),{method:'get',evalScripts:true,onComplete:function(response){$('tree_content').fire('cmdbObjectTree:retrieved',{response:response});Tips.hideAll();$('body').fire('update:tooltips');}});}
function get_tree_object_type(p_group_id,p_objecttype,p_treeMode){remove_drops();var l_link=window.www_dir+'?call=tree&'+C__CMDB__GET__OBJECTGROUP+'='+p_group_id;if(p_treeMode){l_link+='&'+C__CMDB__GET__TREEMODE+'='+p_treeMode;}
get_tree(l_link);if($('contentArea').getStyle('left')=='0px'){new dragBar({dragContainer:'draggableBar',leftContainer:'menuTreeOn',rightContainer:'contentArea',moveInfoBox:true,defaultWidth:$('contentArea').readAttribute('data-default-width')}).activateBar();}
if(p_objecttype){tree_obj_type_click(p_objecttype);}}
function get_tree_by_object(p_object_id,p_treemode,p_selected_catg,p_selected_cats){globalize(C__CMDB__GET__TREEMODE,p_treemode);globalize(C__CMDB__GET__OBJECT,p_object_id);var l_url=window.www_dir+'?call=tree_object&ajax=1&'+C__CMDB__GET__OBJECT+'='+p_object_id+'&'+C__CMDB__GET__TREEMODE+'='+p_treemode;if(p_selected_catg!==undefined&&p_selected_catg!==null){globalize('catgID',p_selected_catg);l_url+='&catgID='+p_selected_catg;}else if(p_selected_cats!==undefined&&p_selected_cats!==null){globalize('catsID',p_selected_cats);l_url+='&catsID='+p_selected_cats;}
new Ajax.Updater('tree_content',l_url,{method:'get',evalScripts:true});}
function get_catd_by_object(p_object_id,p_viewmode,p_treemode){get_tree_by_object(p_object_id,p_treemode);get_content_by_object(p_object_id,p_viewmode);}
function get_content_by_object(p_object_id,p_viewmode,p_category,p_category_type,p_custom_category){if(window.object_list){delete window.object_list;}
change_action_parameter(C__CMDB__GET__VIEWMODE,p_viewmode);change_action_parameter(C__CMDB__GET__OBJECT,p_object_id);change_action_parameter('call','category');remove_action_parameter(['catgID','objTypeID','objGroupID','editMode','moduleID','catsID','cateID','cat1ID','cat2ID','cat3ID','cat4ID','cat5ID','ifaceID','navPageStart','page']);reset_use_template_hidden_field();if(p_category){if(p_category_type){change_action_parameter(p_category_type,p_category);}else{change_action_parameter('catgID',p_category);}}
if(p_custom_category){change_action_parameter('customID',p_custom_category);}
if(g_params[C__CMDB__GET__TREEMODE]||g_params[C__CMDB__GET__TREEMODE]=='undefined'){change_action_parameter(C__CMDB__GET__TREEMODE,g_params[C__CMDB__GET__TREEMODE]);}
form_submit($('isys_form').action,'get');}
function change_page(p_page,p_url,p_content,p_method){if(Object.isUndefined(p_url)){p_url=false;}
if(Object.isUndefined(p_method)){p_method='get';}
change_action_parameter('navPageStart',p_page);form_submit(p_url,p_method,p_content);}
function tree_obj_type_click(p_objtype,p_page,p_status){var url=window.www_dir+'?'+C__CMDB__GET__VIEWMODE+'=1001&'+C__CMDB__GET__OBJECTTYPE+'='+p_objtype+'&call=object_list';$('contentArea').setStyle({'overflow':''});$('navPageStart').setValue((p_page)?p_page:0);$('isys_form').action=url;reset_template_hidden_field();form_submit(url,'get');}
function remove_action_parameter(key){var i,$form=$('isys_form'),formAction=$form.readAttribute('action').parseQuery();if(!Object.isArray(key)){key=[key];}
for(i in key){if(key.hasOwnProperty(i)){delete formAction[key[i]];}}
$form.writeAttribute('action',window.www_dir+'?'+Object.toQueryString(formAction));}
function reset_template_hidden_field(){"use strict";$('body').down('[name="template"]').setValue('');}
function reset_use_template_hidden_field(){"use strict";$('useTemplate').setValue('');}
(function(){"use strict";var ajaxOptions={method:'get',evalScripts:true};var options=ajaxOptions;window.onpopstate=function(event){if(event.state&&event.state.url){new Ajax.Updater(event.state.content,event.state.url+(event.state.url.match(/^.*[\?].*$/)?'&':'?')+'ajax=1',ajaxOptions);breadcrumb(event.state.url,true);}};window.pushState=function(data,title,url){if(window.history.pushState){url=url.replace('ajax=1','');window.history.pushState(data,title,url);}};})();var Tips={initialize:function(){this.tips=[];},get:function(instance){return this.tips.find(function(tip){return tip.$container===instance.$container;});},add:function(instance){this.tips.push(instance);},remove:function(instance){this.tips.filter(function(tip){return tip.$container===instance.$container;}).invoke('remove');},removeAll:function(){this.tips.invoke('remove');this.tips=[];},hideAll:function(){this.tips.invoke('hide');}};Tips.initialize();var Tip=Class.create({initialize:function(container,content,options){var self=this;this.$container=$(container);var existingTip=Tips.get(this);if(existingTip){if(options.hasOwnProperty('ajax')){existingTip.options.ajax=options.ajax;}
if(content){existingTip.content=content;}
existingTip.setContent();return;}
this.inDOM=false;this.showDelayed=false;this.id=Math.random().toString(36).replace(/[^a-z]+/g,'').substr(0,5);this.content=content;this.options={delay:0,showOn:'mouseenter',hideOn:'mouseleave',offsetX:10,offsetY:10,stem:'topleft',style:'default',positionByElement:false,onBeforeShow:Prototype.emptyFunction,onAfterHide:Prototype.emptyFunction};Object.extend(this.options,options||{});this.create();Tips.add(this);this.$container.on(this.options.showOn,function(){if(!self.inDOM){$('body').insert(self.$tip);self.inDOM=true;}
if(!self.isVisible()){self.show();}});this.$container.on(this.options.hideOn,function(){self.showDelayed=false;if(self.isVisible()){self.hide();}});},isVisible:function(){return!this.$tip.hasClassName('hide');},create:function(){var self=this;this.$tip=new Element('div',{className:'tooltip hide'}).setStyle({zIndex:5000});this.$tipPointer=new Element('div',{className:'pointer'});this.$tipContent=new Element('div',{className:'content'});if(this.options.hasOwnProperty('style')){this.$tip.addClassName(this.options.style);}
if(this.options.hasOwnProperty('className')){this.$tipContent.addClassName(this.options.className);}
this.$tip.insert(this.$tipPointer).insert(this.$tipContent);},remove:function(){this.$tip.remove();},setContent:function(){var self=this;if(self.options.hasOwnProperty('ajax')){new Ajax.Request(self.options.ajax.url,{method:'post',onComplete:function(xhr){self.$tipContent.update(xhr.responseText);}});}else{self.$tipContent.update(this.content);}},reposition:function(){const positioning={top:0,left:0};const stemPosition={y:'top',x:'left'};if(this.options.positionByElement){const position=this.$container.getBoundingClientRect();positioning.top=(position.top+position.height+this.options.offsetY);positioning.left=(position.left+(position.width / 2-this.$tip.getWidth()/ 2)+this.options.offsetX);stemPosition.x='middle';}else{positioning.top=(window.mouseY+this.options.offsetY);positioning.left=(window.mouseX+this.options.offsetX);if((window.mouseX+this.$tipContent.getDimensions().width+this.options.offsetX)>window.getWindowWidth()){positioning.left=(window.mouseX-this.$tipContent.getDimensions().width-this.options.offsetX);stemPosition.x='right'}
if((window.mouseY+this.$tipContent.getDimensions().height+this.options.offsetY)>window.getWindowHeight()){positioning.top=(window.mouseY-this.$tipContent.getDimensions().height-this.options.offsetY);stemPosition.y='bottom';}}
this.$tip.setStyle({top:positioning.top+'px',left:positioning.left+'px'});if(this.$tipPointer&&this.$tipPointer.down('div')){this.$tipPointer.down('div').removeAttribute('class');this.$tipPointer.down('div').addClassName(stemPosition.y+stemPosition.x);}},show:function(){var self=this,delayTimer=null;if(this.options.hasOwnProperty('delay')&&this.options.delay){delayTimer=this.options.delay*1000;}
if(this.$tipContent.empty()){this.setContent();this.positionStem();}
this.options.onBeforeShow();if(delayTimer===null){this.$tip.removeClassName('hide');this.reposition();return;}
this.showDelayed=true;delay(function(){if(self.showDelayed){self.$tip.removeClassName('hide');}
self.reposition();},delayTimer,this.id);},hide:function(){this.$tip.addClassName('hide');this.options.onAfterHide();},positionStem:function(){if(!this.options.hasOwnProperty('stem')||!this.options.stem){this.$tipPointer.remove();return;}
this.$tipPointer.insert(new Element('div',{className:this.options.stem.toLowerCase()}));}});window.ChosenExtension=Class.create({$field:null,$chosen_div:null,initialize:function($field,options){var tmp;this.$field=$field;this.$chosen_div=$($field.id+'_chosen')||this.$field.previous('.chosen-container')||this.$field.next('.chosen-container');this.$chosen_div_buttons=new Element('div',{className:'border-top p5 bg-neutral-200'});this.options={disable_button_all:false,disable_button_invert:false,disable_button_none:false,chosenMaxHeight:null,additional_value_field:false};this.$chosen_div.down('.chosen-drop').insert(this.$chosen_div_buttons);Object.extend(this.options,options||{});if(!this.options.disable_button_all){this.add_btn_all();}
if(!this.options.disable_button_invert){this.add_btn_invert();}
if(!this.options.disable_button_none){this.add_btn_none();}
tmp=$(this.options.additional_value_field);this.options.additional_value_field=null;if(Object.isElement(tmp)){this.options.$additional_value_field=tmp;}else{this.options.$additional_value_field=false;}
if(this.options.chosenMaxHeight!==null){this.$chosen_div.down('.chosen-choices').setStyle({maxHeight:this.options.chosenMaxHeight,overflow:'auto'});}
if(this.options.disable_button_all&&this.options.disable_button_invert&&this.options.disable_button_none){this.$chosen_div_buttons.remove();}},add_btn_all:function(){var $btn_all=new Element("button",{type:"button",className:"btn mr5"}).update(new Element("img",{src:window.dir_images+"axialis/basic/symbol-ok.svg",alt:""})).insert(new Element("span").update(this.options['chosen-btn-all']));$btn_all.on('click',function(){this.$field.setValue(this.$field.select('option').invoke('readAttribute','value')).fire('chosen:updated');this.$field.simulate('change');if(this.options.$additional_value_field){this.options.$additional_value_field.setValue(this.$field.getValue().join())}}.bind(this));this.$chosen_div_buttons.insert($btn_all);},add_btn_invert:function(){var $btn_invert=new Element("button",{type:"button",className:"btn mr5"}).update(new Element("img",{src:window.dir_images+"axialis/basic/sort.svg",alt:""})).insert(new Element("span").update(this.options['chosen-btn-inverted']));$btn_invert.on('click',function(){var selection=this.$field.getValue();this.$field.setValue(this.$field.select('option').filter(function($el){return!selection.in_array($el.readAttribute('value'))}).invoke('readAttribute','value')).fire('chosen:updated');this.$field.simulate('change');if(this.options.$additional_value_field){this.options.$additional_value_field.setValue(this.$field.getValue().join())}}.bind(this));this.$chosen_div_buttons.insert($btn_invert);},add_btn_none:function(){var $btn_none=new Element("button",{type:"button",className:"btn"}).update(new Element("img",{src:window.dir_images+"axialis/basic/symbol-cancel.svg",alt:""})).insert(new Element("span").update(this.options['chosen-btn-none']));$btn_none.on('click',function(){this.$field.setValue([]).fire('chosen:updated');this.$field.simulate('change');if(this.options.$additional_value_field){this.options.$additional_value_field.setValue('')}}.bind(this));this.$chosen_div_buttons.insert($btn_none);}});var g_onload_callbacks=[];var g_droppables=[];var drags=[];var dragging=false;function remove_drops(){if(typeof drops=='object'){g_droppables.each(function(drop,k){if(drop){Droppables.remove(drop);drops.splice(k,1);}});drags=[];drops=[];g_droppables=[];}}
function remove_drags(){drags.each(function(drag,k){if(drag){drag.destroy();}});drags=[];}
function init_drops(options){if(typeof drops=='object'){drops.each(function(drop){if($('smenu_tree'+drop.nodeid)){g_droppables.push('smenu_tree'+drop.nodeid);Droppables.add('smenu_tree'+drop.nodeid,{accept:'draggable',hoverclass:'hover',onDrop:function(){var $dragGhost=$('body').down('.mainTableDragGhost'),draggedIDs=$dragGhost.readAttribute('data-ids').split(','),$originTable=$($dragGhost.readAttribute('data-table-id')),toElement=this.element.down('span:first');if(!$dragGhost){return;}
draggedIDs.filter(function(id){return!isNaN(parseInt(id));});if(!draggedIDs.length){idoit.Notify.error('Please try again!',{life:5});return;}
if(confirm(new Template(options.confirmMessage).evaluate({'count':draggedIDs.length,'to':toElement&&toElement.textContent}))){new Ajax.Request('?ajax=1&call=change_object_type',{parameters:{objTypeID:drop.id,objID:draggedIDs.join(',')},method:'post',onComplete:function(xhr){var json=xhr.responseJSON;if(json.success){if($originTable){$originTable.fire('remove:entriesByIds',{ids:$dragGhost.readAttribute('data-ids').split(',')});}
idoit.Notify.success(json.data);}
else{idoit.Notify.error(json.message,{sticky:true});}}.bind(this)});}else{return false;}}});}});}}
function onload_add_callback(p_functioncall){g_onload_callbacks.push(p_functioncall);}
function onload_process(){if(g_onload_callbacks){for(i=0;i<g_onload_callbacks.length;i++){eval(g_onload_callbacks[i]);}}
History.init();}
var Tabs=Class.create({current_body:'',options:{},initTab:'',close:'_close',initialize:function(element,options){this.$element=$(element);if(this.$element){this.options={wrapperClass:'tabs',contentClass:'tab-content',activeBodyClass:'active-body',activeClass:'active',tabClass:'gradient mouse-pointer',onTabSelect:Prototype.emptyFunction};this.options=Object.extend(this.options,options||{});this.$element.addClassName(this.options.wrapperClass);this.$menu=this.$element.select('li a');var preselection=document.location.href.match(/#(\w.+)/);if(preselection){this.initTab=this.$menu.find(function(value){return value.href.match(/#(\w.+)/)[1]==preselection[1];})||this.$menu.first();}
else{this.initTab=this.$menu.first();}
this.$menu.each(this.tab_initialize.bind(this));this.show(this.initTab);}
else{throw new Error('Element '+element+' does not exist.');}},show:function($tab){if($tab.up('li.disabled')){this.initTab=this.$element.down('li:not(.disabled) a');this.show(this.initTab);return;}
this.current_body=$(this.get($tab));$tab.addClassName(this.options.activeClass).blur();this.current_body.addClassName(this.options.contentClass).show();this.options.onTabSelect($tab);},hide:function($tab){this.current_body=$(this.get($tab));$tab.removeClassName(this.options.activeClass);this.current_body.removeClassName(this.options.activeBodyClass).hide();},close:function($tab){},tab_initialize:function($tab){$tab.addClassName(this.options.tabClass);if($(this.get($tab)))$(this.get($tab)).hide();if(!$tab.up('.disabled')){$tab.on('click',this.prepare.bindAsEventListener(this));}
else{$tab.on('click',this.prepareDisabled.bindAsEventListener(this));}},activate:function(tabIndex){if(this.$menu[tabIndex]){this.show(this.$menu[tabIndex]);this.$menu.without(this.$menu[tabIndex]).each(this.hide.bind(this));}},prepare:function(ev){var $tab=ev.findElement('a');ev.stop();this.show($tab);this.$menu.without($tab).each(this.hide.bind(this));},prepareDisabled:function(ev){ev.stop();},get:function($tab){var regex=$tab.href.match(/#([\S]+)/);if(regex){return regex[1];}
else{return'';}}});;(function(){"use strict";var defaultOptions={separator:',',linefeed:'\r\n',header:[]},elementMatchers={'HTMLElements':/^(?:TABLE)$/};Element.addMethods({exportTableAsCSV:function(element,options){element=$(element);options=Object.extend(defaultOptions,options||{});options.separator='"'+options.separator+'"';options.linefeed='"'+options.linefeed+'"';if(elementMatchers.HTMLElements.test(element.tagName)){var tmpSeparator=String.fromCharCode(11),tmpLinefeed=String.fromCharCode(0),csvData='',headerSelector='';if(options.header.length>0){csvData=options.header.join(options.separator)+options.linefeed;}
else{headerSelector='tr:has(th),';}
csvData+='"'+element.select(headerSelector+'tr:has(td)').collect(function(row,i){return row.select('th,td').collect(function(col,j){var text=col.down("a")&&col.down("a").length>0?col.down("a")[0].innerHTML:col.innerHTML;return text.replace(/°/g," ").replace(/"/g,'""').stripTags().unescapeHTML();}).join(tmpSeparator);}).join(options.linefeed).split(tmpLinefeed).join(options.linefeed).split(tmpSeparator).join(options.separator)+'"';window.location='data:text/csv,'+encodeURIComponent(csvData);return csvData;}
return'';}});})();function openPrintPopup(url){const width=950;const height=650;const config=['dependant=yes','width='+width,'height='+height,'menubar=yes','resizable=yes','scrollbars=yes','status=no','toolbar=no','location=no','left='+document.all?parseInt((document.body.offsetWidth / 2)-(width / 2)):parseInt((outerWidth / 2)-(width / 2)),'top='+document.all?parseInt((document.body.offsetHeight / 2)-(height / 2)):parseInt((outerHeight / 2)-(height / 2))];const objWnd=window.open(url,null,config.join(','));if(objWnd){objWnd.focus();}}
function isys_popup_receiver(p_data,p_form_submit){var l_destElement=document.getElementsByName('popupReceiver')[0];if(l_destElement){l_destElement.value=p_data;if(typeof C__GET__NAVMODE=="undefined"){alert('die js var C__GET__NAVMODE muss im Template bekannt gemacht werden');}
if(typeof C__NAVMODE__JS_ACTION=="undefined"){alert('die js var C__NAVMODE__JS_ACTION muss im Template bekannt gemacht werden');}
e=document.getElementsByName(C__GET__NAVMODE)[0];if(e){e.value=C__NAVMODE__JS_ACTION;if(p_form_submit==1){document.forms['isys_form'].submit();}}}}
function increaseNumber(val){val=parseInt(val);if(isNaN(val)){return 1;}
return val+1;}
function decreaseNumber(val){val=parseInt(val);if(isNaN(val)){return 0;}
return val-1;}
function checkNumber(val,allowZero,allowNegative){val=parseInt(val);if(isNaN(val)){return(allowZero?0:1);}
if(val<0){if(allowNegative){return val;}
if(allowZero){return 0;}
return 1;}
if(val===0){if(allowZero){return 0;}
return 1;}
return val;}
(function(){var AbstractChosen,SelectParser,bind=function(fn,me){return function(){return fn.apply(me,arguments);};},extend=function(child,parent){for(var key in parent){if(hasProp.call(parent,key))child[key]=parent[key];}function ctor(){this.constructor=child;}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child;},hasProp={}.hasOwnProperty;SelectParser=(function(){function SelectParser(){this.options_index=0;this.parsed=[];}
SelectParser.prototype.add_node=function(child){if(child.nodeName.toUpperCase()==="OPTGROUP"){return this.add_group(child);}else{return this.add_option(child);}};SelectParser.prototype.add_group=function(group){var group_position,i,len,option,ref,results1;group_position=this.parsed.length;this.parsed.push({array_index:group_position,group:true,label:group.label,title:group.title?group.title:void 0,children:0,disabled:group.disabled,classes:group.className});ref=group.childNodes;results1=[];for(i=0,len=ref.length;i<len;i++){option=ref[i];results1.push(this.add_option(option,group_position,group.disabled));}
return results1;};SelectParser.prototype.add_option=function(option,group_position,group_disabled){if(option.nodeName.toUpperCase()==="OPTION"){if(option.text!==""){if(group_position!=null){this.parsed[group_position].children+=1;}
this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:option.value,text:option.text,html:option.innerHTML,title:option.title?option.title:void 0,selected:option.selected,disabled:group_disabled===true?group_disabled:option.disabled,group_array_index:group_position,group_label:group_position!=null?this.parsed[group_position].label:null,classes:option.className,style:option.style.cssText});}else{this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:true});}
return this.options_index+=1;}};return SelectParser;})();SelectParser.select_to_array=function(select){var child,i,len,parser,ref;parser=new SelectParser();ref=select.childNodes;for(i=0,len=ref.length;i<len;i++){child=ref[i];parser.add_node(child);}
return parser.parsed;};AbstractChosen=(function(){function AbstractChosen(form_field,options1){this.form_field=form_field;this.options=options1!=null?options1:{};this.label_click_handler=bind(this.label_click_handler,this);if(!AbstractChosen.browser_is_supported()){return;}
this.is_multiple=this.form_field.multiple;this.set_default_text();this.set_default_values();this.setup();this.set_up_html();this.register_observers();this.on_ready();}
AbstractChosen.prototype.set_default_values=function(){this.click_test_action=(function(_this){return function(evt){return _this.test_active_click(evt);};})(this);this.activate_action=(function(_this){return function(evt){return _this.activate_field(evt);};})(this);this.active_field=false;this.mouse_on_container=false;this.results_showing=false;this.result_highlighted=null;this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className);this.allow_single_deselect=(this.options.allow_single_deselect!=null)&&(this.form_field.options[0]!=null)&&this.form_field.options[0].text===""?this.options.allow_single_deselect:false;this.disable_search_threshold=this.options.disable_search_threshold||0;this.disable_search=this.options.disable_search||false;this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:true;this.group_search=this.options.group_search!=null?this.options.group_search:true;this.search_contains=this.options.search_contains||false;this.single_backstroke_delete=this.options.single_backstroke_delete!=null?this.options.single_backstroke_delete:true;this.max_selected_options=this.options.max_selected_options||Infinity;this.inherit_select_classes=this.options.inherit_select_classes||false;this.display_selected_options=this.options.display_selected_options!=null?this.options.display_selected_options:true;this.display_disabled_options=this.options.display_disabled_options!=null?this.options.display_disabled_options:true;this.include_group_label_in_selected=this.options.include_group_label_in_selected||false;this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY;this.case_sensitive_search=this.options.case_sensitive_search||false;return this.hide_results_on_select=this.options.hide_results_on_select!=null?this.options.hide_results_on_select:true;};AbstractChosen.prototype.set_default_text=function(){if(this.form_field.getAttribute("data-placeholder")){this.default_text=this.form_field.getAttribute("data-placeholder");}else if(this.is_multiple){this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text;}else{this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text;}
this.default_text=this.escape_html(this.default_text);return this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text;};AbstractChosen.prototype.choice_label=function(item){if(this.include_group_label_in_selected&&(item.group_label!=null)){return"<b class='group-name'>"+(this.escape_html(item.group_label))+"</b>"+item.html;}else{return item.html;}};AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=true;};AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=false;};AbstractChosen.prototype.input_focus=function(evt){if(this.is_multiple){if(!this.active_field){return setTimeout(((function(_this){return function(){return _this.container_mousedown();};})(this)),50);}}else{if(!this.active_field){return this.activate_field();}}};AbstractChosen.prototype.input_blur=function(evt){if(!this.mouse_on_container){this.active_field=false;return setTimeout(((function(_this){return function(){return _this.blur_test();};})(this)),100);}};AbstractChosen.prototype.label_click_handler=function(evt){if(this.is_multiple){return this.container_mousedown(evt);}else{return this.activate_field();}};AbstractChosen.prototype.results_option_build=function(options){var content,data,data_content,i,len,ref,shown_results;content='';shown_results=0;ref=this.results_data;for(i=0,len=ref.length;i<len;i++){data=ref[i];data_content='';if(data.group){data_content=this.result_add_group(data);}else{data_content=this.result_add_option(data);}
if(data_content!==''){shown_results++;content+=data_content;}
if(options!=null?options.first:void 0){if(data.selected&&this.is_multiple){this.choice_build(data);}else if(data.selected&&!this.is_multiple){this.single_set_selected_text(this.choice_label(data));}}
if(shown_results>=this.max_shown_results){break;}}
return content;};AbstractChosen.prototype.result_add_option=function(option){var classes,option_el;if(!option.search_match){return'';}
if(!this.include_option_in_results(option)){return'';}
classes=[];if(!option.disabled&&!(option.selected&&this.is_multiple)){classes.push("active-result");}
if(option.disabled&&!(option.selected&&this.is_multiple)){classes.push("disabled-result");}
if(option.selected){classes.push("result-selected");}
if(option.group_array_index!=null){classes.push("group-option");}
if(option.classes!==""){classes.push(option.classes);}
option_el=document.createElement("li");option_el.className=classes.join(" ");if(option.style){option_el.style.cssText=option.style;}
option_el.setAttribute("data-option-array-index",option.array_index);option_el.innerHTML=option.highlighted_html||option.html;if(option.title){option_el.title=option.title;}
return this.outerHTML(option_el);};AbstractChosen.prototype.result_add_group=function(group){var classes,group_el;if(!(group.search_match||group.group_match)){return'';}
if(!(group.active_options>0)){return'';}
classes=[];classes.push("group-result");if(group.classes){classes.push(group.classes);}
group_el=document.createElement("li");group_el.className=classes.join(" ");group_el.innerHTML=group.highlighted_html||this.escape_html(group.label);if(group.title){group_el.title=group.title;}
return this.outerHTML(group_el);};AbstractChosen.prototype.results_update_field=function(){this.set_default_text();if(!this.is_multiple){this.results_reset_cleanup();}
this.result_clear_highlight();this.results_build();if(this.results_showing){return this.winnow_results();}};AbstractChosen.prototype.reset_single_select_options=function(){var i,len,ref,result,results1;ref=this.results_data;results1=[];for(i=0,len=ref.length;i<len;i++){result=ref[i];if(result.selected){results1.push(result.selected=false);}else{results1.push(void 0);}}
return results1;};AbstractChosen.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide();}else{return this.results_show();}};AbstractChosen.prototype.results_search=function(evt){if(this.results_showing){return this.winnow_results();}else{return this.results_show();}};AbstractChosen.prototype.winnow_results=function(options){var escapedQuery,fix,i,len,option,prefix,query,ref,regex,results,results_group,search_match,startpos,suffix,text;this.no_results_clear();results=0;query=this.get_search_text();escapedQuery=query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");regex=this.get_search_regex(escapedQuery);ref=this.results_data;for(i=0,len=ref.length;i<len;i++){option=ref[i];option.search_match=false;results_group=null;search_match=null;option.highlighted_html='';if(this.include_option_in_results(option)){if(option.group){option.group_match=false;option.active_options=0;}
if((option.group_array_index!=null)&&this.results_data[option.group_array_index]){results_group=this.results_data[option.group_array_index];if(results_group.active_options===0&&results_group.search_match){results+=1;}
results_group.active_options+=1;}
text=option.group?option.label:option.text;if(!(option.group&&!this.group_search)){search_match=this.search_string_match(text,regex);option.search_match=search_match!=null;if(option.search_match&&!option.group){results+=1;}
if(option.search_match){if(query.length){startpos=search_match.index;prefix=text.slice(0,startpos);fix=text.slice(startpos,startpos+query.length);suffix=text.slice(startpos+query.length);option.highlighted_html=(this.escape_html(prefix))+"<em>"+(this.escape_html(fix))+"</em>"+(this.escape_html(suffix));}
if(results_group!=null){results_group.group_match=true;}}else if((option.group_array_index!=null)&&this.results_data[option.group_array_index].search_match){option.search_match=true;}}}}
this.result_clear_highlight();if(results<1&&query.length){this.update_results_content("");return this.no_results(query);}else{this.update_results_content(this.results_option_build());if(!(options!=null?options.skip_highlight:void 0)){return this.winnow_results_set_highlight();}}};AbstractChosen.prototype.get_search_regex=function(escaped_search_string){var regex_flag,regex_string;regex_string=this.search_contains?escaped_search_string:"(^|\\s|\\b)"+escaped_search_string+"[^\\s]*";if(!(this.enable_split_word_search||this.search_contains)){regex_string="^"+regex_string;}
regex_flag=this.case_sensitive_search?"":"i";return new RegExp(regex_string,regex_flag);};AbstractChosen.prototype.search_string_match=function(search_string,regex){var match;match=regex.exec(search_string);if(!this.search_contains&&(match!=null?match[1]:void 0)){match.index+=1;}
return match;};AbstractChosen.prototype.choices_count=function(){var i,len,option,ref;if(this.selected_option_count!=null){return this.selected_option_count;}
this.selected_option_count=0;ref=this.form_field.options;for(i=0,len=ref.length;i<len;i++){option=ref[i];if(option.selected){this.selected_option_count+=1;}}
return this.selected_option_count;};AbstractChosen.prototype.choices_click=function(evt){evt.preventDefault();this.activate_field();if(!(this.results_showing||this.is_disabled)){return this.results_show();}};AbstractChosen.prototype.keydown_checker=function(evt){var ref,stroke;stroke=(ref=evt.which)!=null?ref:evt.keyCode;this.search_field_scale();if(stroke!==8&&this.pending_backstroke){this.clear_backstroke();}
switch(stroke){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:if(this.results_showing&&!this.is_multiple){this.result_select(evt);}
this.mouse_on_container=false;break;case 13:if(this.results_showing){evt.preventDefault();}
break;case 27:if(this.results_showing){evt.preventDefault();}
break;case 32:if(this.disable_search){evt.preventDefault();}
break;case 38:evt.preventDefault();this.keyup_arrow();break;case 40:evt.preventDefault();this.keydown_arrow();break;}};AbstractChosen.prototype.keyup_checker=function(evt){var ref,stroke;stroke=(ref=evt.which)!=null?ref:evt.keyCode;this.search_field_scale();switch(stroke){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0){this.keydown_backstroke();}else if(!this.pending_backstroke){this.result_clear_highlight();this.results_search();}
break;case 13:evt.preventDefault();if(this.results_showing){this.result_select(evt);}
break;case 27:if(this.results_showing){this.results_hide();}
break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search();break;}};AbstractChosen.prototype.clipboard_event_checker=function(evt){if(this.is_disabled){return;}
return setTimeout(((function(_this){return function(){return _this.results_search();};})(this)),50);};AbstractChosen.prototype.container_width=function(){if(this.options.width!=null){return this.options.width;}else{return this.form_field.offsetWidth+"px";}};AbstractChosen.prototype.include_option_in_results=function(option){if(this.is_multiple&&(!this.display_selected_options&&option.selected)){return false;}
if(!this.display_disabled_options&&option.disabled){return false;}
if(option.empty){return false;}
return true;};AbstractChosen.prototype.search_results_touchstart=function(evt){this.touch_started=true;return this.search_results_mouseover(evt);};AbstractChosen.prototype.search_results_touchmove=function(evt){this.touch_started=false;return this.search_results_mouseout(evt);};AbstractChosen.prototype.search_results_touchend=function(evt){if(this.touch_started){return this.search_results_mouseup(evt);}};AbstractChosen.prototype.outerHTML=function(element){var tmp;if(element.outerHTML){return element.outerHTML;}
tmp=document.createElement("div");tmp.appendChild(element);return tmp.innerHTML;};AbstractChosen.prototype.get_single_html=function(){return"<a class=\"chosen-single chosen-default\">\n  <span>"+this.default_text+"</span>\n  <div><img src=\""+window.dir_images+"axialis/user-interface/angle-down-small.svg\" alt=\"\"></div>\n</a>\n<div class=\"chosen-drop\">\n  <div class=\"chosen-search\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n  </div>\n  <ul class=\"chosen-results\"></ul>\n</div>";};AbstractChosen.prototype.get_multi_html=function(){return"<ul class=\"chosen-choices\">\n  <li class=\"search-field\">\n    <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\""+this.default_text+"\" />\n  </li>\n</ul>\n<div class=\"chosen-drop\">\n  <ul class=\"chosen-results\"></ul>\n</div>";};AbstractChosen.prototype.get_no_results_html=function(terms){return"<li class=\"no-results\">\n  "+this.results_none_found+" <span>"+(this.escape_html(terms))+"</span>\n</li>";};AbstractChosen.browser_is_supported=function(){if("Microsoft Internet Explorer"===window.navigator.appName){return document.documentMode>=8;}
if(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)){return false;}
return true;};AbstractChosen.default_multiple_text="Select Some Options";AbstractChosen.default_single_text="Select an Option";AbstractChosen.default_no_result_text="No results match";return AbstractChosen;})();this.Chosen=(function(superClass){var triggerHtmlEvent;extend(Chosen,superClass);function Chosen(){return Chosen.__super__.constructor.apply(this,arguments);}
Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex;};Chosen.prototype.set_up_html=function(){var container_classes,container_props;container_classes=["chosen-container"];container_classes.push("chosen-container-"+(this.is_multiple?"multi":"single"));if(this.inherit_select_classes&&this.form_field.className){container_classes.push(this.form_field.className);}
if(this.is_rtl){container_classes.push("chosen-rtl");}
container_props={'class':container_classes.join(' '),'title':this.form_field.title};if(this.form_field.id.length){container_props.id=this.form_field.id.replace(/[^\w]/g,'_')+"_chosen";}
this.container=new Element('div',container_props);this.container.setStyle({width:this.container_width()});if(this.is_multiple){this.container.update(this.get_multi_html());}else{this.container.update(this.get_single_html());}
this.form_field.hide().insert({before:this.container});this.dropdown=this.container.down('div.chosen-drop');this.search_field=this.container.down('input');this.search_results=this.container.down('ul.chosen-results');this.search_field_scale();this.search_no_results=this.container.down('li.no-results');if(this.is_multiple){this.search_choices=this.container.down('ul.chosen-choices');this.search_container=this.container.down('li.search-field');}else{this.search_container=this.container.down('div.chosen-search');this.selected_item=this.container.down('.chosen-single');}
this.results_build();this.set_tab_index();return this.set_label_behavior();};Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this});};Chosen.prototype.register_observers=function(){this.container.observe("touchstart",(function(_this){return function(evt){return _this.container_mousedown(evt);};})(this));this.container.observe("touchend",(function(_this){return function(evt){return _this.container_mouseup(evt);};})(this));this.container.observe("mousedown",(function(_this){return function(evt){return _this.container_mousedown(evt);};})(this));this.container.observe("mouseup",(function(_this){return function(evt){return _this.container_mouseup(evt);};})(this));this.container.observe("mouseenter",(function(_this){return function(evt){return _this.mouse_enter(evt);};})(this));this.container.observe("mouseleave",(function(_this){return function(evt){return _this.mouse_leave(evt);};})(this));this.search_results.observe("mouseup",(function(_this){return function(evt){return _this.search_results_mouseup(evt);};})(this));this.search_results.observe("mouseover",(function(_this){return function(evt){return _this.search_results_mouseover(evt);};})(this));this.search_results.observe("mouseout",(function(_this){return function(evt){return _this.search_results_mouseout(evt);};})(this));this.search_results.observe("mousewheel",(function(_this){return function(evt){return _this.search_results_mousewheel(evt);};})(this));this.search_results.observe("DOMMouseScroll",(function(_this){return function(evt){return _this.search_results_mousewheel(evt);};})(this));this.search_results.observe("touchstart",(function(_this){return function(evt){return _this.search_results_touchstart(evt);};})(this));this.search_results.observe("touchmove",(function(_this){return function(evt){return _this.search_results_touchmove(evt);};})(this));this.search_results.observe("touchend",(function(_this){return function(evt){return _this.search_results_touchend(evt);};})(this));this.form_field.observe("chosen:updated",(function(_this){return function(evt){return _this.results_update_field(evt);};})(this));this.form_field.observe("chosen:activate",(function(_this){return function(evt){return _this.activate_field(evt);};})(this));this.form_field.observe("chosen:open",(function(_this){return function(evt){return _this.container_mousedown(evt);};})(this));this.form_field.observe("chosen:close",(function(_this){return function(evt){return _this.close_field(evt);};})(this));this.search_field.observe("blur",(function(_this){return function(evt){return _this.input_blur(evt);};})(this));this.search_field.observe("keyup",(function(_this){return function(evt){return _this.keyup_checker(evt);};})(this));this.search_field.observe("keydown",(function(_this){return function(evt){return _this.keydown_checker(evt);};})(this));this.search_field.observe("focus",(function(_this){return function(evt){return _this.input_focus(evt);};})(this));this.search_field.observe("cut",(function(_this){return function(evt){return _this.clipboard_event_checker(evt);};})(this));this.search_field.observe("paste",(function(_this){return function(evt){return _this.clipboard_event_checker(evt);};})(this));if(this.is_multiple){return this.search_choices.observe("click",(function(_this){return function(evt){return _this.choices_click(evt);};})(this));}else{return this.container.observe("click",(function(_this){return function(evt){return evt.preventDefault();};})(this));}};Chosen.prototype.destroy=function(){var event,i,len,ref;this.container.ownerDocument.stopObserving("click",this.click_test_action);ref=['chosen:updated','chosen:activate','chosen:open','chosen:close'];for(i=0,len=ref.length;i<len;i++){event=ref[i];this.form_field.stopObserving(event);}
this.container.stopObserving();this.search_results.stopObserving();this.search_field.stopObserving();if(this.form_field_label!=null){this.form_field_label.stopObserving();}
if(this.is_multiple){this.search_choices.stopObserving();this.container.select(".search-choice-close").each(function(choice){return choice.stopObserving();});}else{this.selected_item.stopObserving();}
if(this.search_field.tabIndex){this.form_field.tabIndex=this.search_field.tabIndex;}
this.container.remove();return this.form_field.show();};Chosen.prototype.search_field_disabled=function(){var ref;this.is_disabled=this.form_field.disabled||((ref=this.form_field.up('fieldset'))!=null?ref.disabled:void 0)||false;if(this.is_disabled){this.container.addClassName('chosen-disabled');}else{this.container.removeClassName('chosen-disabled');}
this.search_field.disabled=this.is_disabled;if(!this.is_multiple){this.selected_item.stopObserving('focus',this.activate_field);}
if(this.is_disabled){return this.close_field();}else if(!this.is_multiple){return this.selected_item.observe('focus',this.activate_field);}};Chosen.prototype.container_mousedown=function(evt){var ref;if(this.is_disabled){return;}
if(evt&&((ref=evt.type)==='mousedown'||ref==='touchstart')&&!this.results_showing){evt.preventDefault();}
if(!((evt!=null)&&evt.target.hasClassName("search-choice-close"))){if(!this.active_field){if(this.is_multiple){this.search_field.clear();}
this.container.ownerDocument.observe("click",this.click_test_action);this.results_show();}else if(!this.is_multiple&&evt&&(evt.target===this.selected_item||evt.target.up("a.chosen-single"))){this.results_toggle();}
return this.activate_field();}};Chosen.prototype.container_mouseup=function(evt){if(evt.target.nodeName==="ABBR"&&!this.is_disabled){return this.results_reset(evt);}};Chosen.prototype.search_results_mousewheel=function(evt){var delta;delta=evt.deltaY||-evt.wheelDelta||evt.detail;if(delta!=null){evt.preventDefault();if(evt.type==='DOMMouseScroll'){delta=delta*40;}
return this.search_results.scrollTop=delta+this.search_results.scrollTop;}};Chosen.prototype.blur_test=function(evt){if(!this.active_field&&this.container.hasClassName("chosen-container-active")){return this.close_field();}};Chosen.prototype.close_field=function(){this.container.ownerDocument.stopObserving("click",this.click_test_action);this.active_field=false;this.results_hide();this.container.removeClassName("chosen-container-active");this.clear_backstroke();this.show_search_field_default();this.search_field_scale();return this.search_field.blur();};Chosen.prototype.activate_field=function(){if(this.is_disabled){return;}
this.container.addClassName("chosen-container-active");this.active_field=true;this.search_field.value=this.get_search_field_value();return this.search_field.focus();};Chosen.prototype.test_active_click=function(evt){if(evt.target.up('.chosen-container')===this.container){return this.active_field=true;}else{return this.close_field();}};Chosen.prototype.results_build=function(){this.parsing=true;this.selected_option_count=null;this.results_data=SelectParser.select_to_array(this.form_field);if(this.is_multiple){this.search_choices.select("li.search-choice").invoke("remove");}else{this.single_set_selected_text();if(this.disable_search||this.form_field.options.length<=this.disable_search_threshold){this.search_field.readOnly=true;this.container.addClassName("chosen-container-single-nosearch");}else{this.search_field.readOnly=false;this.container.removeClassName("chosen-container-single-nosearch");}}
this.update_results_content(this.results_option_build({first:true}));this.search_field_disabled();this.show_search_field_default();this.search_field_scale();return this.parsing=false;};Chosen.prototype.result_do_highlight=function(el){var high_bottom,high_top,maxHeight,visible_bottom,visible_top;this.result_clear_highlight();this.result_highlight=el;this.result_highlight.addClassName("highlighted");maxHeight=parseInt(this.search_results.getStyle('maxHeight'),10);visible_top=this.search_results.scrollTop;visible_bottom=maxHeight+visible_top;high_top=this.result_highlight.positionedOffset().top;high_bottom=high_top+this.result_highlight.getHeight();if(high_bottom>=visible_bottom){return this.search_results.scrollTop=(high_bottom-maxHeight)>0?high_bottom-maxHeight:0;}else if(high_top<visible_top){return this.search_results.scrollTop=high_top;}};Chosen.prototype.result_clear_highlight=function(){if(this.result_highlight){this.result_highlight.removeClassName('highlighted');}
return this.result_highlight=null;};Chosen.prototype.results_show=function(){if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field.fire("chosen:maxselected",{chosen:this});return false;}
this.container.addClassName("chosen-with-drop");this.results_showing=true;this.search_field.focus();this.search_field.value=this.get_search_field_value();this.winnow_results();return this.form_field.fire("chosen:showing_dropdown",{chosen:this});};Chosen.prototype.update_results_content=function(content){return this.search_results.update(content);};Chosen.prototype.results_hide=function(){if(this.results_showing){this.result_clear_highlight();this.container.removeClassName("chosen-with-drop");this.form_field.fire("chosen:hiding_dropdown",{chosen:this});}
return this.results_showing=false;};Chosen.prototype.set_tab_index=function(el){var ti;if(this.form_field.tabIndex){ti=this.form_field.tabIndex;this.form_field.tabIndex=-1;return this.search_field.tabIndex=ti;}};Chosen.prototype.set_label_behavior=function(){this.form_field_label=this.form_field.up("label");if(this.form_field_label==null){this.form_field_label=$$("label[for='"+this.form_field.id+"']").first();}
if(this.form_field_label!=null){return this.form_field_label.observe("click",this.label_click_handler);}};Chosen.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices_count()<1&&!this.active_field){this.search_field.value=this.default_text;return this.search_field.addClassName("default");}else{this.search_field.value="";return this.search_field.removeClassName("default");}};Chosen.prototype.search_results_mouseup=function(evt){var target;target=evt.target.hasClassName("active-result")?evt.target:evt.target.up(".active-result");if(target){this.result_highlight=target;this.result_select(evt);return this.search_field.focus();}};Chosen.prototype.search_results_mouseover=function(evt){var target;target=evt.target.hasClassName("active-result")?evt.target:evt.target.up(".active-result");if(target){return this.result_do_highlight(target);}};Chosen.prototype.search_results_mouseout=function(evt){if(evt.target.hasClassName('active-result')||evt.target.up('.active-result')){return this.result_clear_highlight();}};Chosen.prototype.choice_build=function(item){var choice,close_link;choice=new Element('li',{"class":"search-choice"}).update("<span>"+(this.choice_label(item))+"</span>");if(item.disabled){choice.addClassName('search-choice-disabled');}else{close_link=new Element('a',{href:'#',"class":'search-choice-close',rel:item.array_index});close_link.observe("click",(function(_this){return function(evt){return _this.choice_destroy_link_click(evt);};})(this));choice.insert(close_link);}
return this.search_container.insert({before:choice});};Chosen.prototype.choice_destroy_link_click=function(evt){evt.preventDefault();evt.stopPropagation();if(!this.is_disabled){return this.choice_destroy(evt.target);}};Chosen.prototype.choice_destroy=function(link){if(this.result_deselect(link.readAttribute("rel"))){if(this.active_field){this.search_field.focus();}else{this.show_search_field_default();}
if(this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1){this.results_hide();}
link.up('li').remove();return this.search_field_scale();}};Chosen.prototype.results_reset=function(){this.reset_single_select_options();this.form_field.options[0].selected=true;this.single_set_selected_text();this.show_search_field_default();this.results_reset_cleanup();this.trigger_form_field_change();if(this.active_field){return this.results_hide();}};Chosen.prototype.results_reset_cleanup=function(){var deselect_trigger;this.current_selectedIndex=this.form_field.selectedIndex;deselect_trigger=this.selected_item.down("abbr");if(deselect_trigger){return deselect_trigger.remove();}};Chosen.prototype.result_select=function(evt){var high,item;if(this.result_highlight){high=this.result_highlight;this.result_clear_highlight();if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field.fire("chosen:maxselected",{chosen:this});return false;}
if(this.is_multiple){high.removeClassName("active-result");}else{this.reset_single_select_options();}
high.addClassName("result-selected");item=this.results_data[high.getAttribute("data-option-array-index")];item.selected=true;this.form_field.options[item.options_index].selected=true;this.selected_option_count=null;if(this.is_multiple){this.choice_build(item);}else{this.single_set_selected_text(this.choice_label(item));}
if(this.is_multiple&&(!this.hide_results_on_select||(evt.metaKey||evt.ctrlKey))){if(evt.metaKey||evt.ctrlKey){this.winnow_results({skip_highlight:true});}else{this.search_field.value="";this.winnow_results();}}else{this.results_hide();this.show_search_field_default();}
if(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex){this.trigger_form_field_change();}
this.current_selectedIndex=this.form_field.selectedIndex;evt.preventDefault();return this.search_field_scale();}};Chosen.prototype.single_set_selected_text=function(text){if(text==null){text=this.default_text;}
if(text===this.default_text){this.selected_item.addClassName("chosen-default");}else{this.single_deselect_control_build();this.selected_item.removeClassName("chosen-default");}
return this.selected_item.down("span").update(text);};Chosen.prototype.result_deselect=function(pos){var result_data;result_data=this.results_data[pos];if(!this.form_field.options[result_data.options_index].disabled){result_data.selected=false;this.form_field.options[result_data.options_index].selected=false;this.selected_option_count=null;this.result_clear_highlight();if(this.results_showing){this.winnow_results();}
this.trigger_form_field_change();this.search_field_scale();return true;}else{return false;}};Chosen.prototype.single_deselect_control_build=function(){if(!this.allow_single_deselect){return;}
if(!this.selected_item.down("abbr")){this.selected_item.down("span").insert({after:"<abbr class=\"search-choice-close\"></abbr>"});}
return this.selected_item.addClassName("chosen-single-with-deselect");};Chosen.prototype.get_search_field_value=function(){return this.search_field.value;};Chosen.prototype.get_search_text=function(){return this.get_search_field_value().strip();};Chosen.prototype.escape_html=function(text){return text.escapeHTML();};Chosen.prototype.winnow_results_set_highlight=function(){var do_high;if(!this.is_multiple){do_high=this.search_results.down(".result-selected.active-result");}
if(do_high==null){do_high=this.search_results.down(".active-result");}
if(do_high!=null){return this.result_do_highlight(do_high);}};Chosen.prototype.no_results=function(terms){this.search_results.insert(this.get_no_results_html(terms));return this.form_field.fire("chosen:no_results",{chosen:this});};Chosen.prototype.no_results_clear=function(){var nr,results1;nr=null;results1=[];while(nr=this.search_results.down(".no-results")){results1.push(nr.remove());}
return results1;};Chosen.prototype.keydown_arrow=function(){var next_sib;if(this.results_showing&&this.result_highlight){next_sib=this.result_highlight.next('.active-result');if(next_sib){return this.result_do_highlight(next_sib);}}else{return this.results_show();}};Chosen.prototype.keyup_arrow=function(){var actives,prevs,sibs;if(!this.results_showing&&!this.is_multiple){return this.results_show();}else if(this.result_highlight){sibs=this.result_highlight.previousSiblings();actives=this.search_results.select("li.active-result");prevs=sibs.intersect(actives);if(prevs.length){return this.result_do_highlight(prevs.first());}else{if(this.choices_count()>0){this.results_hide();}
return this.result_clear_highlight();}}};Chosen.prototype.keydown_backstroke=function(){var next_available_destroy;if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.down("a"));return this.clear_backstroke();}else{next_available_destroy=this.search_container.siblings().last();if(next_available_destroy&&next_available_destroy.hasClassName("search-choice")&&!next_available_destroy.hasClassName("search-choice-disabled")){this.pending_backstroke=next_available_destroy;if(this.pending_backstroke){this.pending_backstroke.addClassName("search-choice-focus");}
if(this.single_backstroke_delete){return this.keydown_backstroke();}else{return this.pending_backstroke.addClassName("search-choice-focus");}}}};Chosen.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClassName("search-choice-focus");}
return this.pending_backstroke=null;};Chosen.prototype.search_field_scale=function(){var container_width,div,i,len,style,style_block,styles,width;if(!this.is_multiple){return;}
style_block={position:'absolute',left:'-1000px',top:'-1000px',display:'none',whiteSpace:'pre'};styles=['fontSize','fontStyle','fontWeight','fontFamily','lineHeight','textTransform','letterSpacing'];for(i=0,len=styles.length;i<len;i++){style=styles[i];style_block[style]=this.search_field.getStyle(style);}
div=new Element('div').update(this.escape_html(this.get_search_field_value()));div.setStyle(style_block);document.body.appendChild(div);width=div.measure('width')+25;div.remove();if(container_width=this.container.getWidth()){width=Math.min(container_width-10,width);}
return this.search_field.setStyle({width:width+'px'});};Chosen.prototype.trigger_form_field_change=function(){triggerHtmlEvent(this.form_field,'input');return triggerHtmlEvent(this.form_field,'change');};triggerHtmlEvent=function(element,eventType){var error,evt;if(element.dispatchEvent){try{evt=new Event(eventType,{bubbles:true,cancelable:true});}catch(error){evt=document.createEvent('HTMLEvents');evt.initEvent(eventType,true,true);}
return element.dispatchEvent(evt);}else{return element.fireEvent("on"+eventType,document.createEventObject());}};return Chosen;})(AbstractChosen);}).call(this);(function(){"use strict";Autocompleter.Json=Class.create(Autocompleter.Base,{selectedItem:null,initialize:function(element,update,lookupFunction,options){options=options||{};options.minChars=options.minChars||3;options.searchPlaceHolder=options.searchPlaceHolder||'Search';options.updateElement=options.updateElement.bind(this)||null;this.baseInitialize(element,update,options);this.lookupFunction=lookupFunction;this.options.choices=options.choices||120;},getUpdatedChoices:function(){this.lookupFunction(this.getToken().toLowerCase(),this.updateJsonChoices.bind(this));},updateJsonChoices:function(choices){this.updateChoices('<ul>'+'<li data-search="1"><div class="title search-for">'+this.options.searchPlaceHolder.format(this.element.value)+'</div></li>'+
choices.slice(0,this.options.choices).map(this.jsonChoiceToListChoice.bind(this)).join('')+'</ul>');},jsonChoiceToListChoice:function(choice){var $choice='';if(choice.source){$choice=new Element('div',{className:'type',title:choice.source}).update(choice.source).outerHTML;}
return'<li data-link="'+choice.link+'">'+$choice+'<div class="title" title="'+choice.value+'">'+choice.value+'</div></li>';}});Autocompleter.RateLimiting=function(){this.currentRequest=null;this.scheduledRequest=null;};Autocompleter.RateLimiting.prototype={schedule:function(f,searchTerm,callback){this.scheduledRequest={f:f,searchTerm:searchTerm,callback:callback};this._sendRequest();},_sendRequest:function(){if(!this.currentRequest){this.currentRequest=this.scheduledRequest;this.scheduledRequest=null;this.currentRequest.f(this.currentRequest.searchTerm,this._callback.bind(this));}},_callback:function(data){try{this.currentRequest.callback(data);}
catch(e){}
this.currentRequest=null;if(this.scheduledRequest){this._sendRequest();}}};Autocompleter.Cache=Class.create({initialize:function(backendLookup,options){var self=this;this.fuse=false;this.cache=new Hash();this.backendLookup=backendLookup;this.rateLimiter=new Autocompleter.RateLimiting();this.options=Object.extend({choices:120,fuzzySuggestion:false,fuzzyNumericSearch:false,fuzzySuggestionThreshold:0.2,fuzzySuggestionDistance:50},options||{});idoit.Require.require(['fuse'],function(){self.fuse=true;});},lookup:function(term,callback){return this._lookupInCache(term,null,callback)||this.rateLimiter.schedule(this.backendLookup,term,this._storeInCache.curry(term,callback).bind(this));},_lookupInCache:function(fullTerm,partialTerm,callback){partialTerm=partialTerm||fullTerm;var result=this.cache.get(partialTerm);if(result==null||typeof result!='object'){if(partialTerm.length>1){return this._lookupInCache(fullTerm,partialTerm.substr(0,partialTerm.length-1),callback);}
else{return false;}}
else{if(fullTerm!=partialTerm){var hasMore=result.length>0&&result[result.length-1]['more']==true;result=this._localSearch(result,fullTerm);if(!hasMore){this._storeInCache(fullTerm,null,result);}
else{if(result.length<this.options.choices){return false}}}
if(result.length>0&&result[result.length-1]['more']!=undefined){result=result.slice(0,result.length-1);}
callback(result.slice(0,this.options.choices));return true;}},_naturalCompare:function(a,b){if(a!=b)for(var i,ca,cb=1,ia=0,ib=0;cb;){ca=a.charCodeAt?a.charCodeAt(ia++):0||0;cb=b.charCodeAt?b.charCodeAt(ib++):0||0;if(ca<58&&ca>47&&cb<58&&cb>47){for(i=ia;ca=a.charCodeAt(ia),ca<58&&ca>47;ia++);ca=(a.slice(i-1,ia)|0)+1;for(i=ib;cb=b.charCodeAt(ib),cb<58&&cb>47;ib++);cb=(b.slice(i-1,ib)|0)+1;}
if(ca!=cb)return(ca<cb)?-1:1;}
return 0;},_localSearch:function(data,term){var foundItems=[];if(this.options.fuzzySuggestion&&this.fuse){var f=new Fuse(data,{keys:['value'],threshold:this.options.fuzzySuggestionThreshold,distance:this.options.fuzzySuggestionDistance,shouldSort:false});foundItems=f.search(term);}else{var item,exp=(this.options.fuzzySuggestion)&&term.indexOf(' ')>0&&(!this.options.fuzzyNumericSearch&&isNaN(term))?new RegExp(term.gsub(/./,".*#{0}"),'i'):new RegExp(term.gsub(/\+\.\-\?\#/,""),'i');for(var i=0,len=data.length;i<len;++i){item=data[i];if(exp.test(item.value)){foundItems.push(item);}}}
return foundItems.sort(function(a,b){return typeof a=='object'?this._naturalCompare(a.value.toLowerCase(),b.value.toLowerCase()):this._naturalCompare(a.toLowerCase(),b.toLowerCase());}.bind(this));},_storeInCache:function(term,callback,data){this.cache.set(term,data);if(callback){var items=data.slice(0,this.options.choices);if(items.length>1&&items[items.length-1]['more']!=undefined){items=items.slice(0,items.length-1);}
callback(items);}}});}());