
var oldID;function setSelected(newID){document.getElementById(newID).className="linkSel";if(oldID!=undefined){document.getElementById(oldID).className="link";}
oldID=newID;};function mydoit_trigger(){if(!$('mydoitArea').loaded){aj_submit('index.php?request=mydoit','get','mydoitArea');$('mydoitArea').loaded=true;}
new Effect.toggle('mydoitArea','blind',{duration:0.2});}
function close_mydoit(){if($('mydoitArea').loaded)$('mydoitArea').hide();}
function mydoit_addBookmark(){var location=$('isys_form').action||document.location;document.isys_form.mydoitAction.value='add';aj_submit(location+'&request=mydoit_addBookmark','post','mydoitArea','isys_form',null,null);}
function mydoit_deleteBookmark(){var location=$('isys_form').action||document.location;document.isys_form.mydoitAction.value='delete';aj_submit(location+'&request=mydoit_deleteBookmark','post','mydoitArea','isys_form',null,null);}
function mydoit_openSearchModul(ModuleConst,ModuleID,Searchfavorites){if(ModuleConst&&ModuleConst.length>0&&ModuleID&&ModuleID.length>0){var l_url="?"+ModuleConst+"="+ModuleID+"&searchfavorites="+Searchfavorites;window.location.href=l_url;}}
function mysearch_delCriterion(){var location=$('isys_form').action||document.location;aj_submit(location+'&request=mysearch_delCriterion','post','mydoitArea','isys_form',null,null);}
function isys_popup_open(p_url,p_name,p_centered,p_config)
{var cX,cY,strConf='';if(p_centered){if(document.all){cX=((document.body.offsetWidth/2)-(p_config['width']/2));cY=((document.body.offsetHeight/2)-(p_config['height']/2));}else{cX=((outerWidth/2)-(p_config['width']/2));cY=((outerHeight/2)-(p_config['height']/2));}}
for(var prop in p_config){if(prop=='top'&&p_centered)p_config['top']=cY;if(prop=='left'&&p_centered)p_config['left']=cX;strConf=strConf+prop+'='+p_config[prop]+',';}
if(p_centered){strConf=strConf+",left="+cX+",top="+cY;}else{while(strConf.substring(strConf.length-1,strConf.length)==','){strConf=strConf.substring(0,strConf.length-1);}}
strConf+=",dependant=yes";var objWnd=window.open(p_url,p_name,strConf);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();}}}}
var TableOrderer=Class.create();TableOrderer.prototype={initialize:function(element,options){this.element=element;this.options=options;this.options=Object.extend({data:false,url:false,allowMultiselect:true,unsortedColumn:[],dateFormat:'d',filter:false,pageCount:5,paginate:false,search:false,secondSelection:false},options||{});this.tools={page:1,pages:1,filterCol:'',filterData:'',searchData:''};this.msgs={loading:'Loading...',emptyResults:'No matches found',errorURL:'invalid data',errorData:'no data',searchLabel:'Search : ',filterLabel:'Filter Column : ',paginationOf:' of ',paginationPages:' pages ',paginationFirst:'&laquo;',paginationPrev:'&lsaquo;',paginationNext:'&rsaquo;',paginationLast:'&raquo;'};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.setData();},clearCache:function(){this.isCached=false;this.cache=this.data;if(this.orderField){this.orderData(this.orderField);if(this.order=='desc'){this.cache=this.cache.reverse();}}},perform:function(){this.tools.pages=Math.ceil(this.cache.size()/this.options.pageCount);this.setColumnsName();this.clearCache();this.createTable();},getData:function(url){$(this.element).update(this.msgs.loading);var transmit=new Ajax.Request(url,{onSuccess:function(transport){this.data=transport.responseJSON;this.perform();}.bind(this),onFailure:function(){alert(this.msgs.errorURL);}});},setData:function(){if(!this.options.data&&!this.options.url){alert(this.msgs.errorData);}
this.data=this.options.data?this.options.data:false;if(this.data){this.perform();}else{this.getData(this.options.url);}},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;},defineOrderField:function(e){this.previousOrderField=this.orderField;this.orderField=Event.element(e).id.replace(this.table.id+'-','');},defineOrder:function(){if(this.previousOrderField==this.orderField){this.order=this.order=='desc'?'asc':'desc';}
else{this.order='asc';}},orderData:function(order){this.cache=this.cache.sortBy(function(s){var v=Object.values(s)[Object.keys(s).indexOf(order)];return this.orderRule(v);}.bind(this));},thClick:function(e){this.defineOrderField(e);this.defineOrder();this.orderData(this.orderField);if(this.order=='desc'){this.cache=this.cache.reverse();}
this.updateTable();},thOver:function(e){Event.element(e).addClassName('on');},thOut:function(e){Event.element(e).removeClassName('on');},trClick:function(e){this.setSelected(Event.findElement(e,'tr'));var selected;var items=Event.findElement(e,'tr').descendants().pluck('innerHTML');var json='{';var keys=Object.keys(this.model);items.each(function(i,index){json+=index===0?'':', ';json+='"'+keys[index]+'": "'+i+'"';});json+='}';selected=json.evalJSON();},trOver:function(e){Event.findElement(e,'tr').addClassName('on');},trOut:function(e){Event.findElement(e,'tr').removeClassName('on');},setSelected:function(elt){if(this.options.allowMultiselect){if(elt.hasClassName('selected')){elt.removeClassName('selected');}else{elt.addClassName('selected');}}
else{}},addToolsObserver:function(){var tid=this.table.id;if(this.options.filter){var filterDatakbfx=this.filterData.bindAsEventListener(this);Event.observe(tid+'-filter-column','change',filterDatakbfx);Event.observe(tid+'-filter-data','keyup',filterDatakbfx);}
if(this.options.search){var searchDatakbfx=this.searchData.bindAsEventListener(this);Event.observe(tid+'-search-data','keyup',searchDatakbfx);}
if(this.options.paginate){var pagerDatabfx=this.pagerData.bindAsEventListener(this);Event.observe(tid+'-page-prev','click',pagerDatabfx);Event.observe(tid+'-page-next','click',pagerDatabfx);Event.observe(tid+'-page-last','click',pagerDatabfx);Event.observe(tid+'-page-first','click',pagerDatabfx);}},addTableObserver:function(){var tid=this.table.id;$$('#'+tid+' th').invoke('observe','click',this.thClickbfx).invoke('observe','mouseover',this.thOverbfx).invoke('observe','mouseout',this.thOutbfx);$$('#'+tid+' tr.data').invoke('observe','click',this.trClick.bindAsEventListener(this)).invoke('observe','mouseover',this.trOver.bindAsEventListener(this)).invoke('observe','mouseout',this.trOut.bindAsEventListener(this));},filterData:function(e){var tid=this.table.id;var caller=Event.element(e);if(caller.id==tid+'-filter-column'&&this.tools.filterData===''){this.tools.filterCol=$F(tid+'-filter-column');return;}
this.tools.filterData=$F(tid+'-filter-data');if(caller.id==tid+'-filter-column'){$(tid+'-filter-data').clear();this.tools.filterCol=$F(tid+'-filter-column');this.tools.filterData='';}
this.clearCache();if(this.options.paginate){this.updateTable();return;}
$$('#'+tid+' td.'+tid+'-column-'+this.tools.filterCol).each(function(i){i.ancestors()[1].show();if(!i.innerHTML.toUpperCase().include(this.tools.filterData.toUpperCase())){i.ancestors()[1].hide();}});},pagerData:function(e){var tid=this.table.id;var caller=Event.element(e);switch(caller.id){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;}
this.updateTable();},searchData:function(e){var tid=this.table.id;this.tools.searchData=$F(tid+'-search-data');this.clearCache();this.updateTable();},makeColumnUnsortable:function(columnId){columnId=this.table.id+'-'+columnId;$(columnId).setStyle({'backgroundImage':'none'});Event.stopObserving($(columnId),'click',this.thClickbfx);Event.stopObserving($(columnId),'mouseover',this.thOverbfx);Event.stopObserving($(columnId),'mouseout',this.thOutbfx);},makeUnsort:function(){this.options.unsortedColumn.each(function(i){if($(this.table.id+'-'+i)){this.makeColumnUnsortable(i);}}.bind(this));},createTable:function(){this.container.update();this.container.insert({top:'<table cellspacing="1" cellpadding="0" id="data-grid-'+this.element+'" class="prototools-table"></table>'});this.table=$('data-grid-'+this.element);this.createTools();this.createRows();this.addToolsObserver();this.addTableObserver();this.makeUnsort();},updateTable:function(){this.table=$('data-grid-'+this.element);$(this.table.id).update();this.createRows();this.addTableObserver();this.makeUnsort();},createRow:function(obj,index){var line=index%2;var row='<tr class="data line'+line+'" id="'+this.table.id+'-'+index+'">\n';var values=Object.values(obj);this.tableColumnsName.each(function(s,index){row+='\t<td class="'+this.table.id+'-column-'+s+'">'+values[index]+'</td>\n';}.bind(this));row+='\n</tr>';return row;},createFirstRow:function(obj){var row='<tr>\n';this.tableColumnsName.each(function(i){row+='\t<th id="'+this.table.id+'-'+i+'" key="'+i+'">'+i.replace('_',' ').capitalize()+'</th>';}.bind(this));row+='\n</tr>';this.model=Object.clone(obj);return row;},setColumnsName:function(){this.tableColumnsName=Object.keys(this.data[0]);},createFilter:function(){var option='';this.tableColumnsName.each(function(i){option+='\t<option value="'+i+'">'+i.replace('_',' ').capitalize()+'</option>\n';});$(this.table.id+'-options').insert({bottom:this.msgs.filterLabel}).insert({bottom:'<select id="'+this.table.id+'-filter-column">'+option+'</select>'}).insert({bottom:Element('input',{'id':this.table.id+'-filter-data'})});this.tools.filterCol=$F(this.table.id+'-filter-column');this.tools.filterData=$F(this.table.id+'-filter-data');},createPager:function(){$(this.table.id+'-pager').insert({bottom:Element('input',{'id':this.table.id+'-page-first','type':'button','value':this.msgs.paginationFirst,'class':'first-page-button'})}).insert({bottom:Element('input',{'id':this.table.id+'-page-prev','type':'button','value':this.msgs.paginationPrev,'class':'prev-page-button'})}).insert({bottom:'<span id="'+this.table.id+'-page-current'+'" class="currentpage">'+this.tools.page+'</span>'}).insert({bottom:Element('input',{'id':this.table.id+'-page-next','type':'button','value':this.msgs.paginationNext,'class':'next-page-button'})}).insert({bottom:Element('input',{'id':this.table.id+'-page-last','type':'button','value':this.msgs.paginationLast,'class':'last-page-button'})}).insert({bottom:this.msgs.paginationOf+'<span id="'+this.table.id+'-page-total'+'" class="totalpages">'+this.tools.pages+'</span>'+this.msgs.paginationPages});},createSearch:function(){$(this.table.id+'-search').insert({bottom:this.msgs.searchLabel}).insert({bottom:Element('input',{'id':this.table.id+'-search-data'})});this.tools.searchData=$F(this.table.id+'-search-data');},createTools:function(){var filterDiv,pagerDiv,searchDiv;if(this.options.filter){filterDiv=new Element('div',{'id':this.table.id+'-options','class':'prototools-options'});if(this.options.filter=='top'){this.table.insert({before:filterDiv});filterDiv.setStyle('border-bottom : none;');}
else{this.table.insert({after:filterDiv});filterDiv.setStyle('border-top : none;');}
this.createFilter();}
if(this.options.search)
{searchDiv=new Element('div',{'id':this.table.id+'-search','class':'prototools-search'});if(this.options.search=='top'){this.table.insert({before:searchDiv});searchDiv.setStyle('border-bottom : none;');}
else{this.table.insert({after:searchDiv});searchDiv.setStyle('border-top : none;');}
this.createSearch();}
if(this.options.paginate)
{pagerDiv=new Element('div',{'id':this.table.id+'-pager','class':'prototools-pager'});if(this.options.paginate=='top'){this.table.insert({before:pagerDiv});pagerDiv.setStyle('border-bottom : none;');}
else{this.table.insert({after:pagerDiv});pagerDiv.setStyle('border-top : none;');}
this.createPager();}},createRows:function(){var line=1;var display,enddisplay,startdisplay,dataView,dat,col,searchStr,row,s;this.table.insert({top:this.createFirstRow()});dataView=this.cache;if(this.options.filter&&!this.isCached&&this.tools.filterData!==''){col=this.tools.filterCol;dat=this.tools.filterData.toUpperCase();dataView=[];dataView=this.cache.inject([],function(array,rec,index){if(rec[col].toString().toUpperCase().include(dat))
{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,index){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.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').update(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){this.table.insert({bottom:this.createRow(i,index)});line=(line==1)?2:1;}.bind(this));if(display.size()===0){s=this.tableColumnsName.size();row='<tr class="data line0" id="'+this.table.id+'-0">\n';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(this.order);}
if(!this.isCached){this.isCached=true;this.cache=dataView;}}};TableOrderer.prototype.createPager=function(){if($(this.table.id+'-pager'))$(this.table.id+'-pager').addClassName('toolbar');$(this.table.id+'-pager').insert({bottom:Element('a',{'id':this.table.id+'-page-first','class':'first-page-button'}).update(this.msgs.paginationFirst)}).insert({bottom:Element('a',{'id':this.table.id+'-page-prev','class':'prev-page-button'}).update(this.msgs.paginationPrev)}).insert({bottom:'<span id="'+this.table.id+'-page-current'+'" class="currentpage">'+this.tools.page+'</span>'}).insert({bottom:Element('a',{'id':this.table.id+'-page-next','class':'next-page-button'}).update(this.msgs.paginationNext)}).insert({bottom:Element('a',{'id':this.table.id+'-page-last','class':'last-page-button'}).update(this.msgs.paginationLast)}).insert({bottom: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 i_cnt=1;var row='<thead><tr>';this.tableColumnsName.each(function(i){var style='';if(i_cnt==1)style=' style="width:80px;" ';if(i=='__checkbox__')i='';row+='<th id="'+this.table.id+'-'+i+'"'+style+'>'+i+'</th>';i_cnt++;}.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){return'<input type="radio" name="listSelection" '+(checked?'checked="checked" ':' ')+'onclick="'+this.options.objectSelectionCallback+'([\''+values[0]+'\', \''+values[1]+'\', \''+values[2]+'\', \''+values[3]+'\']);" />';};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.add(["+values[0]+", '"+values[1]+"', '"+values[2]+"', '"+values[3]+"'], true);"+"this.up().update(window.browserList.removeButton(["+values[0]+", '"+values[1]+"', '"+values[2]+"', '"+values[3]+"'], '"+view+"'));";return'<a onclick="'+func_string+'"><img src="images/icons/plus-green.gif" height="10" class="vam" /> '+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__ADD')+'</a>';}else{return this.radioButton(values,false);}};TableOrderer.prototype.removeButton=function(values,view){if((this.options.multiselection&&!this.options.secondSelectionExists)||(this.options.multiselection&&this.options.secondSelectionExists&&view=='r')){var func_string="browserPreselection.remove("+values[0]+", true);"+"this.up().update(window.browserList.addButton(["+values[0]+", '"+values[1]+"', '"+values[2]+"', '"+values[3]+"'], '"+view+"'))";return'<a onclick="'+func_string+'"><img src="images/icons/delete-2.gif" height="10" class="vam" /> '+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__REMOVE')+'</a>';}else{return this.radioButton(values,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('objectid',values[0]);this.tableColumnsName.each(function(s,index){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 toolbar center';}else{tmpContent=values[index];tmpClassName=this.table.id+'-column-'+s;}
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('_',' ')+'</option>\n';}});$(this.table.id+'-options').insert({bottom:this.msgs.filterLabel}).insert({bottom:'<select id="'+this.table.id+'-filter-column">'+option+'</select>'}).insert({bottom:Element('input',{'id':this.table.id+'-filter-data'})});this.tools.filterCol=$F(this.table.id+'-filter-column');this.tools.filterData=$F(this.table.id+'-filter-data');};TableOrderer.prototype.thClick=function(e){this.defineOrderField(e);this.defineOrder();this.orderData(this.orderField);if(this.order=='desc'){this.cache=this.cache.reverse();}
this.updateTable();};window.Browser={};Browser.objectList=Class.create(TableOrderer,{parameters:{form:'browser',minLen:2},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||{});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.add',firstSelection:false,secondSelection:false,secondSelectionExists:false},this.parameters.listOptions||{});this.tools={page:1,pages:1,filterCol:'',filterData:'',searchData:''};this.msgs={loading:'Loading...',emptyResults:'Keine Ergebnisse gefunden',errorURL:'invalid data',errorData:'no data',searchLabel:'Search : ',filterLabel:'Filter Column : ',paginationOf:' of ',paginationPages:' pages ',paginationFirst:'&laquo;',paginationPrev:'&lsaquo;',paginationNext:'&rsaquo;',paginationLast:'&raquo;',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);},searchByType:function(objectTypeID){if(objectTypeID>0)this.parameters.jsonClient.getObjectsByType(objectTypeID,this.initList.bind(this),{select:this.defaultSelection});},searchByGroup:function(objID){if(objID>0)this.parameters.jsonClient.getObjectsByGroup(objID,this.initList.bind(this),{select:new Hash({connected_id:'__checkbox__',connected_title:idoit.Translate.get('LC__CMDB__LOGBOOK__TITLE'),connected_type:idoit.Translate.get('LC__CMDB__CATG__TYPE'),connected_sysid:idoit.Translate.get('LC__CMDB__CATG__SYSID')})});},searchByPersonGroup:function(objID){if(objID>0)this.parameters.jsonClient.getObjectsByPersonGroup(objID,this.initList.bind(this),{select:this.defaultSelection});},searchByRelationType:function(objID){if(objID>0)this.parameters.jsonClient.getObjectsByRelationType(objID,this.initList.bind(this),{select:this.defaultSelection});},searchByTimeCondition:function(p_condition,p_from,p_to,p_params){if(p_condition&&p_condition!=-1)this.parameters.jsonClient.getObjectsByTimeCondition({condition:p_condition,from:p_from,to:p_to},this.initList.bind(this),{parameters:p_params,select:this.defaultSelection});},searchByCategoryFilter:function(p_request,p_callFunction){this.parameters.jsonClient.getObjectsByCustomBrowserRequest(new Hash({request:p_request,callFunction:p_callFunction}),this.initList.bind(this),{select:this.defaultSelection});},search:function(p_element,p_typeFilter,p_groupFilter){if(p_element&&p_element.value.length>this.parameters.minLen)
this.parameters.jsonClient.getObjectsByFilter(encodeURI(p_element.value),this.initList.bind(this),{select:this.defaultSelection,parameters:{typeFilter:p_typeFilter,groupFilter:p_groupFilter}});else this.showError(this.msgs.minLen.replace('{0}',this.parameters.minLen));},showError:function(p_message){$(this.element).update('<p class="emptyPageMessage"><img src="images/outlet.png" class="" /> '+p_message+'</p>');},initList:function(r){this.data=r.responseJSON;if(this.data.length>0){this.perform();if(this.options.colgroup)this.table.insert({top:this.options.colgroup});}else{this.showError(this.msgs.emptyResults);}}});Browser.preselection=Class.create({options:{preselection:[],ajaxURL:'',afterFinish:Prototype.emptyFunction},initialize:function(element,options){this.element=$(element)||false;this.secondElement=('secondElement'in options)?$(options.secondElement):false;this.secondList=('secondList'in options)?options.secondList:false;Object.extend(this.options,options||{});},log:function(string){if(this.options.logElement)$(this.options.logElement).insert({top:new Date().toLocaleString()+': '+string+'\n'});if(this.options.latestLogElement)$(this.options.latestLogElement).update(string);},alreadyAdded:function(name){this.log(('<span class="red">'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__EXISTS_IN_SELECTION')+'</span>').replace('{0}',name));this.morphSelectionCount('#cc0000');},getData:function(){var tmpArray=[];for(var i=0,len=this.options.preselection.length;i<len;++i)tmpArray.push(this.options.preselection[i][0]);return Object.toJSON(tmpArray);},exists:function(objectId){if(this.element)return(this.element.innerHTML.search('objectid="#'+objectId+'"')!=-1);else return false;},remove:function(objID,skipRebuildingTable){var tmpdata=[],index=-1;for(var i=0,len=this.options.preselection.length;i<len;++i){if(objID==this.options.preselection[i][0]){index=i;break;}}
if(index===0&&this.options.preselection.length==1)this.options.preselection=[];else if(index>=0){tmpdata=this.options.preselection[index];if(this.options.preselection.splice(index,1)&&tmpdata[1]&&tmpdata[2])
this.log(('<span class="red">'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__0_FROM_TYPE_1_HAS_BEEN_REMOVED')+'</span>').replace('{0}',tmpdata[1]).replace('{1}',tmpdata[2]));}
if(!skipRebuildingTable)this.element.update(this.compute());this.updateSelectionCount('#cc0000');return true;},addObject:function(objID,objTypeID,objTitle,objTypeTitle){this.add([objID,objTitle,objTypeTitle,'-']);},secondSelectionCall:function(object){if(typeof object[0]=='undefined'){return false;}
if(typeof object[1]!='undefined'){window.secondSelection.objName=object[1];}
if(!this.options.multiselection){this.options.preselection=[object]}
idoitJSON.call(this.options.ajaxURL+'&'+C__CMDB__GET__OBJECT+'='+object[0],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){if(object&&typeof object[0]!='undefined'){if(!this.exists(object[0])){if(!this.options.secondElement||fromButton){if(!this.options.multiselection||this.options.multiselection=='false'){this.options.preselection=[object]}else{this.options.preselection.push(object);}
this.updateSelectionCount();}
if(this.element){if(this.options.preselection.length==1){this.element.update(this.compute());}else{if(this.element.down()){this.element.down().insert(this.addRow(object));}}}
if((this.options.multiselection&&!this.secondElement)||fromButton)
this.log(('<span class="green">'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__0_FROM_TYPE_1_HAS_BEEN_ADDED')+'</span>').replace('{0}',object[1]).replace('{1}',object[2]));else
this.log(('<span class="green">'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__0_FROM_TYPE_1_SELECTED')+'</span>').replace('{0}',object[1]).replace('{1}',object[2]));return true;}else{this.alreadyAdded(object[1]);}}
return false;},addRow:function(object,i){if(!i)i=this.options.preselection.length;return'<tr class="'+((i++%2==0)?'line0':'line1')+'" objectid="#'+object[0]+'">'+'<td class="toolbar"><a href="javascript:;" onclick="browserPreselection.remove(\''+object[0]+'\', true); this.up().up().remove();"><img src="images/icons/delete-2.gif" height="10" class="vam" /> '+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__REMOVE')+'</a></td>'+'<td>'+object[1]+'</td>'+'<td>'+object[2]+'</td>'+'</tr>';},morphSelectionCount:function(toColor){if($(this.options.objectCountElement).up()){new Effect.Morph($(this.options.objectCountElement).up(),{style:'color:'+toColor+';',duration:0.3,afterFinish:function(){new Effect.Morph($(this.options.objectCountElement).up(),{style:'color:#666666;',duration:1.8});}.bind(this)});}},updateSelectionCount:function(morphTo){if(!morphTo)morphTo='#00cc00';if('objectCountElement'in this.options&&$(this.options.objectCountElement)){$(this.options.objectCountElement).update(this.options.preselection.length);this.morphSelectionCount(morphTo);}},count:function(){return this.options.preselection.length;},compute:function(){var content='',i=0;if(this.options.preselection&&this.options.preselection.length>0){content='<table class="prototools-table">'+'<colgroup>'+'<col width="25" />'+'</colgroup>'+'<thead>'+'<tr>'+'<th></th>'+'<th>'+idoit.Translate.get('LC__UNIVERSAL__OBJECT_TITLE')+'</th>'+'<th>'+idoit.Translate.get('LC__UNIVERSAL__OBJECT_TYPE')+'</th>'+'</tr>'+'</thead>'+'<tbody>';this.options.preselection.each(function(v,k){content+=this.addRow(v,i++);}.bind(this));content+='</tbody>'+'</table>';}else{this.log(idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__NO_PRESELECTION'));}
if(this.options.afterFinish)this.options.afterFinish(this);return content||'<p class="exception p10 m10">'+idoit.Translate.get('LC__CMDB__OBJECT_BROWSER__SCRIPT__NO_PRESELECTION')+'</p>';}});var menu_tree=null;var drops=[];function Node(id,pid,name,url,title,target,icon,iconOpen,open,action,backSrc){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;if(typeof action!="undefined")
{this.action=action;}
else
{this.action='';}};function dTree(objName,dirIcons){this.config={target:null,folderLinks:true,useSelection:true,useCookies:false,useLines:true,useIcons:true,useStatusText:false,closeSameLevel:false,inOrder:false}
this.icon={root:dirIcons+'base.gif',folder:dirIcons+'folder.gif',folderOpen:dirIcons+'folderopen.gif',node:dirIcons+'page.gif',empty:dirIcons+'empty.gif',line:dirIcons+'line.gif',join:dirIcons+'join.gif',joinBottom:dirIcons+'joinbottom.gif',plus:dirIcons+'plus.gif',plusBottom:dirIcons+'plusbottom.gif',minus:dirIcons+'minus.gif',minusBottom:dirIcons+'minusbottom.gif',nlPlus:dirIcons+'nolinesplus.gif',nlMinus:dirIcons+'nolinesminus.gif'};this.obj=objName;this.aNodes=[];this.aIndent=[];this.root=new Node(-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){this.aNodes[this.aNodes.length]=new Node(id,pid,name,url,title,target,icon,iconOpen,open,action,backSrc);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='<div class="dtree">\n';if(document.getElementById){if(this.config.useCookies)this.selectedNode=this.getSelected();str+=this.addNode(this.root,'');}else str+='Browser not supported.';str+='</div>';if(!this.selectedFound)this.selectedNode=null;this.completed=true;return str;};dTree.prototype.addNode=function(pNode){var str='';var n=0;if(this.config.inOrder)n=pNode._ai;for(n;n<this.aNodes.length;n++){if(this.aNodes[n].pid==pNode.id){var 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='';var style_name='';str+='<div class="node" style="'+style_name+'">'+this.indent(node,nodeId);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)+'" alt="" />';}
if(node.url){if(nodeId==this.selectedNode)
{var class_name='nodeSel';}
else
{var class_name='node';}
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))
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="" />';}
(node._ls)?this.aIndent.push(0):this.aIndent.push(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);eOld.className="node";}
eNew=document.getElementById("s"+this.obj+id);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.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){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();var 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='';var posName=document.cookie.indexOf(escape(cookieName)+'=');if(posName!=-1){var posValue=posName+(escape(cookieName)+'=').length;var 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;};if(!Array.prototype.push){Array.prototype.push=function array_push(){for(var i=0;i<arguments.length;i++)
this[this.length]=arguments[i];return this.length;}};if(!Array.prototype.pop){Array.prototype.pop=function array_pop(){lastElement=this[this.length-1];this.length=Math.max(this.length-1,0);return lastElement;}};var Tabs=Class.create({current_body:'',options:{wrapperClass:'tabs',contentClass:'tab-content',activeBodyClass:'active-body',activeClass:'active',tabClass:'gradient text-shadow'},initTab:'',close:'_close',initialize:function(element,options){if($(element)){this.options=Object.extend(this.options,options||{});this.element=$(element).addClassName(this.options.wrapperClass);this.menu=$$('#'+element+' 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(el){this.current_body=$(this.get(el));$(el).addClassName(this.options.activeClass).blur()
this.current_body.addClassName(this.options.contentClass).show();},hide:function(el){this.current_body=$(this.get(el));$(el).removeClassName(this.options.activeClass);this.current_body.removeClassName(this.options.activeBodyClass).hide();},close:function(el){},tab_initialize:function(el){el.addClassName(this.options.tabClass);if($(this.get(el)))$(this.get(el)).hide();if(!el.up().hasClassName('disabled')){Event.observe(el,'click',this.prepare.bindAsEventListener(this));}},activate:function(tabNumber){if(this.menu[tabNumber]){this.show(this.menu[tabNumber]);this.menu.without(this.menu[tabNumber]).each(this.hide.bind(this));}},prepare:function(ev){var el=Event.findElement(ev,"a");Event.stop(ev);this.show(el);this.menu.without(el).each(this.hide.bind(this));},get:function(el){var regex=el.href.match(/#([\S]+)/);if(regex)return regex[1];else return'';}});function calc_memory_totalcapacity(){var total=0;var capacity=0;var quantity=0;var unit="";var totalobj;if(typeof(document.getElementsByName('C__CATG__MEMORY_CAPACITY')[0])=='object'){capacity=document.getElementsByName('C__CATG__MEMORY_CAPACITY')[0].value;quantity=document.getElementsByName('C__CATG__MEMORY_QUANTITY')[0].value;unit=document.getElementsByName('C__CATG__MEMORY_UNIT')[0].options[document.getElementsByName('C__CATG__MEMORY_UNIT')[0].selectedIndex].text;total=capacity*quantity;total=total+' '+unit;document.getElementsByName('C__CATG__MEMORY_TOTALCAPACITY')[0].value=total;}}
var jscolor={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{eval('prop='+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.addEventListener){el.addEventListener(evnt,func,false);}else if(el.attachEvent){el.attachEvent('on'+evnt,func);}},fireEvent:function(el,evnt){if(!el){return;}
if(document.createEventObject){var ev=document.createEventObject();el.fireEvent('on'+evnt,ev);}else if(document.createEvent){var ev=document.createEvent('HTMLEvents');ev.initEvent(evnt,true,true);el.dispatchEvent(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];},getMousePos:function(e){if(!e){e=window.event;}
if(typeof e.pageX==='number'){return[e.pageX,e.pageY];}else if(typeof e.clientX==='number'){return[e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e.clientY+document.body.scrollTop+document.documentElement.scrollTop];}},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.valueElement=target;this.styleElement=target;this.hsv=[0,0,1];this.rgb=[1,1,1];this.pickerOnfocus=true;this.pickerMode='HSV';this.pickerPosition='bottom';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=[2*this.pickerBorder+4*this.pickerInset+2*this.pickerFace+jscolor.images.pad[0]+2*jscolor.images.arrow[0]+jscolor.images.sld[0],2*this.pickerBorder+2*this.pickerInset+2*this.pickerFace+jscolor.images.pad[1]];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;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.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.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.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){h<0&&(h=0)||h>6&&(h=6);s<0&&(s=0)||s>1&&(s=1);v<0&&(v=0)||v>1&&(v=1);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){r<0&&(r=0)||r>1&&(r=1);g<0&&(g=0)||g>1&&(g=1);b<0&&(b=0)||b>1&&(b=1);var hsv=RGB_HSV(r===null?this.rgb[0]:(this.rgb[0]=r),g===null?this.rgb[1]:(this.rgb[1]=g),b===null?this.rgb[2]:(this.rgb[2]=b));if(hsv[0]!==null){this.hsv[0]=hsv[0];}
if(hsv[2]!==0){this.hsv[1]=hsv[1];}
this.hsv[2]=hsv[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')};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.boxB.appendChild(jscolor.picker.box);}
var p=jscolor.picker;posPad=[x+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset,y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset];posSld=[null,y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset];p.box.onmouseup=p.box.onmouseout=function(){target.focus();};p.box.onmousedown=function(){abortBlur=true;};p.box.onmousemove=function(e){holdPad&&setPad(e);holdSld&&setSld(e);};p.padM.onmouseup=p.padM.onmouseout=function(){if(holdPad){holdPad=false;jscolor.fireEvent(valueElement,'change');}};p.padM.onmousedown=function(e){holdPad=true;setPad(e);};p.sldM.onmouseup=p.sldM.onmouseout=function(){if(holdSld){holdSld=false;jscolor.fireEvent(valueElement,'change');}};p.sldM.onmousedown=function(e){holdSld=true;setSld(e);};p.box.style.width=4*THIS.pickerInset+2*THIS.pickerFace+jscolor.images.pad[0]+2*jscolor.images.arrow[0]+jscolor.images.sld[0]+'px';p.box.style.height=2*THIS.pickerInset+2*THIS.pickerFace+jscolor.images.pad[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.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.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';}
switch(modeID){case 0:var padImg='hs.png';break;case 1:var padImg='hv.png';break;}
p.padM.style.background="url('"+jscolor.getDir()+"cross.gif') no-repeat";p.sldM.style.background="url('"+jscolor.getDir()+"arrow.gif') no-repeat";p.pad.style.background="url('"+jscolor.getDir()+padImg+"') 0 0 no-repeat";redrawPad();redrawSld();jscolor.picker.owner=THIS;document.getElementsByTagName('body')[0].appendChild(p.boxB);}
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 posM=jscolor.getMousePos(e);var x=posM[0]-posPad[0];var y=posM[1]-posPad[1];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 posM=jscolor.getMousePos(e);var y=posM[1]-posPad[1];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;}}
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;var
posPad,posSld;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);};jscolor.addEvent(valueElement,'keyup',updateField);jscolor.addEvent(valueElement,'input',updateField);jscolor.addEvent(valueElement,'blur',blurValue);valueElement.setAttribute('autocomplete','off');}
if(styleElement){styleElement.jscStyle={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();}};function add_combination(){if($('combination')){if(!$('combination').visible()){$('list').hide();new Effect.Appear('combination',{duration:0.2});}
if($('comb_submit').visible()){$('isys_form').reset();$('sel_app_text').update('');$('comb_submit').hide();new Effect.Morph('object_selection',{style:'width:300px;border-right:1px solid #ccc;',duration:0.2});}}}
function combine(p_object_1,p_object_2,p_link){new Effect.Morph('object_selection',{style:'width:0px;border:0;',duration:0.2});$('object_parent').value=p_object_1;$('object_child').value=p_object_2;new Effect.Appear('comb_submit',{duration:0.1,queue:'end'});$('sel_obj_text').update($('sel_obj_title').value+' > ');$('sel_app_text').update(p_link.innerHTML);$('combination_title').value=$('sel_obj_title').value+' >> '+p_link.innerHTML
resize_comb_submit();new Event.observe(window,'resize',function(){resize_comb_submit();});$('ajax_result').update('');}
function resize_comb_submit(){var l_width=($('combination').getWidth()-$('app_selection').getWidth())-2;$('comb_submit').style.width=l_width+'px';$('combination_title').style.width=(l_width/1.5)+'px';}
function select_object(p_object_id){new Ajax.Get('app_list',document.location+'&objID='+p_object_id,{history:false});}
function save_combination(){togglePreloadPage();new Ajax.Updater('ajax_result',new String(document.location),{method:'post',parameters:$('isys_form').serialize(true)});}
function vwa_autocalc(elVolt,elWatt,elAmpere){if(isNaN(elVolt.value)||isNaN(elWatt.value)||isNaN(elAmpere.value))
return null;if(elVolt.value!=''&&elWatt.value!=''&&elAmpere.value!='')
return null;if(elVolt.value==''&&elWatt.value!=''&&elAmpere.value!='')
elVolt.value=elWatt.value/elAmpere.value;if(elWatt.value==''&&elVolt.value!=''&&elAmpere.value!='')
elWatt.value=elVolt.value*elAmpere.value;if(elAmpere.value==''&&elVolt.value!=''&&elWatt.value!='')
elAmpere.value=elWatt.value/elVolt.value;}
function raidcalc(p_disks,p_space,p_raidtype,p_target,p_targetReal){l_num_disks=parseInt(p_disks);l_space="-";l_message="";l_diskspace_all=l_num_disks;if(l_num_disks%2!=0&&p_raidtype=="1")
{l_message=" Disk amount must be a multiple of 2.";l_num_disks--;}
if(l_num_disks%2!=0&&p_raidtype=="10")
{l_message=" Disk amount must be a multiple of 2.";l_num_disks--;}
l_diskspace_each=parseFloat(p_space);l_diskspace=(l_num_disks*l_diskspace_each);l_diskspace_all=l_diskspace_all*l_diskspace_each;switch(p_raidtype){case"0":strUtilization=l_diskspace;strUtilization2=((l_diskspace*1000000000)/1073741824);l_space=parseInt(strUtilization*100)/100+l_message;l_space_real=parseInt(strUtilization2*100)/100;break;case"1":strUtilization=l_diskspace/2;strUtilization2=((l_diskspace*1000000000)/1073741824)/2;l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;case"10":strUtilization=l_diskspace/2;strUtilization2=((l_diskspace*1000000000)/1073741824)/2;l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;case"2":break;case"3":strUtilization=(l_diskspace*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100));strUtilization2=(((l_diskspace*1000000000)/1073741824)*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100));l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;case"4":strUtilization=(l_diskspace*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100));strUtilization2=(((l_diskspace*1000000000)/1073741824)*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100));l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;case"5":strUtilization=(l_diskspace*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100));strUtilization2=(((l_diskspace*1000000000)/1073741824)*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100))
l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;case"6":strUtilization=(l_diskspace*((parseInt(((l_num_disks-2)/l_num_disks)*10000)/100)/100));strUtilization2=(((l_diskspace*1000000000)/1073741824)*((parseInt(((l_num_disks-1)/l_num_disks)*10000)/100)/100))
l_space=parseInt(strUtilization*100)/100;l_space_real=parseInt(strUtilization2*100)/100;break;}
if(l_space!=0&&isNumeric(l_space)){$(p_target).update(l_space+' GB');}else{$(p_target).update(l_space);}}
function set_raid_type(p_nSelectedID){var softraid=dom_collect_elements_by_name('td','softraid');var hardraid=dom_collect_elements_by_name('td','hardraid');for(var i=0;i<softraid.length;i++){softraid[i].hide();}
for(var i=0;i<hardraid.length;i++){hardraid[i].hide();}
if(p_nSelectedID==1){for(var i=0;i<hardraid.length;i++){new Effect.Appear(hardraid[i],{duration:0.4});}}else if(p_nSelectedID==2){for(var i=0;i<softraid.length;i++){new Effect.Appear(softraid[i],{duration:0.4});}}}
function isdefined(variable){return(typeof(window[variable])=="undefined")?false:true;}
function dom_collect_elements_by_name(p_tagname,p_name)
{var l_result=[];if(document.all){var l_elements=document.getElementsByTagName(p_tagname);for(var l_i=0;l_i<l_elements.length;l_i++){if(l_elements[l_i].name==p_name){l_result.push(l_elements[l_i]);}}}else{l_result=document.getElementsByName(p_name);}
return l_result;}
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 changeCount(p_strValue,p_strDirection,p_bNeg){if(p_strDirection=='up')
return parseInt(p_strValue)+1;else{val=parseInt(p_strValue);if(p_bNeg==true){return val-1;}
else{if(val<2){return val;}
else{return val-1;}}}}
function checkNeg(p_element){var val=parseInt(p_element.value);if(val<1){p_element.value=1;}
return null;}
function checkNaN(p_element){var val=parseInt(p_element.value);if(isNaN(val)){p_element.value=1;}
return null;}
function CheckAllBoxes(me,classname){if(typeof classname=='undefined')classname='checkbox';$$('input.'+classname).each(function(el){if(me.checked=="")el.checked="";else el.checked="checked";});}
Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;Prototype.Browser.IE7=Prototype.Browser.IE&&!Prototype.Browser.IE6;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',_encoding:'ISO-8859-15',_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_encoding)this._encoding=p_encoding;if(p_async)this._asynchronous=p_async;this._url=new String(document.location);},initOptions:function(p_options){var options={history:{cache:true,onStateChange:function(state){}},asynchronous:this._asynchronous,encoding:this._encoding,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(new Array(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=new 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=new 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(Prototype.Browser.IE6){options.onComplete=function(){clearPreloadPage();};options.onSuccess=null;return new Ajax.Updater(p_target,p_url+this._ajax(),options);}
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=new Array();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;}});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({onComplete:isys_ajax_queue._next});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=new 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,encoding:'ISO-8859-15',onComplete:p_complete,onSuccess:function(transport){clearPreloadPage()
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);}}
Object.extend(Event,{KEY_COMMA:188});var ResizableTextbox=Class.create({options:$H({min:5,max:500,step:7}),initialize:function(element,options){var that=this;this.options.update(options);this.el=$(element);this.width=this.el.offsetWidth;this.el.observe('keyup',function(){var newsize=that.options.get('step')*$F(this).length;if(newsize<=that.options.get('min'))newsize=that.width;if(!($F(this).length==this.retrieveData('rt-value')||newsize<=that.options.min||newsize>=that.options.max))
this.setStyle({'width':newsize});}).observe('keydown',function(){this.cacheData('rt-value',$F(this).length);});}});var TextboxList=Class.create({options:$H({resizable:{},className:'bit',separator:',',extrainputs:true,startinput:true,hideempty:true,results:10,wordMatch:false,editmode:0}),initialize:function(element,options){this.options.update(options);if($(element)){this.element=$(element).hide();this.bits=new Hash();this.events=new Hash();this.count=0;this.current=false;if(!options.editmode)return;this.maininput=this.createInput({'class':'maininput','id':options.inputId});this.holder=new Element('ul',{'class':'holder'}).insert(this.maininput);this.element.insert({'before':this.holder});this.holder.observe('click',function(event){event.stop();if(this.maininput!=this.current)this.focus(this.maininput);}.bind(this));this.makeResizable(this.maininput);this.setEvents();}},createAddButton:function(){var that=this;var button=new Element('img',{'src':'images/icons/plus-green.gif','className':'vam','height':12}).observe('click',function(e){var title=this.previous().value;if(title.length==0)return;var found=0;that.data.each(function(e){if(e.evalJSON(true).caption==title)found=e;});if(found==0){idoitJSON.insertNewEntry(title,that.table,function(transport){that.autoAdd({caption:title,value:transport.responseText});});}else if(found>0){that.autoAdd(found.evalJSON(true));}});return button;},setEvents:function(){document.observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(!this.current)return;if(this.current.retrieveData('type')=='box'&&e.keyCode==Event.KEY_BACKSPACE)e.stop();}.bind(this));document.observe('keyup',function(e){e.stop();if(!this.current)return;switch(e.keyCode){case Event.KEY_LEFT:return this.move('left');break;case Event.KEY_RIGHT:return this.move('right');break;case Event.KEY_DELETE:case Event.KEY_BACKSPACE:return this.moveDispose();break;}}.bind(this)).observe('click',function(){document.fire('blur');}.bindAsEventListener(this));},update:function(){this.element.value=this.bits.values().join(this.options.get('separator'));return this;},add:function(text,html){var id=this.options.get('className')+'-'+this.count++;var el=this.createBox($pick(html,text),{'id':id});(this.current||this.maininput).insert({'before':el});el.observe('click',function(e){e.stop();this.focus(el);}.bind(this));this.bits.set(id,text.value);this.update();if(this.options.get('extrainputs')&&(this.options.get('startinput')||el.previous()))this.addSmallInput(el,'before');return el;},addSmallInput:function(el,where){var input=this.createInput({'class':'smallinput'});el.insert({}
[where]=input);input.cacheData('small',true);this.makeResizable(input);if(this.options.get('hideempty'))input.hide();return input;},dispose:function(el){this.bits.unset(el.id);if(el.previous()&&el.previous().retrieveData('small'))el.previous().remove();if(this.current==el)this.focus(el.next());if(el.retrieveData('type')=='box')el.onBoxDispose(this);el.remove();this.update();return this;},focus:function(el,nofocus){if(!this.current)el.fire('focus');else if(this.current==el)return this;this.blur();el.addClassName(this.options.get('className')+'-'+el.retrieveData('type')+'-focus');if(el.retrieveData('small'))el.setStyle({'display':'block'});if(el.retrieveData('type')=='input'){el.onInputFocus(this);if(!nofocus)this.callEvent(el.retrieveData('input'),'focus');}
else el.fire('onBoxFocus');this.current=el;return this;},blur:function(noblur){if(!this.current)return this;if(this.current.retrieveData('type')=='input'){var input=this.current.retrieveData('input');if(!noblur)this.callEvent(input,'blur');input.onInputBlur(this);}
else this.current.fire('onBoxBlur');if(this.current.retrieveData('small')&&!input.get('value')&&this.options.get('hideempty'))
this.current.hide();this.current.removeClassName(this.options.get('className')+'-'+this.current.retrieveData('type')+'-focus');this.current=false;return this;},createBox:function(text,options){return new Element('li',options).addClassName(this.options.get('className')+'-box').update(text.caption).cacheData('type','box');},createInput:function(options){var li=new Element('li',{'class':this.options.get('className')+'-input'});var el=new Element('input',Object.extend(options,{'type':'text'}));el.observe('click',function(e){e.stop();}).observe('focus',function(e){if(!this.isSelfEvent('focus'))this.focus(li,true);}.bind(this)).observe('blur',function(){if(!this.isSelfEvent('blur'))this.blur(true);}.bind(this)).observe('keydown',function(e){this.cacheData('lastvalue',this.value).cacheData('lastcaret',this.getCaretPosition());});var tmp=li.cacheData('type','input').cacheData('input',el).insert(el);return tmp;},callEvent:function(el,type){this.events.set(type,el);el[type]();},isSelfEvent:function(type){return(this.events.get(type))?!!this.events.unset(type):false;},makeResizable:function(li){var el=li.retrieveData('input');el.cacheData('resizable',new ResizableTextbox(el,Object.extend(this.options.get('resizable'),{min:el.offsetWidth,max:(this.element.getWidth()?this.element.getWidth():0)})));return this;},checkInput:function(){var input=this.current.retrieveData('input');return(!input.retrieveData('lastvalue')||(input.getCaretPosition()===0&&input.retrieveData('lastcaret')===0));},move:function(direction){var el=this.current[(direction=='left'?'previous':'next')]();if(el&&(!this.current.retrieveData('input')||((this.checkInput()||direction=='right'))))this.focus(el);return this;},moveDispose:function(){if(this.current.retrieveData('type')=='box')return this.dispose(this.current);if(this.checkInput()&&this.bits.keys().length&&this.current.previous())return this.focus(this.current.previous());}});Element.addMethods({getCaretPosition:function(){if(this.createTextRange){var r=document.selection.createRange().duplicate();r.moveEnd('character',this.value.length);if(r.text==='')return this.value.length;return this.value.lastIndexOf(r.text);}else return this.selectionStart;},cacheData:function(element,key,value){if(Object.isUndefined(this[$(element).identify()])||!Object.isHash(this[$(element).identify()]))
this[$(element).identify()]=$H();this[$(element).identify()].set(key,value);return element;},retrieveData:function(element,key){return this[$(element).identify()].get(key);}});function $pick(){for(var B=0,A=arguments.length;B<A;B++){if(!Object.isUndefined(arguments[B])){return arguments[B];}}
return null;}
if(!idoit)var idoit={};idoit.multiSelect=Class.create(TextboxList,{loptions:$H({autocomplete:{'opacity':0.8,'maxresults':15,'minchars':1}}),initialize:function($super,element,autoholder,options,func){var that=this;var dataString='';$super(element,options);this.data=[];this.inputFields=options.inputFields;this.table=options.table;this.editmode=options.editmode;if(options.data!=undefined&&options.data!=''&&options.data!='null'){options.data.evalJSON(true).each(function(t){this.autoFeed(t);}.bind(this));if(options.mainData!=undefined){this.mainData=options.mainData;if(this.editmode){this.mainData.each(function(e){that.autoAdd(e);});}else{dataString='<ul class="holder">';this.mainData.each(function(e){dataString+='<li class="bit-box" style="padding-right:5px;">'+e.caption+'</li>';});$(autoholder).up().insert(dataString+'</ul>');}}}
else if(options.ajaxURL!=undefined){this.ajaxURL=options.ajaxURL;if(!Object.isUndefined(this.options.get('ajaxURL'))){new Ajax.Request(this.options.get('ajaxURL'),{method:'get',onSuccess:function(transport){transport.responseText.evalJSON(true).each(function(t){this.autoFeed(t);}.bind(this));if(options.mainData!=undefined){this.mainData=options.mainData;if(this.editmode){this.mainData.each(function(e){that.autoAdd(e);});}else{dataString='<ul class="holder">';this.mainData.each(function(e){dataString+='<li class="bit-box" style="padding-right:5px;">'+e.caption+'</li>';});$(autoholder).up().insert(dataString+'</ul>');}}}.bind(this)});}}
this.autoholder=$(autoholder).setOpacity(this.loptions.get('autocomplete').opacity);this.autoholder.observe('mouseover',function(){this.curOn=true;}.bind(this)).observe('mouseout',function(){this.curOn=false;}.bind(this));this.autoresults=this.autoholder.select('ul').first();},autoShow:function(search){this.autoholder.setStyle({'display':'block'});this.autoholder.descendants().each(function(e){e.hide()});this.autocurrent=false;if(!search)search='';search=search.strip();if(search.length<this.loptions.get('autocomplete').minchars)
{this.autoholder.select('.default').first().setStyle({'display':'block'});this.resultsshown=false;}else{this.resultsshown=true;this.autoresults.setStyle({'display':'block'}).update('');if(this.options.get('wordMatch'))var regexp=new RegExp("(^|\\s)"+search,'i')
else var regexp=new RegExp(search,'i')
var count=0;this.data.filter(function(str){return str?regexp.test(str.evalJSON(true).caption):false;}).each(function(result,ti){count++;if(ti>=this.loptions.get('autocomplete').maxresults)return;var that=this;var el=new Element('li').observe('click',function(e){e.stop();that.autoAdd(this);}).observe('mouseover',function(){that.autoFocus(this);}).update(this.autoHighlight(result.evalJSON(true).caption,search));this.autoresults.insert(el);el.cacheData('result',result.evalJSON(true));if(ti==0)this.autoFocus(el);},this);}
if(count>this.options.get('results'))
this.autoresults.setStyle({'height':(this.options.get('results')*22)+'px'});else
this.autoresults.setStyle({'height':(count?(count*22):0)+'px'});return this;},autoHighlight:function(html,highlight){return html.gsub(new RegExp(highlight,'i'),function(match){if(match[0])return'<em>'+match[0]+'</em>';else return'';});},autoHide:function(){this.resultsshown=false;this.autoholder.hide();return this;},autoFocus:function(el){if(!el)return;if(this.autocurrent)this.autocurrent.removeClassName('auto-focus');this.autocurrent=el.addClassName('auto-focus');return this;},autoMove:function(direction){if(!this.resultsshown)return;this.autoFocus(this.autocurrent[(direction=='up'?'previous':'next')]());this.autoresults.scrollTop=this.autocurrent.positionedOffset()[1]-this.autocurrent.getHeight();return this;},autoFeed:function(text){if(this.data.indexOf(Object.toJSON(text))==-1)
this.data.push(Object.toJSON(text));return this;},autoAdd:function(el){if(el.caption!=undefined){this.add(el);delete this.data[this.data.indexOf(Object.toJSON(el))];if(this.lastinput!=undefined)this.lastinput.clear().focus();}else{if(!el||!el.retrieveData('result'))return;this.add(el.retrieveData('result'));delete this.data[this.data.indexOf(Object.toJSON(el.retrieveData('result')))];this.autoHide();var input=this.lastinput||this.current.retrieveData('input');input.clear().focus();}
return this;},createInput:function($super,options){var li=$super(options);var that=this;var input=li.retrieveData('input');input.observe('keydown',function(e){this.dosearch=false;switch(e.keyCode){case Event.KEY_UP:e.stop();return this.autoMove('up');break;case Event.KEY_DOWN:e.stop();return this.autoMove('down');break;case Event.KEY_COMMA:case Event.KEY_RETURN:e.stop();if(this.autocurrent){this.autoAdd(this.autocurrent);}else{if(input&&input.value.length>0){idoitJSON.insertNewEntry(input.value,that.table,function(transport){this.autoAdd({caption:input.value,value:transport.responseText});input.value='';}.bind(this));}}
this.autocurrent=false;this.autoenter=true;break;case Event.KEY_ESC:this.autoHide();if(this.current&&this.current.retrieveData('input'))
this.current.retrieveData('input').clear();break;default:this.dosearch=true;break;}}.bind(this)).observe('keyup',function(e){switch(e.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_RETURN:case Event.KEY_COMMA:case Event.KEY_ESC:;break;default:if(this.searchTimeout)clearTimeout(this.searchTimeout);this.searchTimeout=setTimeout(function(){if(this.dosearch)this.autoShow(input.value);}.bind(this),250);break;}}.bind(this)).observe(Prototype.Browser.IE?'keydown':'keypress',function(e){if(this.autoenter)e.stop();this.autoenter=false;}.bind(this));return li;},createBox:function($super,text,options){var li=$super(text,options);li.observe('mouseover',function(){this.addClassName('bit-hover');}).observe('mouseout',function(){this.removeClassName('bit-hover')});var a=new Element('a',{'href':'#','class':'closebutton'});a.observe('click',function(e){e.stop();if(!this.current)this.focus(this.maininput);this.dispose(li);}.bind(this));li.insert(a).cacheData('text',Object.toJSON(text));return li;}});Element.addMethods({onBoxDispose:function(item,obj){obj.autoFeed(item.retrieveData('text').evalJSON(true));},onInputFocus:function(el,obj){obj.autoShow(el.retrieveData('input').value);},onInputBlur:function(el,obj){obj.lastinput=el;if(!obj.curOn){obj.blurhide=obj.autoHide.bind(obj).delay(0.1);}},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}
return C;}});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,_time:null,_div:null,_zindex:1,_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&#228;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"];if(h_p["language"])
this._language=h_p["language"];this._zindex=(h_p["zindex"])?parseInt(Number(h_p["zindex"])):1;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;this._setPositionTop=(h_p["setPositionTop"])?parseInt(Number(h_p["setPositionTop"])):0;this._setPositionLeft=(h_p["setPositionLeft"])?parseInt(Number(h_p["setPositionLeft"])):0;if(!Object.isUndefined(h_p["enableCloseOnBlur"])&&h_p["enableCloseOnBlur"])
this._enableCloseOnBlur=false;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;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+'">&nbsp;&lt;&nbsp;</th>':'')+'<th id="'+this._id_datepicker_prev+'">&nbsp;&lt;&lt;&nbsp;</th><th id="'+this._id_datepicker_hdr+'" colspan="'+((this._enableYearBrowse)?3:5)+'"></th><th id="'+this._id_datepicker_next+'">&nbsp;&gt;&gt;&nbsp;</th>'+((this._enableYearBrowse)?'<th id="'+this._id_datepicker_next_year+'">&nbsp;&gt;&nbsp;</th>':'')+'</tr></thead><tbody id="'+this._id_datepicker+'-tbody"></tbody><tfoot><td colspan="7" id="'+this._id_datepicker_ftr+'"></td></tfoot></table>';Event.observe(this._relative,this._showEvent,this.click.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._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;}});}},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;},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));this.setPosition(a_pos[1]-scrollOffset[1],a_pos[0]-scrollOffset[0]);}
if(!this.visible()){this._initCurrentDate();this._redrawCalendar();}
eval(this._clickCallback());if(this._enableShowEffect){new Effect.toggle(this._id_datepicker,this._showEffect,{duration:this._showDuration});}else{$(this._id_datepicker).show();}
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;if(!_self.df)_self._initCurrentDate();if(_self._df){var date=($(_self._relative).value=='')?this._current_date:$(_self._relative).value;var hiddenDate=_self._df.match(date);if(hiddenDate){var l_time='';if(!(Object.isUndefined(_self._time))&&$(_self._time)){l_time=(!Object.isUndefined($(_self._time)))?' '+$(_self._time).value:'';}
$(_self._hidden).value=_self._hf.date_to_string(hiddenDate[0],hiddenDate[1],hiddenDate[2],_self._hf.separator)+l_time;}}},setDateFormat:function(format,separator){if(Object.isUndefined(format))
format=this._dateFormat[0];if(Object.isUndefined(separator))
separator=this._dateFormat[1];this._dateFormat=[format,separator];},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};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;');}};function checkPNGs(imagedir){if(!Prototype.Browser.IE6){return;}
$$('img').each(function(img){if(img.src.search(/.png$/)!=-1){img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', enabled=true)";img.src=imagedir+"empty.gif";}});}
function ie6_dropdown_fix(newState){$$('select').each(function(sel){sel.style.visibility=newState;;});}
function popup_open(element){if(!element){element=$('popup');}
Position.includeScrollOffsets=true;show_overlay();if(Prototype.Browser.IE6){ie6_dropdown_fix('hidden');}
var eltDims=element.getDimensions();var browserDims=document.viewport.getDimensions();element.setStyle({"top":Math.ceil((browserDims.height-eltDims.height)/2)+"px","left":Math.ceil((browserDims.width-eltDims.width)/2)+"px","position":"fixed","zIndex":50});new Effect.toggle(element,'appear',{duration:0.3});}
function popup_close(element){if(!element)element=$('popup');if(Prototype.Browser.IE6){ie6_dropdown_fix('');}
new Effect.Fade(element,{duration:0.3});new Effect.Move(element,{x:element.cumulativeOffset().left,y:-500,mode:'absolute',duration:0.3});hide_overlay();}
function get_popup(p_popupname,p_urlparams,p_width,p_height,p_parameters){$('popup').update('');if(p_width){$('popup').style.width=p_width+'px';}
if(p_height){$('popup').style.height=p_height+'px';}
popup_open($('popup'));var l_url='?mod=cmdb&popup='+p_popupname;if(p_urlparams){l_url+='&'+p_urlparams;}
new Ajax.Submit(l_url,'popup',false,{history:false,parameters:p_parameters||{}});}
function get_commentary(){get_popup('commentary','editMode=1',480,250);}
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()){clearPreloadPage();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){if($('ec'+id).innerHTML=="+"){$('ec'+id).innerHTML="-";$('ec'+id).onclick=function(){collapseEntry(id);};}
else if($('ec'+id).innerHTML=="-"){$('ec'+id).innerHTML="+";$('ec'+id).onclick=function(){expandEntry(id);};}}
var preloader=true;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(){if($('content_overlay')){new Effect.Appear('content_overlay',{to:0.4,from:0.1,duration:0.9});}}
function togglePreloadPage(p_force){var element=$('prepage');if((!Object.isUndefined(p_force)||(preloader&&element))&&!element.visible()){showPreloadPage(!Object.isUndefined(p_force));}else if(element){clearPreloadPage();}}
function show_overlay(){if(!Prototype.Browser.IE6&&$('overlay')){$('overlay').setOpacity(0.4).show();}}
function hide_overlay(){if(!Prototype.Browser.IE6){clearPreloadPage();}}
function clearPreloadPage(){if($('prepage'))$('prepage').hide();if($('overlay'))$('overlay').hide();if($('ajax_loading'))$('ajax_loading').hide();if($('treeSwitch'))$('treeSwitch').show();}
function showPreloadPage(p_force){var element=$('prepage');if($('treeSwitch'))$('treeSwitch').hide();if($('ajax_loading'))new Effect.Appear('ajax_loading',{duration:0.2});if((!Object.isUndefined(p_force)||(preloader&&element))&&!element.visible()){show_overlay();var dimensions=element.getDimensions();Position.prepare();var offset_left=(Position.deltaX+Math.floor((getWindowWidth()-dimensions.width)/2));var offset_top=(Position.deltaY+((getWindowHeight()>dimensions.height)?Math.floor((getWindowHeight()-dimensions.height)/2):0));element.setStyle({top:((dimensions.height<=getDocumentHeight())?((offset_top!=null&&offset_top>0)?offset_top:'0')+'px':0),left:((dimensions.width<=getDocumentWidth())?((offset_left!=null&&offset_left>0)?offset_left:'0')+'px':0),position:'absolute',padding:'10px'});new Effect.BlindDown('prepage',{duration:0.15});new Event.observe(element,'click',function(){new Effect.Fade('prepage');$('overlay').hide();});}}
function set_catd_drive(p_nSelectedID){if(p_nSelectedID=='1'){var raid=dom_collect_elements_by_name('tr','partition');for(var i=0;i<raid.length;i++){raid[i].style.display='';}
var raid=dom_collect_elements_by_name('tr','raid');for(var i=0;i<raid.length;i++){raid[i].style.display='none';}}else if(p_nSelectedID=='2'||p_nSelectedID==''){var raid=dom_collect_elements_by_name('tr','raid');for(var i=0;i<raid.length;i++){raid[i].style.display='';}
var raid=dom_collect_elements_by_name('tr','partition');for(var i=0;i<raid.length;i++){raid[i].style.display='none';}}}
var add_oid;var cluster_service_selected,runs_on_callback,set_default_server,SubstituteObjID;var ipDisplay;var rpool_callback,remove_from_pool,relpool_observer;var get_db_instance;function isys_glob_show_error(p_message){Event.observe(window,'load',function(){$('error_message').innerHTML=p_message;Effect.BlindDown('error');Effect.Appear('overlay',{from:0,to:0.3});});}
function $N(name,doc){return(doc||document).getElementsByName(name);}
Array.prototype.in_array=function(needle){for(var i=0;i<this.length;i++)if(this[i]===needle)return true;return false;}
function switch_contentview(img,p_title){new Effect.toggle('contentHeaderInnerTable','appear',{duration:0.2});el=$('object_image_header');if(!el.morphed){el.morphed=true;new Effect.Morph(el,{style:'width:25px; height:25px;',duration:0.2});new Effect.Morph($('contentHeaderTable'),{style:'height:25px;',duration:0.2});if($('barcode'))$('barcode').hide();img.title=p_title;img.src='images/icons/hdrawer_open.png';}else{el.morphed=false;new Effect.Morph(el,{style:'width:100px; height:100px;',duration:0.2});new Effect.Morph($('contentHeaderTable'),{style:'height:100px;',duration:0.2});img.title=p_title;img.src='images/icons/hdrawer_close.png';if($('barcode'))$('barcode').appear();}}
function onlyNumeric(sText){return sText.replace(/[^0-9:]/g,"");}
function isNumeric(x){return(x!=null&&!isNaN(x));}
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(){if($('save'))$('save').disable().setStyle({color:'#ccc'});}
function isys_glob_enable_save(){if($('save'))$('save').enable().setStyle({color:''});}
function ip2long(ip_address){var ip_arr=ip_address.split('.');var 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 purge_object(navmode,ajax,message){var objects=$$('[name="id[]"]:checked');if(objects.length==0){return false;}
var request_data=[];for(var i=0;i<objects.length;i++){request_data.push(objects[i].value);}
var jsonClient=new idoit.JSONClient();jsonClient.getRelationsByObjectId(request_data.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;if(ajax){form_submit();}else{$('isys_form').submit();}}}else{document.isys_form.navMode.value=navmode;if(ajax){form_submit();}else{$('isys_form').submit();}}},{});}
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(){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(dragged,dropped,event){var l_split=dragged.id.split('_');new Ajax.Get('infoBox','?call=change_object_type',{parameters:{objTypeID:drop.id,objID:l_split[1]},method:'post',history:false,onComplete:function(){new Effect.SlideUp(dragged.id);$('infoBox').highlight();}});}});}});}}
function onload_add_callback(p_functioncall){g_onload_callbacks.push(p_functioncall);}
function fix_height(){return;var hg=getDocumentHeight();if($('contentBottom')){var diff=($('contentArea').offsetHeight-$('contentBottom').offsetHeight);}else if($('contentArea')){var diff=$('contentArea').offsetHeight;}else{var diff=0;}
if(diff>screen.height){hg=screen.height-($('top').offsetHeight);}
if($('content'))$('content').style.height=(hg-15-$('top').getHeight())+'px';if($('mydoitArea')){if(Prototype.Browser.IE){$('contentArea').style.height=(hg-15-$('top').getHeight())+'px';$('mydoitArea').className='mydoitAreaIE';if(!Prototype.Browser.IE6)
$('mydoitArea').style.height=(hg-5-$('top').getHeight())+'px';}else{if($('contentArea'))$('contentArea').style.height=hg-25-$('top').getHeight()+'px';$('mydoitArea').style.height=$('content').style.height;$('mydoitArea').className='mydoitArea';}
if($('contentArea').style.overflow=='hidden'){$('contentArea').style.overflow='auto';}}
if($('menuTreeOn'))$('menuTreeOn').style.height=$('mydoitArea').style.height;}
function onload_process()
{if(g_onload_callbacks){for(i=0;i<g_onload_callbacks.length;i++){eval(g_onload_callbacks[i]);}}
History.init();}
function switchNagiosParameters(dir_images){if($('nagiosParameters').visible()){new Effect.SlideUp('nagiosParameters',{duration:0.15});$('expNagios').src=dir_images+"/expand.gif";document.isys_form.nagiosParametersExpanded.value='0';}
else{new Effect.SlideDown('nagiosParameters',{duration:0.15});$('expNagios').src=dir_images+"/collapse.gif";document.isys_form.nagiosParametersExpanded.value='1';}}
function switchNagiosParametersExport(dir_images){if($('nagiosParametersExport').visible()){new Effect.SlideUp('nagiosParametersExport',{duration:0.15});$('expNagiosExport').src=dir_images+"/expand.gif";document.isys_form.nagiosParametersExportExpanded.value='0';}
else{new Effect.SlideDown('nagiosParametersExport',{duration:0.15});$('expNagiosExport').src=dir_images+"/collapse.gif";document.isys_form.nagiosParametersExportExpanded.value='1';}}
function switchNagiosParametersOptional(dir_images){if($('nagiosParametersOptional').visible()){new Effect.SlideUp('nagiosParametersOptional',{duration:0.15});$('expNagiosOptional').src=dir_images+"/expand.gif";document.isys_form.nagiosParametersOptionalExpanded.value='0';}
else{new Effect.SlideDown('nagiosParametersOptional',{duration:0.15});$('expNagiosOptional').src=dir_images+"/collapse.gif";document.isys_form.nagiosParametersOptionalExpanded.value='1';}}
function licence_check(){new Ajax.Get('nag','?ajax=1&call=licence_check',{history:false,onComplete:function(){$('nag').show();}});}
function set_catg_stor(p_nSelectedID){var hd=dom_collect_elements_by_name('td','hd');var notsan=dom_collect_elements_by_name('td','notsan');var san=dom_collect_elements_by_name('td','san');var raid=dom_collect_elements_by_name('td','raid');for(var i=0;i<hd.length;i++){hd[i].hide()}
for(var i=0;i<notsan.length;i++){notsan[i].hide()}
for(var i=0;i<san.length;i++){san[i].hide()}
for(var i=0;i<raid.length;i++){raid[i].hide()}
if(p_nSelectedID==1){for(var i=0;i<hd.length;i++){new Effect.Appear(hd[i],{duration:0.4});}
for(var i=0;i<notsan.length;i++){new Effect.Appear(notsan[i],{duration:0.4});}}else if(p_nSelectedID==4){for(var i=0;i<san.length;i++){new Effect.Appear(san[i],{duration:0.4});}}else if(p_nSelectedID==7){for(var i=0;i<raid.length;i++){new Effect.Appear(raid[i],{duration:0.4});}}else{for(var i=0;i<notsan.length;i++){new Effect.Appear(notsan[i],{duration:0.4});}}}
function isys_clock(p_e)
{var myDate=new Date();var strTemp=myDate.toLocaleString();strTemp=strTemp.substring(0,strTemp.length-3);if($(p_e)){$(p_e).update(strTemp);setTimeout("isys_clock('"+p_e+"');",10000);}}
function is_empty(s){for(var i=0;i<=s.length;i++){var c=s.charAt(i);if((c!=' ')&&(c!='\n')&&(s.length>0)&&(c!=null)){return false;}}
return true;}
var g_checked=false;function check_all(f){var msg;var leerefelder="";var fehler="";for(var i=0;i<f.length;i++){var e=f.elements[i];if(!Prototype.Browser.Opera){if(((e.type=="text")||(e.type=="textarea"))&&!e.optional){if(is_empty(e.value)){leerefelder+="\n"+e.name;continue;}
if(e.numeric||(e.min!=null)||(e.max!=null)){var v=parseFloat(e.value);if(isNaN(v)||((e.min!=null)&&(v<e.min))||((e.max!=null)&&(v>e.max))){fehler+=e.name;if(e.min!=null)fehler+=" muss mindestens "+e.min;if((e.max!=null)&&(e.min!=null))fehler+=" und darf höchstens "+e.max;if((e.max!=null)&&(e.min==null))fehler+=" darf höchstens "+e.max;fehler+=" sein\n";}}}}}
if(is_empty(leerefelder)&&is_empty(fehler)){return true;}
msg="Value not valid: \n\n";msg+=""
if(leerefelder){msg+=leerefelder+"\n";if(fehler)msg+="\n";}
msg+=fehler;if(!g_checked){alert(msg);var g_checked=true;}
return false;}
function check_text(){var l_return,l_field,i;for(i=0;i<arguments.length;i++){l_field=arguments[i];if(l_field.type="text"){if(is_empty(document.getElementByName(l_field)[0].value)==false){throw new Error("Error! "+l_field.name+" is empty!");}else{return true;}}}}
function activateSubmit(){var el=document.getElementById('submit');el.className="visible";}
function deactivateSubmit(){var el=document.getElementById('submit');el.className="invisible";}
function activatePage(page_id){if($){var el_li=$('tab_'+page_id);var el_div=$('content_'+page_id);if(el_li){el_li.className='active';if($('tab_'+activeElementId)){var act_li=$('tab_'+activeElementId);if(activeElementId!=page_id)act_li.className='';}}
if(el_div){if($('content_'+activeElementId)){var act_div=$('content_'+activeElementId);if(activeElementId!=page_id)act_div.className='wizard_content_inactive';}
el_div.className='wizard_content_active';if($('button_0')){if(page_id==0){$('button_0').className="invisible";}else{$('button_0').className="visible;";}}
if($('button_1')){if(page_id==maxElementId){$('button_1').className="invisible";}else{$('button_1').className="visible;";}}}
activeElementId=page_id;if($('focus_element')){$('focus_element').focus();}}}
function nextPage(){var l_next;if(activeElementId<maxElementId){l_next=parseInt(activeElementId)+1;}else{l_next=activeElementId;}
activatePage(l_next);}
function prevPage(){var l_prev;if(activeElementId>0){l_prev=parseInt(activeElementId)-1;}else{l_prev=activeElementId;}
activatePage(l_prev);}
var g_params=new Array();function glob(key){return g_params[key];}
function globalize(param,val){if(val)g_params[param]=val;}
function breadcrumb(p_url){var l_url=p_url.replace(/#.*/g,"");l_url+=(l_url.match(/^.*[\?].*$/))?'&':'?';l_url+='request=breadcrumb';new Ajax.Get('breadcrumb',l_url,{method:'get',history:false,onComplete:function(){document.title='i-doit - '+
$('breadcrumb').innerHTML.stripTags().unescapeHTML();}});}
function save_via_ajax(el){el=$(el);if(el){togglePreloadPage();if(!el.visible())el.show();form_submit($('isys_form').action,'post',el,true);}}
function form_submit(p_url,p_method,p_content,p_no_breadcrumb){showPreloadPage();document.isys_form.target='';l_params=(!p_method||p_method=='post')?$('isys_form').serialize(true):{};if(!Object.isUndefined(p_url)&&p_url){$('isys_form').action=p_url;}else{change_action_parameter('call','category');}
new Ajax.Get((!Object.isUndefined(p_content)&&p_content)?p_content:'main_content',$('isys_form').action,{method:p_method?p_method:'post',onComplete:function(){clearPreloadPage();fix_height();},parameters:l_params});if(!p_no_breadcrumb){breadcrumb($('isys_form').action);}}
function get_content_by_group(p_group_id,p_viewMode){togglePreloadPage()
l_link='?call=object_list&'+
C__CMDB__GET__OBJECTGROUP+'='+p_group_id+'&'+
C__CMDB__GET__VIEWMODE+'='+p_viewMode;new Ajax.Get('main_content',l_link,{method:'get',onSuccess:function(){clearPreloadPage();}});breadcrumb(l_link);}
function get_tree(p_link){togglePreloadPage()
close_mydoit();document.isys_form.target='';globalize(C__CMDB__GET__OBJECT,$H(p_link.parseQuery()).get(C__CMDB__GET__OBJECT));new Ajax.Get('tree_content',p_link,{method:'get',history:false,onSuccess:function(){clearPreloadPage();}});}
function get_tree_object_type(p_group_id,p_objecttype){$$('div#contentArea')[0].setStyle({'overflow':''});remove_drops();var l_link='?call=tree&'+
C__CMDB__GET__OBJECTGROUP+'='+p_group_id;get_tree(l_link);if(p_objecttype){tree_obj_type_click(p_objecttype);}}
function get_tree_by_object(p_object_id,p_treemode){globalize(C__CMDB__GET__TREEMODE,p_treemode);globalize(C__CMDB__GET__OBJECT,p_object_id);new Ajax.Get('tree_content','?call=tree_object&'+
C__CMDB__GET__OBJECT+'='+p_object_id+'&'+
C__CMDB__GET__TREEMODE+'='+p_treemode,{history:false});}
function get_catd_by_object(p_object_id,p_viewmode,p_treemode){showPreloadPage();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){showPreloadPage();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');remove_action_parameter('catsID');remove_action_parameter('cateID');remove_action_parameter('cat1ID');remove_action_parameter('cat2ID');remove_action_parameter('cat3ID');remove_action_parameter('cat4ID');remove_action_parameter('cat5ID');remove_action_parameter('ifaceID');remove_action_parameter('subcatID');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){$('navPageStart').value=(p_page)?p_page:0;if(Object.isUndefined(p_url))p_url=false;form_submit(p_url,false,p_content);}
function tree_obj_type_click(p_objtype,p_page,p_status){$$('div#contentArea')[0].setStyle({'overflow':''});$('navPageStart').value=(p_page)?p_page:0;$('isys_form').action='?'+
C__CMDB__GET__VIEWMODE+'=1001&'+
C__CMDB__GET__OBJECTTYPE+'='+p_objtype+'&call=object_list';form_submit();}
function remove_action_parameter(p_key){var query=$H($('isys_form').action.toQueryParams());if(query.unset(p_key)!='undefined'){$('isys_form').action='?'+query.toQueryString();}}
function change_action_parameter(p_key,p_value){var l_new_action='';var key='';var query=$('isys_form').action.parseQuery();if($('isys_form').action.search(p_key)!=-1){Object.values(query).each(function(val,i){key=Object.keys(query)[i];if(key==p_key){val=p_value;}
l_new_action+=key+'='+val+'&';});if(l_new_action!=''){$('isys_form').action='?'+l_new_action;}}else{$('isys_form').action+='&'+p_key+'='+p_value;}}
function eTree(treeName,treeDataSource,treeCaptionIcon,treeCaption,selectedNodes,imagesFolder,nodeCssClass,selectedNodeCssClass,ajaxAnimation)
{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:"images/please_wait.gif";this.selectedNodesArray=selectedNodes.split(",");this.prevSelectedNodeId=-1;this.loadedNodes=new Array();this.treeLevels=new Array();this.expandedNodes=new Array();this.expandedNodeBottom=new Array();this.parentNodes=new Array();this.expandingImage=null;this.LoadTree(-1);}
eTree.prototype.LoadTree=function(parentNodeId)
{var expander=$(this.treeName+"_Expand_"+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.LoadTreeComplete(transport.responseJSON,parentNodeId);}.bind(this),onFailure:function(){}});}
eTree.prototype.LoadTreeComplete=function(treeData,parentNodeId)
{var expander=$(this.treeName+"_Expand_"+parentNodeId),treeLevel,parentNode
if(expander)
{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");if(this.treeCaptionIcon!='')captionDiv.insert(new Element("img",{src:this.treeCaptionIcon}));if(this.treeCaption!='')captionDiv.insert(this.treeCaption);parentNode.insert(captionDiv);}}
else
{parentNode=$(this.treeName+"_ChildNodes_"+parentNodeId);treeLevel=this.treeLevels[parentNodeId];}
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});var bottomNodes=new Array(),nodeId=parentNodeId;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);var nodeIcon=new Element("img");nodeIcon.src=treeData[i].icon?treeData[i].icon:this.imagesFolder+"page.gif";nodeDiv.insert(nodeIcon);var nodeLink=new Element("a",{id:this.treeName+"_Link_"+treeData[i].id,href:treeData[i].url});nodeLink.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());}}
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)
{if(this.prevSelectedNodeId!=-1)
{$(this.treeName+"_Link_"+this.prevSelectedNodeId).removeClassName(this.selectedNodeCssClass);}
$(this.treeName+"_Link_"+nodeId).removeClassName(this.nodeCssClass);$(this.treeName+"_Link_"+nodeId).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";}}}}
function addNewOption(i,thetext,thevalue,theselectobj){if(theselectobj){if(i==0)theselectobj.length=0;theselectobj.options[i]=new Option(thetext,thevalue);}}
function move(f,bDir,sName){var el=f.elements["list_"+sName];var idx=el.selectedIndex;if(idx==-1)
alert("error, nothing selected..");else{var oldVal=el[idx].value;var oldText=el[idx].text;if(bDir=='upTop'){dst=idx+0-el.selectedIndex;nxidx=dst
for(var i=idx;i>nxidx;i--){el.options[i].text=el.options[(i-1)].text;el.options[i].value=el.options[(i-1)].value;}
el.options[nxidx].text=oldText;el.options[nxidx].value=oldVal;}
else if(bDir=='downBottom'){dst=idx+el.length-1-el.selectedIndex;nxidx=dst
for(var i=idx;i<nxidx;i++){el.options[i].text=el.options[(i+1)].text;el.options[i].value=el.options[(i+1)].value;}
el.options[nxidx].text=oldText;el.options[nxidx].value=oldVal;}
else{var nxidx=idx+(bDir?-1:1)
if(nxidx<0)nxidx=0;if(nxidx>=el.length)nxidx=el.length-1;el[idx].value=el[nxidx].value;el[idx].text=el[nxidx].text;el[nxidx].value=oldVal;el[nxidx].text=oldText;}
el.selectedIndex=nxidx;}}
function processForm(f)
{for(var i=0;i<f.length;i++){var el=f.elements[i];if(el.name.substring(0,5)=="list_"&&el.name.substr(el.name.length-5,5)!="_data"){var strIDs="";var ename=el.name+"_data";for(var j=0;j<el.options.length;j++){strIDs+=el.options[j].value+";"}
document.getElementsByName(ename)[0].value=strIDs;}}}
function list_move_selected_elements(list_src,list_dest,selectedValues,availableValues){var tmp;selectedValues.value="";availableValues.value="";for(i=0;i<list_src.length;i++){if(list_src.options[i].selected){new_entry=new Option(list_src.options[i].text,list_src.options[i].value,false,true);list_dest.options[list_dest.length]=new_entry;}}
for(i=list_src.length-1;i>=0;--i){if(list_src.options[i].selected){list_src.options[i]=null;}}
tmp="";for(i=0;i<list_src.length;i++){if(i!=0)tmp=tmp+',';tmp=tmp+list_src.options[i].value;list_src.options[i].selected=false;}
selectedValues.value=tmp;tmp="";for(i=0;i<list_dest.length;i++){if(i!=0)tmp=tmp+',';tmp=tmp+list_dest.options[i].value;list_dest.options[i].selected=false;}
availableValues.value=tmp;}
if(!idoit)var idoit={};idoit.Translate=new Hash();idoit.Validate=Class.create({config:null,initialize:function(p_config){this.config=p_config;this.config.each(function(e){var elem=null;var value='';if($(this.config.id)){elem=$(this.config.id)
value=elem.getValue();}else if(document.getElementsByName(this.config.id)){elem=document.getElementsByName(this.config.id)[0];value=elem.value;}
if(!idoit.ValidateMethod[e.datatype](value)){this.error(e.datatype+' '+e.id);}}.bind(this));},error:function(str){;}});idoit.ValidateMethod={numeric:function(p_value){return!isNaN(p_value);},integer:function(p_value){var intval=parseInt(p_value);if(isNaN(intval))return false;return p_value==intval&&p_value.toString()==intval.toString();}}
idoit.Suggest=Class.create({initialize:function(method,el,el_hidden,p_options){if(document.getElementsByName(el)[0]||$(el)){Position.includeScrollOffsets=true;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('<div id=\"'+el_choices+'\" class=\"autocomplete\"></div>'+'<span id="indicator'+rnd+'" style="display:none;"><img src="images/ajax-loading.gif" alt="Working..." /></span>');var options={paramName:'search',minChars:2,indicator:'indicator'+rnd,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();else if(p_options.selectCallback)eval(p_options.selectCallback);}};Object.extend(options,p_options||{});options.parameters=$H(options.parameters).toQueryString();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||{});},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;},getObjectByID:function(objectID,callback,options){return this.call(this.jsonGetString+'&'+C__CMDB__GET__OBJECT+'='+objectID,callback,options);},getObjectsByFilter:function(filter,callback,options){return this.call(this.jsonGetString+'&action=filter&filter='+filter,callback,options);},getObjectsByType:function(objTypeID,callback,options){return this.call(this.jsonGetString+'&objTypeID='+objTypeID,callback,options);},getObjectsByGroup:function(groupObjID,callback,options){return this.call(this.jsonGetString+'&action=getByGroup&objID='+groupObjID,callback,options);},getObjectsByPersonGroup:function(groupObjID,callback,options){return this.call(this.jsonGetString+'&action=getByPersonGroup&objID='+groupObjID,callback,options);},getObjectsByTimeCondition:function(condition,callback,options){return this.call(this.jsonGetString+'&action=getByTimeCondition&condition='+condition.condition+'&from='+condition.from+'&to='+condition.to,callback,options);},getObjectsByRelationType:function(relationTypeID,callback,options){return this.call(this.jsonGetString+'&action=getByRelationType&type='+relationTypeID,callback,options);},getObjectsByCustomBrowserRequest:function(request,callback,options){return this.call(this.jsonGetString+'&action=getObjectsByCustomBrowserRequest&request='+Object.toJSON(request),callback,options);},getRelationsByObjectId:function(request,callback,options){return this.call(this.jsonGetString+'&action=getRelationsByObjectId&request='+request,callback,options);},createObject:function(p_objectTitle,p_objectTypeID,p_callback){return this.post(this.jsonGetString+'&action=createObject',{objectTitle:p_objectTitle,objectTypeID:p_objectTypeID},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);},insertNewEntry:function(p_entryTitle,p_entryTable,p_callback){return this.post(this.jsonGetString+'&action=insertNewEntry',{entryTitle:p_entryTitle,entryTable:p_entryTable},p_callback);}});window.idoitJSON=new idoit.JSONClient({raw:true});var _DESC='true';var _MAX=0;function redraw_sortables(container){var i=1;var tmp='';var decr=0;if(_DESC)decr=_MAX+1;$$('#'+container+' .separator').each(function(sep){var nval="";if(sep.title!=""&&sep.title>0){var max=parseInt(sep.title);var content="";for(var n=i;n<(i+max);n++){if(_DESC)tmp=decr-n;else tmp=n-decr;if(tmp<10)nval='0';else nval='';content+=nval+tmp+'<br />';}
sep.update(content);i=(i+max);}else{if(_DESC)tmp=decr-i++;else tmp=i++-decr;if(tmp<10)nval='0';sep.update(nval+tmp);}});}
function remove_object(p_object,p_side){if(p_object>0){var l_location=$('isys_form').action||new String(document.location);new Ajax.Request(l_location,{method:'post',parameters:{object:p_object,side:p_side},onSuccess:function(transport){document.location=transport.request.url;}});}}
function add_object(p_list,p_object,p_ru,p_side){var i=0;var elements=[];var added=false;$$('#'+p_list+' li').each(function(el){if(el.className!='unused'){elements=[];i=0;return;}
if(p_ru>1&&i<p_ru){elements[i++]=el;if(i!=p_ru)return;}
if(p_ru>1){el=elements[(p_ru-i)];elements.each(function(kill,k){if(k>0)kill.remove();});}
new Effect.BlindUp('unused_'+p_object,{duration:0.2});var l_front_str='back';if(p_side==1){l_front_str='front';}
el.className='draggable';el.id=l_front_str+'_'+p_object;var content='<div class="fl separator object" title="'+p_ru+'" ></div>';content+='<div class="fr"><a class="close" title="Clear position" '+'onclick="remove_object(\''+p_object+'\', \''+p_side+'\');\" '+'href=\"javascript:void(\'remove\');"'+'>X</a></div>';content+='<div class="fl">'+$('nopos_'+p_object).innerHTML+'</div>';content+='<div class="cb"></div>';el.update(content);el.highlight();added=true;if(p_side==2){add_object('rack_gui_back',p_object,p_ru,1);}
throw $break;});redraw_sortables(p_list);p_rack_id=p_list;if(p_side==2){p_rack_id='rack_gui_both';}
submit_rack(p_rack_id);if(!added)alert('There is no free rack space available for your selection!');}
function submit_rack(p_rack_id){var l_side=0;var l_list=p_rack_id;if(p_rack_id=='rack_gui_front'){l_side=1;}else if(p_rack_id=='rack_gui_both'){l_list='rack_gui_front';l_side=2;}else{l_list='rack_gui_back';}
var l_location=$('isys_form').action||new String(document.location);new Ajax.Request(l_location,{method:'post',parameters:{positions:Sortable.serialize(l_list),side:l_side,rack:l_list},onSuccess:function(transport){if(transport.responseText!='')
document.location=$('isys_form').action||new String(document.location);}});}
var Rack={init:function(){Position.includeScrollOffsets=true;['rack_gui_front','rack_gui_back'].each(function(rack_id){Sortable.create(rack_id,{scroll:(Prototype.Browser.Gecko)?'contentArea':window,onUpdate:function(el){redraw_sortables(rack_id);submit_rack(rack_id);},onChange:function(el){},onDrop:function(el,last_el){}});Element.makePositioned($(rack_id));})}};
