/*  JS Resource: lib/miwt/miwt-lib.js  */

if(typeof miwt=='undefined')miwt={};if(typeof miwtutil=='undefined'){var miwtutil={};if(typeof Node=='undefined'){Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};}
if(!Array.prototype.each){Array.prototype.each=function(f){for(var h=0,hb=this.length;h<hb;h++)f(h,this[h]);};}
if(!Array.prototype.filter){Array.prototype.filter=function(f,thisObj){var h=0,hb=this.length,r=[];for(;h++<hb;)if(f.call(thisObj,this[h],h,this))r.push(this[h]);return r;};};if(!Array.prototype.without){Array.prototype.without=function(w){return this.filter(function(v){return w!=v;})};}
if(!Array.prototype.indexOf){Array.prototype.indexOf=function(e){for(var h=0,hb=this.length;h<hb;h++)if(this[h]==e)return h;return -1;};}
if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};}
miwt.B=(function(){var ua=navigator.userAgent,isOpera=Object.prototype.toString.call(window.opera)=='[object Opera]';return{IE:!!window.attachEvent&&!isOpera,Opera:isOpera,WebKit:ua.indexOf('AppleWebKit/')> -1,Gecko:ua.indexOf('Gecko')> -1&&ua.indexOf('KHTML')=== -1};})();miwt.children=function(el){if(typeof el.children!='undefined')return miwt.array(el.children);else{var l=[],n=el.firstChild;while(n){if(n.nodeType==1)l.push(n);n=n.nextSibling;}
return l;}};miwt.childElementCount=function(el){if(typeof el.childElementCount!='undefined')return el.childElementCount;else{var c=0,n=el.firstChild;while(n){if(n.nodeType==1)c++;n=n.nextSibling;}
return c;}};miwt.parseUri=function(url){var p=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],u={},i=p.length,m=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);while(i--)u[p[i]]=m[i]||"";return u;};miwt.getComputedStyle=function(el,style){if(document.defaultView&&document.defaultView.getComputedStyle)
return document.defaultView.getComputedStyle(el,"").getPropertyValue(style);else if(el.currentStyle)return el.currentStyle[style];else return"";};miwt.height=function(el){var h,s=el.style,p={},sl={position:'absolute',visibility:'hidden',display:'block',top:'auto',bottom:'auto'},k;for(k in sl){p[k]=s[k];s[k]=sl[k];}
h=el.offsetHeight;for(k in sl){s[k]=p[k];}
return h;};miwt.hasCSSRule=function(el,style,excludeValue){if(!!el.style[style]&&(excludeValue==null||el.style[style]!=excludeValue))
return true;var ss,r,i=0,j,v;el=[el];try{for(;i<document.styleSheets.length&&(ss=document.styleSheets[i++]);){ss=ss.cssRules||ss.rules;if(!ss)continue;for(j=0;r=ss[j++];){try{v=r.style[style];if(v&&(excludeValue==null||v!=excludeValue)&&miwt.$$.matches(r.selectorText,el).length==1){return true;}}catch(e){}}}}catch(e2){miwt.debug('Unable to check stylesheets: '+e2,e2);}
return false;};miwt.closeCKEditors=function(el){if(typeof CKEDITOR=='undefined')return;var i,ta,list=el.getElementsByTagName('textarea');for(i=0;i<list.length;i++){ta=list[i];var editor=CKEDITOR.instances[ta.id];if(editor){try{}finally{if(editor)
editor.destroy();}}}};miwt.pointer=function(evt){var de=document.documentElement,body=document.body,x=evt.pageX||(evt.clientX +(de.scrollLeft||body.scrollLeft) -(de.clientLeft||0)),y=evt.pageY||(evt.clientY +(de.scrollTop||body.scrollTop) -(de.clientTop||0));return{0:x,1:y,x:x,y:y,left:x,top:y};};miwt.$=function element(el){return(typeof el=='string')?document.getElementById(el):el;};miwt.$$=Sizzle_i2rd;miwt.addClassName=function(el,cn){cn=cn.trim();if(!miwt.hasClassName(el,cn))el.className=((el.className||'') +' ' +cn).trim();};miwt.removeClassName=function(el,cn){if(!miwt.hasClassName(el,cn))return;el.className=(el.className||'').replace(RegExp("(^|\\s+)" +cn.trim() +"(\\s+|$)",'g'),' ').trim();};miwt.hasClassName=function(el,cn){var cur=(el.className||'');return(RegExp('\\b'+cn+'\\b').test(cur));};miwt.element=function element(evt){if(typeof evt=='string')return miwt.$(evt);evt=evt||window.event;evt=evt.target||evt.srcElement;if(evt&&evt.nodeType==Node.TEXT_NODE)evt=evt.parentNode;return evt;};miwt.scrollTo=function(el){el=miwt.$(el);var p=miwt.cumulativeOffset(el);window.scrollTo(p.x,p.y);};miwt.findElement=function findElement(start,expression){start=miwt.element(start)||start;while(start){var m=miwt.$$(expression,start);if(m[0])return m[0];start=start.parentNode;}
return null;};miwt.siblings=function(el){var i,l=[],n=miwt.$(el).parentNode.childNodes;for(i=0;i<n.length;i++)if(n[i]!=el)l.push(n[i]);return l;};miwt.array=function(nl){var i,l=[];for(i=0;i<nl.length;i++)l.push(nl[i]);return l;};miwt.wrap=function(el,tag){var w=document.createElement(tag);w.addChild(el);return w;};miwt.remove=function(el){el=miwt.$(el);if(el.parentNode)el.parentNode.removeChild(el);return el;};miwt.getDimensions=function(el){el=miwt.$(el);return{width:el.offsetWidth,height:el.offsetHeight};};miwt.up=function(el,expression){el=miwt.element(el)||el;while(el){var m=miwt.$$.matches(expression,[el]);if(m[0])return m[0];el=el.parentNode;}
return null;};miwt.words=function(s){return s?s.split(/\s+/):[];};miwt.stop=function(evt){evt=evt||window.event;if(evt.preventDefault)evt.preventDefault();if(evt.stopPropagation)evt.stopPropagation();evt.cancelBubble=true;evt.returnValue=false;};miwt.extend=function(dest,src){for(var p in src)
dest[p]=src[p];return dest;};miwt.cumulativeOffset=function(el,scroll){el=miwt.$(el);scroll=!!scroll;var y=0,x=0,t=scroll?'scroll':'offset',wk=miwt.B.WebKit,b=document.body;if(el.parentNode){do{y +=el[t +'Top']||0;x +=el[t +'Left']||0;el=scroll?el.parentNode:el.offsetParent;if(!scroll&&wk&&el==b&&miwt.getComputedStyle(el,'position')=='absolute')
break;}while(el);}
return{0:x,1:y,x:x,y:y,left:x,top:y};};miwt.observe=function(el,name,observer,cap){el=miwt.$(el);if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||el.attachEvent))
name='keydown';if(el.addEventListener){el.addEventListener(name,observer,(cap||false));}else if(el.attachEvent){el.attachEvent('on' +name,observer);}};miwt.stopObserving=function(el,name,observer,cap){el=miwt.$(el);if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||el.detachEvent))
name='keydown';if(el.removeEventListener){el.removeEventListener(name,observer,(cap||false));}else if(el.detachEvent){try{el.detachEvent('on' +name,observer);}catch(e){}}};miwt.serialize=function(form,sv){var t,e,i,s=[];sv=sv||miwt.serializeValue;for(i=0;e=form.elements[i];i++){t=e.type;if(e.serializeValue)e.serializeValue(form,s,e.name,e.value);else if(e.name&&!e.disabled&&t!='submit'&&t!='file'){switch(e.nodeName.toLowerCase()){case'input':switch(t){case'checkbox':case'radio':if(e.checked)sv(form,s,e.name,e.value);break;case'button':break;default:sv(form,s,e.name,e.value);break;}
break;case'select':for(var o,j=0;o=e.options[j];j++)if(o.selected)sv(form,s,e.name,o.value);break;case'button':break;default:sv(form,s,e.name,e.value);break;}}}
return s.join('&');};miwt.disabled=function(el){el.disabled||el.getAttribute("disabled")!=null;};miwt.serializeValue=function(f,s,n,v){if(n&&v!=null){s.push(encodeURIComponent(n) +'=' +encodeURIComponent(v));}};miwt.viewResource=function(url,newWindow){var f=miwt.$$("form.viewresource").pop(),pleaseNo=document.all&&!window.opera;if(f){f.action=url;if(newWindow)
f.target="_blank";else
f.target="_self";f.submit();}else{url=url +(miwt.parseUri(url).query?'&':'?') +"disposition=inline";if(newWindow){var nw=pleaseNo?window.open():window.open(url,'_blank');if(!nw){if(confirm(miwt.$$("dfn.miwt_popup_blocked").pop().firstChild.data))
window.location.href=url;}else if(pleaseNo){var mesg=miwt.$$("dfn.miwt_loading_file").pop().firstChild.data;nw.document.write('<p>' +mesg.replace(/\${url}/,url) +'</p>');nw.location=url;}}else{window.location.href=url;}}};miwt.saveResource=function(url){var f=miwt.$$("form.saveresource").pop();if(f){f.action=url;f.submit();}else{var nw=window.open(url +(miwt.parseUri(url).query?'&':'?') +"disposition=attachment");if(!nw){if(confirm(miwt.$$("dfn.miwt_popup_blocked").pop().firstChild.data))
window.location.href=url;}}};miwt._log=function logger(t,args){var l=window.console,t=arguments[0],f;if(typeof log4js!='undefined')l=log4js.logger;if(l&&typeof(f=l[t])=='function')f.apply(l,args);};miwt.error=function(){miwt._log("error",arguments);};miwt.warn=function(){miwt._log("warn",arguments);};miwt.info=function(){miwt._log("info",arguments);};miwt.debug=function(){miwt._log("debug",arguments);};}
if(typeof miwt.Form=='undefined'){miwt.prv_FormOnSubmitHandler=function(evt){var form=miwt.element(evt);if(!form||!form.MIWTOnSubmit)
return true;return form.MIWTOnSubmit.apply(form);};miwt.TransientFieldNames=["btnhit","dnd_source","dnd_target","dnd_location","dnd_option"];miwt.Form=function(){this.initialize();};miwt.Form.prototype={initialize:function(){this.submitters=[];this.submitter_functions=[];this.onsubmit=miwt.prv_FormOnSubmitHandler;},MIWTOnSubmit:function(){if(typeof(window.miwtReady)!='undefined'&&window.miwtReady==2)
return false;var submitter,el,i=0;for(;submitter=this.submitters[i++];){el=miwt.$(submitter);if(el){var f=this.submitter_functions[el.id];if(f&&!f(this))
{return false;}}}
window.miwtReady=2;return true;},MIWTSubmit:function(opts){if(typeof opts=='function'){opts={postUpdate:opts};}else opts=opts||this.submit_options||{};if(this.lastSubmit){var now=new Date().getTime(),then=this.lastSubmit.getTime();if((now -then)<250){this.ResetTransient();return false;}}
if(!this.MIWTOnSubmit())
return false;if(opts.onSubmit&&!opts.onSubmit.call(this)){window.miwtReady=1;return false;}
if(opts.hasOwnProperty('btnhit')){this.elements.btnhit.value=opts.btnhit;}
var ajax=!miwt.$(this.elements.btnhit.value+"_noajax");if(opts.hasOwnProperty('ajax')){ajax=opts.ajax;}
if(!ajax){var progress=miwtajax.showFormPostWait();if(opts.preUpdate){opts.preUpdate.call(this,progress);}
this.submit();return true;}
var ajax=new miwtajax.InputProcessor(this,opts);this.lastSubmit=new Date();if(!ajax.isRequestSubmitted()){var progress=miwtajax.showFormPostWait();if(opts.preUpdate){opts.preUpdate.call(this,progress);}
this.submit();}
else{}
return true;},RegisterOnSubmitHandler:function(el,handler){if(el==null)
return;this.submitter_functions[el.id]=handler;if(this.submitters.indexOf(el.id)== -1)
this.submitters.push(el.id);},CleanOnSubmitHandlers:function(){var list=[],el,elId,i=0;for(;elId=this.submitters[i++];){el=miwt.$(elId);if(el)
list.push(elId);else
this.submitter_functions[elId]=null;};this.submitters=list;},ResetTransient:function(){for(var name,i=0;name=miwt.TransientFieldNames[i++];){if(this.elements[name])
this.elements[name].value='';}}};}
if(typeof miwtsetup=='undefined'){var miwtsetup={};miwt.setupHandlers=[];for(var i=0,l=["any","a","button","div","img","input","select","dfn","table","textarea"];i<l.length;i++)
miwt.setupHandlers[l[i]]=[];miwt.AddSetupHandler=function(tags,f){if(tags==null)
tags=["any"];var i,tag;for(i=0;tag=tags[i];i++){if(!miwt.setupHandlers[tag])miwt.setupHandlers[tag]=[];miwt.setupHandlers[tag].push(f);}};miwt.setup=function(node){var nodes=node.getElementsByTagName('*');var f,a,j,i=0;var any=miwt.setupHandlers["any"];while(node){var tag=node.tagName.toLowerCase();if(node.className){if(tag=='select'&&node.type&&node.type=='select-one'&&!/\bmiwt_focus\b/.exec(node.className))
{if(miwt.lastFocusId==null)
node.blur();}}
for(j=0;f=any[j];j++){f(tag,node);}
a=miwt.setupHandlers[tag];if(a){for(j=0;f=a[j];j++){f(tag,node);}}
node=nodes.item(i++);}};miwt.scheduleUpdateKeydownHandler=function(evt){miwttimer.scheduleUpdate(miwt.element(evt).form.id);};miwt.observerFormSubmit=function(el){miwt.element(el).form.MIWTSubmit();};miwt.AddSetupHandler(['input','select','textarea'],function(tag,node){if(node.form&&miwt.hasClassName(node,'miwt_watch')){var nt=(node.type||'').toLowerCase();if((tag=='input'&&nt=='text')||tag=='textarea')
miwt.observe(node,'keydown',miwt.scheduleUpdateKeydownHandler);else if(tag=='input'&&(nt=='checkbox'||nt=='radio'))
miwt.observe(node,'click',miwt.observerFormSubmit);else
miwt.observe(node,'change',miwt.observerFormSubmit);}});miwt.AddSetupHandler(['button','input','select','textarea'],function(tag,node){if(node.focus&&miwt.hasClassName(node,'miwt_focus'))
window.setTimeout(function(){node.focus()},200);});miwt.setupForm=function(form){if(form.miwt_init)return;form.miwt_init=true;miwt.extend(form,miwt.Form.prototype);try{form.initialize();miwt.setup(form);}
catch(e){miwt.error("Error configuring MIWT form "+(form.id||form.name),e);}};miwt.setViewportPosition=function(){var wz,w,windows=miwt.$$("div.window");while((w=windows.pop())){if(!wz||(parseInt(wz.style.zIndex)<parseInt(w.style.zIndex)))
wz=w;}
if(!!wz){var pos=miwt.cumulativeOffset(wz);window.scrollTo(pos[0],pos[1] -20);}};miwt.initDoc=function(){var i=0,form;for(;form=document.forms[i++];){if(form.miwt_init)continue;if(miwt.hasClassName(form,'miwt_form')){miwt.setupForm(form);miwt.setViewportPosition();}else if(miwt.hasClassName(form,'miwt_external_action')){var form2=form;setTimeout(function(){form2.submit();},1);}}};miwt.onLoad=function(evt){miwt.initDoc();if(!miwt.domupdate_check){if(window.i2rd)
i2rd.addEvent(document,'dom:update',miwt.initDoc);if(document.addEventListener)
document.addEventListener('DOMNodeInsertedIntoDocument',miwt.initDoc,false);}
miwt.domupdate_check=true;}}
if(typeof miwtbutton=='undefined'){miwtbutton={};miwt.ButtonClicked=function(event){miwt.stop(event);var form=miwt.findElement(event,'form'),el=miwt.element(event),btnId,ct;while(el&&el.parentNode&&!(el.name||el.id))
el=el.parentNode;if(miwt.disabled(el))
return;btnId=el.name||el.id;ct=miwt.$(btnId+'_confirm');if(ct&&!confirm(ct.firstChild.data))
return;form.elements['btnhit'].value=btnId;form.MIWTSubmit();};miwt.resetEventHandler=function(event){miwt.findElement(event,'form').reset();};miwt.AddSetupHandler(null,function BtnSetup(tag,node){if(miwt.hasClassName(node,'miwt_reset'))
miwt.observe(node,"click",miwt.resetEventHandler);if(miwt.hasClassName(node,'miwt_submit')){if((tag=='input'&&(node.type=='text'||node.type=='password'))||tag=='textarea')
miwt.observe(node,"keydown",miwt.FieldAction);else
miwt.observe(node,"click",miwt.ButtonClicked);}});miwt.imagebutton={};miwt.imagebutton.groups=[];miwt.imagebutton.imageButtonEnabled=function(btn){return!miwt.disabled(btn);};miwt.imagebutton.imageButtonMouseOver=function(evt){var t=miwt.element(evt);if(t==null)
return;miwt.stop(evt);if(miwt.imagebutton.imageButtonEnabled(t))
miwt.imagebutton.imageButtonSetState(t,null,null,"rollover");};miwt.imagebutton.imageButtonMouseOut=function(evt){var t=miwt.element(evt);if(t==null)
return;miwt.stop(evt);if(miwt.imagebutton.imageButtonEnabled(t))
miwt.imagebutton.imageButtonSetState(t,null,null,"normal");};miwt.imagebutton.imageButtonMouseDown=function(evt){var t=miwt.element(evt);if(t==null)
return;miwt.stop(evt);if(miwt.imagebutton.imageButtonEnabled(t)){if(t.focus)
t.focus();miwt.imagebutton.imageButtonSetState(t,null,null,"pressed");}};miwt.imagebutton.imageButtonMouseUp=function(evt){var t=miwt.element(evt);if(t==null)
return;miwt.stop(evt);if(miwt.imagebutton.imageButtonEnabled(t))
miwt.imagebutton.imageButtonSetState(t,null,null,"normal");};miwt.imagebutton.imageButtonMouseClick=function(evt){var t=miwt.element(evt);if(t==null)
return;miwt.stop(evt);if(miwt.imagebutton.imageButtonEnabled(t)){var selected=t.miwt_isSelected;if(t.miwt_selectedvalue!=null){selected=(t.miwt_isSelected==false);}
if(t.miwt_buttonGroup==null||selected)
miwt.imagebutton.imageButtonSetState(t,null,selected,"normal");if(t.miwt_watch)
miwt.findElement(evt,'form').MIWTSubmit();}};miwt.imagebutton.imageButtonSetState=function(img,isActive,isSelected,state){isActive=isActive||img.miwt_isActive;isSelected=isSelected||img.miwt_isSelected;if(img.miwt_isActive==isActive&&img.miwt_isSelected==isSelected&&img.miwt_state==state){return false;}
var newimgsrc;if(isActive){if(state=="normal"){if(isSelected&&img.miwt_activeselected!=null)
newimgsrc=img.miwt_activeselected;else
newimgsrc=img.miwt_active;}
else if(state=="rollover"){newimgsrc=img.miwt_activerollover;}else if(state=="pressed"){newimgsrc=img.miwt_activepressed;}else{alert("Invalid button state "+state);}}else{if(state=="normal"){if(isSelected&&img.miwt_inactiveselected!=null){newimgsrc=img.miwt_inactiveselected;}else{newimgsrc=img.miwt_inactive;}}else if(state=="rollover"){newimgsrc=img.miwt_inactiverollover;}else if(state=="pressed"){newimgsrc=img.miwt_inactivepressed;}else{alert("Invalid button state "+state);}}
img.miwt_isActive=isActive;img.miwt_state=state;if(img.miwt_isActive&&img.miwt_isSelected!=isSelected){var wasSelected=img.miwt_isSelected,btn;img.miwt_isSelected=isSelected;if(isSelected){var group=null;if(img.miwt_buttonGroup&&(group=miwt.imagebutton.groups[img.miwt_buttonGroup])){group.each(function(btnId){if(btnId!=img.id){if(btn=miwt.$(btnId))
miwt.imagebutton.imageButtonSetState(btn,null,false,"normal");}});}
img.miwt_valuenode.value=img.miwt_selectedvalue;}else{img.miwt_valuenode.value="";}}
if(newimgsrc&&typeof(newimgsrc)!='undefined'&&newimgsrc!='undefined'&&newimgsrc!='null'){img.src=newimgsrc.src;return true;}else{return false;}};miwt.AddSetupHandler(['img'],function ImgBtnSetup(tag,node){if(tag!='img'||!node.className.match(/miwt_image\S*_button/))
return;var id=node.id;var buttonGroupId=null;var match=/miwt_button_group_(\S+)/.exec(node.className);if(match)
buttonGroupId=match[1];var valueid=null;var selectedvalue=null;if(id.match(/_img$/))
{valueid=id.replace(/(_r\d+)*_img$/,"");var valuenode=miwt.$(id+"_value");if(valuenode)
selectedvalue=valuenode.firstChild.data;}
var img=miwt.$(id);if(img==null)
{miwt.warn("There is an error with the generated page, cannot find image button with id '"+id+"'");return;}
img.miwt_active=miwt.$(id+"_unselected");img.miwt_activeselected=miwt.$(id+"_selected");img.miwt_activepressed=miwt.$(id+"_pressed");img.miwt_activerollover=miwt.$(id+"_rollover");img.miwt_inactive=miwt.$(id+"_unselected_inactive");img.miwt_inactiveselected=miwt.$(id+"_selected_inactive");img.miwt_inactivepressed=miwt.$(id+"_pressed_inactive");img.miwt_inactiverollover=miwt.$(id+"_rollover_inactive");img.miwt_valueid=valueid;img.miwt_valuenode=miwt.$(valueid);img.miwt_selectedvalue=selectedvalue;if(img.miwt_code==null)
img.miwt_code='null';img.miwt_isSelected=(img.miwt_valuenode!=null)&&(img.miwt_valuenode.value==selectedvalue);img.miwt_watch=node.className.match(/miwt_watch/);var isActive=(img.miwt_active&&img.src==img.miwt_active.src)||(img.miwt_activeselected&&img.src==img.miwt_activeselected.src);if(buttonGroupId!=null)
{img.miwt_buttonGroup=buttonGroupId;var group=miwt.imagebutton.groups[buttonGroupId];if(!group)
{group=[];miwt.imagebutton.groups[buttonGroupId]=group;}
else
{var bid=null;var newa=null;for(var i=0;bid=group[i];i++){var bobj=miwt.$(bid);if(!bobj){if(!newa){newa=[];for(var j=0;j<i;j++)
newa.push(group[j]);}}
else if(newa){newa.push(bobj);}}
if(newa){group=newa;miwt.imagebutton.groups[buttonGroupId]=group;}}
group.push(node.id);}
miwt.observe(img,"mouseover",miwt.imagebutton.imageButtonMouseOver,false);miwt.observe(img,"mouseout",miwt.imagebutton.imageButtonMouseOut,false);miwt.observe(img,"mousedown",miwt.imagebutton.imageButtonMouseDown,false);miwt.observe(img,"mouseup",miwt.imagebutton.imageButtonMouseUp,false);miwt.observe(img,"click",miwt.imagebutton.imageButtonMouseClick,false);miwt.imagebutton.imageButtonSetState(img,isActive,img.miwt_isSelected,"normal");});miwt.imagebutton.imageButtonActivate=function(id){var img=miwt.$(id);if(img==null){return;}
miwt.imagebutton.imageButtonSetState(img,true,null,img.miwt_state);};miwt.imagebutton.imageButtonDeactivate=function(id){var img=miwt.$(id);if(img==null){return;}
miwt.imagebutton.imageButtonSetState(img,false,null,img.miwt_state);};}
if(typeof miwtfield=='undefined'){miwtfield={};miwt.FieldAction=function(event){var element=miwt.element(event);var keycode=event.keyCode||event.which;if(keycode==10||keycode==13)
miwt.ButtonClicked(event);};miwt.FieldKeyDownHandler=function(evt){miwttimer.rescheduleTimer();return true;};miwt.FieldKeyUpHandler=function(evt){var field=miwt.element(evt);if(field.maxlength&&field.maxlength>0&&field.value.length>=field.maxlength){field.value=field.value.substring(0,field.maxlength);}
return true;};miwt.FieldFocusHandler=function(evt){var field=miwt.element(evt);miwt.lastFocusId=field.id;if(field.hinttexton){field.value='';field.hinttexton=false;field.style.color=null;}
return true;};miwt.FieldBlurHandler=function(evt){var field=(evt.tagName=='input')?evt:miwt.element(evt);miwt.lastFocusId=null;if(field&&field.hinttext&&field.value==''){field.value=field.hinttext;field.hinttexton=true;field.style.color='gray';}
return true;};miwt.prv_FieldSubmitHandler=function(nodeId){var node=miwt.$(nodeId);if(node.hinttexton){node.value='';node.hinttexton=false;node.style.color=null;}
window.setTimeout("miwt.FieldBlurHandler(miwt.$('"+node.id+"'))",10,"JavaScript");return true;}
miwt.AddSetupHandler(['a','input','textarea'],function(tag,node){if((tag=='input'&&node.type=='text')||tag=='textarea')
{miwt.observe(node,"keydown",miwt.FieldKeyDownHandler,true);miwt.observe(node,"focus",miwt.FieldFocusHandler,true);miwt.observe(node,"blur",miwt.FieldBlurHandler,true);var hint=miwt.$(node.id+"_hint");if(hint){var hinttext=hint.firstChild.data;node.hinttext=hinttext;if(node.value==''){node.value=hinttext;node.hinttexton=true;node.style.color='gray';}
var nodeId=node.id;node.form.RegisterOnSubmitHandler(node,function(){return miwt.prv_FieldSubmitHandler(nodeId);});}
var maxlength=miwt.$(node.id+"_maxlength");if(maxlength){var i=parseInt(maxlength.firstChild.data,10);if(!isNaN(i)){node.maxlength=i;miwt.observe(node,"keyup",miwt.FieldKeyUpHandler,true);}}
if(/\bfckeditor\b/.exec(node.className)){CKeditorHelper.fckactivate(node);node.serializeValue=function(f,s,n,v){s.push(encodeURIComponent(n) +'=' +encodeURIComponent(CKEDITOR.instances[this.id].getData()));};}}});}
if(typeof miwtsearchablecombo=='undefined'){var miwtsearchablecombo={};miwt.SearchableComboButtonClick=function(event){miwt.stop(event);miwt.element(event).combo.doSearch();};miwt.SetupSearchableCombo=function(tag,element){if(tag!='select'||!/\bmiwt_searchable\b/.exec(element.className))
return;try
{var field=miwt.$(element.id+"_field");field.combo=element;miwt.extend(element,miwt.SearchBox.prototype);element.initialize(field);miwt.observe(field,'keydown',miwt.SearchableComboKeydownHandler);var button=miwt.$(element.id+"_search");if(button&&!/\bmiwt_submit\b/.exec(button.className))
{button.combo=element;miwt.observe(button,'click',miwt.SearchableComboButtonClick);if(field.value&&element.mode==element.MODE_FILTER)
element.doSearch();}}
catch(e){miwt.error("Setup searchable combo "+element.id,e);}};miwt.AddSetupHandler(['select'],miwt.SetupSearchableCombo);miwt.SearchableComboKeydownHandler=function(event){if(event.keyCode==13){miwt.stop(event);miwt.element(event).combo.doSearch();}};miwt.SearchBox=function(){};miwt.SearchBox.prototype={MODE_ITERATE:0,MODE_FILTER:1,initialize:function(field)
{this.field=field;this.selectOptions=[];var opt,i;for(i=0;opt=this.options[i];i++)
this.selectOptions[i]=opt;this.mode=this.MODE_ITERATE;var me=this,cns=miwt.words(this.className),i,c;for(i=0;i<cns.length;i++){c=cns[i];if(/.*_flags_(\w+)/.exec(c)){me.flags=RegExp.$1.toLowerCase();}else if(/.*_mode_filter/.test(c)){me.mode=me.MODE_FILTER;}}},addAvailableOption:function(val,txt){var opt=new Option();opt.value=val;opt.text=txt;this.selectOptions.push(opt);},getAvailableOptions:function(){return this.selectOptions;},setVisibleOptions:function(visibleOptions){this.options.length=0;var opt;for(var i=0;opt=visibleOptions[i];i++)
this.options[i]=opt;},setSelectedIndex:function(index){if(index>=0&&index<this.options.length)
this.options[index].selected=true;},doSearch:function(){if(this.mode==this.MODE_ITERATE)
this.searchSelectIterative(false);else
this.searchSelectFilter(false);},searchSelectFilter:function(onlyIfNoMatch){var searchString=this.field.value;var searchTextLength=searchString.length;var allOptions=this.getAvailableOptions();var selectedIndex=0;var matches=[];var matcher=new RegExp(searchString,this.flags);for(j=0;j<allOptions.length;j++)
{var optionText=allOptions[j].text;if(searchTextLength==0||matcher.test(optionText))
{matches[matches.length]=allOptions[j];if(allOptions[j].selected)
{selectedIndex=matches.length-1;}}}
this.setVisibleOptions(matches);this.setSelectedIndex(selectedIndex);},searchSelectIterative:function(onlyIfNoMatch){var searchString=this.field.value;var searchTextLength=searchString.length;if(searchTextLength==0)
return;var start=this.selectedIndex +1;if(start>=this.options.length)
start=0;var end=this.selectedIndex -1;if(end<=0)
end=this.options.length;var matcher=new RegExp(searchString,this.flags);if(onlyIfNoMatch&&matcher.test(this.options[this.selectedIndex].text))
{return;}
var forEnd=(start<end?end:this.options.length);for(j=start;j<forEnd;j++)
{var optionText=this.options[j].text;if(matcher.test(optionText))
{this.selectedIndex=j;return;}}
if(start>end)
{for(j=0;j<=end;j++)
{var optionText=this.options[j].text;if(matcher.test(optionText))
{this.selectedIndex=j;return;}}}}};}
if(typeof miwt.menu=='undefined'){(function(){var PAT_MENU=/(^|\s)menu(\s|$)/;var PAT_MENU_ITEM=/(^|\s)menu_item(\s|$)/;var PAT_MENU_COMPONENT=/(^|\s)menu_component(\s|$)/;miwt.menu={};miwt.menu.ActiveMenuList=[];miwt.menu.ActivateMenu=function(evt){var menu=miwt.up(miwt.element(evt),"div.menu_component");if(!menu||miwt.hasClassName(menu,'active'))return null;miwt.addClassName(menu,"active");while(miwt.menu.ActiveMenuList.length>0)
miwt.menu.DeactivateLastActiveMenu();miwt.siblings(menu).each(function(idx,el){if(miwt.up(el,"div.menu_bar")&&PAT_MENU_COMPONENT.test(el.className))
miwt.observe(el,"mouseover",miwt.menu.ShowMenu);});miwt.menu.ActiveMenuList.push(menu);return menu;};miwt.menu.DeactivateLastActiveMenu=function(){var menu=miwt.menu.ActiveMenuList.pop();if(!menu)return;miwt.removeClassName(menu,"active");if(miwt.up(menu,"div.menu_bar")){miwt.stopObserving(menu,"mouseover",miwt.menu.ShowMenu);miwt.siblings(menu).each(function(idx,el){miwt.stopObserving(el,"mouseover",miwt.menu.ShowMenu);});}};miwt.menu.MenuItemHit=function(evt){miwt.stop(evt);var mi=miwt.up(evt,'.menu_item'),li=miwt.up(mi,'li.menu'),hasSubmenu=miwt.$$('.menu_items',li).length>0;if(mi&&!hasSubmenu){while(miwt.menu.ActiveMenuList.length>0)
miwt.menu.HideMenu(evt);var form=miwt.findElement(evt,'form');form.elements['btnhit'].value=mi.id;form.MIWTSubmit();}};miwt.menu.HideMenu=function(evt){if((evt.keyCode&&evt.keyCode!=27)||evt.which==3)
return;miwt.stop(evt);miwt.menu.DeactivateLastActiveMenu();if(miwt.menu.ActiveMenuList.length==0){miwt.stopObserving(document,"click",miwt.menu.HideMenu);miwt.stopObserving(document,"keydown",miwt.menu.HideMenu);}};miwt.menu.ShowMenu=function(evt){var target=miwt.findElement(evt,'a')
if(miwt.menu.ActivateMenu(evt)){miwt.stop(evt);window.setTimeout(function(){miwt.observe(document,"click",miwt.menu.HideMenu);miwt.observe(document,"keydown",miwt.menu.HideMenu);},5);}};miwt.AddSetupHandler(['a'],function(tag,node){if(PAT_MENU_ITEM.test(node.className)&&PAT_MENU_COMPONENT.test(node.parentNode.className))
miwt.observe(node,"click",miwt.menu.ShowMenu);});miwt.AddSetupHandler(['li'],function(tag,node){if(PAT_MENU.test(node.className)){miwt.observe(node,'click',miwt.menu.MenuItemHit);if(navigator.userAgent.match(/MSIE 6/)){miwt.observe(node,"mouseenter",function(evt){miwt.addClassName(miwt.element(evt),'active');});miwt.observe(node,"mouseleave",function(evt){miwt.removeClassName(miwt.element(evt),'active');});}}});})();}
if(typeof miwtselectall=='undefined'){var miwtselectall={};miwt.setupSelectAllCheckbox=function(checkbox){var selectall=miwt.$(checkbox.name+"_all");if(!selectall)
return;if(!selectall.checkboxes)
{selectall.checkboxes=[];miwt.observe(selectall,"click",miwt.selectAllChanged,false);}
checkbox.selectall=selectall;selectall.checkboxes.push(checkbox);miwt.observe(checkbox,"click",miwt.selectAllChildChanged,false);};miwt.selectAllChanged=function(event){var selectall=miwt.element(event),box,i;for(i=0;box=selectall.checkboxes[i];i++){box.checked=selectall.checked;}};miwt.selectAllChildChanged=function(event){var box=miwt.element(event);if(!box.checked)
box.selectall.checked=false;};miwt.AddSetupHandler(['input'],function(tag,node){if(tag=='input'&&node.type=='checkbox'&&/\bmiwt_row_select\b/.exec(node.className))
miwt.setupSelectAllCheckbox(node);});}
if(typeof miwtajax=='undefined'){var miwtajax={READY_STATE_UNINITIALIZED:0,READY_STATE_LOADING:1,READY_STATE_LOADED:2,READY_STATE_INTERACTIVE:3,READY_STATE_COMPLETE:4,serial:{},ajax_failed_update_callback:[],ajax_request_complete_callback:[]};miwtajax.getDocContentType=function(){var d=document,de=d.documentElement,ct=d.contentType,m,el;try{if(!ct){m=miwt.array(document.getElementsByTagName('head')[0].getElementsByTagName('meta'));while((el=m.pop())){if((el.getAttribute('http-equiv')+'').toLowerCase()=='content-type'){ct=el.getAttribute('content').replace(/;.+/,'');break;}}
if(!ct)
ct=de.getAttribute('xmlns')=='http://www.w3.org/1999/xhtml'?'application/xhtml+xml':'text/html';return ct;}}catch(e){return'text/html';}};miwtajax.currentSerial=function(form){var key=form['wm'].value,val=miwtajax.serial[key];if(!val)val=parseInt(form['ajax_serial'].value,10);return val;};miwtajax.nextSerial=function(form){var key=form['wm'].value,val=miwtajax.serial[key];if(!val)val=parseInt(form['ajax_serial'].value,10);miwtajax.serial[key]=(++val);return val;};miwtajax.Progress=function(){this.dialog=document.createElement("div");this.dialog.innerHTML='<div class="miwt_ajax_progress" style="position: absolute; top: 100px; left: 100px;">'
+miwt.$$("dfn.miwt_loading_message").pop().firstChild.data
+"<div id=\"miwt_loading_message_503\" style=\"display: none;\">" +miwt.$$("dfn.miwt_loading_message503").pop().firstChild.data +"</div>"
+'<br /><br />'
+'<span class="miwt_ajax_progress">'
+'<span id="miwt_ajax_progress_0">&#x00a0;&#x00a0;&#x00a0;&#x00a0;&#x00a0;</span>'
+'<span id="miwt_ajax_progress_1">&#x00a0;&#x00a0;&#x00a0;&#x00a0;&#x00a0;</span>'
+'<span id="miwt_ajax_progress_2">&#x00a0;&#x00a0;&#x00a0;&#x00a0;&#x00a0;</span>'
+'<span id="miwt_ajax_progress_3">&#x00a0;&#x00a0;&#x00a0;&#x00a0;&#x00a0;</span>'
+'<span id="miwt_ajax_progress_4">&#x00a0;&#x00a0;&#x00a0;&#x00a0;&#x00a0;</span>'
+'</span>'
+'</div>';this.dialog.firstChild.style.visibility='hidden';document.getElementsByTagName("body").item(0).appendChild(this.dialog);this.useCount=0;};miwtajax.Progress.prototype={start:function(){this.useCount++;if(this.useCount>1)
return;var progress=this;this.timeout_callback=function(){progress.callback.call(progress);}
for(var i=miwtajax.READY_STATE_UNINITIALIZED;i<=miwtajax.READY_STATE_COMPLETE;i++)
{var progressNode=miwt.$("miwt_ajax_progress_"+i);if(progressNode!=null)
progressNode.style.backgroundColor='white';}
if(this.indeterminate)
this.mark=miwtajax.READY_STATE_UNINITIALIZED;this.timeout=setTimeout(this.timeout_callback,500);},callback:function(){if(document.all)
this.dialog.firstChild.style.position='absolute';this.dialog.firstChild.style.visibility='visible';var w=miwt.getWindowWidth();var h=miwt.getWindowHeight();var scroll=miwt.getScrollOffset();this.dialog.firstChild.style.top=(scroll.y+((parseInt(h)/2)-17))+"px";this.dialog.firstChild.style.left=(scroll.x+((parseInt(w)/2)-100))+"px";if(this.indeterminate){this.mark++;if(this.mark>miwtajax.READY_STATE_COMPLETE)
this.mark=miwtajax.READY_STATE_UNINITIALIZED;for(var i=miwtajax.READY_STATE_UNINITIALIZED;i<=miwtajax.READY_STATE_COMPLETE;i++)
{var progressNode=miwt.$("miwt_ajax_progress_"+i);if(progressNode!=null){if(this.mark==i)
progressNode.style.backgroundColor='lightsteelblue';else
progressNode.style.backgroundColor='white';}}}
this.timeout=setTimeout(this.timeout_callback,300,"JavaScript");},stop:function(){if(this.useCount<=0)
return;this.useCount--;if(this.useCount>0)
return;if(this.timeout!=null)
{window.clearTimeout(this.timeout);this.timeout=null;this.timeout_callback=null;}
this.dialog.firstChild.style.visibility='hidden';}};miwtajax.showFormPostWait=function(){if(miwt.ajaxprogress==null)miwt.ajaxprogress=new miwtajax.Progress();miwt.ajaxprogress.indeterminate=true;miwt.ajaxprogress.start();return miwt.ajaxprogress;};miwtajax.InputProcessor=function(form,opts){this.req=null;this.opts=opts;if(form.encoding&&form.encoding.match(/multipart/))
{var el,i=0;for(;el=form.elements[i++];){if(el.type=='file'&&el.value!=null&&el.value.length>0)
return;}}
this.form=form;this.failsafe=false;if(miwt.ajaxprogress==null)miwt.ajaxprogress=new miwtajax.Progress();this.initXMLHttpRequest();if(this.req==null)
{return;}
var sv=opts.serializeValue||miwt.serializeValue,params=opts.serialize?opts.serialize.call(this.form,this.form,sv):miwt.serialize(this.form,sv);params +="&ajax="+miwtajax.nextSerial(form);this.form.ResetTransient();var dotimeout=deploymentcontext?deploymentcontext.doAjaxTimeout:true;if(dotimeout&&!miwtajax.debug){var ajax=this,to=opts.ajax_to||15;this.timeout_callback=function(){ajax.doFailsafe.call(ajax);}
this.timeout=setTimeout(this.timeout_callback,(to*1000));}
miwt.ajaxprogress.start();if(opts.preUpdate)opts.preUpdate.call(this.form,miwt.ajaxprogress);this.req.send(params);};miwtajax.InputProcessor.prototype={initXMLHttpRequest:function(){var uriEl=miwt.$$("dfn.ajax_uri",this.form).pop();if(!uriEl||!uriEl.firstChild)
return;this.uri=uriEl.firstChild.data;if(window.XMLHttpRequest){this.req=new XMLHttpRequest();}else if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");}
if(this.req){var processor=this;this.req.onreadystatechange=function(){processor.handleReadyStateForComponentUpdate.call(processor);};this.req.open("POST",this.uri,true);this.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.req.setRequestHeader("X-MIWT-Ajax","true");this.req.setRequestHeader("X-DocumentContentType",miwtajax.getDocContentType());}},decomposeParts:function(node){var content="",partNodesFound=false,partnode,j=0,i;for(;partnode=node.childNodes[j++];){if(partnode.nodeName=='part'){for(i=0;i<partnode.childNodes.length;i++){content +=partnode.childNodes.item(i).nodeValue;}
partNodesFound=true;}}
if(!partNodesFound){content=node.firstChild.nodeValue;}
return content;},handleReadyStateForComponentUpdate:function(){for(var i=miwtajax.READY_STATE_UNINITIALIZED;i<=this.req.readyState;i++){var progressNode=miwt.$("miwt_ajax_progress_"+i);if(progressNode!=null&&progressNode.style.backgroundColor!='lightsteelblue')
progressNode.style.backgroundColor='lightsteelblue';}
if(this.failsafe)
return;if(this.req.readyState==miwtajax.READY_STATE_COMPLETE){delete this.req.onreadystatechange;this.req.onreadystatechange=function(){};if(this.timeout){window.clearTimeout(this.timeout);this.timeout=null;}
var failsafe=false,failsafeSkipParam=false,updatedNodes=[],action='failsafe';processXML:if(this.req.status==503){miwt.ajaxprogress.indeterminate=true;miwt.ajaxprogress.mark=miwtajax.READY_STATE_UNINITIALIZED;var retryTime=this.req.getResponseHeader("Retry-After")||'30',mesgElement=miwt.$("miwt_loading_message_503");mesgElement.style.display="block";mesgElement.innerHTML=mesgElement.innerHTML.replace("$(seconds)",retryTime);var retryTimeMillis=parseInt(retryTime)*1000,form=this.form,retryFunc=function(){mesgElement.style.display="none";form.submit();};window.setTimeout(retryFunc,retryTimeMillis);return;}else if(this.req.status==301||this.req.status==302){miwt.ajaxprogress.stop();var loc=this.req.getResponseHeader("Location"),data={status:this.req.status,action:'redirect',location:loc,success:true,nodesUpdated:[],source:this.form};if(this.opts.postUpdate)this.opts.postUpdate.call(this.form,data);this.req=null;window.location.href=loc;return;}else if(this.req.status!=200){miwt.debug("Unsuccessful HTTP response: "+this.req.status);failsafe=true;}else if(/html/.test(this.req.getResponseHeader("Content-Type"))){miwt.debug("Received HTML response: "+this.req.responseText);failsafe=true;}else if(this.req.responseXML!=null){var actionNodes=this.req.responseXML.getElementsByTagName("action"),redirectURL;action="reload";if(actionNodes.length>0){var actionNode=actionNodes.item(0);action=actionNode.firstChild.nodeValue;redirectURL=actionNode.getAttribute('url');}else{miwt.debug("Received HTML response: "+this.req.responseText);miwt.error("No action specified");}
var firstChild=this.req.responseXML.firstChild;if(firstChild==null||firstChild.nodeName.toLowerCase()=="html"){if(miwtajax.debug){if(firstChild!=null){var stack=[];stack.push(firstChild);while(stack.length>0){var node=stack.pop();if(node.nodeType==3){miwt.error("Parse error: "+node.nodeValue);}else{for(var i=0;i<node.childNodes.length;i++)
stack.push(node.childNodes.item(i));}}}
break processXML;}
miwt.error("Parse error. firstChild is "
+(firstChild==null?"null":(firstChild.nodeName +" -> " +firstChild.innerHTML)));failsafe=true;}else if(action=='reload'){failsafe=true;failsafeSkipParam=true;}else if(action=='nochange'){break processXML;}else if(action=='update'){var lastFocusId=miwt.lastFocusId,closeNodes=this.req.responseXML.getElementsByTagName("closewindow");for(var i=0;i<closeNodes.length;i++){var refid=closeNodes.item(i).attributes.getNamedItem("ref").nodeValue;var n=miwt.$(refid);if(n){miwt.closeWindow(n);}}
var contentNodes=this.req.responseXML.getElementsByTagName("component"),preProcessNode=this.opts.preProcessNode,postProcessNode=this.opts.postProcessNode;try{for(var i=0;i<contentNodes.length;i++){var iecase,tmpnode,newcontent,newnode,updatenode=contentNodes.item(i),refid=updatenode.attributes.getNamedItem("ref").nodeValue,docnode=miwt.$(refid);if(docnode==null){miwt.info("Node not found: "+refid+", likely caused by update to component that was not rendered here");failsafe=true;break;}
miwt.closeCKEditors(docnode);newcontent=this.decomposeParts(updatenode);tmpnode=document.createElement("div");try{iecase=miwt.B.IE&&(docnode.tagName||'').toUpperCase()=='TD'&&!newcontent.match(/^</);if(preProcessNode){newcontent=preProcessNode.call(this.form,{content:newcontent,refid:refid});if(newcontent==null)continue;}
if(iecase)
tmpnode.innerHTML="<span>"+newcontent+"</span>";else
tmpnode.innerHTML=newcontent;}catch(exception){miwt.error("Exception creating DOM node from " +newcontent,exception);failsafe=true;break;}
newnode=tmpnode.firstChild;if(miwt.childElementCount(tmpnode)==1&&newnode.nodeName==docnode.nodeName&&newnode.getAttribute("id")==docnode.getAttribute("id"))
{docnode.parentNode.replaceChild(newnode,docnode);updatedNodes.push(newnode);}
else
{while(docnode.firstChild!=null)
docnode.removeChild(docnode.firstChild);while(tmpnode.firstChild!=null){var node=tmpnode.firstChild;tmpnode.removeChild(node);docnode.appendChild(node);}
updatedNodes.push(docnode);newnode=docnode;}
if(postProcessNode)postProcessNode.call(this.form,{node:newnode});}}
catch(exception)
{miwt.error("Exception updating DOM",exception);failsafe=true;}
var windowNodes=this.req.responseXML.getElementsByTagName("newwindow");for(var i=0;i<windowNodes.length;i++){var tmpnode=document.createElement("div"),tmpcontent=this.decomposeParts(windowNodes.item(i));if(preProcessNode){tmpcontent=preProcessNode.call(this.form,{content:tmpcontent,refid:null});if(tmpcontent==null)continue;}
tmpnode.innerHTML=tmpcontent;var newnode=tmpnode.firstChild;var windowcon=miwt.$$("form#"+this.form.id+" > div.miwt").pop();if(windowcon){var refid=windowNodes.item(i).attributes.getNamedItem("ref").nodeValue;var existing=miwt.$(refid);if(existing){existing.parentNode.replaceChild(newnode,existing);}
else{windowcon.appendChild(newnode);}
updatedNodes.push(newnode);if(postProcessNode)postProcessNode.call(this.form,{node:newnode});}else{failsafe=true;}}
try{miwt.ajaxprogress.stop();var oldloc=window.location.href;var locref=false;var initNodes=this.req.responseXML.getElementsByTagName("jsinit");for(var i=0;i<initNodes.length;i++){var node=initNodes.item(i);var script=this.decomposeParts(node);locref=locref||script.match(/window\.location\.href/);if(window.execScript)
window.execScript(script);else
window.eval(script);}
if(locref||oldloc!=window.location.href){return;}
if(failsafe)
break processXML;if(window.windowlist)
repairWindowsAfterUpdate();var focusChanged=false;if(lastFocusId!=null){var node=miwt.$(lastFocusId);if(node!=null&&node.focus){try{node.focus();focusChanged=true;}catch(e){miwt.info("Unable to reset focus for ID = "+lastFocusId,e);}}}
for(var i=0;i<updatedNodes.length;i++){var n=updatedNodes[i],w=miwt.up(n,"div.window");try{__i2rd_domupdate_fire(n);}catch(e){}
miwt.setup(n);if(w&&w!=n&&w.auto_size_serial!==miwtajax.currentSerial(this.form)){w.auto_size_serial=miwtajax.currentSerial(this.form);miwt.autoSizeWindow(w);}}
if(miwt.B.IE){var fcklist=miwt.$$('textarea.fckeditor',this.form);if(!focusChanged&&fcklist.length>0){var el,nodes=miwt.$$('input[type="text"]',this.form);while((el=nodes.shift())){if(el.type!='hidden'&&el.focus){var f=function(){for(var i=0;i<fcklist.length;i++){var fck=fcklist[i];var iframes=miwt.$$('iframe',fck.parentNode);if(iframes.length==0){window.setTimeout(f,100);return;}
var iframe;while(iframe=iframes.shift()){miwt.observe(iframe,"load",function(){if(!el.disabled)el.focus();});if(!el.disabled)el.focus();}}};window.setTimeout(f,100);break;}}}}
if(updatedNodes.length>0){var docHeight,scroll=miwt.getScrollOffset(),clientHeight,scrollBottom,de=document.documentElement,db=document.body;if(de){clientHeight=de.clientHeight;docHeight=de.scrollHeight;scrollBottom=scroll.y+clientHeight;}else{clientHeight=db.clientHeight;docHeight=db.scrollHeight;scrollBottom=scroll.y+clientHeight;}
if(docHeight>clientHeight){var scrollNode,miny= -1,node,y;for(var i=0;node=updatedNodes[i];i++){if(!node.id.match(/c_.*/)||!miwt.isInActiveWindow(node))
continue;y=miwt.cumulativeOffset(node)[1];if(miny== -1||y<miny){miny=y;scrollNode=node;}}
if(miny!= -1&&(miny<scroll.y||miny>scrollBottom)){if(miny>scrollBottom){var targetHeight=scrollNode.offsetHeight;if(targetHeight<clientHeight){miny=miny -(clientHeight -targetHeight);}}
window.scrollTo(0,miny);}}}}catch(exception){miwt.error("Exception processing updates",exception);failsafe=true;break processXML;}
this.form.CleanOnSubmitHandlers();}else if(action=="error"){miwt.error("Error occurred during rendering");var errormessage="",errormessageNodes=this.req.responseXML.getElementsByTagName("errormessage");for(var i=0;i<errormessageNodes.length;i++){if(i>0)errormessage=errormessage +"\n";errormessage=errormessage +errormessageNodes.item(i).firstChild.nodeValue;}
var errordetail="",errordetailNodes=this.req.responseXML.getElementsByTagName("errordetail");for(var i=0;i<errordetailNodes.length;i++){if(i>0)errordetail=errordetail +"\n";errordetail=errordetail +errordetailNodes.item(i).firstChild.nodeValue;}
var node=document.createElement("div");node.innerHTML='<div style="border: solid red 10px; background-color: white; position: fixed; z-index: 9000; top: 10px; left: 10px; padding: 10px; max-width: 800px; max-height: 600px; overflow: scroll;"><div>'+errormessage+'</div><textarea cols="60" rows="10" wrap="off">'+errordetail+'</textarea></div>';document.getElementsByTagName("body").item(0).appendChild(node);}else if(action=='redirect'){if(!redirectURL)
miwt.error("Missing redirect URL.");else{var url=this.opts.processRedirect?this.opts.processRedirect(redirectURL):redirectURL;if(url!==false){if((typeof url)=='string')redirectURL=url;window.location.href=redirectURL;return;}}}else{miwt.error("Unknown action: "+action);failsafe=true;}}else{miwt.error("Received no content / invalid content from server. Status = " +this.req.status
+", ResponseText: " +this.req.responseText);failsafe=true;}
try{miwt.ajaxprogress.stop();window.miwtReady=1;var postUpdateData={status:this.req.status,action:action,nodesUpdated:updatedNodes,success:true,source:this.form};if(failsafe){this.doFailsafe(failsafeSkipParam);}else{this.form.ResetTransient();if(this.opts.postUpdate)
this.opts.postUpdate.call(this.form,postUpdateData);}
this.doRequestCompleteCallback(postUpdateData);}finally{this.req=null;}}},doRequestCompleteCallback:function(data){var i=0,f;for(;f=miwtajax.ajax_request_complete_callback[i++];)
f.call(this.form,data);},doFailsafe:function(skipParam){var i=0,f,data={status:this.req.status,action:'failsafe',nodesUpdated:[],success:false,source:this.form};for(;f=miwtajax.ajax_failed_update_callback[i++];){if(!f.call(this.form,data))return;}
if(this.opts.postUpdate)this.opts.postUpdate.call(this.form,data);this.failsafe=true;if(!!skipParam)
window.location.href=this.form.action;else
window.location.href=this.form.action +(miwt.parseUri(this.form.action).query?'&':'?') +"failsafe=true";},isRequestSubmitted:function(){return this.req!=null;}};miwtajax.addMIWTAJAXUpdateFailureCallback=function(f){miwtajax.ajax_failed_update_callback.push(f);};miwtajax.removeMIWTAJAXUpdateFailureCallback=function(f){miwtajax.ajax_failed_update_callback=miwtajax.ajax_failed_update_callback.without(f);};miwtajax.addMIWTAJAXRequestCompleteCallback=function(f){miwtajax.ajax_request_complete_callback.push(f);};miwtajax.removeMIWTAJAXRequestCompleteCallback=function(f){miwtajax.ajax_request_complete_callback=miwtajax.ajax_request_complete_callback.without(f);};}
if(typeof miwtcardcontainer=='undefined'){miwtcardcontainer={};miwt.CardContainerSelect=function(containerId,cardId){var container=miwt.$(containerId);var i;for(i=0;i<container.childNodes.length;i++)
{var node=container.childNodes.item(i);if(node.nodeType==1&&node.nodeName.toLowerCase()=="div")
{if(node.id==cardId)
node.style.display="block";else
node.style.display="none";}}};miwt.CardContainerSelectEvent=function(event){var element=miwt.element(event);miwt.CardContainerSelect(element.cardid,element.cardname);};miwt.CardContainerSelectSetup=function(el,containerId,cardId){el.cardid=containerId;el.cardname=cardId;if(el.type){switch(el.type.toLowerCase())
{case'checkbox':case'radio':miwt.observe(el,'click',miwt.CardContainerSelectEvent);break;case'password':case'text':case'textarea':case'select-one':case'select-multiple':miwt.observe(el,'change',miwt.CardContainerSelectEvent);break;}}
else
{miwt.observe(element,'click',miwt.CardContainerSelectEvent);}};miwt.AddSetupHandler(null,function(tag,node){var match=/miwt_card_(\S+)___(\S+)/.exec(node.className);if(match)
miwt.CardContainerSelectSetup(node,match[1],match[2]);});}
if(typeof miwt.windowTopZIndex=='undefined'){miwt.windowMoveTarget=null;miwt.windowTopZIndex=1;miwt.windowlist=[];miwt.getWindowWidth=function()
{if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth>0)
{return document.documentElement.clientWidth;}
else if(document.body&&document.body.clientWidth&&document.body.clientWidth>0)
{return document.body.clientWidth;}
else if(window.innerWidth)
{return window.innerWidth;}
else
{return null;}};miwt.getWindowHeight=function(){if(window.innerHeight&&window.innerHeight>0)
{return window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight&&document.documentElement.clientHeight>0)
{return document.documentElement.clientHeight;}
else if(document.body&&document.body.clientHeight&&document.body.clientHeight>0)
{return document.body.clientHeight;}
else
{return null;}};miwt.getScrollOffset=function(){var x,y,b=document.body,de=document.documentElement;if(self.pageYOffset){x=self.pageXOffset;y=self.pageYOffset;}else{if(de&&de.scrollTop){x=de.scrollLeft;y=de.scrollTop;}else if(b){x=b.scrollLeft;y=b.scrollTop;}}
return{x:x,y:y};};miwt.fixWindowList=function(){var newlist=[];for(var i=0;i<miwt.windowlist.length;i++)
{var w=miwt.$(miwt.windowlist[i]);if(w!=null)
newlist.push(w.id);}
miwt.windowlist=newlist;};miwt.saveWindowPosition=function(winName,topFormName,leftFormName,widthFormName,heightFormName,zorderFormName){var win=miwt.$(winName);if(win==null)
return;var zorder=miwt.$(zorderFormName);if(zorder!=null)
zorder.value=win.style.zIndex;var top=miwt.$(topFormName);if(top!=null)
top.value=win.style.top;var left=miwt.$(leftFormName);if(left!=null)
left.value=win.style.left;var width=miwt.$(widthFormName);if(width!=null)
width.value=win.style.width;var height=miwt.$(heightFormName);if(height!=null)
height.value=win.style.height;};miwt.getWindowForElement=function(el){var oel=el,tn;while(el!=null){tn=(el.tagName||"").toLowerCase();if(tn=="div")
{if(miwt.hasClassName(el,'window')||miwt.hasClassName(el,'inlinewindow'))
return el;}
if(el.parentNode)
el=el.parentNode;else
el=el.parentElement;}
miwt.error("miwt.getWindowForElement(" +oel +"): Unable to find element parent that is a window.");alert("An unexpected error occurred. Try reloading the page.");return null;};miwt.repairWindowsAfterUpdate=function(){var activewindow=null;var newlist=[];for(i=0;i<miwt.windowlist.length;i++)
{var w=miwt.$(miwt.windowlist[i]);if(w!=null)
{newlist.push(miwt.windowlist[i]);w.miwt_hide_permiating=false;if(miwt.isWindowActive(w))
activewindow=w;}}
miwt.windowlist=newlist;if(activewindow!=null)
miwt.checkForPermiatingElements(activewindow);};miwt.activateWindow=function(object){if(miwt.$(object.id+"_title_div")==null)
return;if(object.style.zIndex!=miwt.windowTopZIndex){miwt.windowTopZIndex++;object.style.zIndex=miwt.windowTopZIndex;}
var title_td=miwt.$(object.id+"_title_td");miwt.removeClassName(title_td,"inactivewindowtitle");miwt.addClassName(title_td,"activewindowtitle");var title_div=miwt.$(object.id+"_title_div");miwt.removeClassName(title_div,"inactivewindowtitle");miwt.addClassName(title_div,"activewindowtitle");if(miwt.$(object.id+"_menu_btn")!=null)
miwt.button.imageButtonActivate(object.id+"_menu_btn");if(miwt.$(object.id+"_minimize_btn")!=null)
miwt.button.imageButtonActivate(object.id+"_minimize_btn");if(miwt.$(object.id+"_maximize_btn")!=null)
miwt.button.imageButtonActivate(object.id+"_maximize_btn");if(miwt.$(object.id+"_close_btn")!=null)
miwt.button.imageButtonActivate(object.id+"_close_btn");if(object.focusable)
miwt.stopObserving(miwt.getWindowContent(object),"mousedown",miwt.activateWindowPassive,false);var dialog=!!/\bdialog\b/.exec(object.className);for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=object.id)
{var w=miwt.$(miwt.windowlist[i]);if(w!=null&&w!=object){miwt.deactivateWindow(w);if(dialog)
miwt.disableChildren(w);}}}
miwt.enableChildren(object);object.miwt_hide_permiating=true;miwt.showPermiatingElements(object);};miwt.deactivateWindow=function(object){if(miwt.$(object.id+"_title_div")==null)
return;var title_td=miwt.$(object.id+"_title_td");miwt.removeClassName(title_td,"activewindowtitle");miwt.addClassName(title_td,"inactivewindowtitle");var title_div=miwt.$(object.id+"_title_div");miwt.removeClassName(title_div,"activewindowtitle");miwt.addClassName(title_div,"inactivewindowtitle");if(miwt.$(object.id+"_menu_btn")!=null)
miwt.button.imageButtonDeactivate(object.id+"_menu_btn");if(miwt.$(object.id+"_minimize_btn")!=null)
miwt.button.imageButtonDeactivate(object.id+"_minimize_btn");if(miwt.$(object.id+"_maximize_btn")!=null)
miwt.button.imageButtonDeactivate(object.id+"_maximize_btn");if(miwt.$(object.id+"_close_btn")!=null)
miwt.button.imageButtonDeactivate(object.id+"_close_btn");if(object.focusable)
miwt.observe(miwt.getWindowContent(object),"mousedown",miwt.activateWindowPassive,false);}
miwt.closeWindow=function(object){var dialog=!!/\bdialog\b/.exec(object.className);miwt.closeCKEditors(object);object.parentNode.removeChild(object);miwt.repairWindowsAfterUpdate();if(miwt.windowlist.length>0){var top=miwt.$(miwt.windowlist[0]);if(!top){miwt.error("miwt.closeWindow: Expecting top window at miwt.windowlist[0], got null");return;}
if(dialog)
miwt.enableChildren(top);for(i=1;i<miwt.windowlist.length;i++)
{var w=miwt.$(miwt.windowlist[i]);if(dialog)
miwt.enableChildren(w);if(w&&w.style.zIndex>top.style.zIndex)
top=w;}
miwt.activateWindow(top);}};miwt.isWindowActive=function(object){if(object.className.match(/inlinewindow/)&&miwt.windowlist.length==1)
{for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=object.id)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(!otherwindow.className.match(/inlinewindow/))
{var titletd=miwt.$(otherwindow.id+"_title_td");if(titletd!=null&&titletd.className.match(/activewindowtitle/))
return false;}}}
return true;}
var titletd=miwt.$(object.id+"_title_td");if(titletd==null)
{return false;}
return!!titletd.className.match(/activewindowtitle/);};miwt.getWindowContent=function(object){return miwt.$(object.id+"_content_div");};miwt.isWindowOverlapped=function(activewindow,otherwindow){if(otherwindow.className.match(/inlinewindow/))
return true;var activeTop=parseInt(activewindow.style.top);var activeLeft=parseInt(activewindow.style.left);var activeBottom=activeTop+parseInt(activewindow.offsetHeight);var activeRight=activeLeft+parseInt(activewindow.offsetWidth);var otherTop=parseInt(otherwindow.style.top);var otherLeft=parseInt(otherwindow.style.left);var otherBottom=otherTop+parseInt(otherwindow.offsetHeight);var otherRight=otherLeft+parseInt(otherwindow.offsetWidth);if(activeTop>otherBottom)return false;if(activeBottom<otherTop)return false;if(activeLeft>otherRight)return false;if(activeRight<otherLeft)return false;return true;};miwt.checkForPermiatingElements=function(activewindow){for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=activewindow.id)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(otherwindow!=null)
{if(miwt.isWindowOverlapped(activewindow,otherwindow))
miwt.hidePermiatingElements(otherwindow);else
miwt.showPermiatingElements(otherwindow);}}}
miwt.showPermiatingElements(activewindow);};miwt.beginWindowMove=function(evt){miwt.windowMoveTarget=miwt.getWindowForElement(miwt.element(evt));if(miwt.windowMoveTarget==null)
return;miwt.stop(evt);var p=miwt.pointer(evt);miwt.lastWindowX=p.x;miwt.lastWindowY=p.y;miwt.observe(document,"mousemove",miwt.doWindowMove,true);miwt.observe(document,"mouseup",miwt.endWindowMove,true);var td=miwt.$(miwt.windowMoveTarget.id+"_title_td");miwt.lastWindowCursor=td.style.cursor;td.style.cursor='move';miwt.lastDocumentCursor=document.body.style.cursor;document.body.style.cursor='move';var activate=true,i,mzi=miwt.windowMoveTarget.style.zIndex,w;if(mzi!=miwt.windowTopZIndex)
{for(i=0;i<miwt.windowlist.length&&activate;i++)
{w=miwt.$(miwt.windowlist[i]);if(w!=null&&w.className.match(/\bdialog\b/)&&w.style.zIndex>mzi){activate=false;}}}
if(activate)miwt.activateWindow(miwt.windowMoveTarget);miwt.$(miwt.windowMoveTarget.id+"_content_div").style.visibility="hidden";};miwt.getWindowPositionDelta=function(w,p){var dx=p.x-miwt.lastWindowX,dy=p.y-miwt.lastWindowY;return{dx:dx,dy:dy,distance:(Math.sqrt(Math.pow(dx,2) +Math.pow(dy,2)))};};miwt.updateLastWindowPosition=function(p){miwt.lastWindowX=p.x;miwt.lastWindowY=p.y;miwt.lastWindowTime=new Date().getMilliseconds();};miwt.doWindowMove=function(evt,force){miwt.stop(evt);var w=miwt.windowMoveTarget,p=miwt.pointer(evt),td=new Date().getMilliseconds()-miwt.lastWindowTime,delta=miwt.getWindowPositionDelta(w,p);force=force||Math.abs(delta.distance)>10||td>75;var f=function windowMove(){miwt.moveWindowRelative(w,delta);miwt.updateLastWindowPosition(p);};if(force)
f();};miwt.moveWindowRelative=function(w,delta){var x=parseInt(w.style.left)+delta.dx,y=parseInt(w.style.top)+delta.dy;w.style.left=x+"px";w.style.top=y+"px";};miwt.endWindowMove=function(evt){miwt.stopObserving(document,"mousemove",miwt.doWindowMove,true);miwt.stopObserving(document,"mouseup",miwt.endWindowMove,true);miwt.doWindowMove(evt,true);miwt.$(miwt.windowMoveTarget.id+"_title_td").style.cursor=miwt.lastWindowCursor;document.body.style.cursor=miwt.lastDocumentCursor;miwt.$(miwt.windowMoveTarget.id+"_content_div").style.visibility="visible";miwt.stop(evt);miwt.checkForPermiatingElements(miwt.windowMoveTarget);miwt.windowMoveTarget=null;};miwt.beginWindowResize=function(evt){var target=miwt.element(evt);miwt.windowResizeTarget=miwt.getWindowForElement(target);if(miwt.windowResizeTarget==null)
return;miwt.stop(evt);miwt.updateLastWindowPosition(miwt.pointer(evt));miwt.windowResizeDir=target.resizeDir;miwt.observe(document,"mousemove",miwt.doWindowResize,true);miwt.observe(document,"mouseup",miwt.endWindowResize,true);miwt.activateWindow(miwt.windowResizeTarget);};miwt.doWindowResize=function(evt){miwt.$(miwt.windowResizeTarget.id+"_content_div").style.visibility="hidden";var p=miwt.pointer(evt);var difX=p.x-miwt.lastWindowX;var difY=p.y-miwt.lastWindowY;var object=miwt.windowResizeTarget;var top=parseInt(object.style.top);var left=parseInt(object.style.left);var width=parseInt(object.style.width);var height=parseInt(object.style.height);var table=miwt.$(miwt.windowResizeTarget.id+"_table");var tableWidth=parseInt(table.style.width);var tableHeight=parseInt(table.style.height);var content=miwt.$(miwt.windowResizeTarget.id+"_content_div");var contentWidth=parseInt(content.style.width);var contentHeight=parseInt(content.style.height);if(miwt.windowResizeDir=="ne"){width=width+difX;height=height-difY;tableWidth=tableWidth+difX;tableHeight=tableHeight-difY;contentWidth=contentWidth+difX;contentHeight=contentHeight-difY;top=top+difY;}else if(miwt.windowResizeDir=="nw"){width=width-difX;height=height-difY;tableWidth=tableWidth-difX;tableHeight=tableHeight-difY;contentWidth=contentWidth-difX;contentHeight=contentHeight-difY;left=left+difX;top=top+difY;}else if(miwt.windowResizeDir=="se"){width=width+difX;height=height+difY;tableWidth=tableWidth+difX;tableHeight=tableHeight+difY;contentWidth=contentWidth+difX;contentHeight=contentHeight+difY;}else if(miwt.windowResizeDir=="sw"){width=width-difX;height=height+difY;tableWidth=tableWidth-difX;tableHeight=tableHeight+difY;contentWidth=contentWidth-difX;contentHeight=contentHeight+difY;left=left+difX;}else{alert("Internal error in window resize, I don't know which direction you are resizing.");miwt.endWindowResize(evt);}
object.style.top=top+"px";object.style.left=left+"px";object.style.width=width+"px";object.style.height=height+"px";table.style.width=tableWidth+"px";table.style.height=tableHeight+"px";content.style.width=contentWidth+"px";content.style.height=contentHeight+"px";};miwt.endWindowResize=function(evt){miwt.stopObserving(document,"mousemove",miwt.doWindowResize,true);miwt.stopObserving(document,"mouseup",miwt.endWindowResize,true);miwt.$(miwt.windowResizeTarget.id+"_content_div").style.visibility="visible";miwt.stop(evt);miwt.checkForPermiatingElements(miwt.windowMoveTarget);miwt.windowResizeTarget=null;};miwt.disableWindowActivation=function(evt){miwt.stop(evt);};miwt.enableChildren=function(root){miwt.disableChildren(root,false);};miwt.disableChildren=function(root,disable){if(root==null||!root.hasChildNodes()||miwt.IsIterationStopNode(root))
return;if(typeof disable=='undefined')
disable=true;var i;for(i=0;i<root.childNodes.length;i++)
{var node=root.childNodes.item(i);if(node.nodeType==Node.ELEMENT_NODE)
{if(node.hasAttributes)
{if(node.hasAttributes())
{if(disable){if(!node.hasAttribute("disabled")){node.wedisabled=true;node.setAttribute("disabled","true");}}else{if(node.wedisabled){node.wedisabled=false;node.removeAttribute("disabled");}}}}
else
{if(disable){if(node.disabled){node.wedisabled=true;node.disabled=disable;}}else{if(node.wedisabled){node.wedisabled=false;node.disabled=false;}}}
miwt.disableChildren(node,disable);}}};miwt.activateWindowPassive=function(evt){var win=miwt.getWindowForElement(miwt.element(evt));if(win==null)
return;if(!miwt.isWindowActive(win))
{miwt.activateWindow(win);miwt.checkForPermiatingElements(win);}};miwt.setAbsoluteWidth=function(object){var width=parseInt(object.offsetWidth,10);var height=parseInt(object.offsetHeight,10);object.style.width=width+"px";object.style.height=height+"px";};miwt.setInitialPosition=function(windowObject){if(windowObject.className.match(/inlinewindow/))
return;if(!windowObject.style.top||windowObject.style.top=="")
{var scroll=miwt.getScrollOffset();var initialTop=scroll.y +10;if(windowObject.className.match(/dialog/)){var height=miwt.getComputedStyle(windowObject,"height");if(height.match(/px/)){height=parseInt(height);if(height<miwt.getWindowHeight())
initialTop=scroll.y +(miwt.getWindowHeight() -height)/2;}
else if(height.match(/%/)){height=parseInt(height);if(height>0)
initialTop=scroll.y +(miwt.getWindowHeight()*(1 -height/100))/2;}else{height=windowObject.offsetHeight;if(height<miwt.getWindowHeight())
initialTop=scroll.y +(miwt.getWindowHeight() -height)/2;}}
for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=windowObject.id)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(otherwindow.style.top&&otherwindow.style.top!=''&&Math.abs(parseInt(otherwindow.style.top) -initialTop)<30)
{initialTop +=30;}}}
windowObject.style.top=initialTop +"px";}
if(!windowObject.style.left||windowObject.style.left=="")
{var scroll=miwt.getScrollOffset();var initialLeft=scroll.x +10;if(windowObject.className.match(/dialog/)){var width=miwt.getComputedStyle(windowObject,"width");if(width.match(/px/)){width=parseInt(width);if(width<miwt.getWindowWidth())
initialLeft=scroll.x +(miwt.getWindowWidth() -width)/2;}
else if(width.match(/%/)){width=parseInt(width);if(width>0)
initialLeft=scroll.x +(miwt.getWindowWidth()*(1 -width/100))/2;}else{width=windowObject.offsetWidth;if(width<miwt.getWindowWidth())
initialLeft=scroll.x +(miwt.getWindowWidth() -width)/2;}}
for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=windowObject.id)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(otherwindow.style.left&&otherwindow.style.left!=''&&Math.abs(parseInt(otherwindow.style.left) -initialLeft)<30)
{initialLeft +=30;}}}
windowObject.style.left=initialLeft +"px";}};miwt.ensurePassiveWindowActivation=function(windowObject){var windowContent=miwt.$(windowObject.id+"_content_div");miwt.stopObserving(windowContent,"mousedown",miwt.activateWindowPassive,false);miwt.observe(windowContent,"mousedown",miwt.activateWindowPassive,false);}
miwt.setupWindow=function(name,resizable,zindex,focusable,moveable){miwt.fixWindowList();var alreadyInList=false;for(var i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]==name)
{alreadyInList=true;break;}}
if(!alreadyInList)
miwt.windowlist.push(name);var windowObject=miwt.$(name);var windowTitle=miwt.$(name+"_table");var windowTable=miwt.$(name+"_table");var windowContent=miwt.$(name+"_content_div");var title=miwt.$(name+"_title_td");var active=miwt.isWindowActive(windowObject);if(zindex>miwt.windowTopZIndex)
{miwt.windowTopZIndex=zindex;}
windowObject.focusable=focusable;if(focusable)
{if(!active)
{miwt.ensurePassiveWindowActivation(windowObject);}
else if(!windowObject.className.match(/inlinewindow/))
{for(i=0;i<miwt.windowlist.length;i++)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(otherwindow.className.match(/inlinewindow/))
{miwt.ensurePassiveWindowActivation(otherwindow);}}}
if(moveable)
{miwt.observe(title,"mousedown",miwt.beginWindowMove,true);}
if(resizable)
{setAbsoluteWidth(windowContent);setAbsoluteWidth(windowTable);setAbsoluteWidth(windowObject);var resize;resize=miwt.$(name+"_windowresize_nw_div");miwt.observe(resize,"mousedown",miwt.beginWindowResize,false);resize.resizeDir="nw";resize=miwt.$(name+"_windowresize_ne_div");miwt.observe(resize,"mousedown",miwt.beginWindowResize,false);resize.resizeDir="ne";resize=miwt.$(name+"_windowresize_sw_div");miwt.observe(resize,"mousedown",miwt.beginWindowResize,false);resize.resizeDir="sw";resize=miwt.$(name+"_windowresize_se_div");miwt.observe(resize,"mousedown",miwt.beginWindowResize,false);resize.resizeDir="se";}}
else
{miwt.observe(windowObject,"mousedown",miwt.disableWindowActivation,true);miwt.disableChildren(windowObject);}
for(i=0;i<miwt.windowlist.length;i++)
{if(miwt.windowlist[i]!=windowObject.id)
{var otherwindow=miwt.$(miwt.windowlist[i]);if(otherwindow!=null&&miwt.isWindowOverlapped(windowObject,otherwindow))
{if(active)
{miwt.hidePermiatingElements(otherwindow);}
else
{miwt.hidePermiatingElements(windowObject);}}}}
if(active)
{miwt.showPermiatingElements(windowObject);}
if(!miwt.hasClassName(windowObject,"inlinewindow"))
{var form=miwt.up(windowObject,'form');var funcArg=name;form.RegisterOnSubmitHandler(windowObject,function(){return miwt.prv_saveWindowPosition(funcArg)});miwt.autoSizeWindow(windowObject,windowContent,windowTitle);}
miwt.setInitialPosition(windowObject);if(active||!miwt.hasClassName(windowObject,"dialog"))
miwt.activateWindow(windowObject);};miwt.autoSizeWindow=function(windowObject,windowContent,windowTitle){if(miwt.isResizable(windowObject)||!windowObject)
return;var wos=windowObject.style,hasHeight=miwt.hasCSSRule(windowObject,'height','auto');if(!hasHeight||!!windowObject.autosized)
{wos.top='0px';wos.left='0px';windowContent=windowContent||miwt.$(windowObject.id+"_content_div");var hb=windowContent.offsetTop,contentNode=windowContent.firstChild;if(navigator.userAgent.match(/MSIE 7/))contentNode.style.minHeight="2em";windowTitle=windowTitle||miwt.$(windowObject.id+"_table");var childH=0,hh=false,h=miwt.getWindowHeight() -40,i,el,list=miwt.children(contentNode),cnh=0;for(i=0;el=list[i++];)childH +=miwt.height(el);for(i=0,list=[windowContent,contentNode];el=list[i++];){cnh=Math.max(cnh,miwt.height(el));if(miwt.hasCSSRule(el,'height','100%')){hh=true;break;}}
if(!hh)cnh=Math.max(cnh,childH);if(cnh>0){var ih=cnh +hb;if(ih>h)ih=h;if(ih>windowObject.offsetHeight)
windowObject.style.height=ih +"px";else if(windowObject.autosized&&(cnh +40)<windowObject.offsetHeight)
windowObject.style.height=(cnh +hb) +"px";windowObject.autosized=true;}
wos.top='';wos.left='';miwt.setInitialPosition(windowObject);}};miwt.prv_saveWindowPosition=function(){miwt.saveWindowPosition(this+'',this+'_windowTop',this+'_windowLeft',this+'_windowWidth',this+'_windowHeight',this+'_windowZOrder');return true;};miwt.isWindow=function(node){if(!node||!node.className)
return false;return!!/\bwindow\b/.exec(node.className);};miwt.isInlineWindow=function(node){if(!node||!node.className)
return false;return!!/\binlinewindow\b/.exec(node.className);};miwt.isInActiveWindow=function(node){var win=miwt.getWindowForElement(node);if(!win)
return false;return miwt.isWindowActive(win);};miwt.AddSetupHandler(['div'],function(tag,node)
{var isWindow=miwt.isWindow(node);var isInlineWindow=miwt.isInlineWindow(node);if(isWindow||isInlineWindow)
{miwt.setupWindow(node.id,miwt.isResizable(node),miwt.getComputedStyle(node,'z-index')||0,true,!isInlineWindow);}});miwt.isResizable=function(node){return node&&miwt.$(node.id+"_windowresize_nw_div")!=null};}
if(typeof miwtpermiating=='undefined'){var miwtpermiating={};miwt.elementPermiatingNone=[];miwt.elementPermiatingIE6=['select'];miwt.elementPermiating=miwt.elementPermiatingNone;if(navigator.userAgent.match(/MSIE [456]/))
miwt.elementPermiating=miwt.elementPermiatingIE6;miwt.isElementPermiating=function(node){if(!node.tagName)return false;var tag=node.tagName.toLowerCase(),t,i=0;for(;t=miwt.elementPermiating[i++];)
if(tag==t)return true;return false;};miwt.hidePermiatingElements=function(object){if(object.miwt_hide_permiating==true)
return;object.miwt_hide_permiating=true;var el,node,i=0,nodes,j;for(;el=miwt.elementPermiating[i++];){nodes=object.getElementsByTagName(el);for(j=0;node=nodes[j++];)node.style.visibility="hidden";}};miwt.showPermiatingElements=function(object){if(object.miwt_hide_permiating==false)
return;object.miwt_hide_permiating=false;var el,node,i=0,j,nodes,p;for(;el=miwt.elementPermiating[i++];){nodes=object.getElementsByTagName(el);nodeLoop:for(j=0;node=nodes[j++];){p=node.parentNode;while(p){if(miwt.isVisibilitySet(p)){try{node.style.visibility=null;break nodeLoop;}catch(e){}}
p=p.parentNode;}
node.style.visibility="visible";}}};miwt.isVisibilitySet=function(node){var s=node.style;return(s&&(s.visibility||'')!='');};miwt.IsIterationStopNode=function(object){return object.nodeName=="SELECT"||object.nodeName=="select";};}
if(typeof miwtcollapsible=='undefined'){var miwtcollapsible={};miwt.collapsableContainerToggle=function(collapseFormKey,containerDivId,triggerId,anchor,inline){var formElement=miwt.$(collapseFormKey);if(formElement==null)
return;if(formElement.value=="true"){miwt.prv_collapsableContainerShow(containerDivId,triggerId,anchor,inline);formElement.value="false";}
else if(formElement.value=="false"){miwt.prv_collapsableContainerHide(containerDivId,triggerId,inline);formElement.value="true";}};miwt.prv_collapsableContainerShow=function(containerDivId,triggerId,anchor,inline){var divObject=miwt.$(containerDivId);if(divObject==null)
return;var triggerObject=miwt.$(triggerId);if(triggerObject!=null){var pos=miwt.cumulativeOffset(triggerObject);if(anchor.indexOf("south")>=0){if(anchor=="south"){divObject.style.left=pos[0]+"px";divObject.style.top=(pos[1]+triggerObject.offsetHeight)+"px";}
else{divObject.style.top=pos[1]+"px";}}
if(anchor.indexOf("east")>=0){divObject.style.left=(pos[0]+triggerObject.offsetWidth)+"px";if(anchor=="east")
divObject.style.top=pos[1]+"px";}
if(anchor.indexOf("north")>=0){if(anchor=="north"){divObject.style.left=pos[0]+"px";divObject.style.top=(pos[1]-divObject.offsetHeight)+"px";}
else{divObject.style.top=((pos[1]+triggerObject.offsetHeight)-divObject.offsetHeight)+"px";}}
if(anchor.indexOf("west")>=0){divObject.style.left=(pos[0]-divObject.offsetWidth)+"px";if(anchor=="west")
divObject.style.top=pos[1]+"px";}
miwt.removeClassName(triggerObject,"miwt_collapsable_hidden");miwt.removeClassName(triggerObject.parentNode,"miwt_collapsable_hidden");miwt.addClassName(triggerObject,"miwt_collapsable_shown");miwt.addClassName(triggerObject.parentNode,"miwt_collapsable_shown");}
miwt.removeClassName(divObject,"miwt_collapsable_hidden");miwt.addClassName(divObject,"miwt_collapsable_shown");if(inline)
divObject.style.display="inline";else
divObject.style.visibility="visible";if(miwt.hasClassName(triggerObject,"miwt_collapsable_exclusive"))
{var el,list;list=miwt.$$('.miwt_collapsable_exclusive');while(el=list.pop()){if(el.div&&el.div!=divObject){miwt.prv_collapsableContainerHide(el.div.id,el.id,el.disposition.toLowerCase()=='inline');el.state.value="true";}}}};miwt.prv_collapsableContainerHide=function(containerDivId,triggerId,inline){var divObject=miwt.$(containerDivId);if(divObject==null)
return;if(inline)
divObject.style.display="none";else
divObject.style.visibility="hidden";miwt.removeClassName(divObject,"miwt_collapsable_shown");miwt.addClassName(divObject,"miwt_collapsable_hidden");var triggerObject=miwt.$(triggerId);if(triggerObject!=null){miwt.removeClassName(triggerObject,"miwt_collapsable_shown");miwt.removeClassName(triggerObject.parentNode,"miwt_collapsable_shown");miwt.addClassName(triggerObject,"miwt_collapsable_hidden");miwt.addClassName(triggerObject.parentNode,"miwt_collapsable_hidden");}};miwt.collapseContainerToggle=function(event){miwt.stop(event);var element=miwt.element(event)||event;miwt.collapsableContainerToggle(element.state.name,element.div.id,element.id,element.anchor,element.disposition.toLowerCase()=='inline');};miwt.AddSetupHandler(['button','a','img'],function(tag,node){var match=/miwt_collapsable_(\w+)_(\w+)/.exec(node.className);if(match){node.anchor=match[1];node.disposition=match[2];node.div=miwt.$(node.id.replace("_collapsable_trigger","_collapsable"));node.state=miwt.$(node.id.replace("_collapsable_trigger",""));miwt.observe(node,"click",miwt.collapseContainerToggle);if(node.disposition.toLowerCase()!='inline'&&node.state.value=='false'){miwt.prv_collapsableContainerShow(node.div.id,node.id,node.anchor,false);}}});}
if(typeof miwttimer=='undefined'){var miwttimer={};miwttimer.graceperiod=3000;miwttimer.fireTimer=function(formname){var form=miwt.$(formname);if(!form)
return;miwttimer.oldTimer=null;if(miwttimer.rescheduleTimerNeeded&&(new Date() -miwttimer.rescheduleTimerNeeded)<miwttimer.graceperiod)
{miwttimer.oldTimer=setTimeout('miwttimer.fireTimer("'+formname+'")',miwttimer.graceperiod,'JavaScript');}
else
{form.MIWTSubmit();}};miwttimer.rescheduleTimer=function(){if(miwttimer.oldTimer){miwttimer.rescheduleTimerNeeded=new Date();}};miwttimer.scheduleUpdate=function(formname,time){var form=miwt.$(formname);if(miwttimer.oldTimer){clearTimeout(miwttimer.oldTimer);miwttimer.oldTimer=null;}
miwttimer.oldTimer=setTimeout('miwttimer.fireTimer("'+formname+'")',time||1000,'JavaScript');};miwt.AddSetupHandler(['dfn'],function(tag,node){if(tag=='dfn'&&/\bmiwt_timer\b/.exec(node.className))
{var form=node;while(form.parentNode&&(!form.tagName||(form.tagName.toLowerCase()!="form")))
form=form.parentNode;miwttimer.scheduleUpdate(form.id||form.name,parseInt(node.firstChild.data));}});}
if(typeof validation=='undefined'){var validation={};validation.integerpattern=new RegExp("[ ]*([-]?[ ]*[0-9]+)[ ]*$");validation.realpattern=new RegExp("([ ]*[-]?[ ]*[0-9]*[\.][0-9]+[ ]*$)|([ ]*[-]?[ ]*[0-9]+[\.][0-9]*[ ]*$)");validation.emailpattern=new RegExp("^.+@.+\..{2,3}$");validation.date_mmddyyyy_slash=/([0-9][0-9])\x2F([0-9][0-9])\x2F([0-9][0-9][0-9][0-9])/;validation.date_mmddyyyy_dash=new RegExp("([0-9][0-9])-([0-9][0-9])-([0-9][0-9][0-9][0-9])");validation.date_mmddyy_slash=/([0-9][0-9])\x2F([0-9][0-9])\x2F([0-9][0-9])/;validation.date_mmddyy_dash=new RegExp("([0-9][0-9])-([0-9][0-9])-([0-9][0-9])");validation.config_regex_formatpattern=new RegExp("([-]?[\\w]*)[ ]*,[ ]*([-]?[\\w]*)");validation.config_typepattern=new RegExp("([\\w]+)([\\(](.*)[\\)])?");validation.config_formatpattern=new RegExp("([-]?[^\\s,]*)[ ]*,[ ]*([-]?[^\\s,]*)");validation.isWhiteSpace=function(s){if(s==' '||s=='\t'||s=='\n'||s=='\r'||s=='\b'||s=='\f')
return true;else
return false;};validation.ltrim=function(s){if(s=='')
return s;var n=s.length;for(var i=0;i<n;i++)
{if(validation.isWhiteSpace(s.charAt(i))==false)
return s.substr(i);}
return'';};validation.rtrim=function(s){if(s=='')
return s;var n=s.length;for(var i=n;i>0;i--)
{if(validation.isWhiteSpace(s.charAt(i-1))==false)
return s.substr(0,i);}
return'';};validation.trim=function(s){return validation.ltrim(validation.rtrim(s));};validation.isInteger=function(s){var re=validation.integerpattern;var parse=re.exec(s);if(parse==null)
return false;else if(parse[0]==s)
return true;else
return false;};validation.checkNumber=function(n,lbound,ubound){var nn=new Number(n);if(lbound!=""&&ubound!="")
{lbound=new Number(lbound);ubound=new Number(ubound);if(nn<lbound||nn>ubound)
return false;}
else if(lbound==""&&ubound!="")
{ubound=new Number(ubound);if(nn>ubound)
return false;}
if(lbound!=""&&ubound=="")
{lbound=new Number(lbound);if(nn<lbound)
return false;}
return true;};validation.checkString=function(s,lbound,ubound){var nn=s.length;if(lbound!=""&&ubound!="")
{lbound=new Number(lbound);ubound=new Number(ubound);if(nn<lbound||nn>ubound)
return false;}
else if(lbound==""&&ubound!="")
{ubound=new Number(ubound);if(nn>ubound)
return false;}
if(lbound!=""&&ubound=="")
{lbound=new Number(lbound);if(nn<lbound)
return false;}
return true;};validation.isDate=function(s,dateFormat){var re;if(dateFormat=="mm/dd/yyyy")
{re=validation.date_mmddyyyy_slash;}
else if(dateFormat=="mm-dd-yyyy")
{re=validation.date_mmddyyyy_dash;}
else if(dateFormat=="mm/dd/yy")
{re=validation.date_mmddyy_slash;}
else if(dateFormat=="mm-dd-yy")
{re=validation.date_mmddyy_dash;}
var s=validation.trim(s);var parse=re.exec(s);if(parse==null||parse[0]!=s)
{return false;}
else
return true;};validation.isReal=function(s){var re=validation.realpattern;var parse=re.exec(s);if(parse==null)
return false;else if(parse[0]==s)
return true;else
return false;};validation.isNumeric=function(s){return validation.isInteger(s)||validation.isReal(s);};validation.isEmail=function(s){var re=validation.emailpattern;var parse=re.exec(s);if(parse==null)
return false;else
return true;};validation.isIgnored=function(htmlform){return htmlform.elements['btnhit'].value&&miwt.$(htmlform.elements['btnhit'].value+'_ignore_validation');};validation.validateForm=function(htmlform){if(validation.isIgnored(htmlform))
return true;for(var i=0;i<validation.fields.length;i++)
{if(validation.fields[i]==null||htmlform.elements[validation.fields[i].element.name]==null)
{var new_fv_fields=[];for(var j=0;j<validation.fields.length;j++)
{if(validation.fields[j]!=null&&htmlform.elements[validation.fields[j].element.name]!=null)
{new_fv_fields.push(validation.fields[j]);}}
validation.fields=new_fv_fields;return validation.validateForm(htmlform);}
if(validation.fields[i].required=="1")
{var e=validation.fields[i].element;if(e.type=="text"||e.type=="textarea")
{if(validation.trim(e.value).length==0)
{validation.inValidation=true;alert(validation.fields[i].message);e.focus();e.select();validation.inValidation=false;return false;}}
else if(e.type=="select-one"||e.type=="select-multiple")
{if(e.selectedIndex== -1||e.options[e.selectedIndex].value=="")
{validation.inValidation=true;alert(validation.fields[i].message);e.focus();validation.inValidation=false;return false;}}
else if(e.type=="radio"||e.type=="checkbox")
{var radios=htmlform.elements[e.name];var n=0;for(var k=0;k<radios.length;k++)
{if(radios[k].checked)
{n++;break;}}
if(n==0)
{validation.inValidation=true;alert(validation.fields[i].message);validation.inValidation=false;return false;}}}
else
{if(!validation.isFieldValid(validation.fields[i]))
{var e=validation.fields[i].element;if(!e.validation_called)
{e.focus();e.blur();}
return false;}}
if(validation.fields[i].type=="doubleentry")
{var value=validation.fields[i].element.value;var compareField=miwt.$(validation.fields[i].format);if(compareField!=null)
{var value2=compareField.value;if(value!=value2)
{validation.inValidation=true;alert(validation.fields[i].message);validation.inValidation=false;return false;}}}}
return true;};validation.badValidation=function(){if(validation.failedValidationInfo!=null){alert(validation.failedValidationInfo.message);validation.failedValidationInfo.element.focus();validation.failedValidationInfo.element.select();validation.failedValidationInfo=null;}};validation.isFieldValid=function(fieldinfo){var valid=true;var value=fieldinfo.element.value;if(validation.trim(value).length>0)
{if(fieldinfo.type=="int")
{valid=(validation.isInteger(value)&&validation.checkNumber(value,fieldinfo.lbound,fieldinfo.ubound));}
else if(fieldinfo.type=="num")
{valid=(validation.isNumeric(value)&&validation.checkNumber(value,fieldinfo.lbound,fieldinfo.ubound));}
else if(fieldinfo.type=="float")
{valid=(validation.isReal(value)&&validation.checkNumber(value,fieldinfo.lbound,fieldinfo.ubound));}
else if(fieldinfo.type=="text")
{valid=validation.checkString(value,fieldinfo.lbound,fieldinfo.ubound);}
else if(fieldinfo.type=="email")
{valid=validation.isEmail(value);}
else if(fieldinfo.type=="date")
{var dateFormat=(fieldinfo.format=="")?"mm/dd/yyyy":fieldinfo.format;valid=validation.isDate(value,dateFormat);}
else if(fieldinfo.type=="regexp")
{var re=new RegExp(fieldinfo.format);var s=validation.trim(value);var parse=re.exec(s);valid=(parse!=null&&parse[0]==s);}}
return valid;};validation.onBlurHandler=function(evt){if(validation.inValidation)
return true;var target=miwt.element(evt);if(validation.isIgnored(target.form))
return true;validation.inValidation=true;var fieldinfo=validation.getFieldInfo(target);var valid=true;if(fieldinfo!=null)
{valid=validation.isFieldValid(fieldinfo);}
target.validation_called=true;if(valid)
{validation.inValidation=false;return true;}
else
{validation.failedValidationInfo=fieldinfo;setTimeout(validation.badValidation,100,"JavaScript");validation.inValidation=false;Event.stop(evt);return false;}};validation.getFieldInfo=function(field){for(var i=0;i<validation.fields.length;i++)
{if(validation.fields[i].element.name==field.name)
return validation.fields[i];}
return null;};validation.setHandler=function(fieldinfo){validation.setEventHandler(fieldinfo.element,fieldinfo);};validation.setEventHandler=function(field,fieldinfo){if(field.type=="text"||field.type=="textarea")
{miwt.observe(field,"blur",validation.onBlurHandler,false);}};validation.fieldInfo=function(element,message,type,required){this.element=element;this.message=message;this.required=required;this.type=type.toLowerCase();this.format="";this.lbound="";this.ubound="";var parse=validation.config_typepattern.exec(type);if(parse!=null)
{this.type=parse[1];if(parse.length==4)
this.format=parse[3];parse=validation.config_formatpattern.exec(this.format);if(parse!=null)
{this.lbound=parse[1];this.ubound=parse[2];}}};validation.FormValidation_Register=function(element,message,type,required){var f=new validation.fieldInfo(element,message,type,required);validation.setHandler(f);for(var i=0;i<validation.fields.length;i++)
{if(validation.fields[i].element.name==element.name)
{validation.fields[i]=f;return;}}
validation.fields.push(f);};validation.fields=[];validation.inValidation=false;miwt.AddSetupHandler(['form'],function(tag,node){if(miwt.hasClassName(node,'miwt_form'))node.RegisterOnSubmitHandler(node,validation.validateForm);});miwt.AddSetupHandler(['dfn'],function(tag,node){if(tag!='dfn'||!/\bmiwt_validation\b/.exec(node.className))
return;var match=/(\S+)_val/.exec(node.id);if(!match)
return;var type=node.firstChild.data;var msgnode=miwt.$(node.id+"_message");var reqnode=miwt.$(node.id+"_required");if(msgnode&&msgnode.firstChild&&reqnode&&reqnode.firstChild){var msg=msgnode.firstChild.data;var req=reqnode.firstChild.data;var el=miwt.$(match[1]);if(el)
validation.FormValidation_Register(el,msg,type,req);else
miwt.error("Could not find element "+match[1]+" for validation");}});}
if(typeof miwttable=='undefined'){var miwttable={};miwt.AddSetupHandler(['table'],function(tag,node){if(tag!='table')
return;var headers=miwt.$$("thead th",node),i=0,n;if(miwt.$("columnmoving_"+node.id)){for(i=0;n=headers[i];i++){if(miwt.hasClassName(n,'control'))continue;n.id="columnmove_"+node.id+"_th_"+i;miwt.addClassName(n,"dnd_source");miwtdnd.setupDragSource(n);miwt.addClassName(n,"dnd_target");miwtdnd.setupDropTarget(n);}}});}
if(typeof miwtdnd=='undefined'){var miwtdnd={};miwtdnd.active=false;miwtdnd.dragSource=null;miwtdnd.dropTarget=null;miwtdnd.feedbackElement=null;miwtdnd.dropactiveset=false;miwtdnd.window_mousemove=function(evt){if(!miwtdnd.dragSource)
return;var p=miwt.pointer(evt);if(!miwtdnd.active){if(Math.abs(p.x -miwtdnd.startX)>2||Math.abs(p.y -miwtdnd.startY)>2){miwt.stop(evt);miwtdnd.active=true;if(miwtdnd.menu){miwt.remove(miwtdnd.menu);miwtdnd.menu=null;}
miwt.addClassName(document.body,'dnd_active');var ua=navigator.userAgent,ie6=(miwt.B.IE&&ua.indexOf('MSIE 6')> -1),ie7=(miwt.B.IE&&ua.indexOf('MSIE 7')> -1);miwtdnd.feedbackElement=miwtdnd.dragSource.cloneNode(true);if(ie6||ie7){if(miwtdnd.feedbackElement.tagName.toLowerCase()=='td'){miwtdnd.feedbackElement=miwt.wrap(miwtdnd.feedbackElement,'tr');miwtdnd.feedbackElement.style.className=miwtdnd.dragSource.style.className;miwtdnd.feedbackElement=miwt.wrap(miwtdnd.feedbackElement,'table');miwtdnd.feedbackElement.style.className=miwtdnd.dragSource.parentNode.style.className;}
else if(miwtdnd.feedbackElement.tagName.toLowerCase()=='tr'){miwtdnd.feedbackElement=miwt.wrap(miwtdnd.feedbackElement,'table');miwtdnd.feedbackElement.style.className=miwtdnd.dragSource.style.className;}
miwtdnd.feedbackElement.style.position='absolute';}else{miwtdnd.feedbackElement.style.position='fixed';}
miwtdnd.feedbackElement.style.display='block';miwtdnd.feedbackElement.style.margin='0px';miwtdnd.feedbackElement.style.padding='0px';miwtdnd.feedbackElement.style.zIndex='999999';miwtdnd.feedbackElement.style.right='';miwtdnd.feedbackElement.style.bottom='';{miwtdnd.feedbackElement.removeAttribute("id");var node,nodes=miwtdnd.feedbackElement.getElementsByTagName('*');for(var i=0;node=nodes.item(i); ++i){node.removeAttribute("id");}}
miwt.removeClassName(miwtdnd.feedbackElement,"dnd_target");miwt.removeClassName(miwtdnd.feedbackElement,"dnd_source");miwt.addClassName(miwtdnd.feedbackElement,"dnd_feedback");miwtdnd.feedbackOffsetLeft=5;miwtdnd.feedbackOffsetTop=5;miwtdnd.feedbackElement.style.width=miwtdnd.dragSource.offsetWidth+"px";miwtdnd.feedbackElement.style.height=miwtdnd.dragSource.offsetHeight+"px";if(ie6||ie7)
document.body.appendChild(miwtdnd.feedbackElement);else
miwtdnd.dragSource.parentNode.appendChild(miwtdnd.feedbackElement);miwt.observe(document,"keydown",miwtdnd.window_escape,true);}}
else{miwt.stop(evt);}
if(miwtdnd.feedbackElement){var scrollOffsets;if(miwtdnd.feedbackElement.style.position=='absolute'){scrollOffsets={left:0,top:0};}
else{scrollOffsets=miwt.cumulativeOffset(document.body,true);}
miwtdnd.feedbackElement.style.left=(p.x-scrollOffsets.left+miwtdnd.feedbackOffsetLeft)+"px";miwtdnd.feedbackElement.style.top=(p.y-scrollOffsets.top+miwtdnd.feedbackOffsetTop)+"px";}
var i,e,dropEl=miwt.element(evt);if(dropEl==miwtdnd.feedbackElement)
return;while(dropEl&&!miwt.hasClassName(dropEl,"dnd_target"))
dropEl=dropEl.parentNode;if(dropEl&&!miwtdnd.isCompatible(miwtdnd.dragSource,dropEl)){miwt.info("Drop "+dropEl +" not compatible");dropEl=null;}
var addStyles=['dnd_target_active'];var removeStyles=[];if(dropEl&&dropEl.locations&&dropEl.locationRows&&dropEl.locationColumns){var targetOffset=miwt.cumulativeOffset(dropEl);var targetDim=miwt.getDimensions(dropEl);var row=Math.floor((p.y -targetOffset.top)/Math.max(1,targetDim.height/dropEl.locationRows));var col=Math.floor((p.x -targetOffset.left)/Math.max(1,targetDim.width/dropEl.locationColumns));if(row<0)
row=0;else if(row>=dropEl.locationRows)
row=dropEl.locationRows-1;if(col<0)
col=0;else if(col>=dropEl.locationColumns)
col=dropEl.locationColumns-1;var dropClass=dropEl.locations[row+","+col];if(dropClass){addStyles.push(dropClass);for(i=0;e=dropEl.allClassNames[i];i++)
if(dropClass!=e)removeStyles.push(e);}else
removeStyles=dropEl.allClassNames;}
if(miwtdnd.dropactiveset){var el,list=miwt.$$(".dnd_target_active");while(el=list.pop()){if(el!=dropEl)
el.className=el.className.replace(/\bdnd_target_active\S*\b/g,' ').trim();}}
miwtdnd.dropactiveset=false;if(dropEl&&dropEl.className){for(i=0;e=addStyles[i];i++)
miwt.addClassName(dropEl,e);for(i=0;e=removeStyles[i];i++)
miwt.removeClassName(dropEl,e);miwtdnd.dropactiveset=true;}};miwtdnd.window_mouseup=function(evt){miwt.stopObserving(document,"mousemove",miwtdnd.window_mousemove,true);miwt.stopObserving(document,"mouseup",miwtdnd.window_mouseup,true);miwt.removeClassName(document.body,'dnd_active');window.setTimeout(miwtdnd.stopOperation,10);};miwtdnd.window_escape=function(evt){var keycode=evt.keyCode||evt.which;if(keycode!=27)
return;miwt.stop(evt);miwtdnd.stopOperation();if(miwtdnd.menu){miwtdnd.menu.form.ResetTransient();miwtdnd.menu.parentNode.removeChild(miwtdnd.menu);miwtdnd.menu=null;}
miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);};miwtdnd.stopOperation=function(){if(miwtdnd.dropOpPending)
return;miwtdnd.active=false;miwtdnd.dragSource=null;miwtdnd.dropTarget=null;miwtdnd.startX=null;miwtdnd.startY=null;if(miwtdnd.feedbackElement){miwt.remove(miwtdnd.feedbackElement);miwtdnd.feedbackElement=null;}
if(miwtdnd.dropactiveset){var el,list=miwt.$$(".dnd_target_active");while(el=list.pop())
el.className=el.className.replace(/\bdnd_target_active\S*\b/g,' ').trim();miwtdnd.dropactiveset=false;}};miwtdnd.dragSource_mousedown=function(evt,drag){var src=miwt.element(evt);if(src&&(tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;miwtdnd.dragSource=drag||src;var p=miwt.pointer(evt);miwtdnd.startX=p.x;miwtdnd.startY=p.y;miwt.stop(evt);miwt.observe(document,"mousemove",miwtdnd.window_mousemove,true);miwt.observe(document,"mouseup",miwtdnd.window_mouseup,true);};miwtdnd.setupDragSource=function(node,contentTypes){var drag=node;drag.provides=contentTypes||[];miwt.addClassName(drag,"dnd_source");miwt.observe(node,"mousedown",function(evt){miwtdnd.dragSource_mousedown(evt||window.event,drag)},true);};miwtdnd.dropTarget_mouseup=function(evt,drop){if(!miwtdnd.active)
return;var eventel=miwt.element(evt);while(eventel&&!miwt.hasClassName(eventel,"dnd_target"))
eventel=eventel.parentNode;drop=eventel||drop;if(!miwtdnd.isCompatible(miwtdnd.dragSource,drop))
return;if(miwtdnd.dropTarget){var el=miwtdnd.dropTarget;while(el){if(drop==el){return;}
el=el.parentNode;}}
miwtdnd.dropTarget=drop;if(miwtdnd.dropTimer){clearTimeout(miwtdnd.dropTimer);miwtdnd.dropTimer=null;}
miwtdnd.dropOpPending=true;var form=miwt.findElement(evt,'form');var p=miwt.pointer(evt);miwtdnd.dropTimer=setTimeout(function(){miwtdnd.handleDropTargetActivate(drop,form,p.x,p.y);},10);};miwtdnd.handleDropTargetActivate=function(drop,form,x,y){miwtdnd.active=false;if(miwtdnd.dropTimer){clearTimeout(miwtdnd.dropTimer);miwtdnd.dropTimer=null;}
if(form){form.elements['dnd_source'].value=miwtdnd.dragSource.id;form.elements['dnd_target'].value=miwtdnd.dropTarget.id;var left,top,dropDim,dropOffset,scrollOffset,docOffset;docOffset=miwt.cumulativeOffset(document.body,true);scrollOffset=miwt.cumulativeOffset(miwtdnd.dropTarget,true);dropOffset=miwt.cumulativeOffset(miwtdnd.dropTarget);dropDim=miwt.getDimensions(miwtdnd.dropTarget);left=dropOffset.left -(scrollOffset.left -docOffset.left);top=dropOffset.top -(scrollOffset.top -docOffset.top);form.elements['dnd_location'].value="("+left+","+top+","+dropDim.width+","+dropDim.height+"),("+x+","+y+")";miwtdnd.dropOpPending=false;miwtdnd.stopOperation();if(drop.hasOptions){miwtdnd.menu=document.createElement("div");miwtdnd.menu.form=form;miwtdnd.menu.className="dropoptions";miwtdnd.menu.style.position='absolute';miwtdnd.menu.style.top=y+"px";miwtdnd.menu.style.left=x+"px";document.getElementsByTagName("body")[0].appendChild(miwtdnd.menu);miwtdnd.menu.innerHTML='<div class="loading">Loading...</div>';new Ajax.Request(miwt.$$("dfn.ajax_uri",form).pop().firstChild.data,{method:'get',parameters:{ajax:'true',alt:'dropoptions',dnd_source:form.elements['dnd_source'].value,dnd_target:form.elements['dnd_target'].value},onSuccess:function(transport){try{var tmpnode=document.createElement("div");tmpnode.innerHTML=transport.responseText;miwtdnd.menu.removeChild(miwtdnd.menu.firstChild);miwtdnd.menu.appendChild(tmpnode.firstChild);var el,list,count=0;list=miwt.$$("a",miwtdnd.menu);while(el=list.pop()){count++;el.dndoption=el.href.substring(el.href.indexOf("#")+1);el.href='#';el.onclick=function(evt){miwt.stop(evt);miwtdnd.menu.parentNode.removeChild(miwtdnd.menu);miwtdnd.menu=null;form.elements['dnd_option'].value=this.dndoption;miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);try{this.onclick=null;}catch(e){}
form.MIWTSubmit();};}
if(count==0)
{miwtdnd.menu.parentNode.removeChild(miwtdnd.menu);miwtdnd.menu=null;miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);form.MIWTSubmit();}}
catch(e){miwt.info("drop options",e);}},onFailure:function(){miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);form.MIWTSubmit();},onException:function(){miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);form.MIWTSubmit();}});}
else{miwt.stopObserving(document,"keydown",miwtdnd.window_escape,true);form.MIWTSubmit();}}else{miwtdnd.dropOpPending=false;miwtdnd.stopOperation();}};miwtdnd.setupDropTarget=function(node,hasOptions,contentTypes,locations){var drop=node;drop.accepts=contentTypes||[];drop.hasOptions=!!hasOptions;miwt.addClassName(drop,"dnd_target");drop.locations=[];drop.allClassNames=[];drop.locationRows=1;drop.locationColumns=1;if(locations&&locations.length>0){var dim=/(\d+)X(\d+)/.exec(locations[0]);drop.locationRows=dim[1];drop.locationColumns=dim[2];for(var i=1,cells,className;(cells=locations[i++])&&(className=locations[i++]);){className="dnd_target_active_" +className;drop.allClassNames.push(className);var values=cells.match(/\d+/g);for(var r,c;(r=values.shift())&&(c=values.shift());){drop.locations[r+","+c]=className;}}}
miwt.observe(node,"mouseup",function(evt){miwtdnd.dropTarget_mouseup(evt,drop)},true);};miwtdnd.isCompatible=function(dragSource,dropTarget){if(dragSource==null)
return false;if(dropTarget==null)
return false;if(dragSource.provides.length==0)
return true;if(dropTarget.accepts.length==0)
return true;for(var i=0,a;a=dropTarget.accepts[i];i++){for(var j=0,b;b=dragSource.provides[j];j++)
if(a==b)return true;}
return false;};miwt.AddSetupHandler(['dfn'],function(tag,node)
{if(/\bdnd_source_def\b/.exec(node.className)){var a=miwt.words(node.firstChild.data);miwtdnd.setupDragSource(miwt.$(a.shift()),a);}
if(/\bdnd_target_def\b/.exec(node.className)){var a=miwt.words(node.firstChild.data);var drop=miwt.$(a.shift());var hasOptions=!/nodropoptions/.test(a.shift());var contentTypes=[];var locations=[];for(var el;el=a.shift();){if(locations.length>0||/\d+X\d+/.test(el))
locations.push(el);else
contentTypes.push(el);}
miwtdnd.setupDropTarget(drop,hasOptions,contentTypes,locations);}});}
if(typeof miwtcalendar=='undefined'){miwtcalendar={};miwt.calendarClearHandler=function(evt){var node=miwt.element(evt).node;node.value='';if(/\bmiwt_submit\b/.exec(node.className))
miwt.calendarUpdateSubmit(node);else
miwt.calendarUpdateNoSubmit(node);};miwt.calendarUpdateSubmit=function(node){if(this&&this.target){node=miwt.$(this.target);}
if(!node)return;var form=node.form;form.elements['btnhit'].value=node.name||node.id;node.hinttexton=false;node.style.color=null;form.MIWTSubmit();};miwt.calendarUpdateNoSubmit=function(node){if(this&&this.target){node=miwt.$(this.target);}
if(!node)return;node.hinttexton=false;node.style.color=null;};miwt.AddSetupHandler(['input'],function(tag,node){if(!/\bmiwt_calendar\b/.exec(node.className))
return;var submit=/\bmiwt_submit\b/.exec(node.className);var form=node.form;var yearstart=miwt.$(node.id+'_yearstart');var yearend=miwt.$(node.id+'_yearend');var yearrange=null;if(yearstart&&yearend)
yearrange=[parseInt(yearstart.firstChild.data),parseInt(yearend.firstChild.data)];else
yearrange=[1900,2999];var funcArg={target:node.id},updateFunction=(submit)?function(){miwt.calendarUpdateSubmit.call(funcArg);}:function(){miwt.calendarUpdateNoSubmit.call(funcArg);};var clearbutton=miwt.$(node.id+"_clear");if(clearbutton){clearbutton.node=node;miwt.observe(clearbutton,"click",miwt.calendarClearHandler);}
try
{var openbutton=miwt.$(node.id+"_open");if(openbutton){Calendar.setup({inputField:node.id,button:openbutton,ifFormat:miwt.$(node.id+'_format').firstChild.data,range:yearrange,showOthers:true,showsTime:(miwt.$(node.id+'_time')!=null),onUpdate:updateFunction,timeFormat:"12",cache:true});}}
catch(e){miwt.error("Cannot init calendar, check your classpath",e);}});}
if(typeof miwt.list=='undefined'){miwt.list={};miwt.list.inputclick=function(evt){var input=miwt.element(evt),p=input.parentNode,el,list;if(input.checked){if(input.type=='radio'){list=miwt.$$(".checked",p.parentNode);while(el=list.pop())
miwt.removeClassName(el,"checked");}
miwt.addClassName(p,"checked");}else{miwt.removeClassName(p,"checked");}};miwt.list.elementclick=function(evt){var el=miwt.element(evt),input=miwt.$$("input.selector",el).pop();if(!input)return;input.click();};miwt.AddSetupHandler(['input'],function ListSetupFn(tag,node){var el=node.parentNode,richlist=el.parentNode;if(!/\belement\b/.exec(el.className))
return;if(!/\brichlist\b/.exec(richlist.className))
return;miwt.observe(node,'click',miwt.list.inputclick);miwt.observe(el,'click',miwt.list.elementclick);});}
if(document.addEventListener)
document.addEventListener("DOMContentLoaded",miwt.onLoad,false);miwt.observe(window,'load',miwt.onLoad);if(document.readyState=='complete'||(window.i2rd&&window.i2rd.rdy))
miwt.onLoad();
/*  JS Resource: cms/js/bean/MenuBean.js  */

if(typeof MB=='undefined'){var MB={};}
MB.array=function(nl){var i,l=[];for(i=0;i<nl.length;i++)l.push(nl.item(i));return l;};MB.lastEventTime=new Date();MB.addClassName=function(el,cn){if(!MB.hasClassName(el,cn))
el.className=((el.className||'') +' ' +cn);};MB.err=function(m,e){if(typeof log4js!='undefined')log4js.logger.error(m,e);else if(typeof console!='undefined')console.log(m);};MB.data=window.localStorage;MB.getData=function(key){if(!!MB.data)return MB.data[key];else{var i=0,c,cn=key+"=",ca=document.cookie.split(';');for(;c=ca[i];i++){while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(cn)==0)return c.substring(cn.length,c.length);}
return null;}};MB.setData=function(key,val){if(!!MB.data)MB.data[key]=val;else{var d=new Date();d.setDate(d.getDate()+5);document.cookie=key +"=" +val +"; expires=" +d.toUTCString() +"; path=/";}};MB.removeClassName=function(el,cn){if(!MB.hasClassName(el,cn))return;el.className=(el.className||'').replace(RegExp("(^|\\s+)" +cn +"(\\s+|$)",'g'),' ');};MB.hasClassName=function(el,cn){var cur=(el.className||'');return cur==cn||(RegExp('\\b'+cn+'\\b').test(cur));};MB.getTarget=function(evt){evt=evt||window.event;var el=(evt.srcElement||evt.target);while(el&&el.nodeName.toLowerCase()!="li")
el=el.parentNode;return el;};MB.getTop=function(li){var parent=li;while(parent&&parent.className!='menubean'&&parent.nodeName.toLowerCase()!='div'){parent=parent.parentNode;}
if(parent==null)
throw new Error("Unable to find top of menu");return parent;};MB.GetChildUL=function(li){if(!MB.hasClassName(li,'mi_parent'))return null;var h,ul,hb,t;var children=li.getElementsByTagName("ul");if(!children||children.length==0){children=li.getElementsByTagName("UL");}
for(h=0,hb=children.length;(t=children[h]);h++){if(t.parentNode===li){if(ul){MB.err("Invalid DOM structure for menu. li.id = "+li.id+", children.length = " +(children==null?"null":children.length));break;}else{ul=t;}}}
return ul;};MB.SetInactiveClass=function(el){var elements=el.getElementsByTagName("li");if(!elements||elements.length==0){try{elements=el.getElementsByTagName("LI");}catch(e){}}
var liElements=MB.array(elements);var node=null;while((node=liElements.pop())){MB.removeClassName(node,'mi_active');MB.addClassName(node,'mi_inactive');}};MB.SetActive=function(li,activate){if(!MB.hasClassName(li,'over')){MB.addClassName(li,'over');var ul=MB.GetChildUL(li);if(ul&&ul.className.match("_persistent")){var nodelist=MB.GetOpenState(li);var entry=new RegExp("\\b" +li.id +"\\b");if(!entry.test(nodelist)){nodelist=(nodelist +"," +li.id);}
MB.SetOpenState(li,nodelist)}}
if(activate){var top=MB.getTop(li);MB.SetInactiveClass(top);if(!MB.hasClassName(li,'mi_active')){MB.removeClassName(li,'mi_inactive');MB.addClassName(li,'mi_active');}}
var ps=li.previousSibling,ns=li.nextSibling;if(ps&&!MB.hasClassName(ps,'prev_sibling')){MB.addClassName(ps,'prev_sibling');}
if(ns&&!MB.hasClassName(ns,'next_sibling')){MB.addClassName(ns,'next_sibling');}};MB.SetInActive=function(li){if(!MB.hasClassName(li,'over'))
return;MB.removeClassName(li,'over');var ul=MB.GetChildUL(li);if(ul&&ul.className.match("_persistent")){var nodelist=MB.GetOpenState(li);nodelist=nodelist.replace(new RegExp("," +li.id +"\\b"),"");MB.SetOpenState(li,nodelist);}
var ps=li.previousSibling,ns=li.nextSibling;if(ps){MB.removeClassName(ps,'prev_sibling');}
if(ns){MB.removeClassName(ns,'next_sibling');}};MB.GetOpenState=function(li){return MB.getData(MB.getTop(li).id +"-CMO")||"";};MB.SetOpenState=function(li,nodelist){MB.setData(MB.getTop(li).id +"-CMO",nodelist);};MB.MenuBeanInit=function(div){if(typeof div=='string')div=document.getElementById(div);if(!!div.mbinited)return;div.mbinited=true;var nodelist=MB.getData(div.id +"-CMO")||"";var item=null;var elements=div.getElementsByTagName("li");var liElements=MB.array(elements);while((item=liElements.pop())){var pn=item.parentNode;if(pn&&pn.nodeName.toLowerCase()=="ul"){pn=pn.parentNode;if(pn&&pn.nodeName.toLowerCase()=="li"&&!MB.hasClassName(pn,'mi_parent')){MB.addClassName(pn,'mi_parent');}}
item.onclick=function(evt){var now=new Date();if((now -MB.lastEventTime)<200)return;MB.lastEventTime=new Date();var target=MB.getTarget(evt);if(MB.hasClassName(target,'over')){MB.SetInActive(target,true);}
else{MB.SetActive(target);}};if(!item.parentNode.className.match(/_persistent/)){item.onmouseover=function(evt){try{MB.SetActive(this);}catch(e){}};item.onmouseout=function(evt){try{MB.SetInActive(this);}catch(e){}};}else{var tmpId="," +item.id;if(nodelist.indexOf(tmpId)== -1){MB.SetInActive(item);}}}
if(document.getElementById){var liList=nodelist.split(",");for(var h=0;h<liList.length;h++){var id=liList[h];if(id){var li=document.getElementById(id);if(li){MB.SetActive(li);}}}}};MB.scan=function(start){if(typeof start=='string')start=document.getElementById(start);var m,div,s=(start||document),i,ib;if(document.evalute){var result=document.evaluate("//div[contains(@class,'menubean')]",s,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(i=0,ib=result.snapshotLength;i<ib;i++){m[m.length]=result.snapshotItem(i);}}else{m=s.getElementsByTagName("div");}
for(i=0,ib=m.length;i<ib;i++){div=m[i];if((div.className||'').match(/menubean/))
MB.MenuBeanInit(div);}};
if(typeof cms_js_includes != 'undefined') {
 cms.addJSInclude('/resources/dyn/docroot/lib/miwt/miwt-lib.js/_fn/miwt-lib.js');
 cms.addJSInclude('/resources/dyn/docroot/cms/js/bean/MenuBean.js/_fn/MenuBean.js');
}

