Other recent changes had broken the Rico calendar on IE6-8. This update fixes all...
[infodrom/rico3] / ricoClient / js / rico_min.js
1 Rico.applyShadow=function(b,a){if(typeof a=="undefined"){a=true
2 }if(a){Rico.addClass(b,"ricoShadow")
3 }return b
4 };
5 Rico._OpenPopupList=[];
6 Rico._RemoveOpenPopup=function(a){if(a.openIndex>=0&&a.openIndex<Rico._OpenPopupList.length){Rico._OpenPopupList.splice(a.openIndex,1)
7 }a.openIndex=-1
8 };
9 Rico._AddOpenPopup=function(a){a.openIndex=Rico._OpenPopupList.push(a)-1
10 };
11 Rico._checkEscKey=function(b){if(Rico.eventKey(b)!=27){return true
12 }while(Rico._OpenPopupList.length>0){var a=Rico._OpenPopupList.pop();
13 if(a&&a.visible()){a.openIndex=-1;
14 Rico.eventStop(b);
15 a.closeFunc();
16 return false
17 }}return true
18 };
19 Rico.eventBind(document,"keyup",Rico.eventHandle(Rico,"_checkEscKey"));
20 Rico.Popup=function(b,a){this.initialize(b,a)
21 };
22 Rico.Popup.prototype={initialize:function(b,a){this.options={hideOnClick:false,ignoreClicks:false,position:"absolute",shadow:true,zIndex:2,canDrag:false,dragElement:false,closeFunc:false};
23 this.openIndex=-1;
24 if(b){this.setDiv(b,a)
25 }},createContainer:function(a){this.setDiv(document.createElement("div"),a);
26 if(a&&a.parent){a.parent.appendChild(this.container)
27 }else{document.getElementsByTagName("body")[0].appendChild(this.container)
28 }},setDiv:function(c,b){Rico.extend(this.options,b||{});
29 this.container=Rico.$(c);
30 if(this.options.position=="auto"){this.position=Rico.getStyle(this.container,"position").toLowerCase()
31 }else{this.position=this.container.style.position=this.options.position
32 }this.content=document.createElement("div");
33 while(this.container.firstChild){this.content.appendChild(this.container.firstChild)
34 }this.container.appendChild(this.content);
35 this.content.className="RicoPopupContent";
36 this.content.style.position="relative";
37 if(this.position!="absolute"){return
38 }if(this.options.closeFunc){this.closeFunc=this.options.closeFunc
39 }else{var a=this;
40 this.closeFunc=function(){a.closePopup()
41 }
42 }this.container.style.top="0px";
43 this.container.style.left="0px";
44 this.container.style.display="none";
45 if(this.options.zIndex>=0){this.container.style.zIndex=this.options.zIndex
46 }this.content.style.zIndex=2;
47 if(Rico.isIE&&Rico.ieVersion<7){this.ifr=document.createElement("iframe");
48 this.ifr.className="RicoShim";
49 this.ifr.frameBorder=0;
50 this.ifr.src="javascript:'';";
51 this.container.appendChild(this.ifr)
52 }Rico.applyShadow(this.container,this.options.shadow);
53 if(this.options.hideOnClick){Rico.eventBind(document,"click",Rico.eventHandle(this,"_docClick"))
54 }this.dragEnabled=false;
55 this.mousedownHandler=Rico.eventHandle(this,"_startDrag");
56 this.dragHandler=Rico.eventHandle(this,"_drag");
57 this.dropHandler=Rico.eventHandle(this,"_endDrag");
58 if(this.options.canDrag){this.enableDragging()
59 }if(this.options.ignoreClicks||this.options.canDrag){this.ignoreClicks()
60 }},clearContent:function(){this.content.innerHTML=""
61 },setContent:function(a){this.content.innerHTML=a
62 },enableDragging:function(){if(!this.dragEnabled&&this.options.dragElement){Rico.eventBind(this.options.dragElement,"mousedown",this.mousedownHandler);
63 this.dragEnabled=true
64 }return this.dragEnabled
65 },disableDragging:function(){if(!this.dragEnabled){return
66 }Rico.eventUnbind(this.options.dragElement,"mousedown",this.mousedownHandler);
67 this.dragEnabled=false
68 },setZ:function(a){this.container.style.zIndex=a
69 },ignoreClicks:function(){Rico.eventBind(this.container,"click",Rico.eventHandle(this,"_ignoreClick"))
70 },_ignoreClick:function(a){if(a.stopPropagation){a.stopPropagation()
71 }else{a.cancelBubble=true
72 }return true
73 },_docClick:function(a){this.closeFunc();
74 return true
75 },move:function(b,a){if(typeof b=="number"){this.container.style.left=b+"px"
76 }if(typeof a=="number"){this.container.style.top=a+"px"
77 }},_startDrag:function(b){var a=Rico.eventElement(b);
78 this.container.style.cursor="move";
79 this.lastMouse=Rico.eventClient(b);
80 Rico.eventBind(document,"mousemove",this.dragHandler);
81 Rico.eventBind(document,"mouseup",this.dropHandler);
82 Rico.eventStop(b)
83 },_drag:function(d){var b=Rico.eventClient(d);
84 var c=parseInt(this.container.style.left,10)+b.x-this.lastMouse.x;
85 var a=parseInt(this.container.style.top,10)+b.y-this.lastMouse.y;
86 this.move(c,a);
87 this.lastMouse=b;
88 Rico.eventStop(d)
89 },_endDrag:function(){this.container.style.cursor="";
90 Rico.eventUnbind(document,"mousemove",this.dragHandler);
91 Rico.eventUnbind(document,"mouseup",this.dropHandler)
92 },openPopup:function(b,a){if(typeof b=="number"){this.container.style.left=b+"px"
93 }if(typeof a=="number"){this.container.style.top=a+"px"
94 }this.container.style.display="";
95 if(this.container.id){Rico.log("openPopup "+this.container.id+" at "+b+","+a)
96 }Rico._AddOpenPopup(this)
97 },centerPopup:function(){this.openPopup();
98 var d=this.container.offsetWidth;
99 var c=this.container.offsetHeight;
100 var a=this.container.parentNode.offsetWidth;
101 var b=this.container.parentNode.offsetHeight;
102 this.move(parseInt(Math.max((a-d)/2,0),10),parseInt(Math.max((b-c)/2,0),10))
103 },visible:function(){return Rico.visible(this.container)
104 },closePopup:function(){Rico._RemoveOpenPopup(this);
105 if(!Rico.visible(this.container)){return
106 }if(this.container.id){Rico.log("closePopup "+this.container.id)
107 }if(this.dragEnabled){this._endDrag()
108 }this.container.style.display="none";
109 if(this.options.onClose){this.options.onClose()
110 }}};
111 Rico.closeButton=function(d){var b=document.createElement("a");
112 b.className="RicoCloseAnchor";
113 if(Rico.theme.closeAnchor){Rico.addClass(b,Rico.theme.closeAnchor)
114 }var c=b.appendChild(document.createElement("span"));
115 c.title=Rico.getPhraseById("close");
116 new Rico.HoverSet([b]);
117 Rico.addClass(c,Rico.theme.close||"rico-icon RicoClose");
118 Rico.eventBind(b,"click",d);
119 return b
120 };
121 Rico.floatButton=function(b,e,f){var c=document.createElement("a");
122 c.className="RicoButtonAnchor";
123 Rico.addClass(c,Rico.theme.buttonAnchor||"RicoButtonAnchorNative");
124 var d=c.appendChild(document.createElement("span"));
125 if(f){d.title=f
126 }d.className=Rico.theme[b.toLowerCase()]||"rico-icon Rico"+b;
127 Rico.eventBind(c,"click",e,false);
128 new Rico.HoverSet([c]);
129 return c
130 };
131 Rico.clearButton=function(b){var a=document.createElement("span");
132 a.title=Rico.getPhraseById("clear");
133 a.className="ricoClear";
134 Rico.addClass(a,Rico.theme.clear||"rico-icon ricoClearNative");
135 Rico.eventBind(a,"click",b);
136 return a
137 };
138 Rico.Window=function(c,a,b){this.initialize(c,a,b)
139 };
140 Rico.Window.prototype={initialize:function(c,a,b){a=a||{overflow:"auto"};
141 Rico.extend(this,new Rico.Popup());
142 this.titleDiv=document.createElement("div");
143 this.options.canDrag=true;
144 this.options.dragElement=this.titleDiv;
145 this.createContainer(a);
146 this.content.appendChild(this.titleDiv);
147 b=Rico.$(b);
148 this.contentDiv=b||document.createElement("div");
149 this.content.appendChild(this.contentDiv);
150 this.titleDiv.className="ricoTitle";
151 if(Rico.theme.dialogTitle){Rico.addClass(this.titleDiv,Rico.theme.dialogTitle)
152 }this.titleDiv.style.position="relative";
153 this.titleContent=document.createElement("span");
154 this.titleContent.className="ricoTitleSpan";
155 this.titleDiv.appendChild(this.titleContent);
156 this.titleDiv.appendChild(Rico.closeButton(Rico.eventHandle(this,"closeFunc")));
157 if(!c&&b){c=b.title;
158 b.title=""
159 }this.setTitle(c||"&nbsp;");
160 this.contentDiv.className="ricoContent";
161 if(Rico.theme.dialogContent){Rico.addClass(this.contentDiv,Rico.theme.dialogContent)
162 }this.contentDiv.style.position="relative";
163 if(a.height){this.contentDiv.style.height=a.height
164 }if(a.width){this.contentDiv.style.width=a.width
165 }if(a.overflow){this.contentDiv.style.overflow=a.overflow
166 }Rico.addClass(this.content,"ricoWindow");
167 if(Rico.theme.dialog){Rico.addClass(this.content,Rico.theme.dialog)
168 }this.content=this.contentDiv
169 },setTitle:function(a){this.titleContent.innerHTML=a
170 }};
171 Rico.Menu=function(a){this.initialize(a)
172 };
173 Rico.Menu.prototype={initialize:function(a){Rico.extend(this,new Rico.Popup());
174 Rico.extend(this.options,{width:"15em",arrowColor:"b",showDisabled:false,hideOnClick:true});
175 if(typeof a=="string"){this.options.width=a
176 }else{Rico.extend(this.options,a||{})
177 }this.hideFunc=null;
178 this.highlightElem=null
179 },createDiv:function(a){if(this.container){return
180 }var b=this;
181 var c={closeFunc:function(){b.cancelmenu()
182 }};
183 if(a){c.parent=a
184 }this.createContainer(c);
185 this.content.className=Rico.isWebKit?"ricoMenuSafari":"ricoMenu";
186 this.content.style.width=this.options.width;
187 this.direction=Rico.getStyle(this.container,"direction")||"ltr";
188 this.direction=this.direction.toLowerCase();
189 this.hidemenu();
190 this.itemCount=0
191 },showmenu:function(b,c){Rico.eventStop(b);
192 this.hideFunc=c;
193 if(this.content.childNodes.length==0){this.cancelmenu();
194 return false
195 }var a=Rico.eventClient(b);
196 this.openmenu(a.x,a.y,0,0)
197 },openmenu:function(g,f,j,e,a){var h=g+(a?0:Rico.docScrollLeft());
198 this.container.style.visibility="hidden";
199 this.container.style.display="block";
200 var i=this.container.offsetWidth;
201 var b=this.content.offsetWidth;
202 if(this.direction=="rtl"){if(h>i+j){h-=b+j
203 }}else{if(g+i>Rico.windowWidth()){h-=b+j-2
204 }}var d=Rico.docScrollTop();
205 var c=f+(a?0:d);
206 if(f+this.container.offsetHeight-d>Rico.windowHeight()){c=Math.max(c-this.content.offsetHeight+e,0)
207 }this.openPopup(h,c);
208 this.container.style.visibility="visible";
209 return false
210 },clearMenu:function(){this.clearContent();
211 this.defaultAction=null;
212 this.itemCount=0
213 },addMenuHeading:function(b){var a=document.createElement("div");
214 a.innerHTML=b;
215 a.className="ricoMenuHeading";
216 this.content.appendChild(a)
217 },addMenuBreak:function(){var a=document.createElement("div");
218 a.className="ricoMenuBreak";
219 this.content.appendChild(a)
220 },addSubMenuItem:function(b,e,g){var d=this.direction=="rtl"?"left":"right";
221 var c=this.addMenuItem(b,null,true,null,g);
222 c.className="ricoSubMenu";
223 var f=c.appendChild(document.createElement("div"));
224 f.className="rico-icon rico-"+d+"-"+this.options.arrowColor;
225 Rico.setStyle(f,{position:"absolute",top:"2px"});
226 f.style[d]="0px";
227 c.RicoSubmenu=e;
228 Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"showSubMenu"))
229 },showSubMenu:function(c){if(this.openSubMenu){this.hideSubMenu()
230 }var b=Rico.eventElement(c);
231 if(!b.RicoSubmenu){b=b.parentNode
232 }if(!b.RicoSubmenu){return
233 }this.openSubMenu=b.RicoSubmenu;
234 this.openMenuAnchor=b;
235 if(Rico.hasClass(b,"ricoSubMenu")){Rico.removeClass(b,"ricoSubMenu");
236 Rico.addClass(b,"ricoSubMenuOpen")
237 }b.RicoSubmenu.openmenu(parseInt(this.container.style.left)+b.offsetWidth,parseInt(this.container.style.top)+b.offsetTop,b.offsetWidth-2,b.offsetHeight+2,true)
238 },hideSubMenu:function(){if(this.openMenuAnchor){Rico.removeClass(this.openMenuAnchor,"ricoSubMenuOpen");
239 Rico.addClass(this.openMenuAnchor,"ricoSubMenu");
240 this.openMenuAnchor=null
241 }if(this.openSubMenu){this.openSubMenu.hidemenu();
242 this.openSubMenu=null
243 }},addMenuItemId:function(c,b,a,e,d){if(arguments.length<3){a=true
244 }this.addMenuItem(Rico.getPhraseById(c),b,a,e,d)
245 },addMenuItem:function(b,e,d,g,f){if(arguments.length>=3&&!d&&!this.options.showDisabled){return null
246 }this.itemCount++;
247 var c=document.createElement(typeof e=="string"?"a":"div");
248 if(arguments.length<3||d){if(typeof e=="string"){c.href=e;
249 if(f){c.target=f
250 }}else{if(f=="event"){Rico.eventBind(c,"click",e)
251 }else{c.onclick=e
252 }}c.className="enabled";
253 if(this.defaultAction==null){this.defaultAction=e
254 }}else{c.disabled=true;
255 c.className="disabled"
256 }c.innerHTML=b;
257 if(typeof g=="string"){c.title=g
258 }c=this.content.appendChild(c);
259 Rico.eventBind(c,"mouseover",Rico.eventHandle(this,"mouseOver"));
260 Rico.eventBind(c,"mouseout",Rico.eventHandle(this,"mouseOut"));
261 return c
262 },mouseOver:function(b){if(this.highlightElem&&this.highlightElem.className=="enabled-hover"){this.highlightElem.className="enabled";
263 this.highlightElem=null
264 }var a=Rico.eventElement(b);
265 if(a.parentNode==this.openMenuAnchor){a=a.parentNode
266 }if(this.openMenuAnchor&&this.openMenuAnchor!=a){this.hideSubMenu()
267 }if(a.className=="enabled"){a.className="enabled-hover";
268 this.highlightElem=a
269 }},mouseOut:function(b){var a=Rico.eventElement(b);
270 if(a.className=="enabled-hover"){a.className="enabled"
271 }if(this.highlightElem==a){this.highlightElem=null
272 }},cancelmenu:function(){if(!this.visible()){return
273 }if(this.hideFunc){this.hideFunc()
274 }this.hideFunc=null;
275 this.hidemenu()
276 },hidemenu:function(){if(this.openSubMenu){this.openSubMenu.hidemenu()
277 }this.closePopup()
278 }};
279 Rico.SelectionSet=function(b,a){this.initialize(b,a)
280 };
281 Rico.SelectionSet.prototype={initialize:function(e,b){Rico.log("SelectionSet#initialize");
282 this.options=b||{};
283 if(typeof e=="string"){e=Rico.select(e)
284 }this.previouslySelected=[];
285 this.selectionSet=[];
286 this.selectedClassName=this.options.selectedClass||Rico.theme.selected||"selected";
287 this.selectNode=this.options.selectNode||function(f){return f
288 };
289 this.onSelect=this.options.onSelect;
290 this.onFirstSelect=this.options.onFirstSelect;
291 var a=this;
292 this.clickHandler=function(f){a.selectIndex(f)
293 };
294 this.selectedIndex=-1;
295 for(var c=0;
296 c<e.length;
297 c++){this.add(e[c])
298 }if(!this.options.noDefault){var d=this.options.cookieName?this.getCookie():0;
299 this.selectIndex(d||this.options.selectedIndex||0)
300 }},getCookie:function(){var b=Rico.getCookie(this.options.cookieName);
301 if(!b){return 0
302 }var a=parseInt(b);
303 return a<this.selectionSet.length?a:0
304 },reset:function(){this.previouslySelected=[];
305 this._notifySelected(this.selectedIndex)
306 },clearSelected:function(){if(this.selected){Rico.removeClass(this.selectNode(this.selected),this.selectedClassName)
307 }},getIndex:function(b){for(var a=0;
308 a<this.selectionSet.length;
309 a++){if(b==this.selectionSet[a]){return a
310 }}return -1
311 },select:function(b){if(this.selected==b){return
312 }var a=this.getIndex(b);
313 if(a>=0){this.selectIndex(a)
314 }},_notifySelected:function(a){if(a<0){return
315 }var b=this.selectionSet[a];
316 if(this.options.cookieName){Rico.setCookie(this.options.cookieName,a,this.options.cookieDays,this.options.cookiePath,this.options.cookieDomain)
317 }if(this.onFirstSelect&&!this.previouslySelected[a]){this.onFirstSelect(b,a);
318 this.previouslySelected[a]=true
319 }if(this.onSelect){try{this.onSelect(a)
320 }catch(c){}}},selectIndex:function(a){if(this.selectedIndex==a||a>=this.selectionSet.length){return
321 }this.clearSelected();
322 this._notifySelected(a);
323 this.selectedIndex=a;
324 this.selected=this.selectionSet[a].element;
325 Rico.addClass(this.selectNode(this.selected),this.selectedClassName)
326 },nextSelectIndex:function(){return(this.selectedIndex+1)%this.selectionSet.length
327 },nextSelectItem:function(){return this.selectionSet[this.nextSelectIndex()]
328 },selectNext:function(){this.selectIndex(this.nextSelectIndex())
329 },add:function(b){var a=this.selectionSet.length;
330 this.selectionSet[a]=new Rico._SelectionItem(b,a,this.clickHandler)
331 },remove:function(b){if(b==this.selected){this.clearSelected()
332 }var a=this.getIndex(b);
333 if(a<0){return
334 }this.selectionSet[a].remove();
335 this.selectionSet.splice(a,1)
336 },removeAll:function(){this.clearSelected();
337 while(this.selectionSet.length>0){this.selectionSet.pop().remove()
338 }}};
339 Rico._SelectionItem=function(b,a,c){this.add(b,a,c)
340 };
341 Rico._SelectionItem.prototype={add:function(b,a,c){this.element=b;
342 this.index=a;
343 this.callback=c;
344 this.handle=Rico.eventHandle(this,"click");
345 Rico.eventBind(b,"click",this.handle)
346 },click:function(a){this.callback(this.index)
347 },remove:function(){Rico.eventUnbind(this.element,"click",this.handle)
348 }};
349 Rico.HoverSet=function(b,a){this.initialize(b,a)
350 };
351 Rico.HoverSet.prototype={initialize:function(c,a){Rico.log("HoverSet#initialize");
352 a=a||{};
353 this.hoverClass=a.hoverClass||Rico.theme.hover||"hover";
354 this.hoverFunc=a.hoverNodes||function(d){return[d]
355 };
356 this.hoverSet=[];
357 if(!c){return
358 }for(var b=0;
359 b<c.length;
360 b++){this.add(c[b])
361 }},add:function(a){this.hoverSet.push(new Rico._HoverItem(a,this.hoverFunc,this.hoverClass))
362 },removeAll:function(){while(this.hoverSet.length>0){this.hoverSet.pop().remove()
363 }}};
364 Rico._HoverItem=function(b,a,c){this.add(b,a,c)
365 };
366 Rico._HoverItem.prototype={add:function(b,a,c){this.element=b;
367 this.selectFunc=a;
368 this.hoverClass=c;
369 this.movehandle=Rico.eventHandle(this,"move");
370 this.outhandle=Rico.eventHandle(this,"mouseout");
371 Rico.eventBind(b,"mousemove",this.movehandle);
372 Rico.eventBind(b,"mouseout",this.outhandle)
373 },move:function(c){var a=this.selectFunc(this.element);
374 for(var b=0;
375 b<a.length;
376 b++){Rico.addClass(a[b],this.hoverClass)
377 }},mouseout:function(c){var a=this.selectFunc(this.element);
378 for(var b=0;
379 b<a.length;
380 b++){Rico.removeClass(a[b],this.hoverClass)
381 }},remove:function(){Rico.eventUnbind(element,"mousemove",this.movehandle);
382 Rico.eventUnbind(element,"mouseout",this.outhandle)
383 }};
384 Rico.Effect={};
385 Rico.Effect.easeIn=function(a){return Math.sqrt(a)
386 };
387 Rico.Effect.easeOut=function(a){return a*a
388 };
389 Rico.ContentTransitionBase=function(){};
390 Rico.ContentTransitionBase.prototype={initBase:function(e,d,b){Rico.log("ContentTransitionBase#initBase");
391 if(typeof e=="string"){e=Rico.select(e)
392 }if(typeof d=="string"){d=Rico.select(d)
393 }this.options=b||{};
394 this.titles=e;
395 this.contents=d;
396 this.hoverSet=new Rico.HoverSet(e,b);
397 for(var c=0;
398 c<d.length;
399 c++){if(d[c]){Rico.hide(d[c])
400 }}var a=this;
401 this.selectionSet=new Rico.SelectionSet(e,Rico.extend(b,{onSelect:function(f){a._finishSelect(f)
402 }}))
403 },reset:function(){this.selectionSet.reset()
404 },select:function(a){this.selectionSet.selectIndex(a)
405 },_finishSelect:function(b){Rico.log("ContentTransitionBase#_finishSelect");
406 var a=this.contents[b];
407 if(!a){alert("Internal error: no panel @index="+b);
408 return
409 }if(this.selected==a){return
410 }if(this.transition){if(this.selected){this.transition(a)
411 }else{a.style.display="block"
412 }}else{if(this.selected){Rico.hide(this.selected)
413 }a.style.display="block"
414 }this.selected=a
415 },addBase:function(b,a){this.titles.push(b);
416 this.contents.push(a);
417 this.hoverSet.add(b);
418 this.selectionSet.add(b);
419 Rico.hide(a)
420 },removeBase:function(a){},removeAll:function(){this.hoverSet.removeAll();
421 this.selectionSet.removeAll()
422 }};
423 Rico.Accordion=function(b,a){this.initialize(b,a)
424 };
425 Rico.Accordion.prototype=Rico.extend(new Rico.ContentTransitionBase(),{initialize:function(g,e){g=Rico.$(g);
426 g.style.overflow="hidden";
427 g.className=e.accClass||Rico.theme.accordion||"Rico_accordion";
428 if(typeof e.panelWidth=="number"){e.panelWidth+="px"
429 }if(e.panelWidth){g.style.width=e.panelWidth
430 }var d=Rico.getDirectChildrenByTag(g,"div");
431 var c,j=[],h=[];
432 for(var f=0;
433 f<d.length;
434 f++){c=Rico.getDirectChildrenByTag(d[f],"div");
435 if(c.length>=2){c[0].className=e.titleClass||Rico.theme.accTitle||"Rico_accTitle";
436 c[1].className=e.contentClass||Rico.theme.accContent||"Rico_accContent";
437 j.push(c[0]);
438 h.push(c[1]);
439 var b=Rico.wrapChildren(c[0],"","","a");
440 b.href="javascript:void(0)"
441 }}Rico.log("creating Rico.Accordion for "+g.id+" with "+j.length+" panels");
442 this.initBase(j,h,e);
443 this.selected.style.height=this.options.panelHeight+"px";
444 this.totSteps=(typeof e.duration=="number"?e.duration:200)/25
445 },transition:function(b){if(!this.options.noAnimate){this.closing=this.selected;
446 this.opening=b;
447 this.curStep=0;
448 var a=this;
449 this.timer=setInterval(function(){a.step()
450 },25)
451 }else{b.style.height=this.options.panelHeight+"px";
452 if(this.selected){Rico.hide(this.selected)
453 }b.style.display="block"
454 }},step:function(){this.curStep++;
455 var a=Math.round(this.curStep/this.totSteps*this.options.panelHeight);
456 this.opening.style.height=a+"px";
457 this.closing.style.height=(this.options.panelHeight-a)+"px";
458 if(this.curStep==1){this.opening.style.paddingTop=this.opening.style.paddingBottom="0px";
459 this.opening.style.display="block"
460 }if(this.curStep==this.totSteps){clearInterval(this.timer);
461 this.opening.style.paddingTop=this.opening.style.paddingBottom="";
462 Rico.hide(this.closing)
463 }},setPanelHeight:function(a){this.options.panelHeight=a;
464 this.selected.style.height=this.options.panelHeight+"px"
465 }});
466 Rico.TabbedPanel=function(b,a){this.initialize(b,a)
467 };
468 Rico.TabbedPanel.prototype=Rico.extend(new Rico.ContentTransitionBase(),{initialize:function(d,k){d=Rico.$(d);
469 k=k||{};
470 if(typeof k.panelWidth=="number"){k.panelWidth+="px"
471 }if(typeof k.panelHeight=="number"){k.panelHeight+="px"
472 }d.className=k.tabClass||Rico.theme.tabPanel||"Rico_tabPanel";
473 if(k.panelWidth){d.style.width=k.panelWidth
474 }var g=[];
475 var j=d.childNodes;
476 for(var e=0;
477 e<j.length;
478 e++){if(j[e]&&j[e].tagName&&j[e].tagName.match(/^div|ul$/i)){g.push(j[e])
479 }}if(g.length<2){return
480 }var c=g[0].tagName.toLowerCase()=="ul"?"li":"div";
481 g[0].className=k.navContainerClass||Rico.theme.tabNavContainer||"Rico_tabNavContainer";
482 g[0].style.listStyle="none";
483 g[1].className=k.contentContainerClass||Rico.theme.tabContentContainer||"Rico_tabContentContainer";
484 var f=Rico.getDirectChildrenByTag(g[0],c);
485 var b=Rico.getDirectChildrenByTag(g[1],"div");
486 if(!k.corners){k.corners="top"
487 }for(var e=0;
488 e<f.length;
489 e++){f[e].className=k.titleClass||Rico.theme.tabTitle||"Rico_tabTitle";
490 var h=Rico.wrapChildren(f[e],"","","a");
491 h.href="javascript:void(0)";
492 b[e].className=k.contentClass||Rico.theme.tabContent||"Rico_tabContent";
493 if(k.panelHeight){b[e].style.overflow="auto"
494 }if(k.corners!="none"){if(k.panelHdrWidth){f[e].style.width=k.panelHdrWidth
495 }Rico.Corner.round(f[e],Rico.theme.tabCornerOptions||k)
496 }}k.selectedClass=Rico.theme.tabSelected||"selected";
497 this.initBase(f,b,k);
498 if(this.selected){this.transition(this.selected)
499 }},transition:function(a){Rico.log("TabbedPanel#transition "+typeof(a));
500 if(this.selected){Rico.hide(this.selected)
501 }Rico.show(a);
502 if(this.options.panelHeight){a.style.height=this.options.panelHeight
503 }}});
504 Rico.Corner={round:function(b,a){b=Rico.$(b);
505 this.options={corners:"all",bgColor:"fromParent",compact:false,nativeCorners:false};
506 Rico.extend(this.options,a||{});
507 if(typeof(Rico.getStyle(b,"border-radius"))=="string"){this._roundCornersStdCss(b)
508 }else{if(typeof(Rico.getStyle(b,"-webkit-border-radius"))=="string"){this._roundCornersWebKit(b)
509 }else{if(typeof(Rico.getStyle(b,"-moz-border-radius"))=="string"){this._roundCornersMoz(b)
510 }else{if(!this.options.nativeCorners){this._roundCornersImpl(b)
511 }}}}},_roundCornersStdCss:function(b){var a=this.options.compact?"4px":"8px";
512 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{borderRadius:a})
513 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{borderTopLeftRadius:a})
514 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{borderTopRightRadius:a})
515 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{borderBottomLeftRadius:a})
516 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{borderBottomRightRadius:a})
517 }}},_roundCornersWebKit:function(b){var a=this.options.compact?"4px":"8px";
518 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{WebkitBorderRadius:a})
519 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{WebkitBorderTopLeftRadius:a})
520 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{WebkitBorderTopRightRadius:a})
521 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{WebkitBorderBottomLeftRadius:a})
522 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{WebkitBorderBottomRightRadius:a})
523 }}},_roundCornersMoz:function(b){var a=this.options.compact?"4px":"8px";
524 if(this._hasString(this.options.corners,"all")){Rico.setStyle(b,{MozBorderRadius:a})
525 }else{if(this._hasString(this.options.corners,"top","tl")){Rico.setStyle(b,{MozBorderRadiusTopleft:a})
526 }if(this._hasString(this.options.corners,"top","tr")){Rico.setStyle(b,{MozBorderRadiusTopright:a})
527 }if(this._hasString(this.options.corners,"bottom","bl")){Rico.setStyle(b,{MozBorderRadiusBottomleft:a})
528 }if(this._hasString(this.options.corners,"bottom","br")){Rico.setStyle(b,{MozBorderRadiusBottomright:a})
529 }}},_roundCornersImpl:function(b){var a=this.options.bgColor=="fromParent"?this._background(b.parentNode):this.options.bgColor;
530 b.style.position="relative";
531 if(this._hasString(this.options.corners,"all","top","tl")){this._createCorner(b,"top","left",a)
532 }if(this._hasString(this.options.corners,"all","top","tr")){this._createCorner(b,"top","right",a)
533 }if(this._hasString(this.options.corners,"all","bottom","bl")){this._createCorner(b,"bottom","left",a)
534 }if(this._hasString(this.options.corners,"all","bottom","br")){this._createCorner(b,"bottom","right",a)
535 }},_createCorner:function(b,c,f,k){var n=document.createElement("div");
536 n.className="ricoCorner";
537 Rico.setStyle(n,{width:"6px",height:"5px"});
538 var o=Rico.getStyle(b,"border-"+c+"-style");
539 var a=o=="none"?k:Rico.getStyle(b,"border-"+c+"-color");
540 var j=o=="none"?"0px":"-1px";
541 n.style[c]=j;
542 n.style[f]=Rico.isIE&&Rico.ieVersion<7&&f=="right"&&o!="none"?"-2px":"-1px";
543 b.appendChild(n);
544 var h=[0,2,3,4,4];
545 if(c=="bottom"){h.reverse()
546 }var m=o=="none"?"0px none":"1px solid "+a;
547 var g=f=="left"?"Right":"Left";
548 for(var e=0;
549 e<h.length;
550 e++){var l=document.createElement("div");
551 Rico.setStyle(l,{backgroundColor:k,height:"1px"});
552 l.style["margin"+g]=h[e]+"px";
553 l.style["border"+g]=m;
554 n.appendChild(l)
555 }},_background:function(c){try{var a=Rico.getStyle(c,"backgroundColor");
556 if(a.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&c.parentNode){return this._background(c.parentNode)
557 }return a==null?"#ffffff":a
558 }catch(b){return"#ffffff"
559 }},_hasString:function(b){for(var a=1;
560 a<arguments.length;
561 a++){if(b.indexOf(arguments[a])>=0){return true
562 }}return false
563 }};
564 Rico.toColorPart=function(a){return Rico.zFill(a,2,16)
565 };
566 Rico.Color=function(c,b,a){this.initialize(c,b,a)
567 };
568 Rico.Color.prototype={initialize:function(c,b,a){this.rgb={r:c,g:b,b:a}
569 },setRed:function(a){this.rgb.r=a
570 },setGreen:function(a){this.rgb.g=a
571 },setBlue:function(a){this.rgb.b=a
572 },setHue:function(b){var a=this.asHSB();
573 a.h=b;
574 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b)
575 },setSaturation:function(b){var a=this.asHSB();
576 a.s=b;
577 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,a.b)
578 },setBrightness:function(a){var c=this.asHSB();
579 c.b=a;
580 this.rgb=Rico.Color.HSBtoRGB(c.h,c.s,c.b)
581 },darken:function(b){var a=this.asHSB();
582 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.max(a.b-b,0))
583 },brighten:function(b){var a=this.asHSB();
584 this.rgb=Rico.Color.HSBtoRGB(a.h,a.s,Math.min(a.b+b,1))
585 },blend:function(a){this.rgb.r=Math.floor((this.rgb.r+a.rgb.r)/2);
586 this.rgb.g=Math.floor((this.rgb.g+a.rgb.g)/2);
587 this.rgb.b=Math.floor((this.rgb.b+a.rgb.b)/2)
588 },isBright:function(){var a=this.asHSB();
589 return this.asHSB().b>0.5
590 },isDark:function(){return !this.isBright()
591 },asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"
592 },asHex:function(){return"#"+Rico.toColorPart(this.rgb.r)+Rico.toColorPart(this.rgb.g)+Rico.toColorPart(this.rgb.b)
593 },asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)
594 },toString:function(){return this.asHex()
595 }};
596 Rico.Color.createFromHex=function(d){if(d.length==4){var b=d;
597 d="#";
598 for(var c=1;
599 c<4;
600 c++){d+=(b.charAt(c)+b.charAt(c))
601 }}if(d.indexOf("#")==0){d=d.substring(1)
602 }if(!d.match(/^[0-9A-Fa-f]{6}$/)){return null
603 }var f=d.substring(0,2);
604 var e=d.substring(2,4);
605 var a=d.substring(4,6);
606 return new Rico.Color(parseInt(f,16),parseInt(e,16),parseInt(a,16))
607 };
608 Rico.Color.createColorFromBackground=function(d){if(!d.style){return new Rico.Color(255,255,255)
609 }var b=Rico.getStyle(d,"background-color");
610 if(b.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&d.parentNode){return Rico.Color.createColorFromBackground(d.parentNode)
611 }if(b==null){return new Rico.Color(255,255,255)
612 }if(b.indexOf("rgb(")==0){var a=b.substring(4,b.length-1);
613 var c=a.split(",");
614 return new Rico.Color(parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10))
615 }else{if(b.indexOf("#")==0){return Rico.Color.createFromHex(b)
616 }else{return new Rico.Color(255,255,255)
617 }}};
618 Rico.Color.HSBtoRGB=function(i,e,k){var c=0;
619 var d=0;
620 var l=0;
621 if(e==0){c=parseInt(k*255+0.5,10);
622 d=c;
623 l=c
624 }else{var g=(i-Math.floor(i))*6;
625 var j=g-Math.floor(g);
626 var b=k*(1-e);
627 var a=k*(1-e*j);
628 var m=k*(1-(e*(1-j)));
629 switch(parseInt(g,10)){case 0:c=(k*255+0.5);
630 d=(m*255+0.5);
631 l=(b*255+0.5);
632 break;
633 case 1:c=(a*255+0.5);
634 d=(k*255+0.5);
635 l=(b*255+0.5);
636 break;
637 case 2:c=(b*255+0.5);
638 d=(k*255+0.5);
639 l=(m*255+0.5);
640 break;
641 case 3:c=(b*255+0.5);
642 d=(a*255+0.5);
643 l=(k*255+0.5);
644 break;
645 case 4:c=(m*255+0.5);
646 d=(b*255+0.5);
647 l=(k*255+0.5);
648 break;
649 case 5:c=(k*255+0.5);
650 d=(b*255+0.5);
651 l=(a*255+0.5);
652 break
653 }}return{r:parseInt(c,10),g:parseInt(d,10),b:parseInt(l,10)}
654 };
655 Rico.Color.RGBtoHSB=function(a,f,l){var h;
656 var e;
657 var k;
658 var m=(a>f)?a:f;
659 if(l>m){m=l
660 }var i=(a<f)?a:f;
661 if(l<i){i=l
662 }k=m/255;
663 if(m!=0){e=(m-i)/m
664 }else{e=0
665 }if(e==0){h=0
666 }else{var c=(m-a)/(m-i);
667 var j=(m-f)/(m-i);
668 var d=(m-l)/(m-i);
669 if(a==m){h=d-j
670 }else{if(f==m){h=2+c-d
671 }else{h=4+j-c
672 }}h=h/6;
673 if(h<0){h=h+1
674 }}return{h:h,s:e,b:k}
675 };
676 Rico.createXmlDocument=function(){if(document.implementation&&document.implementation.createDocument){var a=document.implementation.createDocument("","",null);
677 if(a.readyState==null){a.readyState=1;
678 a.addEventListener("load",function(){a.readyState=4;
679 if(typeof a.onreadystatechange=="function"){a.onreadystatechange()
680 }},false)
681 }return a
682 }if(window.ActiveXObject){return Rico.tryFunctions(function(){return new ActiveXObject("MSXML2.DomDocument")
683 },function(){return new ActiveXObject("Microsoft.DomDocument")
684 },function(){return new ActiveXObject("MSXML.DomDocument")
685 },function(){return new ActiveXObject("MSXML3.DomDocument")
686 })||false
687 }return null
688 };
689 Rico.CalendarControl=function(b,a){this.initialize(b,a)
690 };
691 Rico.CalendarControl.prototype={initialize:function(c,b){this.id=c;
692 var a=new Date();
693 Rico.extend(this,new Rico.Popup());
694 Rico.extend(this.options,{ignoreClicks:true,startAt:0,showWeekNumber:0,showToday:1,dateFmt:"ISO8601",minDate:new Date(a.getFullYear()-50,0,1),maxDate:new Date(a.getFullYear()+50,11,31)});
695 Rico.extend(this.options,b||{});
696 this.close=this.closePopup;
697 this.bPageLoaded=false;
698 this.img=[];
699 this.Holidays={};
700 this.weekString=Rico.getPhraseById("calWeekHdg");
701 this.re=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
702 this.setDateFmt(this.options.dateFmt)
703 },setDateFmt:function(a){this.dateFmt=(a=="rico")?Rico.dateFmt:a;
704 Rico.log(this.id+" date format set to "+this.dateFmt);
705 this.dateParts={};
706 if(this.re.exec(this.dateFmt)){this.dateParts[RegExp.$1]=0;
707 this.dateParts[RegExp.$3]=1;
708 this.dateParts[RegExp.$5]=2
709 }},addHoliday:function(f,a,g,e,c,b){this.Holidays[this.holidayKey(g,a-1,f)]={desc:e,txtColor:b,bgColor:c||"#DDF"}
710 },holidayKey:function(c,a,b){return"h"+Rico.zFill(c,4)+Rico.zFill(a,2)+Rico.zFill(b,2)
711 },atLoad:function(){Rico.log("Calendar#atLoad: "+this.id);
712 var d=Rico.$(this.id);
713 if(d){this.setDiv(d)
714 }else{this.createContainer();
715 this.container.id=this.id
716 }Rico.addClass(this.content,Rico.theme.calendar||"ricoCalContainer");
717 this.content.style.display="block";
718 this.heading=this.content.appendChild(document.createElement("div"));
719 this.heading.className="RicoCalHeading";
720 if(Rico.theme.calendarHeading){Rico.addClass(this.heading,Rico.theme.calendarHeading)
721 }var k=this._createTitleSection("Month");
722 this.heading.appendChild(k);
723 this.heading.appendChild(this._createTitleSection("Year"));
724 new Rico.HoverSet(this.heading.getElementsByTagName("a"));
725 if(this.position=="absolute"){this.heading.appendChild(Rico.closeButton(Rico.eventHandle(this,"close")))
726 }this.maintab=document.createElement("table");
727 this.maintab.cellSpacing=2;
728 this.maintab.cellPadding=0;
729 this.maintab.border=0;
730 this.maintab.style.borderCollapse="separate";
731 this.maintab.className="ricoCalTab";
732 if(Rico.theme.calendarTable){Rico.addClass(this.maintab,Rico.theme.calendarTable)
733 }this.tbody=Rico.getTBody(this.maintab);
734 var b,l,g,f,h,p,m,q,e;
735 this.colStart=this.options.showWeekNumber?1:0;
736 for(g=0;
737 g<7;
738 g++){b=this.tbody.insertRow(-1);
739 b.className="row"+g;
740 for(l=0;
741 l<7+this.colStart;
742 l++){b.insertCell(-1)
743 }}b=this.tbody.rows[0];
744 b.className="ricoCalDayNames";
745 if(this.options.showWeekNumber){b.cells[0].innerHTML=this.weekString;
746 for(g=0;
747 g<7;
748 g++){this.tbody.rows[g].cells[0].className="ricoCalWeekNum"
749 }}this.styles=[];
750 for(g=0;
751 g<7;
752 g++){p=(g+this.options.startAt)%7;
753 b.cells[g+this.colStart].innerHTML=Rico.dayAbbr(p);
754 this.styles[g]="ricoCal"+p
755 }if(this.options.showToday){this.tfoot=this.maintab.createTFoot();
756 b=this.tfoot.insertRow(-1);
757 this.todayCell=b.insertCell(-1);
758 this.todayCell.colSpan=7+this.colStart;
759 if(Rico.theme.calendarFooter){Rico.addClass(this.todayCell,Rico.theme.calendarFooter)
760 }Rico.eventBind(this.todayCell,"click",Rico.eventHandle(this,"selectNow"),false)
761 }this.content.appendChild(this.maintab);
762 new Rico.HoverSet(this.tbody.getElementsByTagName("td"),{hoverNodes:function(a){return a.innerHTML.match(/^\d+$/)?[a]:[]
763 }});
764 this.monthPopup=new Rico.Popup(document.createElement("div"));
765 this.monthPopup.closePopup();
766 e=document.createElement("table");
767 e.className="ricoCalMenu";
768 if(Rico.theme.calendarPopdown){Rico.addClass(e,Rico.theme.calendarPopdown)
769 }e.cellPadding=2;
770 e.cellSpacing=0;
771 e.border=0;
772 e.style.borderCollapse="separate";
773 e.style.margin="0px";
774 for(g=0;
775 g<4;
776 g++){b=e.insertRow(-1);
777 for(f=0;
778 f<3;
779 f++){l=b.insertCell(-1);
780 m=document.createElement("a");
781 m.innerHTML=Rico.monthAbbr(g*3+f);
782 m.name=g*3+f;
783 if(Rico.theme.calendarDay){Rico.addClass(m,Rico.theme.calendarDay)
784 }l.appendChild(m);
785 Rico.eventBind(m,"click",Rico.eventHandle(this,"selectMonth"),false)
786 }}new Rico.HoverSet(e.getElementsByTagName("a"));
787 this.monthPopup.content.appendChild(e);
788 this.container.appendChild(this.monthPopup.container);
789 this.yearPopup=new Rico.Popup(document.createElement("div"));
790 this.yearPopup.closePopup();
791 this.yearPopup.content.className="ricoCalYearPrompt";
792 if(Rico.theme.calendarPopdown){Rico.addClass(this.yearPopup.content,Rico.theme.calendarPopdown)
793 }var o=document.createElement("p");
794 o.innerHTML=Rico.getPhraseById("calYearRange",this.options.minDate.getFullYear(),this.options.maxDate.getFullYear());
795 var n=document.createElement("p");
796 this.yearInput=n.appendChild(document.createElement("input"));
797 this.yearInput.maxlength=4;
798 this.yearInput.size=4;
799 Rico.eventBind(this.yearInput,"keyup",Rico.eventHandle(this,"yearKey"),false);
800 m=Rico.floatButton("Checkmark",Rico.eventHandle(this,"processPopUpYear"));
801 n.appendChild(m);
802 m=Rico.floatButton("Cancel",Rico.eventHandle(this,"popDownYear"));
803 n.appendChild(m);
804 this.yearPopup.content.appendChild(o);
805 this.yearPopup.content.appendChild(n);
806 this.container.appendChild(this.yearPopup.container);
807 this.yearPopup.container.style.left="";
808 this.yearPopup.container.style.right="5px";
809 this.yearPopup.container.style.zIndex=10;
810 m=this.content.getElementsByTagName("a");
811 for(g=0;
812 g<m.length;
813 g++){m[g].href="javascript:void(0)"
814 }Rico.eventBind(this.tbody,"click",Rico.eventHandle(this,"saveAndClose"));
815 this.close();
816 this.bPageLoaded=true
817 },_createTitleSection:function(d){var c=document.createElement("span");
818 c.className="RicoCal"+d+"Heading";
819 if(Rico.theme.calendarSubheading){Rico.addClass(c,Rico.theme.calendarSubheading)
820 }var b=c.appendChild(document.createElement("a"));
821 b.className="Rico_leftArrow";
822 b.appendChild(this.createNavArrow("dec"+d,"left"));
823 var b=c.appendChild(document.createElement("a"));
824 Rico.eventBind(b,"click",Rico.eventHandle(this,"popUp"+d),false);
825 this["title"+d]=b;
826 b=c.appendChild(document.createElement("a"));
827 b.className="Rico_rightArrow";
828 b.appendChild(this.createNavArrow("inc"+d,"right"));
829 return c
830 },selectNow:function(){var a=new Date();
831 this.dateNow=a.getDate();
832 this.monthNow=a.getMonth();
833 this.yearNow=a.getFullYear();
834 this.monthSelected=this.monthNow;
835 this.yearSelected=this.yearNow;
836 this.constructCalendar()
837 },createNavArrow:function(a,c){var b=document.createElement("span");
838 b.className=Rico.theme[c+"Arrow"]||"rico-icon Rico_"+c+"Arrow";
839 b.style.display="inline-block";
840 Rico.eventBind(b,"click",Rico.eventHandle(this,a),false);
841 return b
842 },isValidMonth:function(a,b){if(a<this.options.minDate.getFullYear()){return false
843 }if(a==this.options.minDate.getFullYear()&&b<this.options.minDate.getMonth()){return false
844 }if(a>this.options.maxDate.getFullYear()){return false
845 }if(a==this.options.maxDate.getFullYear()&&b>this.options.maxDate.getMonth()){return false
846 }return true
847 },incMonth:function(){var b=this.monthSelected+1;
848 var a=this.yearSelected;
849 if(b>11){b=0;
850 a++
851 }if(!this.isValidMonth(a,b)){return
852 }this.monthSelected=b;
853 this.yearSelected=a;
854 this.constructCalendar()
855 },decMonth:function(){var b=this.monthSelected-1;
856 var a=this.yearSelected;
857 if(b<0){b=11;
858 a--
859 }if(!this.isValidMonth(a,b)){return
860 }this.monthSelected=b;
861 this.yearSelected=a;
862 this.constructCalendar()
863 },selectMonth:function(b){var a=Rico.eventElement(b);
864 this.monthSelected=parseInt(a.name,10);
865 this.constructCalendar();
866 Rico.eventStop(b)
867 },popUpMonth:function(a){Rico.eventStop(a);
868 if(this.monthPopup.visible()){this.popDownMonth();
869 return
870 }this.popDownYear();
871 if(Rico.isIE&&Rico.ieVersion<7){this.monthPopup.openPopup(null,this.heading.offsetHeight+2);
872 this.monthPopup.container.style.left=""
873 }else{this.monthPopup.openPopup(3,this.heading.offsetHeight+2)
874 }return false
875 },popDownMonth:function(){this.monthPopup.closePopup()
876 },popDownYear:function(){this.yearPopup.closePopup();
877 this.yearInput.disabled=true
878 },popUpYear:function(b){Rico.eventStop(b);
879 if(this.yearPopup.visible()){this.popDownYear();
880 return
881 }this.popDownMonth();
882 this.yearInput.disabled=false;
883 this.yearInput.value="";
884 this.yearPopup.openPopup(null,this.heading.offsetHeight+2);
885 var a=this;
886 setTimeout(function(){a.yearInput.focus()
887 },10);
888 return false
889 },yearKey:function(a){switch(Rico.eventKey(a)){case 27:this.popDownYear();
890 Rico.eventStop(a);
891 return false;
892 case 13:this.processPopUpYear();
893 Rico.eventStop(a);
894 return false
895 }return true
896 },processPopUpYear:function(){var a=this.yearInput.value;
897 a=parseInt(a,10);
898 if(isNaN(a)||a<this.options.minDate.getFullYear()||a>this.options.maxDate.getFullYear()){alert(Rico.getPhraseById("calInvalidYear"))
899 }else{this.yearSelected=a;
900 this.popDownYear();
901 this.constructCalendar()
902 }},incYear:function(){if(this.yearSelected>=this.options.maxDate.getFullYear()){return
903 }this.yearSelected++;
904 this.constructCalendar()
905 },decYear:function(){if(this.yearSelected<=this.options.minDate.getFullYear()){return
906 }this.yearSelected--;
907 this.constructCalendar()
908 },WeekNbr:function(h,f,j){var g=new Date(h,f,j);
909 var c=new Date(h,0,1);
910 var e=7+1-c.getDay();
911 if(e==8){e=1
912 }var b=((Date.UTC(h,g.getMonth(),g.getDate(),0,0,0)-Date.UTC(h,0,1,0,0,0))/1000/60/60/24)+1;
913 var d=Math.floor((b-e+7)/7);
914 if(d==0){h--;
915 var a=new Date(h,0,1);
916 var i=7+1-a.getDay();
917 d=(i==2||i==8)?53:52
918 }return d
919 },constructCalendar:function(){var l=[31,0,31,30,31,30,31,31,30,31,30,31];
920 var d=new Date(this.yearSelected,this.monthSelected,1);
921 var j,e,f,b;
922 if(typeof this.monthSelected!="number"||this.monthSelected>=12||this.monthSelected<0){alert("ERROR in calendar: monthSelected="+this.monthSelected);
923 return
924 }if(this.monthSelected==1){j=new Date(this.yearSelected,this.monthSelected+1,1);
925 j=new Date(j-(24*60*60*1000));
926 e=j.getDate()
927 }else{e=l[this.monthSelected]
928 }var n=d.getDay()-this.options.startAt;
929 if(n<0){n+=7
930 }this.popDownMonth();
931 this.popDownYear();
932 if(this.options.showWeekNumber){for(f=1;
933 f<7;
934 f++){this.tbody.rows[f].cells[0].innerHTML="&nbsp;"
935 }}for(f=0;
936 f<n;
937 f++){this.resetCell(this.tbody.rows[1].cells[f+this.colStart])
938 }for(var k=1,a=1;
939 k<=e;
940 k++,n++){b=n%7;
941 if(this.options.showWeekNumber&&b==0){this.tbody.rows[a].cells[0].innerHTML=this.WeekNbr(this.yearSelected,this.monthSelected,k)
942 }var m=this.tbody.rows[a].cells[b+this.colStart];
943 m.innerHTML=k;
944 m.className=this.styles[b];
945 if((k==this.dateNow)&&(this.monthSelected==this.monthNow)&&(this.yearSelected==this.yearNow)){Rico.addClass(m,Rico.theme.calendarToday||"ricoCalToday")
946 }if(Rico.theme.calendarDay){Rico.addClass(m,Rico.theme.calendarDay)
947 }if((k==this.odateSelected)&&(this.monthSelected==this.omonthSelected)&&(this.yearSelected==this.oyearSelected)){Rico.addClass(m,Rico.theme.calendarSelectedDay||"ricoSelectedDay")
948 }var g=this.Holidays[this.holidayKey(this.yearSelected,this.monthSelected,k)];
949 if(!g){g=this.Holidays[this.holidayKey(0,this.monthSelected,k)]
950 }m.style.color=g?g.txtColor:"";
951 m.style.backgroundColor=g?g.bgColor:"";
952 m.title=g?g.desc:"";
953 if(b==6){a++
954 }}while(n<42){b=n%7;
955 this.resetCell(this.tbody.rows[a].cells[b+this.colStart]);
956 n++;
957 if(b==6){a++
958 }}this.titleMonth.innerHTML=Rico.monthAbbr(this.monthSelected);
959 this.titleYear.innerHTML=this.yearSelected;
960 if(this.todayCell){this.todayCell.innerHTML=Rico.getPhraseById("calToday",this.dateNow,Rico.monthAbbr(this.monthNow),this.yearNow,this.monthNow+1)
961 }},resetCell:function(a){a.innerHTML="&nbsp;";
962 a.className="ricoCalEmpty";
963 a.style.color="";
964 a.style.backgroundColor="";
965 a.title=""
966 },saveAndClose:function(g){Rico.eventStop(g);
967 var f=Rico.eventElement(g);
968 var c=f.innerHTML.replace(/&nbsp;/g,"");
969 if(c==""||f.className=="ricoCalWeekNum"){return
970 }var b=parseInt(c,10);
971 if(isNaN(b)){return
972 }var h=new Date(this.yearSelected,this.monthSelected,b);
973 var a=Rico.formatDate(h,this.dateFmt=="ISO8601"?"yyyy-mm-dd":this.dateFmt);
974 if(this.returnValue){this.returnValue(a);
975 this.close()
976 }},open:function(b){if(!this.bPageLoaded){return
977 }var a=new Date();
978 this.dateNow=a.getDate();
979 this.monthNow=a.getMonth();
980 this.yearNow=a.getFullYear();
981 this.oyearSelected=-1;
982 if(typeof b=="object"){this.odateSelected=b.getDate();
983 this.omonthSelected=b.getMonth();
984 this.oyearSelected=b.getFullYear()
985 }else{if(this.dateFmt=="ISO8601"){var c=Rico.setISO8601(b);
986 if(c){this.odateSelected=c.getDate();
987 this.omonthSelected=c.getMonth();
988 this.oyearSelected=c.getFullYear()
989 }}else{if(this.re.exec(b)){var f=[RegExp.$1,RegExp.$3,RegExp.$5];
990 this.odateSelected=parseInt(f[this.dateParts.dd],10);
991 this.omonthSelected=parseInt(f[this.dateParts.mm],10)-1;
992 this.oyearSelected=parseInt(f[this.dateParts.yyyy],10);
993 if(this.oyearSelected<100){this.oyearSelected+=this.yearNow-(this.yearNow%100);
994 var e=this.options.maxDate.getFullYear();
995 while(this.oyearSelected>e){this.oyearSelected-=100
996 }}}else{if(b){alert("ERROR: invalid date passed to calendar ("+b+")")
997 }}}}if(this.oyearSelected>0){this.dateSelected=this.odateSelected;
998 this.monthSelected=this.omonthSelected;
999 this.yearSelected=this.oyearSelected
1000 }else{this.dateSelected=this.dateNow;
1001 this.monthSelected=this.monthNow;
1002 this.yearSelected=this.yearNow
1003 }this.constructCalendar();
1004 this.openPopup()
1005 }};
1006 Rico.ColorPicker=function(b,a){this.initialize(b,a)
1007 };
1008 Rico.ColorPicker.prototype={initialize:function(h,c){this.id=h;
1009 this.currentValue="#FFFFFF";
1010 Rico.extend(this,new Rico.Popup());
1011 Rico.extend(this.options,{showColorCode:false,cellsPerRow:18,palette:[]});
1012 var f=["00","33","66","99","CC","FF"];
1013 for(var e=0;
1014 e<f.length;
1015 e++){for(var d=0;
1016 d<f.length;
1017 d++){for(var a=0;
1018 a<f.length;
1019 a++){this.options.palette.push(f[d]+f[e]+f[a])
1020 }}}Rico.extend(this.options,c||{})
1021 },atLoad:function(){this.createContainer();
1022 this.content.className="ricoColorPicker";
1023 var c=this.options.cellsPerRow;
1024 var d="<TABLE BORDER='1' CELLSPACING='1' CELLPADDING='0'>";
1025 for(var b=0;
1026 b<this.options.palette.length;
1027 b++){if((b%c)==0){d+="<TR>"
1028 }d+='<TD BGCOLOR="#'+this.options.palette[b]+'">&nbsp;</TD>';
1029 if(((b+1)>=this.options.palette.length)||(((b+1)%c)==0)){d+="</TR>"
1030 }}var a=Math.floor(c/2);
1031 if(this.options.showColorCode){d+="<TR><TD COLSPAN='"+a+"' ID='colorPickerSelectedColor'>&nbsp;</TD><TD COLSPAN='"+(c-a)+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>"
1032 }else{d+="<TR><TD COLSPAN='"+c+"' ID='colorPickerSelectedColor'>&nbsp;</TD></TR>"
1033 }d+="</TABLE>";
1034 this.content.innerHTML=d;
1035 this.open=this.openPopup;
1036 this.close=this.closePopup;
1037 Rico.eventBind(this.container,"mouseover",Rico.eventHandle(this,"highlightColor"),false);
1038 Rico.eventBind(this.container,"click",Rico.eventHandle(this,"selectColor"),false);
1039 this.close()
1040 },selectColor:function(a){Rico.eventStop(a);
1041 if(this.returnValue){this.returnValue(this.currentValue)
1042 }this.close()
1043 },highlightColor:function(b){var a=Rico.eventElement(b);
1044 if(!a.tagName||a.tagName.toLowerCase()!="td"){return
1045 }var g=Rico.Color.createColorFromBackground(a).toString();
1046 this.currentValue=g;
1047 Rico.setStyle("colorPickerSelectedColor",{backgroundColor:g});
1048 var f=Rico.$("colorPickerSelectedColorValue");
1049 if(f){f.innerHTML=g
1050 }}};
1051 Rico.dndMgrList=[];
1052 Rico.registerDraggable=function(b,a){if(typeof a!="number"){a=0
1053 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr()
1054 }Rico.dndMgrList[a].registerDraggable(b)
1055 };
1056 Rico.registerDropZone=function(b,a){if(typeof a!="number"){a=0
1057 }if(typeof Rico.dndMgrList[a]!="object"){Rico.dndMgrList[a]=new Rico.dndMgr()
1058 }Rico.dndMgrList[a].registerDropZone(b)
1059 };
1060 Rico.dndMgr=function(){this.initialize()
1061 };
1062 Rico.dndMgr.prototype={initialize:function(){this.dropZones=[];
1063 this.draggables=[];
1064 this.currentDragObjects=[];
1065 this.dragElement=null;
1066 this.lastSelectedDraggable=null;
1067 this.currentDragObjectVisible=false;
1068 this.interestedInMotionEvents=false;
1069 this._mouseDown=Rico.eventHandle(this,"_mouseDownHandler");
1070 this._mouseMove=Rico.eventHandle(this,"_mouseMoveHandler");
1071 this._mouseUp=Rico.eventHandle(this,"_mouseUpHandler")
1072 },registerDropZone:function(a){this.dropZones[this.dropZones.length]=a
1073 },deregisterDropZone:function(a){var d=new Array();
1074 var b=0;
1075 for(var c=0;
1076 c<this.dropZones.length;
1077 c++){if(this.dropZones[c]!=a){d[b++]=this.dropZones[c]
1078 }}this.dropZones=d
1079 },clearDropZones:function(){this.dropZones=new Array()
1080 },registerDraggable:function(a){this.draggables[this.draggables.length]=a;
1081 var b=a.getMouseDownHTMLElement();
1082 if(b!=null){b.ricoDraggable=a;
1083 Rico.eventBind(b,"mousedown",Rico.eventHandle(this,"_attachEvents"));
1084 Rico.eventBind(b,"mousedown",this._mouseDown)
1085 }},clearSelection:function(){for(var a=0;
1086 a<this.currentDragObjects.length;
1087 a++){this.currentDragObjects[a].deselect()
1088 }this.currentDragObjects=new Array();
1089 this.lastSelectedDraggable=null
1090 },hasSelection:function(){return this.currentDragObjects.length>0
1091 },setStartDragFromElement:function(a,c){this.origPos=Rico.cumulativeOffset(c);
1092 var b=Rico.eventClient(a);
1093 this.startx=b.x-this.origPos.left;
1094 this.starty=b.y-this.origPos.top;
1095 this.interestedInMotionEvents=this.hasSelection();
1096 Rico.eventStop(a)
1097 },updateSelection:function(a,b){if(!b){this.clearSelection()
1098 }if(a.isSelected()){this.currentDragObjects=this.currentDragObjects.without(a);
1099 a.deselect();
1100 if(a==this.lastSelectedDraggable){this.lastSelectedDraggable=null
1101 }}else{a.select();
1102 if(a.isSelected()){this.currentDragObjects.push(a);
1103 this.lastSelectedDraggable=a
1104 }}},_mouseDownHandler:function(f){if(!Rico.eventLeftClick(f)){return
1105 }var d=Rico.eventElement(f);
1106 var a=d.ricoDraggable;
1107 var c=d;
1108 while(a==null&&c.parentNode){c=c.parentNode;
1109 a=c.ricoDraggable
1110 }if(a==null){return
1111 }this.updateSelection(a,f.ctrlKey);
1112 if(this.hasSelection()){for(var b=0;
1113 b<this.dropZones.length;
1114 b++){this.dropZones[b].clearPositionCache()
1115 }}this.setStartDragFromElement(f,a.getMouseDownHTMLElement())
1116 },_mouseMoveHandler:function(a){if(!this.interestedInMotionEvents){return
1117 }if(!this.hasSelection()){return
1118 }if(!this.currentDragObjectVisible){this._startDrag(a)
1119 }if(!this.activatedDropZones){this._activateRegisteredDropZones()
1120 }this._updateDraggableLocation(a);
1121 this._updateDropZonesHover(a);
1122 Rico.eventStop(a)
1123 },_makeDraggableObjectVisible:function(b){if(!this.hasSelection()){return
1124 }var a;
1125 if(this.currentDragObjects.length>1){a=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects)
1126 }else{a=this.currentDragObjects[0].getSingleObjectDragGUI()
1127 }this.dragElemPosition=Rico.getStyle(a,"position");
1128 if(this.dragElemPosition!="absolute"){a.style.position="absolute"
1129 }if(a.parentNode==null||a.parentNode.nodeType==11){document.body.appendChild(a)
1130 }this.dragElement=a;
1131 this._updateDraggableLocation(b);
1132 this.currentDragObjectVisible=true
1133 },_leftOffset:function(a){return a.offsetX?document.body.scrollLeft:0
1134 },_topOffset:function(a){return a.offsetY?document.body.scrollTop:0
1135 },_updateDraggableLocation:function(b){var a=this.dragElement.style;
1136 var c=Rico.eventClient(b);
1137 a.left=(c.x+this._leftOffset(b)-this.startx)+"px";
1138 a.top=(c.y+this._topOffset(b)-this.starty)+"px"
1139 },_updateDropZonesHover:function(b){var a,c=this.dropZones.length;
1140 for(a=0;
1141 a<c;
1142 a++){if(!this._mousePointInDropZone(b,this.dropZones[a])){this.dropZones[a].hideHover()
1143 }}for(a=0;
1144 a<c;
1145 a++){if(this._mousePointInDropZone(b,this.dropZones[a])){if(this.dropZones[a].canAccept(this.currentDragObjects)){this.dropZones[a].showHover()
1146 }}}},_startDrag:function(b){for(var a=0;
1147 a<this.currentDragObjects.length;
1148 a++){this.currentDragObjects[a].startDrag()
1149 }this._makeDraggableObjectVisible(b)
1150 },_mouseUpHandler:function(b){if(!this.hasSelection()){return
1151 }if(!Rico.eventLeftClick(b)){return
1152 }this.interestedInMotionEvents=false;
1153 if(this._placeDraggableInDropZone(b)){this._completeDropOperation(b)
1154 }else{if(this.dragElement!=null){Rico.eventStop(b);
1155 var a=this;
1156 Rico.animate(this.dragElement,{duration:300,onEnd:function(){a._doCancelDragProcessing()
1157 }},{left:this.origPos.left,top:this.origPos.top})
1158 }}Rico.eventUnbind(document.body,"mousemove",this._mouseMove);
1159 Rico.eventUnbind(document.body,"mouseup",this._mouseUp)
1160 },_retTrue:function(){return true
1161 },_completeDropOperation:function(a){if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
1162 }}this._deactivateRegisteredDropZones();
1163 this._endDrag();
1164 this.clearSelection();
1165 this.dragElement=null;
1166 this.currentDragObjectVisible=false;
1167 Rico.eventStop(a)
1168 },_doCancelDragProcessing:function(){this._cancelDrag();
1169 if(this.dragElement==this.currentDragObjects[0].getMouseDownHTMLElement()){this.dragElement.style.position=this.dragElemPosition
1170 }else{if(this.dragElement&&this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
1171 }}this._deactivateRegisteredDropZones();
1172 this.dragElement=null;
1173 this.currentDragObjectVisible=false
1174 },_placeDraggableInDropZone:function(c){var a=false;
1175 var d=this.dropZones.length;
1176 for(var b=0;
1177 b<d;
1178 b++){if(this._mousePointInDropZone(c,this.dropZones[b])){if(this.dropZones[b].canAccept(this.currentDragObjects)){this.dropZones[b].hideHover();
1179 this.dropZones[b].accept(this.currentDragObjects);
1180 a=true;
1181 break
1182 }}}return a
1183 },_cancelDrag:function(){for(var a=0;
1184 a<this.currentDragObjects.length;
1185 a++){this.currentDragObjects[a].cancelDrag()
1186 }},_endDrag:function(){for(var a=0;
1187 a<this.currentDragObjects.length;
1188 a++){this.currentDragObjects[a].endDrag()
1189 }},_mousePointInDropZone:function(b,c){var a=c.getAbsoluteRect();
1190 var d=Rico.eventClient(b);
1191 return d.x>a.left+this._leftOffset(b)&&d.x<a.right+this._leftOffset(b)&&d.y>a.top+this._topOffset(b)&&d.y<a.bottom+this._topOffset(b)
1192 },_activateRegisteredDropZones:function(){var c=this.dropZones.length;
1193 for(var a=0;
1194 a<c;
1195 a++){var b=this.dropZones[a];
1196 if(b.canAccept(this.currentDragObjects)){b.activate()
1197 }}this.activatedDropZones=true
1198 },_deactivateRegisteredDropZones:function(){var b=this.dropZones.length;
1199 for(var a=0;
1200 a<b;
1201 a++){this.dropZones[a].deactivate()
1202 }this.activatedDropZones=false
1203 },_attachEvents:function(){Rico.eventBind(document.body,"mousemove",this._mouseMove);
1204 Rico.eventBind(document.body,"mouseup",this._mouseUp)
1205 }};
1206 Rico.Draggable=function(a,b){this.initialize(a,b)
1207 };
1208 Rico.Draggable.prototype={initialize:function(a,b){this.type=a;
1209 this.htmlElement=Rico.$(b);
1210 this.selected=false
1211 },getMouseDownHTMLElement:function(){return this.htmlElement
1212 },select:function(){this._select()
1213 },_select:function(){this.selected=true;
1214 if(this.showingSelected){return
1215 }this.showingSelected=true;
1216 var b=this.getMouseDownHTMLElement();
1217 var a=Rico.Color.createColorFromBackground(b);
1218 a.isBright()?a.darken(0.033):a.brighten(0.033);
1219 this.saveBackground=Rico.getStyle(b,"backgroundColor","background-color");
1220 b.style.backgroundColor=a.asHex()
1221 },deselect:function(){this.selected=false;
1222 if(!this.showingSelected){return
1223 }var a=this.getMouseDownHTMLElement();
1224 a.style.backgroundColor=this.saveBackground;
1225 this.showingSelected=false
1226 },isSelected:function(){return this.selected
1227 },startDrag:function(){},cancelDrag:function(){},endDrag:function(){},getSingleObjectDragGUI:function(){return this.htmlElement
1228 },getMultiObjectDragGUI:function(a){return this.htmlElement
1229 },getDroppedGUI:function(){return this.htmlElement
1230 },toString:function(){return this.type+":"+this.htmlElement+":"
1231 }};
1232 Rico.LiveGridDraggable=function(b,a,c){this.initialize(b,a,c)
1233 };
1234 Rico.LiveGridDraggable.prototype=Rico.extend(new Rico.Draggable(),{initialize:function(b,a,c){this.type="RicoCell";
1235 this.htmlElement=b.cell(a,c);
1236 this.liveGrid=b;
1237 this.dragRow=a;
1238 this.dragCol=c
1239 },select:function(){if(this.dragRow>=this.liveGrid.buffer.totalRows){return
1240 }this.selected=true;
1241 this.showingSelected=true
1242 },deselect:function(){this.selected=false;
1243 this.showingSelected=false
1244 },getSingleObjectDragGUI:function(){var a=document.createElement("div");
1245 a.className="LiveGridDraggable";
1246 a.style.width=(this.htmlElement.offsetWidth-10)+"px";
1247 a.innerHTML=this.htmlElement.innerHTML;
1248 return a
1249 }});
1250 Rico.Dropzone=function(a){this.initialize(a)
1251 };
1252 Rico.Dropzone.prototype={initialize:function(a){this.htmlElement=Rico.$(a);
1253 this.absoluteRect=null
1254 },getHTMLElement:function(){return this.htmlElement
1255 },clearPositionCache:function(){this.absoluteRect=null
1256 },getAbsoluteRect:function(){if(this.absoluteRect==null){var a=this.getHTMLElement();
1257 var b=Rico.viewportOffset(a);
1258 this.absoluteRect={top:b.top,left:b.left,bottom:b.top+a.offsetHeight,right:b.left+a.offsetWidth}
1259 }return this.absoluteRect
1260 },activate:function(){var c=this.getHTMLElement();
1261 if(c==null||this.showingActive){return
1262 }this.showingActive=true;
1263 this.saveBackgroundColor=c.style.backgroundColor;
1264 var b="#ffea84";
1265 var a=Rico.Color.createColorFromBackground(c);
1266 if(a==null){c.style.backgroundColor=b
1267 }else{a.isBright()?a.darken(0.2):a.brighten(0.2);
1268 c.style.backgroundColor=a.asHex()
1269 }},deactivate:function(){var a=this.getHTMLElement();
1270 if(a==null||!this.showingActive){return
1271 }a.style.backgroundColor=this.saveBackgroundColor;
1272 this.showingActive=false;
1273 this.saveBackgroundColor=null
1274 },showHover:function(){var a=this.getHTMLElement();
1275 if(a==null||this.showingHover){return
1276 }this.saveBorderWidth=a.style.borderWidth;
1277 this.saveBorderStyle=a.style.borderStyle;
1278 this.saveBorderColor=a.style.borderColor;
1279 this.showingHover=true;
1280 a.style.borderWidth="1px";
1281 a.style.borderStyle="solid";
1282 a.style.borderColor="#ffff00"
1283 },hideHover:function(){var a=this.getHTMLElement();
1284 if(a==null||!this.showingHover){return
1285 }a.style.borderWidth=this.saveBorderWidth;
1286 a.style.borderStyle=this.saveBorderStyle;
1287 a.style.borderColor=this.saveBorderColor;
1288 this.showingHover=false
1289 },canAccept:function(a){return true
1290 },accept:function(b){var d=this.getHTMLElement();
1291 if(d==null){return
1292 }var e=b.length;
1293 for(var a=0;
1294 a<e;
1295 a++){var c=b[a].getDroppedGUI();
1296 if(Rico.getStyle(c,"position")=="absolute"){c.style.position="static";
1297 c.style.top="";
1298 c.style.top=""
1299 }d.appendChild(c)
1300 }}};
1301 Rico.KeywordSearch=function(b,a){this.initialize(b,a)
1302 };
1303 Rico.KeywordSearch.prototype={initialize:function(b,a){this.id=b;
1304 Rico.extend(this,new Rico.Window(Rico.getPhraseById("keywordTitle"),a));
1305 Rico.addClass(this.content,"ricoKeywordSearch");
1306 Rico.extend(this.options,{listLength:10,maxSuggest:20,width:"12em"})
1307 },atLoad:function(){this.searchField=Rico.createFormField(this.contentDiv,"input","text",this.id+"_search");
1308 this.searchField.style.display="block";
1309 this.searchField.style.width=this.options.width;
1310 Rico.eventBind(this.searchField,"keyup",Rico.eventHandle(this,"filterKeypress"),false);
1311 this.selectList=Rico.createFormField(this.contentDiv,"select",null,this.id+"_list");
1312 this.selectList.size=this.options.listLength;
1313 this.selectList.style.display="block";
1314 this.selectList.style.width=this.options.width;
1315 Rico.eventBind(this.selectList,"change",Rico.eventHandle(this,"listClick"),false);
1316 this.close=this.closePopup;
1317 this.close()
1318 },open:function(a,b){this.column=b;
1319 this.grid=this.column.liveGrid;
1320 this.searchField.value="";
1321 this.selectList.options.length=0;
1322 this.openPopup();
1323 this.searchField.focus();
1324 this.selectValuesRequest("")
1325 },selectValuesRequest:function(c){var d=this.column.index;
1326 var b={};
1327 Rico.extend(b,this.grid.buffer.ajaxOptions);
1328 b.parameters={id:this.grid.tableId,offset:"0",page_size:this.options.maxSuggest,edit:d};
1329 b.parameters[this.grid.actionId]="query";
1330 if(c!=""&&c!="*"){if(c.indexOf("*")==-1){c="*"+c+"*"
1331 }b.parameters["f[1][op]"]="LIKE";
1332 b.parameters["f[1][len]"]=1;
1333 b.parameters["f[1][0]"]=c
1334 }var a=this;
1335 b.onComplete=function(e){a.selectValuesUpdate(e)
1336 };
1337 new Rico.ajaxRequest(this.grid.buffer.dataSource,b)
1338 },selectValuesUpdate:function(b){var a=b.responseXML.getElementsByTagName("ajax-response");
1339 Rico.log("selectValuesUpdate: "+b.status);
1340 if(a==null||a.length!=1){return
1341 }a=a[0];
1342 var h=a.getElementsByTagName("error");
1343 if(h.length>0){var f=Rico.getContentAsString(h[0],this.grid.buffer.isEncoded);
1344 Rico.log("Data provider returned an error:\n"+f);
1345 alert(Rico.getPhraseById("requestError",f));
1346 return null
1347 }this.selectList.options.length=0;
1348 a=a.getElementsByTagName("response")[0];
1349 var g=a.getElementsByTagName("rows")[0];
1350 var j=this.grid.buffer.dom2jstable(g);
1351 Rico.log("selectValuesUpdate: id="+this.selectList.id+" rows="+j.length);
1352 for(var d=0;
1353 d<j.length;
1354 d++){if(j[d].length>0){var e=j[d][0];
1355 var c=(j[d].length>1)?j[d][1]:e;
1356 Rico.addSelectOption(this.selectList,e,c)
1357 }}},filterKeypress:function(c){var a=Rico.eventElement(c);
1358 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
1359 }if(this.lastKeyFilter==a.value){return
1360 }var b=a.value;
1361 Rico.log("filterKeypress: "+this.index+" "+b);
1362 this.lastKeyFilter=b;
1363 this.selectValuesRequest(b)
1364 },listClick:function(c){var b=Rico.eventElement(c);
1365 if(b.tagName.toLowerCase()!="select"){return
1366 }if(this.returnValue){var a=b.options[b.selectedIndex];
1367 this.returnValue(a.value,a.innerHTML)
1368 }this.close()
1369 }};
1370 Rico.TreeControl=function(c,b,a){this.initialize(c,b,a)
1371 };
1372 Rico.TreeControl.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Popup());
1373 Rico.extend(this.options,{ignoreClicks:true,nodeIdDisplay:"none",showCheckBox:false,showFolders:false,showPlusMinus:true,showLines:true,defaultAction:Rico.eventHandle(this,"nodeClick"),height:"300px",width:"300px",leafIcon:"rico-icon rico-doc"});
1374 Rico.extend(this.options,a||{});
1375 this.id=c;
1376 this.dataSource=b;
1377 this.close=this.closePopup;
1378 this.hoverSet=new Rico.HoverSet([])
1379 },atLoad:function(){this.treeDiv=document.createElement("div");
1380 this.treeDiv.id=this.id;
1381 this.treeDiv.className="ricoTree";
1382 if(Rico.theme.treeContent){Rico.addClass(this.treeDiv,Rico.theme.treeContent)
1383 }this.treeDiv.style.height=this.options.height;
1384 this.treeDiv.style.width=this.options.width;
1385 this.createContainer();
1386 this.content.className=Rico.theme.tree||"ricoTreeContainer";
1387 this.content.appendChild(this.treeDiv);
1388 if(this.options.showCheckBox){this.buttonDiv=document.createElement("div");
1389 this.buttonDiv.style.width=this.options.width;
1390 this.buttonDiv.className="ricoTreeButtons";
1391 if(Rico.getStyle(this.container,"position")=="absolute"){var a=document.createElement("span");
1392 a.innerHTML=RicoTranslate.getPhraseById("treeSave");
1393 Rico.setStyle(a,{"float":"left",cursor:"pointer"});
1394 this.buttonDiv.appendChild(a);
1395 Rico.eventBind(a,"click",Rico.eventHandle(this,"saveSelection"))
1396 }var a=document.createElement("span");
1397 a.innerHTML=RicoTranslate.getPhraseById("treeClear");
1398 Rico.setStyle(a,{"float":"right",cursor:"pointer"});
1399 this.buttonDiv.appendChild(a);
1400 this.content.appendChild(this.buttonDiv);
1401 Rico.eventBind(a,"click",Rico.eventHandle(this,"clrCheckBoxEvent"))
1402 }this.close()
1403 },setTreeDiv:function(a){this.treeDiv=Rico.$(a);
1404 this.openPopup=function(){}
1405 },open:function(){this.openPopup();
1406 if(this.treeDiv.childNodes.length==0&&this.dataSource){this.loadXMLDoc()
1407 }},loadXMLDoc:function(c){var b={id:this.id};
1408 if(c){b.Parent=c
1409 }Rico.log("Tree loadXMLDoc: "+this.id);
1410 var a=this;
1411 new Rico.ajaxRequest(this.dataSource,{parameters:b,method:"get",onComplete:function(d){a.processResponse(d)
1412 }})
1413 },domID:function(b,a){return"RicoTree_"+a+"_"+this.id+"_"+b
1414 },processResponse:function(d){var b=d.responseXML.getElementsByTagName("ajax-response");
1415 if(b==null||b.length!=1){return
1416 }var f=b[0].getElementsByTagName("rows")[0];
1417 var g=f.getElementsByTagName("tr");
1418 var k=[];
1419 for(var e=0;
1420 e<g.length;
1421 e++){var l=g[e].getElementsByTagName("td");
1422 if(l.length<5){continue
1423 }var h=[];
1424 h[5]=this.options.leafIcon;
1425 for(var c=0;
1426 c<l.length;
1427 c++){h[c]=Rico.getContentAsString(l[c],true)
1428 }h[3]=h[3].match(/^0|L$/i)?0:1;
1429 h[4]=parseInt(h[4]);
1430 k.push(h)
1431 }for(var e=0;
1432 e<k.length;
1433 e++){var a=(e<k.length-1)&&(k[e][0]==k[e+1][0]);
1434 this.addNode(k[e][0],k[e][1],k[e][2],k[e][3],k[e][4],k[e][5],!a)
1435 }},addNode:function(q,l,t,f,u,s,k){var h=Rico.$(this.domID(q,"Parent"));
1436 var v=Rico.$(this.domID(q,"Children"));
1437 var a=h?h.TreeLevel+1:0;
1438 var b=document.createElement("table");
1439 var m=document.createElement("div");
1440 m.id=this.domID(l,"Children");
1441 m.className="ricoTreeBranch";
1442 m.style.display=h?"none":"";
1443 b.border=0;
1444 b.cellSpacing=0;
1445 b.cellPadding=0;
1446 b.id=this.domID(l,"Parent");
1447 b.TreeLevel=a;
1448 b.TreeContainer=f;
1449 b.TreeFetchedChildren=this.dataSource?false:true;
1450 var d=b.insertRow(0);
1451 var g=[];
1452 for(var r=0;
1453 r<a-1;
1454 r++){g[r]=d.insertCell(-1)
1455 }if(a>1){var e=h.getElementsByTagName("td");
1456 for(var r=0;
1457 r<a-2;
1458 r++){g[r].innerHTML=e[r].innerHTML
1459 }var w=document.createElement("div");
1460 w.className="rico-icon rico-tree-"+(v.nextSibling&&this.options.showLines?"nodeline":"nodeblank");
1461 g[a-2].appendChild(w)
1462 }if(a>0){var c=k&&this.options.showLines?"last":"";
1463 var o=this.options.showLines?"node":"";
1464 if(this.options.showPlusMinus&&f){var w=document.createElement("div");
1465 w.name=l;
1466 w.style.cursor="pointer";
1467 Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch"));
1468 w.className="rico-icon rico-tree-"+o+"p"+c;
1469 d.insertCell(-1).appendChild(w)
1470 }else{if(this.options.showLines){var w=document.createElement("div");
1471 w.className="rico-icon rico-tree-node"+c;
1472 d.insertCell(-1).appendChild(w)
1473 }}if(this.options.showFolders&&(f||(s&&s!="none"))){var w=document.createElement("div");
1474 if(!f){w.className=s
1475 }else{w.name=l;
1476 w.style.cursor="pointer";
1477 Rico.eventBind(w,"click",Rico.eventHandle(this,"clickBranch"));
1478 w.className="rico-icon rico-folderclosed"
1479 }d.insertCell(-1).appendChild(w)
1480 }}if(u&&this.options.showCheckBox){var n=document.createElement("input");
1481 n.type="checkbox";
1482 n.value=l;
1483 d.insertCell(-1).appendChild(n)
1484 }if(u&&!this.options.showCheckBox){var p=document.createElement("a");
1485 if(typeof u=="string"){p.href=u
1486 }else{p.href="javascript:void(0)";
1487 Rico.eventBind(p,"click",this.options.defaultAction)
1488 }this.hoverSet.add(p)
1489 }else{var p=document.createElement("p")
1490 }p.id=this.domID(l,"Desc");
1491 p.className="ricoTreeLevel"+a;
1492 switch(this.options.nodeIdDisplay){case"last":t+=" ("+l+")";
1493 break;
1494 case"first":t=l+" - "+t;
1495 break;
1496 case"tooltip":p.title=l;
1497 break
1498 }p.appendChild(document.createTextNode(t));
1499 d.insertCell(-1).appendChild(p);
1500 var j=v||this.treeDiv;
1501 j.appendChild(b);
1502 j.appendChild(m)
1503 },nodeClick:function(c){var b=Rico.eventElement(c);
1504 if(this.returnValue){var a=this.domID("","Desc");
1505 this.returnValue(b.id.substr(a.length),b.innerHTML)
1506 }this.close()
1507 },saveSelection:function(a){if(this.returnValue){this.returnValue(this.getCheckedItems())
1508 }this.close()
1509 },getCheckedItems:function(){var b=this.treeDiv.getElementsByTagName("input");
1510 var c=[];
1511 for(var a=0;
1512 a<b.length;
1513 a++){if(b[a].type=="checkbox"&&b[a].checked){c.push(b[a].value)
1514 }}return c
1515 },setCheckBoxes:function(c){var b=this.treeDiv.getElementsByTagName("input");
1516 for(var a=0;
1517 a<b.length;
1518 a++){if(b[a].type=="checkbox"){b[a].checked=c
1519 }}},clrCheckBoxEvent:function(a){Rico.eventStop(a);
1520 this.setCheckBoxes(false)
1521 },clickBranch:function(h){var g=Rico.eventElement(h);
1522 var f=Rico.getParentByTagName(g,"table");
1523 if(!f||!f.TreeContainer){return
1524 }var c=f.id.split("_");
1525 c[1]="Children";
1526 var b=Rico.$(c.join("_"));
1527 Rico.toggle(b);
1528 if(g.tagName=="DIV"){var d=Rico.visible(b);
1529 if(g.className.match(/node(p|m)(last)?$/)){g.className=g.className.replace(/nodep|nodem/,"node"+(d?"m":"p"))
1530 }else{if(g.className.match(/folder(open|closed)$/)){g.className=g.className.replace(/folder(open|closed)/,"folder"+(d?"open":"closed"))
1531 }else{if(g.className.match(/\b(m|p)$/)){g.className=g.className.replace(/(p|m)$/,d?"m":"p")
1532 }}}}if(!f.TreeFetchedChildren){f.TreeFetchedChildren=1;
1533 this.loadXMLDoc(g.name)
1534 }}};
1535 if(typeof Rico=="undefined"){throw ("GridCommon requires the Rico JavaScript framework")
1536 }Rico.GridCommon={baseInit:function(){this.options={saveColumnInfo:{width:true,filter:false,sort:false},cookiePrefix:"RicoGrid.",allowColResize:true,windowResize:true,click:null,dblclick:null,contextmenu:null,menuEvent:null,defaultWidth:-1,scrollBarWidth:19,minScrollWidth:100,frozenColumns:0,exportWindow:"height=400,width=500,scrollbars=1,menubar=1,resizable=1,location=0,toolbar=0,status=0",exportStyleList:["background-color","color","text-align","font-weight","font-size","font-family"],exportImgTags:false,exportFormFields:true,FilterLocation:null,FilterAllToken:"___ALL___",columnSpecs:[]};
1537 this.hdrCells=[];
1538 this.headerColCnt=0;
1539 this.headerRowIdx=0;
1540 this.tabs=new Array(2);
1541 this.thead=new Array(2);
1542 this.tbody=new Array(2)
1543 },attachMenuEvents:function(){var a;
1544 if(!this.options.menuEvent||this.options.menuEvent=="none"){return
1545 }this.hideScroll=navigator.userAgent.match(/Macintosh\b.*\b(Firefox|Camino)\b/i)||(Rico.isOpera&&parseFloat(window.opera.version())<9.5);
1546 this.options[this.options.menuEvent]=Rico.eventHandle(this,"handleMenuClick");
1547 if(this.highlightDiv){switch(this.options.highlightElem){case"cursorRow":this.attachMenu(this.highlightDiv[0]);
1548 break;
1549 case"cursorCell":for(a=0;
1550 a<2;
1551 a++){this.attachMenu(this.highlightDiv[a])
1552 }break
1553 }}for(a=0;
1554 a<2;
1555 a++){this.attachMenu(this.tbody[a])
1556 }},attachMenu:function(a){if(this.options.click){Rico.eventBind(a,"click",this.options.click,false)
1557 }if(this.options.dblclick){if(Rico.isWebKit||Rico.isOpera){Rico.eventBind(a,"click",Rico.eventHandle(this,"handleDblClick"),false)
1558 }else{Rico.eventBind(a,"dblclick",this.options.dblclick,false)
1559 }}if(this.options.contextmenu){if(Rico.isOpera||Rico.isKonqueror){Rico.eventBind(a,"click",Rico.eventHandle(this,"handleContextMenu"),false)
1560 }else{Rico.eventBind(a,"contextmenu",this.options.contextmenu,false)
1561 }}},handleDblClick:function(b){var a=Rico.eventElement(b);
1562 if(this.dblClickElem==a){this.options.dblclick(b)
1563 }else{this.dblClickElem=a;
1564 this.safariTimer=Rico.runLater(300,this,"clearDblClick")
1565 }},clearDblClick:function(){this.dblClickElem=null
1566 },handleContextMenu:function(c){var a;
1567 if(typeof(c.which)=="number"){a=c.which
1568 }else{if(typeof(c.button)=="number"){a=c.button
1569 }else{return
1570 }}if(a==1&&c.ctrlKey){this.options.contextmenu(c)
1571 }},cancelMenu:function(){if(this.menu){this.menu.cancelmenu()
1572 }},getColumnInfo:function(f){Rico.log("getColumnInfo: len="+f.length);
1573 if(f.length==0){return 0
1574 }this.headerRowCnt=f.length;
1575 var d,h,e;
1576 for(d=0;
1577 d<this.headerRowCnt;
1578 d++){var b=f[d];
1579 var a=b.cells;
1580 if(d>=this.hdrCells.length){this.hdrCells[d]=[]
1581 }for(h=0;
1582 h<a.length;
1583 h++){var g={};
1584 g.cell=a[h];
1585 g.colSpan=a[h].colSpan||1;
1586 if(this.options.defaultWidth<0){g.initWidth=a[h].offsetWidth
1587 }this.hdrCells[d].push(g)
1588 }if(b.id.slice(-5)=="_main"){e=this.hdrCells[d].length;
1589 this.headerRowIdx=d
1590 }}if(!e){this.headerRowIdx=this.headerRowCnt-1;
1591 e=this.hdrCells[this.headerRowIdx].length
1592 }Rico.log("getColumnInfo: colcnt="+e);
1593 return e
1594 },addHeadingRow:function(g){var a=this.headerRowCnt++;
1595 this.hdrCells[a]=[];
1596 for(var e=0;
1597 e<2;
1598 e++){var k=this.thead[e].insertRow(-1);
1599 var f="ricoLG_hdg "+this.tableId+"_hdg"+a;
1600 if(g){f+=" "+g
1601 }k.className=f;
1602 var b=e==0?this.options.frozenColumns:this.headerColCnt-this.options.frozenColumns;
1603 for(var j=0;
1604 j<b;
1605 j++){var d=k.insertCell(-1);
1606 var i=Rico.wrapChildren(d,"ricoLG_col");
1607 Rico.wrapChildren(i,"ricoLG_cell");
1608 this.hdrCells[a].push({cell:d,colSpan:1})
1609 }}return a
1610 },createColumnArray:function(b){this.direction=Rico.getStyle(this.outerDiv,"direction").toLowerCase();
1611 this.align=this.direction=="rtl"?["right","left"]:["left","right"];
1612 Rico.log("createColumnArray: dir="+this.direction);
1613 this.columns=[];
1614 for(var e=0;
1615 e<this.headerColCnt;
1616 e++){Rico.log("createColumnArray: c="+e);
1617 var d=e<this.options.frozenColumns?0:1;
1618 var a=new Rico[b](this,e,this.hdrCells[this.headerRowIdx][e],d);
1619 this.columns.push(a);
1620 if(e>0){this.columns[e-1].next=a
1621 }}this.getCookie();
1622 Rico.runLater(100,this,"insertResizers")
1623 },insertResizers:function(){if(!this.options.allowColResize){return
1624 }for(var a=0;
1625 a<this.columns.length;
1626 a++){this.columns[a].insertResizer()
1627 }},createDivs:function(){Rico.log("createDivs start");
1628 this.outerDiv=this.createDiv("outer");
1629 if(Rico.theme.gridContainer){Rico.addClass(this.outerDiv,Rico.theme.gridContainer)
1630 }if(this.outerDiv.firstChild&&this.outerDiv.firstChild.tagName&&this.outerDiv.firstChild.tagName.toUpperCase()=="TABLE"){this.structTab=this.outerDiv.firstChild;
1631 this.structTabLeft=this.structTab.rows[0].cells[0];
1632 this.structTabUR=this.structTab.rows[0].cells[1];
1633 this.structTabLR=this.structTab.rows[1].cells[0]
1634 }else{this.structTab=document.createElement("table");
1635 this.structTab.border=0;
1636 this.structTab.cellPadding=0;
1637 this.structTab.cellSpacing=0;
1638 var b=this.structTab.insertRow(-1);
1639 b.vAlign="top";
1640 this.structTabLeft=b.insertCell(-1);
1641 this.structTabLeft.rowSpan=2;
1642 this.structTabLeft.style.padding="0px";
1643 this.structTabLeft.style.border="none";
1644 var d=this.structTab.insertRow(-1);
1645 d.vAlign="top";
1646 this.structTabUR=b.insertCell(-1);
1647 this.structTabUR.style.padding="0px";
1648 this.structTabUR.style.border="none";
1649 this.structTabLR=d.insertCell(-1);
1650 this.structTabLR.style.padding="0px";
1651 this.structTabLR.style.border="none";
1652 this.outerDiv.appendChild(this.structTab)
1653 }Rico.addClass(this.structTab,"ricoLG_StructTab");
1654 this.frozenTabs=this.createDiv("frozenTabs",this.structTabLeft);
1655 this.innerDiv=this.createDiv("inner",this.structTabUR);
1656 this.scrollDiv=this.createDiv("scroll",this.structTabLR);
1657 this.resizeDiv=this.createDiv("resize",this.outerDiv,true);
1658 this.messagePopup=new Rico.Popup();
1659 this.messagePopup.createContainer({hideOnEscape:false,hideOnClick:false,parent:this.outerDiv});
1660 this.messagePopup.content.className="ricoLG_messageDiv";
1661 if(Rico.theme.gridMessage){Rico.addClass(this.messagePopup.content,Rico.theme.gridMessage)
1662 }this.keywordPopup=new Rico.Window("",{zIndex:-1,parent:this.outerDiv});
1663 Rico.addClass(this.keywordPopup.container,"ricoLG_keywordDiv");
1664 var a=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
1665 a.innerHTML=Rico.getPhraseById("keywordPrompt");
1666 this.keywordBox=this.keywordPopup.contentDiv.appendChild(document.createElement("input"));
1667 this.keywordBox.size=20;
1668 Rico.eventBind(this.keywordBox,"keypress",Rico.eventHandle(this,"keywordKey"),false);
1669 this.keywordPopup.contentDiv.appendChild(Rico.floatButton("Checkmark",Rico.eventHandle(this,"processKeyword")));
1670 var c=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
1671 Rico.setStyle(c,{clear:"both"});
1672 Rico.log("createDivs end")
1673 },keywordKey:function(a){switch(Rico.eventKey(a)){case 27:this.closeKeyword();
1674 Rico.eventStop(a);
1675 return false;
1676 case 13:this.processKeyword();
1677 Rico.eventStop(a);
1678 return false
1679 }return true
1680 },openKeyword:function(a){this.keywordCol=a;
1681 this.keywordBox.value="";
1682 this.keywordPopup.setTitle(this.columns[a].displayName);
1683 this.keywordPopup.centerPopup();
1684 this.keywordBox.focus()
1685 },closeKeyword:function(){this.keywordPopup.closePopup();
1686 this.cancelMenu()
1687 },processKeyword:function(){var a=this.keywordBox.value;
1688 this.closeKeyword();
1689 this.columns[this.keywordCol].setFilterKW(a)
1690 },createDiv:function(c,a,b){var e=this.tableId+"_"+c+"Div";
1691 var d=document.getElementById(e);
1692 if(!d){d=document.createElement("div");
1693 d.id=e;
1694 if(a){a.appendChild(d)
1695 }}d.className="ricoLG_"+c+"Div";
1696 if(b){Rico.hide(d)
1697 }return d
1698 },baseSizeDivs:function(){this.setOtherHdrCellWidths();
1699 if(this.options.frozenColumns){Rico.show(this.tabs[0]);
1700 Rico.show(this.frozenTabs);
1701 this.hdrHt=Math.max(Rico.nan2zero(this.thead[0].offsetHeight),this.thead[1].offsetHeight);
1702 this.dataHt=Math.max(Rico.nan2zero(this.tbody[0].offsetHeight),this.tbody[1].offsetHeight);
1703 this.frzWi=this.borderWidth(this.tabs[0])
1704 }else{Rico.hide(this.tabs[0]);
1705 Rico.hide(this.frozenTabs);
1706 this.frzWi=0;
1707 this.hdrHt=this.thead[1].offsetHeight;
1708 this.dataHt=this.tbody[1].offsetHeight
1709 }var d,b;
1710 var c=this.borderWidth(this.columns[0].dataCell);
1711 Rico.log("baseSizeDivs "+this.tableId+": hdrHt="+this.hdrHt+" dataHt="+this.dataHt);
1712 Rico.log(this.tableId+" frzWi="+this.frzWi+" borderWi="+c);
1713 for(b=0;
1714 b<this.options.frozenColumns;
1715 b++){if(this.columns[b].visible){this.frzWi+=parseInt(this.columns[b].colWidth,10)+c
1716 }}this.scrTabWi=this.borderWidth(this.tabs[1]);
1717 this.scrTabWi0=this.scrTabWi;
1718 Rico.log("scrTabWi: "+this.scrTabWi);
1719 for(b=this.options.frozenColumns;
1720 b<this.columns.length;
1721 b++){if(this.columns[b].visible){this.scrTabWi+=parseInt(this.columns[b].colWidth,10)+c
1722 }}this.scrWi=this.scrTabWi+this.options.scrollBarWidth;
1723 if(this.sizeTo=="parent"){if(Rico.isIE){Rico.hide(this.outerDiv)
1724 }d=this.outerDiv.parentNode.offsetWidth;
1725 if(Rico.isIE){Rico.show(this.outerDiv)
1726 }}else{d=Rico.windowWidth()-this.options.scrollBarWidth-8
1727 }if(this.outerDiv.parentNode.clientWidth>0){d=Math.min(this.outerDiv.parentNode.clientWidth,d)
1728 }var a=this.frzWi+this.scrWi-d;
1729 Rico.log("baseSizeDivs "+this.tableId+": scrWi="+this.scrWi+" wiLimit="+d+" overage="+a+" clientWidth="+this.outerDiv.parentNode.clientWidth);
1730 if(a>0&&this.options.frozenColumns<this.columns.length){this.scrWi=Math.max(this.scrWi-a,this.options.minScrollWidth)
1731 }this.scrollDiv.style.width=this.scrWi+"px";
1732 this.frozenTabs.style.width=this.frzWi+"px";
1733 this.outerDiv.style.width=(this.frzWi+this.scrWi)+"px"
1734 },borderWidth:function(c){var a=Rico.nan2zero(Rico.getStyle(c,"borderLeftWidth"));
1735 var b=Rico.nan2zero(Rico.getStyle(c,"borderRightWidth"));
1736 Rico.log((c.id||c.tagName)+" borderWidth: L="+a+", R="+b);
1737 return a+b
1738 },setOtherHdrCellWidths:function(){var k,g,f,a,l,b,m,d,e,h;
1739 for(a=0;
1740 a<this.hdrCells.length;
1741 a++){if(a==this.headerRowIdx){continue
1742 }Rico.log("setOtherHdrCellWidths: r="+a);
1743 k=g=0;
1744 while(g<this.headerColCnt&&k<this.hdrCells[a].length){b=this.hdrCells[a][k];
1745 m=b.cell;
1746 d=e=b.colSpan;
1747 for(l=f=0;
1748 f<d;
1749 f++,g++){if(this.columns[g].hdrCell.style.display=="none"){e--
1750 }else{if(this.columns[g].hdrColDiv.style.display!="none"){l+=parseInt(this.columns[g].colWidth,10)
1751 }}}if(!b.hdrColDiv||!b.hdrCellDiv){h=m.getElementsByTagName("div");
1752 b.hdrColDiv=(h.length<1)?Rico.wrapChildren(m,"ricoLG_col"):h[0];
1753 b.hdrCellDiv=(h.length<2)?Rico.wrapChildren(b.hdrColDiv,"ricoLG_cell"):h[1]
1754 }if(e==0){m.style.display="none"
1755 }else{if(l==0){b.hdrColDiv.style.display="none";
1756 m.colSpan=e
1757 }else{m.style.display="";
1758 b.hdrColDiv.style.display="";
1759 m.colSpan=e;
1760 b.hdrColDiv.style.width=l+"px"
1761 }}k++
1762 }}},initFilterImage:function(a){this.filterAnchor=document.getElementById(this.tableId+"_filterLink");
1763 if(!this.filterAnchor){return
1764 }this.filterRows=Rico.select("tr."+this.tableId+"_hdg"+a);
1765 if(this.filterRows.length!=2){return
1766 }for(var c=0,d=[];
1767 c<2;
1768 c++){d[c]=Rico.select(".ricoLG_cell",this.filterRows[c])
1769 }this.filterElements=d[0].concat(d[1]);
1770 this.saveHeight=this.filterElements[0].offsetHeight;
1771 var e=Rico.getStyle(this.filterElements[0],"paddingTop");
1772 var b=Rico.getStyle(this.filterElements[0],"paddingBottom");
1773 if(e){this.saveHeight-=parseInt(e,10)
1774 }if(b){this.saveHeight-=parseInt(b,10)
1775 }this.rowNum=a;
1776 this.setFilterImage(false)
1777 },toggleFilterRow:function(){if(Rico.visible(this.filterRows[0])){this.slideFilterUp()
1778 }else{this.slideFilterDown()
1779 }},setFilterImage:function(b){var a=Rico.getPhraseById((b?"show":"hide")+"FilterRow");
1780 this.filterAnchor.innerHTML='<img src="'+Rico.imgDir+"tableFilter"+(b?"Expand":"Collapse")+'.gif" alt="'+a+'" border="0">'
1781 },cell:function(a,b){return(0<=b&&b<this.columns.length&&a>=0)?this.columns[b].cell(a):null
1782 },availHt:function(){var a=Rico.cumulativeOffset(this.outerDiv);
1783 return Rico.windowHeight()-a.top-2*this.options.scrollBarWidth-15
1784 },setHorizontalScroll:function(){var a=(-this.scrollDiv.scrollLeft)+"px";
1785 this.hdrTabs[1].style.marginLeft=a
1786 },pluginScroll:function(){if(this.scrollPluggedIn){return
1787 }Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
1788 this.scrollPluggedIn=true
1789 },unplugScroll:function(){Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
1790 this.scrollPluggedIn=false
1791 },hideMsg:function(){this.messagePopup.closePopup()
1792 },showMsg:function(a){this.messagePopup.setContent(a);
1793 this.messagePopup.centerPopup();
1794 Rico.log("showMsg: "+a)
1795 },listInvisible:function(b){var c=[];
1796 for(var a=0;
1797 a<this.columns.length;
1798 a++){if(!this.columns[a].visible){c.push(b?this.columns[a][b]:this.columns[a])
1799 }}return c
1800 },firstVisible:function(){for(var a=0;
1801 a<this.columns.length;
1802 a++){if(this.columns[a].visible){return a
1803 }}return -1
1804 },showAll:function(){var b=this.listInvisible();
1805 for(var a=0;
1806 a<b.length;
1807 a++){b[a].showColumn()
1808 }},chooseColumns:function(){this.menu.cancelmenu();
1809 var a,f,b,e,d,c;
1810 if(!this.columnChooser){Rico.log("creating columnChooser");
1811 f=Rico.getStyle(this.outerDiv.offsetParent,"zIndex");
1812 if(typeof f!="number"){f=0
1813 }this.columnChooser=new Rico.Window(Rico.getPhraseById("gridChooseCols"),{zIndex:f+2,parent:this.outerDiv});
1814 Rico.addClass(this.columnChooser.container,"ricoLG_chooserDiv");
1815 c=this.columnChooser.contentDiv;
1816 for(a=0;
1817 a<this.columns.length;
1818 a++){b=this.columns[a];
1819 e=c.appendChild(document.createElement("div"));
1820 b.ChooserBox=Rico.createFormField(e,"input","checkbox");
1821 d=e.appendChild(document.createElement("span"));
1822 d.innerHTML=b.displayName;
1823 Rico.eventBind(b.ChooserBox,"click",Rico.eventHandle(b,"chooseColumn"),false)
1824 }}Rico.log("opening columnChooser");
1825 this.columnChooser.openPopup(1,this.hdrHt);
1826 for(a=0;
1827 a<this.columns.length;
1828 a++){this.columns[a].ChooserBox.checked=this.columns[a].visible;
1829 this.columns[a].ChooserBox.disabled=!this.columns[a].canHideShow()
1830 }},blankRow:function(a){for(var b=0;
1831 b<this.columns.length;
1832 b++){this.columns[b].clearCell(a)
1833 }},getExportStyles:function(a){var e=this.options.exportStyleList;
1834 var b=Rico.getStyle(a,"backgroundImage");
1835 if(!b||b=="none"){return e
1836 }for(var d=[],c=0;
1837 c<e.length;
1838 c++){if(e[c]!="background-color"&&e[c]!="color"){d.push(e[c])
1839 }}return d
1840 },exportStart:function(){var a,h,f,d,b,e,k,l;
1841 var g=this.getExportStyles(this.thead[0]);
1842 this.exportRows=[];
1843 this.exportText="<html><head></head><body><table border='1' cellspacing='0'>";
1844 for(h=0;
1845 h<this.columns.length;
1846 h++){if(this.columns[h].visible){this.exportText+="<col width='"+parseInt(this.columns[h].colWidth,10)+"'>"
1847 }}this.exportText+="<thead style='display: table-header-group;'>";
1848 if(this.exportHeader){this.exportText+=this.exportHeader
1849 }for(a=0;
1850 a<this.hdrCells.length;
1851 a++){if(this.hdrCells[a].length==0||!Rico.visible(this.hdrCells[a][0].cell.parentNode)){continue
1852 }this.exportText+="<tr>";
1853 for(h=0,f=0;
1854 h<this.hdrCells[a].length;
1855 h++){b=this.hdrCells[a][h];
1856 e=b.colSpan;
1857 for(d=0;
1858 d<b.colSpan;
1859 d++,f++){if(!this.columns[f].visible){e--
1860 }}if(e>0){k=Rico.select(".ricoLG_cell",b.cell);
1861 l=k&&k.length>0?k[0]:b.cell;
1862 this.exportText+="<td style='"+this.exportStyle(l,g)+"'";
1863 if(b.colSpan>1){this.exportText+=" colspan='"+e+"'"
1864 }this.exportText+=">"+Rico.getInnerText(l,!this.options.exportImgTags,!this.options.exportFormFields,"NoExport")+"</td>"
1865 }}this.exportText+="</tr>"
1866 }this.exportText+="</thead><tbody>"
1867 },exportFinish:function(){if(this.hideMsg){this.hideMsg()
1868 }window.status=Rico.getPhraseById("exportComplete");
1869 if(this.exportRows.length>0){this.exportText+="<tr>"+this.exportRows.join("</tr><tr>")+"</tr>"
1870 }if(this.exportFooter){this.exportText+=this.exportFooter
1871 }this.exportText+="</tbody></table></body></html>";
1872 if(this.cancelMenu){this.cancelMenu()
1873 }var a=window.open("","_blank",this.options.exportWindow);
1874 if(a==null){alert(Rico.getPhraseById("disableBlocker"))
1875 }else{a.document.open();
1876 a.document.write(this.exportText);
1877 a.document.close()
1878 }this.exportText=undefined;
1879 this.exportRows=undefined
1880 },exportStyle:function(d,g){for(var b=0,c="";
1881 b<g.length;
1882 b++){try{var a=Rico.getStyle(d,g[b]);
1883 if(a){c+=g[b]+":"+a+";"
1884 }}catch(f){}}return c
1885 },getCookie:function(){var k=Rico.getCookie(this.options.cookiePrefix+this.tableId);
1886 if(!k){return
1887 }var f=k.split(",");
1888 for(var g=0;
1889 g<f.length;
1890 g++){var a=f[g].split(":");
1891 if(a.length!=2){continue
1892 }var h=parseInt(a[0].slice(1),10);
1893 if(h<0||h>=this.columns.length){continue
1894 }var e=this.columns[h];
1895 switch(a[0].charAt(0)){case"w":e.setColWidth(a[1]);
1896 e.customWidth=true;
1897 break;
1898 case"h":if(a[1].toLowerCase()=="true"){e.hideshow(true,true)
1899 }else{e.hideshow(false,true)
1900 }break;
1901 case"s":if(!this.options.saveColumnInfo.sort||!e.sortable){break
1902 }e.setSorted(a[1]);
1903 break;
1904 case"f":if(!this.options.saveColumnInfo.filter||!e.filterable){break
1905 }var d=a[1].split("~");
1906 e.filterOp=d.shift();
1907 e.filterValues=[];
1908 e.filterType=Rico.ColumnConst.USERFILTER;
1909 for(var b=0;
1910 b<d.length;
1911 b++){e.filterValues.push(unescape(d[b]))
1912 }break
1913 }}},setCookie:function(){var d=[];
1914 for(var e=0;
1915 e<this.columns.length;
1916 e++){var c=this.columns[e];
1917 if(this.options.saveColumnInfo.width){if(c.customWidth){d.push("w"+e+":"+c.colWidth)
1918 }if(c.customVisible){d.push("h"+e+":"+c.visible)
1919 }}if(this.options.saveColumnInfo.sort){if(c.currentSort!=Rico.ColumnConst.UNSORTED){d.push("s"+e+":"+c.currentSort)
1920 }}if(this.options.saveColumnInfo.filter&&c.filterType==Rico.ColumnConst.USERFILTER){var b=[c.filterOp];
1921 for(var a=0;
1922 a<c.filterValues.length;
1923 a++){b.push(escape(c.filterValues[a]))
1924 }d.push("f"+e+":"+b.join("~"))
1925 }}Rico.setCookie(this.options.cookiePrefix+this.tableId,d.join(","),this.options.cookieDays,this.options.cookiePath,this.options.cookieDomain)
1926 }};
1927 Rico.ColumnConst={UNFILTERED:0,SYSTEMFILTER:1,USERFILTER:2,UNSORTED:0,SORT_ASC:"ASC",SORT_DESC:"DESC",MINWIDTH:10};
1928 Rico.TableColumnBase=function(){};
1929 Rico.TableColumnBase.prototype={baseInit:function(h,g,e,d){Rico.log("TableColumnBase.init index="+g+" tabIdx="+d);
1930 this.liveGrid=h;
1931 this.index=g;
1932 this.hideWidth=Rico.isKonqueror||Rico.isWebKit||h.headerRowCnt>1?5:2;
1933 this.options=h.options;
1934 this.tabIdx=d;
1935 this.hdrCell=e.cell;
1936 this.body=document.getElementsByTagName("body")[0];
1937 this.displayName=this.getDisplayName(this.hdrCell);
1938 var c=this.hdrCell.getElementsByTagName("div");
1939 this.hdrColDiv=(c.length<1)?Rico.wrapChildren(this.hdrCell,"ricoLG_col"):c[0];
1940 this.hdrCellDiv=(c.length<2)?Rico.wrapChildren(this.hdrColDiv,"ricoLG_cell"):c[1];
1941 var f=d==0?g:g-h.options.frozenColumns;
1942 this.dataCell=h.tbody[d].rows[0].cells[f];
1943 c=this.dataCell.getElementsByTagName("div");
1944 this.dataColDiv=(c.length<1)?Rico.wrapChildren(this.dataCell,"ricoLG_col"):c[0];
1945 this.mouseDownHandler=Rico.eventHandle(this,"handleMouseDown");
1946 this.mouseMoveHandler=Rico.eventHandle(this,"handleMouseMove");
1947 this.mouseUpHandler=Rico.eventHandle(this,"handleMouseUp");
1948 this.mouseOutHandler=Rico.eventHandle(this,"handleMouseOut");
1949 this.fieldName="col"+this.index;
1950 this.format={type:"text"};
1951 var b=h.options.columnSpecs[g];
1952 if(typeof b=="object"){Rico.extend(this.format,b)
1953 }Rico.addClass(this.dataColDiv,this.colClassName());
1954 this.visible=true;
1955 if(typeof this.format.visible=="boolean"){this.visible=this.format.visible
1956 }Rico.log("TableColumn.init index="+g+" fieldName="+this.fieldName);
1957 this.sortable=typeof this.format.canSort=="boolean"?this.format.canSort:h.options.canSortDefault;
1958 this.currentSort=Rico.ColumnConst.UNSORTED;
1959 this.filterable=typeof this.format.canFilter=="boolean"?this.format.canFilter:h.options.canFilterDefault;
1960 this.filterType=Rico.ColumnConst.UNFILTERED;
1961 this.hideable=typeof this.format.canHide=="boolean"?this.format.canHide:h.options.canHideDefault;
1962 var a;
1963 switch(typeof this.format.width){case"number":a=this.format.width;
1964 break;
1965 case"string":a=parseInt(this.format.width,10);
1966 break;
1967 default:a=e.initWidth;
1968 break
1969 }a=(typeof(a)=="number")?Math.max(a,Rico.ColumnConst.MINWIDTH):h.options.defaultWidth;
1970 this.setColWidth(a);
1971 if(!this.visible){this.setDisplay("none")
1972 }},colClassName:function(){return this.format.ClassName?this.format.ClassName:this.liveGrid.tableId+"_col"+this.index
1973 },insertResizer:function(){if(this.format.noResize){return
1974 }var a=document.createElement("div");
1975 a.className="ricoLG_Resize";
1976 a.style[this.liveGrid.align[1]]="0px";
1977 this.hdrCellDiv.appendChild(a);
1978 Rico.eventBind(a,"mousedown",this.mouseDownHandler,false)
1979 },getDisplayName:function(a){var b=a.getElementsByTagName("A");
1980 if(b.length>0){return b[0].innerHTML
1981 }else{return Rico.stripTags(a.innerHTML)
1982 }},_clear:function(a){a.innerHTML="&nbsp;"
1983 },clearCell:function(b){var a=this.cell(b);
1984 this._clear(a,b);
1985 if(this.liveGrid.buffer&&this.liveGrid.buffer.options.acceptStyle){a.style.cssText=""
1986 }},dataTable:function(){return this.liveGrid.tabs[this.tabIdx]
1987 },numRows:function(){return this.dataColDiv.childNodes.length
1988 },clearColumn:function(){var b=this.numRows();
1989 for(var a=0;
1990 a<b;
1991 a++){this.clearCell(a)
1992 }},cell:function(a){return this.dataColDiv.childNodes[a]
1993 },getFormattedValue:function(c,a,d,b){return Rico.getInnerText(this.cell(c),a,d,b)
1994 },setColWidth:function(a){if(typeof a=="number"){a=parseInt(a,10);
1995 if(a<Rico.ColumnConst.MINWIDTH){return
1996 }a=a+"px"
1997 }Rico.log("setColWidth "+this.index+": "+a);
1998 this.colWidth=a;
1999 this.hdrColDiv.style.width=a;
2000 this.dataColDiv.style.width=a
2001 },pluginMouseEvents:function(){if(this.mousePluggedIn==true){return
2002 }Rico.eventBind(this.body,"mousemove",this.mouseMoveHandler,false);
2003 Rico.eventBind(this.body,"mouseup",this.mouseUpHandler,false);
2004 Rico.eventBind(this.body,"mouseout",this.mouseOutHandler,false);
2005 this.mousePluggedIn=true
2006 },unplugMouseEvents:function(){Rico.eventUnbind(this.body,"mousemove",this.mouseMoveHandler,false);
2007 Rico.eventUnbind(this.body,"mouseup",this.mouseUpHandler,false);
2008 Rico.eventUnbind(this.body,"mouseout",this.mouseOutHandler,false);
2009 this.mousePluggedIn=false
2010 },handleMouseDown:function(b){this.resizeStart=Rico.eventClient(b).x;
2011 this.origWidth=parseInt(this.colWidth,10);
2012 var a=Rico.positionedOffset(this.hdrCell);
2013 if(this.liveGrid.direction=="rtl"){this.edge=a.left+this.liveGrid.options.scrollBarWidth;
2014 switch(this.tabIdx){case 0:this.edge+=this.liveGrid.innerDiv.offsetWidth;
2015 break;
2016 case 1:this.edge-=this.liveGrid.scrollDiv.scrollLeft;
2017 break
2018 }}else{this.edge=a.left+this.hdrCell.offsetWidth;
2019 if(this.tabIdx>0){this.edge+=Rico.nan2zero(this.liveGrid.tabs[0].offsetWidth)
2020 }}this.liveGrid.resizeDiv.style.left=this.edge+"px";
2021 this.liveGrid.resizeDiv.style.display="";
2022 this.liveGrid.outerDiv.style.cursor="e-resize";
2023 this.tmpHighlight=this.liveGrid.highlightEnabled;
2024 this.liveGrid.highlightEnabled=false;
2025 this.pluginMouseEvents();
2026 Rico.eventStop(b)
2027 },handleMouseMove:function(b){var c=Rico.eventClient(b).x-this.resizeStart;
2028 var a=(this.liveGrid.direction=="rtl")?this.origWidth-c:this.origWidth+c;
2029 if(a<Rico.ColumnConst.MINWIDTH){return
2030 }this.liveGrid.resizeDiv.style.left=(this.edge+c)+"px";
2031 this.colWidth=a;
2032 Rico.eventStop(b)
2033 },handleMouseUp:function(a){this.unplugMouseEvents();
2034 Rico.log("handleMouseUp "+this.liveGrid.tableId);
2035 this.liveGrid.outerDiv.style.cursor="";
2036 this.liveGrid.resizeDiv.style.display="none";
2037 this.setColWidth(this.colWidth);
2038 this.customWidth=true;
2039 this.liveGrid.setCookie();
2040 this.liveGrid.highlightEnabled=this.tmpHighlight;
2041 this.liveGrid.sizeDivs();
2042 Rico.eventStop(a)
2043 },handleMouseOut:function(b){var a=Rico.eventRelatedTarget(b)||b.toElement;
2044 while(a!=null&&a.nodeName.toLowerCase()!="body"){a=a.parentNode
2045 }if(a!=null&&a.nodeName.toLowerCase()=="body"){return true
2046 }this.handleMouseUp(b);
2047 return true
2048 },setDisplay:function(a){this.hdrCell.style.display=a;
2049 this.hdrColDiv.style.display=a;
2050 this.dataCell.style.display=a;
2051 this.dataColDiv.style.display=a
2052 },hideshow:function(b,a){this.setDisplay(b?"":"none");
2053 this.liveGrid.cancelMenu();
2054 this.visible=b;
2055 this.customVisible=true;
2056 if(a){return
2057 }this.liveGrid.setCookie();
2058 this.liveGrid.sizeDivs()
2059 },hideColumn:function(){Rico.log("hideColumn "+this.liveGrid.tableId);
2060 this.hideshow(false,false)
2061 },showColumn:function(){Rico.log("showColumn "+this.liveGrid.tableId);
2062 this.hideshow(true,false)
2063 },chooseColumn:function(b){var a=Rico.eventElement(b);
2064 this.hideshow(a.checked,false)
2065 },setImage:function(){if(this.currentSort==Rico.ColumnConst.SORT_ASC){this.imgSort.style.display="inline-block";
2066 this.imgSort.className=Rico.theme.sortAsc||"rico-icon ricoLG_sortAsc"
2067 }else{if(this.currentSort==Rico.ColumnConst.SORT_DESC){this.imgSort.style.display="inline-block";
2068 this.imgSort.className=Rico.theme.sortDesc||"rico-icon ricoLG_sortDesc"
2069 }else{this.imgSort.style.display="none"
2070 }}if(this.filterType==Rico.ColumnConst.USERFILTER){this.imgFilter.style.display="inline-block";
2071 this.imgFilter.title=this.getFilterText()
2072 }else{this.imgFilter.style.display="none"
2073 }},canHideShow:function(){return this.hideable
2074 }};
2075 if(typeof Rico=="undefined"){throw ("SimpleGrid requires the Rico JavaScript framework")
2076 }Rico.SimpleGrid=function(b,a){this.initialize(b,a)
2077 };
2078 Rico.SimpleGrid.prototype={initialize:function(b,a){Rico.extend(this,Rico.GridCommon);
2079 this.baseInit();
2080 Rico.setDebugArea(b+"_debugmsgs");
2081 Rico.extend(this.options,a||{});
2082 this.tableId=b;
2083 Rico.log("SimpleGrid initialize start: "+b);
2084 this.createDivs();
2085 this.hdrTabs=new Array(2);
2086 this.simpleGridInit();
2087 Rico.log("SimpleGrid initialize end: "+b)
2088 },simpleGridInit:function(){var a;
2089 for(a=0;
2090 a<2;
2091 a++){Rico.log("simpleGridInit "+a);
2092 this.tabs[a]=Rico.$(this.tableId+"_tab"+a);
2093 if(!this.tabs[a]){return
2094 }this.hdrTabs[a]=Rico.$(this.tableId+"_tab"+a+"h");
2095 if(!this.hdrTabs[a]){return
2096 }this.thead[a]=this.hdrTabs[a];
2097 this.tbody[a]=this.tabs[a];
2098 this.headerColCnt=this.getColumnInfo(this.hdrTabs[a].rows);
2099 if(a==0){this.options.frozenColumns=this.headerColCnt
2100 }if(Rico.theme.gridheader){Rico.addClass(this.thead[a],Rico.theme.gridheader)
2101 }if(Rico.theme.gridcontent){Rico.addClass(this.tbody[a],Rico.theme.gridcontent)
2102 }}if(this.headerColCnt==0){alert('ERROR: no columns found in "'+this.tableId+'"');
2103 return
2104 }this.createColumnArray("SimpleGridColumn");
2105 this.pageSize=this.columns[0].dataColDiv.childNodes.length;
2106 this.sizeDivs();
2107 if(typeof(this.options.FilterLocation)=="number"){this.createFilters(this.options.FilterLocation)
2108 }this.attachMenuEvents();
2109 this.scrollEventFunc=Rico.eventHandle(this,"handleScroll");
2110 this.pluginScroll();
2111 if(this.options.windowResize){Rico.eventBind(window,"resize",Rico.eventHandle(this,"sizeDivs"),false)
2112 }},filterId:function(a){return"RicoFilter_"+this.tableId+"_"+a
2113 },createFilters:function(a){if(a<0){a=this.addHeadingRow();
2114 this.sizeDivs()
2115 }for(var g=0;
2116 g<this.headerColCnt;
2117 g++){var d=this.columns[g];
2118 var e=d.format;
2119 if(typeof e.filterUI!="string"){continue
2120 }var k=this.hdrCells[a][g].cell;
2121 var j,b=this.filterId(g);
2122 var h=k.getElementsByTagName("div");
2123 switch(e.filterUI.charAt(0)){case"t":j=Rico.createFormField(h[1],"input","text",b,b);
2124 var m=e.filterUI.match(/\d+/);
2125 j.maxLength=e.Length||50;
2126 j.size=m?parseInt(m,10):10;
2127 Rico.eventBind(j,"keyup",Rico.eventHandle(d,"filterKeypress"),false);
2128 break;
2129 case"s":j=Rico.createFormField(h[1],"select",null,b);
2130 Rico.addSelectOption(j,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));
2131 this.getFilterValues(d);
2132 var l=Rico.keys(d.filterHash);
2133 l.sort();
2134 for(var f=0;
2135 f<l.length;
2136 f++){Rico.addSelectOption(j,l[f],l[f]||Rico.getPhraseById("filterBlank"))
2137 }Rico.eventBind(j,"change",Rico.eventHandle(d,"filterChange"),false);
2138 break
2139 }}this.initFilterImage(a)
2140 },getFilterValues:function(b){var e={};
2141 var f=b.numRows();
2142 for(var c=0;
2143 c<f;
2144 c++){var a=Rico.getInnerText(b.cell(c));
2145 var d=e[a];
2146 if(d){d.push(c)
2147 }else{e[a]=[c]
2148 }}b.filterHash=e
2149 },applyFilters:function(){var b=[];
2150 for(var f=0;
2151 f<this.columns.length;
2152 f++){if(this.columns[f].filterRows){b.push(this.columns[f].filterRows)
2153 }}if(b.length==0){this.showAllRows();
2154 return
2155 }for(var d=0;
2156 d<this.pageSize;
2157 d++){var e=true;
2158 for(var a=0;
2159 a<b.length;
2160 a++){if(b[a].indexOf(d)==-1){e=false;
2161 break
2162 }}if(e){this.showRow(d)
2163 }else{this.hideRow(d)
2164 }}this.sizeDivs()
2165 },handleScroll:function(b){var a=(-this.scrollDiv.scrollTop)+"px";
2166 this.tabs[0].style.marginTop=a;
2167 this.setHorizontalScroll()
2168 },registerScrollMenu:function(a){if(!this.menu){this.menu=a
2169 }a.grid=this;
2170 a.showmenu=a.showSimpleMenu;
2171 a.showSubMenu=a.showSimpleSubMenu;
2172 a.createDiv(this.outerDiv)
2173 },handleMenuClick:function(a){if(!this.menu){return
2174 }this.cancelMenu();
2175 this.menuCell=Rico.getParentByTagName(Rico.eventElement(a),"div");
2176 this.highlightEnabled=false;
2177 if(this.hideScroll){this.scrollDiv.style.overflow="hidden"
2178 }if(this.menu.buildGridMenu){this.menu.buildGridMenu(this.menuCell)
2179 }this.menu.showmenu(a,this.closeMenu.bind(this))
2180 },closeMenu:function(){if(this.hideScroll){this.scrollDiv.style.overflow=""
2181 }this.highlightEnabled=true
2182 },sizeDivs:function(){if(this.outerDiv.offsetParent.style.display=="none"){return
2183 }this.baseSizeDivs();
2184 var c=Math.max(this.options.maxHt||this.availHt(),50);
2185 var b=Math.min(this.hdrHt+this.dataHt,c);
2186 Rico.log("sizeDivs "+this.tableId+": hdrHt="+this.hdrHt+" dataHt="+this.dataHt);
2187 this.dataHt=b-this.hdrHt;
2188 if(this.scrWi>0){this.dataHt+=this.options.scrollBarWidth
2189 }this.scrollDiv.style.height=this.dataHt+"px";
2190 this.frozenTabs.style.height=this.scrollDiv.clientHeight+"px";
2191 var a=2;
2192 this.innerDiv.style.width=(this.scrWi-this.options.scrollBarWidth+a)+"px";
2193 b+=a;
2194 this.resizeDiv.style.height=b+"px";
2195 this.handleScroll()
2196 },printVisible:function(){this.showMsg(Rico.getPhraseById("exportInProgress"));
2197 Rico.runLater(10,this,"_printVisible")
2198 },_printVisible:function(){this.exportStart();
2199 var f=this.getExportStyles(this.tbody[0]);
2200 for(var e=0;
2201 e<this.pageSize;
2202 e++){if(this.columns[0].cell(e).style.display=="none"){continue
2203 }var d="";
2204 for(var g=0;
2205 g<this.columns.length;
2206 g++){var b=this.columns[g];
2207 if(b.visible){var a=b.getFormattedValue(e,!this.options.exportImgTags,!this.options.exportFormFields,"NoExport");
2208 if(b.format.exportPrefix){a=b.format.exportPrefix+a
2209 }if(a==""){a="&nbsp;"
2210 }d+="<td style='"+this.exportStyle(b.cell(e),f)+"'>"+a+"</td>"
2211 }}this.exportRows.push(d)
2212 }this.exportFinish()
2213 },hideRow:function(a){if(this.columns[0].cell(a).style.display=="none"){return
2214 }for(var b=0;
2215 b<this.columns.length;
2216 b++){this.columns[b].cell(a).style.display="none"
2217 }},showRow:function(a){if(this.columns[0].cell(a).style.display==""){return
2218 }for(var b=0;
2219 b<this.columns.length;
2220 b++){this.columns[b].cell(a).style.display=""
2221 }},searchRows:function(h,e,c){if(!e){return
2222 }var f=new RegExp(e);
2223 var d=this.columns[h].numRows();
2224 for(var g=0;
2225 g<d;
2226 g++){var b=this.cell(g,h).innerHTML;
2227 var a=(b.match(f)!=null);
2228 if(a!=c){this.hideRow(g)
2229 }}this.sizeDivs();
2230 this.handleScroll()
2231 },showAllRows:function(){for(var a=0;
2232 a<this.pageSize;
2233 a++){this.showRow(a)
2234 }this.sizeDivs()
2235 },openPopup:function(d,e){while(d&&!Rico.hasClass(d,"ricoLG_cell")){d=d.parentNode
2236 }if(!d){return false
2237 }var f=Rico.getParentByTagName(d,"td");
2238 var c=Math.floor(f.offsetLeft-this.scrollDiv.scrollLeft+f.offsetWidth/2);
2239 if(this.direction=="rtl"){if(c>this.width){c-=this.width
2240 }}else{if(c+this.width+this.options.margin>this.scrollDiv.clientWidth){c-=this.width
2241 }}e.divPopup.style.visibility="hidden";
2242 e.divPopup.style.display="block";
2243 var b=e.divPopup.offsetHeight;
2244 var a=Math.floor(d.offsetTop-this.scrollDiv.scrollTop+d.offsetHeight/2);
2245 if(a+b+e.options.margin>this.scrollDiv.clientHeight){a=Math.max(a-b,0)
2246 }e.openPopup(this.frzWi+c,this.hdrHt+a);
2247 e.divPopup.style.visibility="visible";
2248 return d
2249 }};
2250 if(Rico.Menu){Rico.extend(Rico.Menu.prototype,{showSimpleMenu:function(b,c){Rico.eventStop(b);
2251 this.hideFunc=c;
2252 if(this.div.childNodes.length==0){this.cancelmenu();
2253 return false
2254 }var a=Rico.eventElement(b);
2255 this.grid.openPopup(a,this);
2256 return a
2257 },showSimpleSubMenu:function(b,c){if(this.openSubMenu){this.hideSubMenu()
2258 }this.openSubMenu=c;
2259 this.openMenuAnchor=b;
2260 if(b.className=="ricoSubMenu"){b.className="ricoSubMenuOpen"
2261 }var e=parseInt(this.div.style.top,10);
2262 var d=parseInt(this.div.style.left,10);
2263 c.openPopup(d+b.offsetWidth,e+b.offsetTop);
2264 c.div.style.visibility="visible"
2265 }})
2266 }Rico.SimpleGridColumn=function(a,d,c,b){this.initialize(a,d,c,b)
2267 };
2268 Rico.SimpleGridColumn.prototype={initialize:function(a,d,c,b){Rico.extend(this,new Rico.TableColumnBase());
2269 this.baseInit(a,d,c,b)
2270 },setUnfiltered:function(){this.filterRows=null
2271 },filterChange:function(a){var b=Rico.eventElement(a);
2272 if(b.value==this.liveGrid.options.FilterAllToken){this.setUnfiltered()
2273 }else{this.filterRows=this.filterHash[b.value]
2274 }this.liveGrid.applyFilters()
2275 },filterKeypress:function(f){var a=Rico.eventElement(f);
2276 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
2277 }if(this.lastKeyFilter==a.value){return
2278 }var b=a.value;
2279 Rico.log("filterKeypress: "+this.index+" "+b);
2280 this.lastKeyFilter=b;
2281 if(b){b=b.replace("\\","\\\\");
2282 b=b.replace("(","\\(").replace(")","\\)");
2283 b=b.replace(".","\\.");
2284 if(this.format.filterUI.indexOf("^")>0){b="^"+b
2285 }var d=new RegExp(b,"i");
2286 this.filterRows=[];
2287 var h=this.numRows();
2288 for(var c=0;
2289 c<h;
2290 c++){var g=Rico.getInnerText(this.cell(c));
2291 if(g.match(d)){this.filterRows.push(c)
2292 }}}else{this.setUnfiltered()
2293 }this.liveGrid.applyFilters()
2294 }};
2295 if(typeof Rico=="undefined"){throw ("LiveGrid requires the Rico JavaScript framework")
2296 }if(!Rico.Buffer){Rico.Buffer={}
2297 }Rico.Buffer.Base=function(b,a){this.initialize(b,a)
2298 };
2299 Rico.Buffer.Base.prototype={initialize:function(b,a){this.clear();
2300 this.updateInProgress=false;
2301 this.lastOffset=0;
2302 this.rcvdRowCount=false;
2303 this.foundRowCount=false;
2304 this.totalRows=0;
2305 this.rowcntContent="";
2306 this.rcvdOffset=-1;
2307 this.options={fixedHdrRows:0,canFilter:true,isEncoded:true,acceptStyle:false};
2308 Rico.extend(this.options,a||{});
2309 if(b){this.loadRowsFromTable(b,this.options.fixedHdrRows);
2310 b.parentNode.removeChild(b)
2311 }else{this.clear()
2312 }},registerGrid:function(a){this.liveGrid=a
2313 },setTotalRows:function(a){if(typeof(a)!="number"){a=this.size
2314 }if(this.totalRows==a){return
2315 }this.totalRows=a;
2316 if(!this.liveGrid){return
2317 }Rico.log("setTotalRows, newTotalRows="+a);
2318 switch(this.liveGrid.sizeTo){case"data":this.liveGrid.resizeWindow();
2319 break;
2320 case"datamax":this.liveGrid.setPageSize(a);
2321 break;
2322 default:this.liveGrid.updateHeightDiv();
2323 break
2324 }},loadRowsFromTable:function(h,g){var e=[];
2325 var a=h.getElementsByTagName("tr");
2326 for(var d=g||0;
2327 d<a.length;
2328 d++){var f=[];
2329 var c=a[d].getElementsByTagName("td");
2330 for(var b=0;
2331 b<c.length;
2332 b++){f[b]=c[b].innerHTML
2333 }e.push(f)
2334 }this.loadRows(e)
2335 },loadRowsFromArray:function(b){for(var c=0;
2336 c<b.length;
2337 c++){for(var a=0;
2338 a<b[c].length;
2339 a++){b[c][a]=b[c][a].toString()
2340 }}this.loadRows(b)
2341 },loadRows:function(a){this.baseRows=a;
2342 this.startPos=0;
2343 this.size=this.baseRows.length
2344 },dom2jstable:function(f){Rico.log("dom2jstable: encoded="+this.options.isEncoded);
2345 var e=[];
2346 var a=f.getElementsByTagName("tr");
2347 for(var d=0;
2348 d<a.length;
2349 d++){var g=[];
2350 var c=a[d].getElementsByTagName("td");
2351 for(var b=0;
2352 b<c.length;
2353 b++){g[b]=Rico.getContentAsString(c[b],this.options.isEncoded)
2354 }e.push(g)
2355 }return e
2356 },_blankRow:function(){var a=[];
2357 for(var b=0;
2358 b<this.liveGrid.columns.length;
2359 b++){a[b]=""
2360 }return a
2361 },deleteRows:function(b,a){this.baseRows.splice(b,typeof(a)=="number"?a:1);
2362 this.liveGrid.isPartialBlank=true;
2363 this.size=this.baseRows.length
2364 },insertRow:function(a){var b=this._blankRow();
2365 this.baseRows.splice(a,0,b);
2366 this.size=this.baseRows.length;
2367 this.liveGrid.isPartialBlank=true;
2368 if(this.startPos<0){this.startPos=0
2369 }return b
2370 },appendRows:function(b){var c=[];
2371 for(var a=0;
2372 a<b;
2373 a++){var d=this._blankRow();
2374 this.baseRows.push(d);
2375 c.push(d)
2376 }this.size=this.baseRows.length;
2377 this.liveGrid.isPartialBlank=true;
2378 if(this.startPos<0){this.startPos=0
2379 }return c
2380 },sortFunc:function(b){var a=this;
2381 switch(b){case"number":return function(d,c){return a._sortNumeric(d,c)
2382 };
2383 case"control":return function(d,c){return a._sortControl(d,c)
2384 };
2385 default:return function(d,c){return a._sortAlpha(d,c)
2386 }
2387 }},sortBuffer:function(b){if(!this.baseRows){this.delayedSortCol=b;
2388 return
2389 }this.liveGrid.showMsg(Rico.getPhraseById("sorting"));
2390 this.sortColumn=b;
2391 var a=this.liveGrid.columns[b];
2392 this.getValFunc=a._sortfunc;
2393 this.baseRows.sort(this.sortFunc(a.format.type));
2394 if(a.getSortDirection()=="DESC"){this.baseRows.reverse()
2395 }},_sortAlpha:function(d,c){var e=this.sortColumn<d.length?Rico.getInnerText(d[this.sortColumn]):"";
2396 var f=this.sortColumn<c.length?Rico.getInnerText(c[this.sortColumn]):"";
2397 if(e==f){return 0
2398 }if(e<f){return -1
2399 }return 1
2400 },_sortNumeric:function(d,c){var e=this.sortColumn<d.length?this.nan2zero(Rico.getInnerText(d[this.sortColumn])):0;
2401 var f=this.sortColumn<c.length?this.nan2zero(Rico.getInnerText(c[this.sortColumn])):0;
2402 return e-f
2403 },nan2zero:function(a){if(typeof(a)=="string"){a=parseFloat(a)
2404 }return isNaN(a)||typeof(a)=="undefined"?0:a
2405 },_sortControl:function(d,c){var e=this.sortColumn<d.length?Rico.getInnerText(d[this.sortColumn]):"";
2406 var f=this.sortColumn<c.length?Rico.getInnerText(c[this.sortColumn]):"";
2407 if(this.getValFunc){e=this.getValFunc(e);
2408 f=this.getValFunc(f)
2409 }if(e==f){return 0
2410 }if(e<f){return -1
2411 }return 1
2412 },clear:function(){this.baseRows=[];
2413 this.rows=[];
2414 this.startPos=-1;
2415 this.size=0;
2416 this.windowPos=0
2417 },isInRange:function(a){var b=Math.min(this.totalRows,a+this.liveGrid.pageSize);
2418 return(a>=this.startPos)&&(b<=this.endPos())
2419 },endPos:function(){return this.startPos+this.rows.length
2420 },fetch:function(a){Rico.log("fetch "+this.liveGrid.tableId+": offset="+a);
2421 this.applyFilters();
2422 this.setTotalRows();
2423 this.rcvdRowCount=true;
2424 this.foundRowCount=true;
2425 if(a<0){a=0
2426 }this.liveGrid.refreshContents(a);
2427 return
2428 },visibleRows:function(){return this.rows.slice(this.windowStart,this.windowEnd)
2429 },setWindow:function(b,a){this.windowStart=b-this.startPos;
2430 Rico.log("setWindow "+this.liveGrid.tableId+": "+b+", "+a+", newstart="+this.windowStart);
2431 this.windowEnd=Math.min(a,this.size);
2432 this.windowPos=b
2433 },isVisible:function(a){return a<this.rows.length&&a>=this.windowStart&&a<this.windowEnd
2434 },bufferRow:function(a){return this.windowStart+a
2435 },getWindowCell:function(c,b){var a=this.bufferRow(c);
2436 return this.isVisible(a)&&b<this.rows[a].length?this.rows[a][b]:null
2437 },getWindowStyle:function(c,b){var a=this.bufferRow(c);
2438 return this.attr&&this.isVisible(a)&&b<this.attr[a].length?this.attr[a][b]:""
2439 },getWindowValue:function(b,a){return this.getWindowCell(b,a)
2440 },setWindowValue:function(d,b,c){var a=this.bufferRow(d);
2441 if(a>=this.windowEnd){return false
2442 }return this.setValue(a,b,c)
2443 },getCell:function(b,a){return b<this.size?this.rows[b][a]:null
2444 },getValue:function(b,a){return this.getCell(b,a)
2445 },setValue:function(d,b,c,a){if(d>=this.size){return false
2446 }if(!this.rows[d][b]){this.rows[d][b]={}
2447 }this.rows[d][b]=c;
2448 if(typeof a=="string"){this.rows[d][b]._style=a
2449 }this.rows[d][b].modified=true;
2450 return true
2451 },getRows:function(f,d){var e=f-this.startPos;
2452 var a=Math.min(e+d,this.size);
2453 var c=[];
2454 for(var b=e;
2455 b<a;
2456 b++){c.push(this.rows[b])
2457 }return c
2458 },applyFilters:function(){var g=[],k=[];
2459 var a,h,d,e,f,b;
2460 var j=this.liveGrid.columns;
2461 for(d=0,b=0;
2462 d<j.length;
2463 d++){h=j[d];
2464 if(h.filterType==Rico.ColumnConst.UNFILTERED){continue
2465 }b++;
2466 if(h.filterOp=="LIKE"){k[d]=new RegExp(h.filterValues[0],"i")
2467 }}Rico.log("applyFilters: # of filters="+b);
2468 if(b==0){this.rows=this.baseRows
2469 }else{for(a=0;
2470 a<this.baseRows.length;
2471 a++){f=true;
2472 for(d=0;
2473 d<j.length&&f;
2474 d++){h=j[d];
2475 if(h.filterType==Rico.ColumnConst.UNFILTERED){continue
2476 }switch(h.filterOp){case"LIKE":f=k[d].test(this.baseRows[a][d]);
2477 break;
2478 case"EQ":f=this.baseRows[a][d]==h.filterValues[0];
2479 break;
2480 case"NE":for(e=0;
2481 e<h.filterValues.length&&f;
2482 e++){f=this.baseRows[a][d]!=h.filterValues[e]
2483 }break;
2484 case"LE":if(h.format.type=="number"){f=this.nan2zero(this.baseRows[a][d])<=this.nan2zero(h.filterValues[0])
2485 }else{f=this.baseRows[a][d]<=h.filterValues[0]
2486 }break;
2487 case"GE":if(h.format.type=="number"){f=this.nan2zero(this.baseRows[a][d])>=this.nan2zero(h.filterValues[0])
2488 }else{f=this.baseRows[a][d]>=h.filterValues[0]
2489 }break;
2490 case"NULL":f=this.baseRows[a][d]=="";
2491 break;
2492 case"NOTNULL":f=this.baseRows[a][d]!="";
2493 break
2494 }}if(f){g.push(this.baseRows[a])
2495 }}this.rows=g
2496 }this.rowcntContent=this.size=this.rows.length
2497 },printAll:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress"));
2498 Rico.runLater(10,this,"_printAll")
2499 },_printAll:function(){this.liveGrid.exportStart();
2500 this.exportBuffer(this.getRows(0,this.totalRows));
2501 this.liveGrid.exportFinish()
2502 },printVisible:function(){this.liveGrid.showMsg(Rico.getPhraseById("exportInProgress"));
2503 Rico.runLater(10,this,"_printVisible")
2504 },_printVisible:function(){this.liveGrid.exportStart();
2505 this.exportBuffer(this.visibleRows());
2506 this.liveGrid.exportFinish()
2507 },exportBuffer:function(l,f){var a,g,k,b,j;
2508 Rico.log("exportBuffer: "+l.length+" rows");
2509 var e=this.liveGrid.getExportStyles(this.liveGrid.tbody[0]);
2510 var i=[];
2511 var d=f||0;
2512 var h=this.liveGrid.columns;
2513 for(g=0;
2514 g<h.length;
2515 g++){if(h[g].visible){i[g]=this.liveGrid.exportStyle(h[g].cell(0),e)
2516 }}for(a=0;
2517 a<l.length;
2518 a++){j="";
2519 for(g=0;
2520 g<h.length;
2521 g++){if(!h[g].visible){continue
2522 }b=h[g];
2523 b.expStyle=i[g];
2524 k=b._export(l[a][g],l[a]);
2525 if(k==""){k="&nbsp;"
2526 }j+="<td style='"+b.expStyle+"'>"+k+"</td>"
2527 }this.liveGrid.exportRows.push(j);
2528 d++;
2529 if(d%10==0){window.status=Rico.getPhraseById("exportStatus",d)
2530 }}}};
2531 Rico.LiveGrid=function(c,a,b){this.initialize(c,a,b)
2532 };
2533 Rico.LiveGrid.prototype={initialize:function(e,b,d){Rico.extend(this,Rico.GridCommon);
2534 Rico.extend(this,Rico.LiveGridMethods);
2535 this.baseInit();
2536 this.tableId=e;
2537 this.buffer=b;
2538 this.actionId="_action_"+e;
2539 Rico.setDebugArea(e+"_debugmsgs");
2540 Rico.extend(this.options,{visibleRows:-3,frozenColumns:0,offset:0,prefetchBuffer:true,minPageRows:2,maxPageRows:50,canSortDefault:true,canFilterDefault:b.options.canFilter,canHideDefault:true,highlightElem:"none",highlightSection:3,highlightMethod:"class",highlightClass:Rico.theme.gridHighlightClass||"ricoLG_selection",maxPrint:5000,headingSort:"link",hdrIconsFirst:true});
2541 var c=this;
2542 this.options.sortHandler=function(){c.sortHandler()
2543 };
2544 this.options.filterHandler=function(){c.filterHandler()
2545 };
2546 this.options.onRefreshComplete=function(f,g){c.bookmarkHandler(f,g)
2547 };
2548 this.options.rowOverHandler=Rico.eventHandle(this,"rowMouseOver");
2549 this.options.mouseDownHandler=Rico.eventHandle(this,"selectMouseDown");
2550 this.options.mouseOverHandler=Rico.eventHandle(this,"selectMouseOver");
2551 this.options.mouseUpHandler=Rico.eventHandle(this,"selectMouseUp");
2552 Rico.extend(this.options,d||{});
2553 switch(typeof this.options.visibleRows){case"string":this.sizeTo=this.options.visibleRows;
2554 switch(this.options.visibleRows){case"data":this.options.visibleRows=-2;
2555 break;
2556 case"body":this.options.visibleRows=-3;
2557 break;
2558 case"parent":this.options.visibleRows=-4;
2559 break;
2560 case"datamax":this.options.visibleRows=-5;
2561 break;
2562 default:this.options.visibleRows=-1;
2563 break
2564 }break;
2565 case"number":switch(this.options.visibleRows){case -1:this.sizeTo="window";
2566 break;
2567 case -2:this.sizeTo="data";
2568 break;
2569 case -3:this.sizeTo="body";
2570 break;
2571 case -4:this.sizeTo="parent";
2572 break;
2573 case -5:this.sizeTo="datamax";
2574 break;
2575 default:this.sizeTo="fixed";
2576 break
2577 }break;
2578 default:this.sizeTo="body";
2579 this.options.visibleRows=-3;
2580 break
2581 }this.highlightEnabled=this.options.highlightSection>0;
2582 this.pageSize=0;
2583 this.createTables();
2584 if(this.headerColCnt==0){alert('ERROR: no columns found in "'+this.tableId+'"');
2585 return
2586 }this.createColumnArray("LiveGridColumn");
2587 if(this.options.headingSort=="hover"){this.createHoverSet()
2588 }this.bookmark=document.getElementById(this.tableId+"_bookmark");
2589 this.sizeDivs();
2590 var a=-1;
2591 if(this.buffer.options.canFilter&&this.options.AutoFilter){a=this.addHeadingRow("ricoLG_FilterRow")
2592 }this.createDataCells(this.options.visibleRows);
2593 if(this.pageSize==0){return
2594 }this.buffer.registerGrid(this);
2595 if(this.buffer.setBufferSize){this.buffer.setBufferSize(this.pageSize)
2596 }this.scrollTimeout=null;
2597 this.lastScrollPos=0;
2598 this.attachMenuEvents();
2599 this.setSortUI(this.options.sortCol,this.options.sortDir);
2600 this.setImages();
2601 if(this.listInvisible().length==this.columns.length){this.columns[0].showColumn()
2602 }this.sizeDivs();
2603 this.scrollDiv.style.display="";
2604 if(this.buffer.totalRows>0){this.updateHeightDiv()
2605 }if(this.options.prefetchBuffer){if(this.bookmark){this.bookmark.innerHTML=Rico.getPhraseById("bookmarkLoading")
2606 }if(this.options.canFilterDefault&&this.options.getQueryParms){this.checkForFilterParms()
2607 }this.scrollToRow(this.options.offset);
2608 this.buffer.fetch(this.options.offset)
2609 }if(a>=0){this.createFilters(a)
2610 }this.scrollEventFunc=Rico.eventHandle(this,"handleScroll");
2611 this.wheelEventFunc=Rico.eventHandle(this,"handleWheel");
2612 this.wheelEvent=(Rico.isIE||Rico.isOpera||Rico.isWebKit)?"mousewheel":"DOMMouseScroll";
2613 if(this.options.offset&&this.options.offset<this.buffer.totalRows){Rico.runLater(50,this,"scrollToRow",this.options.offset)
2614 }this.pluginScroll();
2615 this.setHorizontalScroll();
2616 Rico.log("setHorizontalScroll done");
2617 if(this.options.windowResize){Rico.runLater(100,this,"pluginWindowResize")
2618 }Rico.log("initialize complete for "+this.tableId)
2619 }};
2620 Rico.LiveGridMethods={createHoverSet:function(){var a=[];
2621 for(var b=0;
2622 b<this.headerColCnt;
2623 b++){if(this.columns[b].sortable){a.push(this.columns[b].hdrCellDiv)
2624 }}this.hoverSet=new Rico.HoverSet(a)
2625 },checkForFilterParms:function(){var b=window.location.search;
2626 if(b.charAt(0)=="?"){b=b.substring(1)
2627 }var c=b.split("&");
2628 for(var a=0;
2629 a<c.length;
2630 a++){if(c[a].match(/^f\[\d+\]/)){this.buffer.options.requestParameters.push(c[a])
2631 }}},drillDown:function(g,f,h){var b=Rico.eventElement(g||window.event);
2632 b=Rico.getParentByTagName(b,"div","ricoLG_cell");
2633 if(!b){return -1
2634 }var a=this.winCellIndex(b);
2635 if(a.row>=this.buffer.totalRows){return -1
2636 }this.unhighlight();
2637 this.menuIdx=a;
2638 this.highlight(a);
2639 var c=this.buffer.getWindowCell(a.row,f);
2640 for(var d=3;
2641 d<arguments.length;
2642 d++){arguments[d].setDetailFilter(h,c)
2643 }return a.row
2644 },setDetailFilter:function(a,d){var b=this.columns[a];
2645 b.format.ColData=d;
2646 b.setSystemFilter("EQ",d)
2647 },createTables:function(){var f,g,b;
2648 var e=document.getElementById(this.tableId)||document.getElementById(this.tableId+"_outerDiv");
2649 if(!e){return false
2650 }if(e.tagName.toLowerCase()=="table"){var a=e.getElementsByTagName("thead");
2651 if(a.length==1){Rico.log("createTables: using thead section, id="+this.tableId);
2652 if(this.options.ColGroupsOnTabHdr&&this.options.ColGroups){var d=a[0].insertRow(0);
2653 this.insertPanelNames(d,0,this.options.frozenColumns,"ricoFrozen");
2654 this.insertPanelNames(d,this.options.frozenColumns,this.options.columnSpecs.length)
2655 }g=a[0].rows
2656 }else{Rico.log("createTables: using tbody section, id="+this.tableId);
2657 g=new Array(e.rows[0])
2658 }f=e
2659 }else{if(this.options.columnSpecs.length>0){if(!e.id.match(/_outerDiv$/)){f=e
2660 }Rico.log("createTables: inserting at "+e.tagName+", id="+this.tableId)
2661 }else{alert("ERROR!\n\nUnable to initialize '"+this.tableId+"'\n\nLiveGrid terminated");
2662 return false
2663 }}this.createDivs();
2664 this.scrollContainer=this.createDiv("scrollContainer",this.structTabLR);
2665 this.scrollContainer.appendChild(this.scrollDiv);
2666 this.scrollTab=this.createDiv("scrollTab",this.scrollContainer);
2667 this.shadowDiv=this.createDiv("shadow",this.scrollDiv);
2668 this.shadowDiv.style.direction="ltr";
2669 this.scrollDiv.style.display="none";
2670 this.scrollDiv.scrollTop=0;
2671 if(this.options.highlightMethod!="class"){this.highlightDiv=[];
2672 switch(this.options.highlightElem){case"menuRow":case"cursorRow":this.highlightDiv[0]=this.createDiv("highlight",this.outerDiv);
2673 this.highlightDiv[0].style.display="none";
2674 break;
2675 case"menuCell":case"cursorCell":for(b=0;
2676 b<2;
2677 b++){this.highlightDiv[b]=this.createDiv("highlight",b==0?this.frozenTabs:this.scrollTab);
2678 this.highlightDiv[b].style.display="none";
2679 this.highlightDiv[b].id+=b
2680 }break;
2681 case"selection":var h=this.options.highlightSection==1?this.frozenTabs:this.scrollTab;
2682 for(b=0;
2683 b<4;
2684 b++){this.highlightDiv[b]=this.createDiv("highlight",h);
2685 this.highlightDiv[b].style.display="none";
2686 this.highlightDiv[b].style.overflow="hidden";
2687 this.highlightDiv[b].id+=b;
2688 this.highlightDiv[b].style[b%2==0?"height":"width"]="0px"
2689 }break
2690 }}for(b=0;
2691 b<3;
2692 b++){this.tabs[b]=document.createElement("table");
2693 this.tabs[b].className=(b<2)?"ricoLG_table":"ricoLG_scrollTab";
2694 this.tabs[b].border=0;
2695 this.tabs[b].cellPadding=0;
2696 this.tabs[b].cellSpacing=0;
2697 this.tabs[b].id=this.tableId+"_tab"+b
2698 }for(b=0;
2699 b<2;
2700 b++){this.thead[b]=this.tabs[b].createTHead();
2701 this.thead[b].className="ricoLG_top";
2702 if(Rico.theme.gridheader){Rico.addClass(this.thead[b],Rico.theme.gridheader)
2703 }}for(b=0;
2704 b<2;
2705 b++){this.tbody[b]=Rico.getTBody(this.tabs[b==0?0:2]);
2706 this.tbody[b].className="ricoLG_bottom";
2707 if(Rico.theme.gridcontent){Rico.addClass(this.tbody[b],Rico.theme.gridcontent)
2708 }this.tbody[b].insertRow(-1)
2709 }this.frozenTabs.appendChild(this.tabs[0]);
2710 this.innerDiv.appendChild(this.tabs[1]);
2711 this.scrollTab.appendChild(this.tabs[2]);
2712 if(f){f.parentNode.insertBefore(this.outerDiv,f)
2713 }if(g){this.headerColCnt=this.getColumnInfo(g);
2714 this.loadHdrSrc(g)
2715 }else{this.createHdr(0,0,this.options.frozenColumns);
2716 this.createHdr(1,this.options.frozenColumns,this.options.columnSpecs.length);
2717 if(this.options.ColGroupsOnTabHdr&&this.options.ColGroups){this.insertPanelNames(this.thead[0].insertRow(0),0,this.options.frozenColumns);
2718 this.insertPanelNames(this.thead[1].insertRow(0),this.options.frozenColumns,this.options.columnSpecs.length)
2719 }for(b=0;
2720 b<2;
2721 b++){this.headerColCnt=this.getColumnInfo(this.thead[b].rows)
2722 }}for(var j=0;
2723 j<this.headerColCnt;
2724 j++){this.tbody[j<this.options.frozenColumns?0:1].rows[0].insertCell(-1)
2725 }if(f){e.parentNode.removeChild(e)
2726 }Rico.log("createTables end");
2727 return true
2728 },createDataCells:function(d){if(d<0){for(var a=0;
2729 a<this.options.minPageRows;
2730 a++){this.appendBlankRow()
2731 }this.sizeDivs();
2732 this.autoAppendRows(this.remainingHt())
2733 }else{for(var c=0;
2734 c<d;
2735 c++){this.appendBlankRow()
2736 }}var b=this.options.highlightSection;
2737 if(b&1){this.attachHighlightEvents(this.tbody[0])
2738 }if(b&2){this.attachHighlightEvents(this.tbody[1])
2739 }},filterId:function(a){return"RicoFilter_"+this.tableId+"_"+a
2740 },createFilters:function(b){for(var h=0;
2741 h<this.headerColCnt;
2742 h++){var e=this.columns[h];
2743 var f=e.format;
2744 if(typeof f.filterUI!="string"){continue
2745 }var l=this.hdrCells[b][h].cell;
2746 var j,d=this.filterId(h);
2747 var i=l.getElementsByTagName("div");
2748 var g=Rico.getStyle(this.cell(0,h),"textAlign");
2749 i[1].style.textAlign=g;
2750 switch(f.filterUI.charAt(0)){case"t":j=Rico.createFormField(i[1],"input",Rico.inputtypes.search?"search":"text",d,d);
2751 var n=f.filterUI.match(/\d+/);
2752 j.maxLength=f.Length||50;
2753 j.size=n?parseInt(n,10):10;
2754 if(j.type!="search"){i[1].appendChild(Rico.clearButton(Rico.eventHandle(e,"filterClear")))
2755 }if(e.filterType==Rico.ColumnConst.USERFILTER&&e.filterOp=="LIKE"){var k=e.filterValues[0];
2756 if(k.charAt(0)=="*"){k=k.substr(1)
2757 }if(k.slice(-1)=="*"){k=k.slice(0,-1)
2758 }j.value=k;
2759 e.lastKeyFilter=k
2760 }Rico.eventBind(j,"keyup",Rico.eventHandle(e,"filterKeypress"),false);
2761 e.filterField=j;
2762 break;
2763 case"m":case"s":j=Rico.createFormField(i[1],"select",null,d);
2764 Rico.addSelectOption(j,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));
2765 e.filterField=j;
2766 var m={};
2767 Rico.extend(m,this.buffer.ajaxOptions);
2768 var a=typeof(f.filterCol)=="number"?f.filterCol:h;
2769 m.parameters={id:this.tableId,distinct:a};
2770 m.parameters[this.actionId]="query";
2771 m.onComplete=this.filterValuesUpdateFunc(h);
2772 new Rico.ajaxRequest(this.buffer.dataSource,m);
2773 break;
2774 case"c":if(typeof e._createFilters=="function"){e._createFilters(i[1],d)
2775 }break
2776 }}this.initFilterImage(b)
2777 },filterValuesUpdateFunc:function(b){var a=this;
2778 return function(c){a.filterValuesUpdate(b,c)
2779 }
2780 },filterValuesUpdate:function(a,g){var f=g.responseXML.getElementsByTagName("ajax-response");
2781 Rico.log("filterValuesUpdate: "+g.status);
2782 if(f==null||f.length!=1){return false
2783 }f=f[0];
2784 var n=f.getElementsByTagName("error");
2785 if(n.length>0){Rico.log("Data provider returned an error:\n"+Rico.getContentAsString(n[0],this.buffer.isEncoded));
2786 alert(Rico.getPhraseById("requestError",Rico.getContentAsString(n[0],this.buffer.isEncoded)));
2787 return false
2788 }f=f.getElementsByTagName("response")[0];
2789 var l=f.getElementsByTagName("rows")[0];
2790 var d=this.columns[parseInt(a,10)];
2791 var r=this.buffer.dom2jstable(l);
2792 var m,b,q;
2793 if(d.filterType==Rico.ColumnConst.USERFILTER&&d.filterOp=="EQ"){q=d.filterValues[0]
2794 }Rico.log("filterValuesUpdate: col="+a+" rows="+r.length);
2795 switch(d.format.filterUI.charAt(0)){case"m":d.mFilter=document.body.appendChild(document.createElement("div"));
2796 d.mFilter.className="ricoLG_mFilter";
2797 Rico.hide(d.mFilter);
2798 var e=d.mFilter.appendChild(document.createElement("div"));
2799 e.className="ricoLG_mFilter_content";
2800 var o=d.mFilter.appendChild(document.createElement("div"));
2801 o.className="ricoLG_mFilter_button";
2802 d.mFilterButton=o.appendChild(document.createElement("button"));
2803 d.mFilterButton.innerHTML=Rico.getPhraseById("ok");
2804 var j=Rico.isWebKit?"mousedown":"click";
2805 Rico.eventBind(d.filterField,j,Rico.eventHandle(d,"mFilterSelectClick"));
2806 Rico.eventBind(d.mFilterButton,"click",Rico.eventHandle(d,"mFilterFinish"));
2807 tab=e.appendChild(document.createElement("table"));
2808 tab.border=0;
2809 tab.cellPadding=2;
2810 tab.cellSpacing=0;
2811 var p=this.filterId(a)+"_";
2812 this.createMFilterItem(tab,this.options.FilterAllToken,Rico.getPhraseById("filterAll"),p+"all",Rico.eventHandle(d,"mFilterAllClick"));
2813 var k=Rico.eventHandle(d,"mFilterOtherClick");
2814 for(var h=0;
2815 h<r.length;
2816 h++){if(r[h].length>0){m=r[h][0];
2817 this.createMFilterItem(tab,m,m||Rico.getPhraseById("filterBlank"),p+h,k)
2818 }}d.mFilterInputs=e.getElementsByTagName("input");
2819 d.mFilterLabels=e.getElementsByTagName("label");
2820 d.mFilterFocus=d.mFilterInputs.length?d.mFilterInputs[0]:d.mFilterButton;
2821 break;
2822 case"s":for(var h=0;
2823 h<r.length;
2824 h++){if(r[h].length>0){m=r[h][0];
2825 b=Rico.addSelectOption(d.filterField,m,m||Rico.getPhraseById("filterBlank"));
2826 if(d.filterType==Rico.ColumnConst.USERFILTER&&m==q){b.selected=true
2827 }}}Rico.eventBind(d.filterField,"change",Rico.eventHandle(d,"filterChange"));
2828 break
2829 }return true
2830 },createMFilterItem:function(j,b,i,a,e){var f=j.insertRow(-1);
2831 f.vAlign="top";
2832 if(f.rowIndex%2==1){f.className="ricoLG_mFilter_oddrow"
2833 }var d=f.insertCell(-1);
2834 var c=f.insertCell(-1);
2835 var h=Rico.createFormField(d,"input","checkbox",a);
2836 h.value=b;
2837 h.checked=true;
2838 var g=c.appendChild(document.createElement("label"));
2839 g.htmlFor=a;
2840 g.innerHTML=i;
2841 Rico.eventBind(h,"click",e)
2842 },unplugHighlightEvents:function(){var a=this.options.highlightSection;
2843 if(a&1){this.detachHighlightEvents(this.tbody[0])
2844 }if(a&2){this.detachHighlightEvents(this.tbody[1])
2845 }},insertPanelNames:function(a,b,d,f){Rico.log("insertPanelNames: start="+b+" limit="+d);
2846 a.className="ricoLG_hdg";
2847 var i=-1,j,e=null,g=0;
2848 for(var h=b;
2849 h<d;
2850 h++){if(i==this.options.columnSpecs[h].ColGroupIdx){j++
2851 }else{if(e){e.colSpan=j
2852 }e=a.insertCell(-1);
2853 if(f){e.className=f
2854 }j=1;
2855 i=this.options.columnSpecs[h].ColGroupIdx;
2856 e.innerHTML=this.options.ColGroups[i]
2857 }}if(e){e.colSpan=j
2858 }},createHdr:function(d,g,b){Rico.log("createHdr: i="+d+" start="+g+" limit="+b);
2859 var a=this.thead[d].insertRow(-1);
2860 a.id=this.tableId+"_tab"+d+"h_main";
2861 a.className="ricoLG_hdg";
2862 for(var f=g;
2863 f<b;
2864 f++){var e=a.insertCell(-1);
2865 e.innerHTML=this.options.columnSpecs[f].Hdg
2866 }},loadHdrSrc:function(g){var b,d,j,e,f,a;
2867 Rico.log("loadHdrSrc start");
2868 for(b=0;
2869 b<2;
2870 b++){for(e=0;
2871 e<g.length;
2872 e++){f=this.thead[b].insertRow(-1);
2873 f.className="ricoLG_hdg "+this.tableId+"_hdg"+e
2874 }}if(g.length==1){a=g[0].cells;
2875 for(j=0;
2876 a.length>0;
2877 j++){this.thead[j<this.options.frozenColumns?0:1].rows[0].appendChild(a[0])
2878 }}else{for(e=0;
2879 e<g.length;
2880 e++){a=g[e].cells;
2881 for(j=0,d=0;
2882 a.length>0;
2883 j++){if(Rico.hasClass(a[0],"ricoFrozen")){if(e==this.headerRowIdx){this.options.frozenColumns=j+1
2884 }}else{d=1
2885 }this.thead[d].rows[e].appendChild(a[0])
2886 }}}Rico.log("loadHdrSrc end")
2887 },sizeDivs:function(){Rico.log("sizeDivs: "+this.tableId);
2888 this.unhighlight();
2889 this.baseSizeDivs();
2890 var d=this.firstVisible();
2891 if(this.pageSize==0||d<0){return
2892 }var c=this.columns[d].dataColDiv.offsetHeight;
2893 this.rowHeight=Math.round(c/this.pageSize);
2894 var b=this.dataHt;
2895 if(this.scrTabWi0==this.scrTabWi){this.innerDiv.style.height=(this.hdrHt+1)+"px";
2896 this.scrollDiv.style.overflowX="hidden"
2897 }else{this.scrollDiv.style.overflowX="scroll";
2898 b+=this.options.scrollBarWidth
2899 }this.scrollDiv.style.height=b+"px";
2900 this.innerDiv.style.width=(this.scrWi)+"px";
2901 this.scrollTab.style.width=(this.scrWi-this.options.scrollBarWidth)+"px";
2902 this.resizeDiv.style.height=(this.hdrHt+this.dataHt+1)+"px";
2903 Rico.log("sizeDivs scrHt="+b+" innerHt="+this.innerDiv.style.height+" rowHt="+this.rowHeight+" pageSize="+this.pageSize);
2904 var a=(this.scrWi-this.scrTabWi<this.options.scrollBarWidth)?2:0;
2905 this.shadowDiv.style.width=(this.scrTabWi+a)+"px";
2906 this.outerDiv.style.height=(this.hdrHt+b)+"px";
2907 this.setHorizontalScroll()
2908 },setHorizontalScroll:function(){var a=(-this.scrollDiv.scrollLeft)+"px";
2909 this.tabs[1].style.marginLeft=a;
2910 this.tabs[2].style.marginLeft=a
2911 },remainingHt:function(){var f=this.outerDiv.offsetHeight;
2912 var g=Rico.windowHeight();
2913 var e=Rico.isIE?15:10;
2914 if(!Rico.isIE&&window.frameElement&&window.frameElement.scrolling=="yes"&&this.sizeTo!="parent"){e+=this.options.scrollBarWidth
2915 }switch(this.sizeTo){case"window":var d=Rico.cumulativeOffset(this.outerDiv).top;
2916 Rico.log("remainingHt/window, winHt="+g+" tabHt="+f+" gridY="+d);
2917 return g-d-f-e;
2918 case"parent":var h=this.offsetFromParent(this.outerDiv);
2919 if(Rico.isIE){Rico.hide(this.outerDiv)
2920 }var b=this.outerDiv.parentNode.clientHeight;
2921 if(Rico.isIE){Rico.show(this.outerDiv)
2922 }Rico.log("remainingHt/parent, parentHt="+b+" offset="+h+" tabHt="+f);
2923 return b-f-h-e;
2924 case"data":case"body":var a=Rico.isIE?document.body.scrollHeight:document.body.offsetHeight;
2925 var c=g-a-e;
2926 if(!Rico.isWebKit){c-=this.options.scrollBarWidth
2927 }Rico.log("remainingHt, winHt="+g+" pageHt="+a+" remHt="+c);
2928 return c;
2929 default:Rico.log("remainingHt, winHt="+g+" tabHt="+f);
2930 if(this.sizeTo.slice(-1)=="%"){g*=parseFloat(this.sizeTo)/100
2931 }else{if(this.sizeTo.slice(-2)=="px"){g=parseInt(this.sizeTo,10)
2932 }}return g-f-e
2933 }},offsetFromParent:function(b){var a=0;
2934 var c=b.parentNode;
2935 do{a+=b.offsetTop||0;
2936 b=b.offsetParent;
2937 if(!b||b==null){break
2938 }var d=Rico.getStyle(b,"position");
2939 if(b.tagName=="BODY"||b.tagName=="HTML"||d=="absolute"){return a-c.offsetTop
2940 }}while(b!=c);
2941 return a
2942 },adjustPageSize:function(){var a=this.remainingHt();
2943 Rico.log("adjustPageSize remHt="+a+" lastRow="+this.lastRowPos);
2944 if(a>this.rowHeight){this.autoAppendRows(a)
2945 }else{if(a<0||this.sizeTo=="data"){this.autoRemoveRows(-a)
2946 }}},setPageSize:function(b){b=Math.min(b,this.options.maxPageRows);
2947 b=Math.max(b,this.options.minPageRows);
2948 this.sizeTo="fixed";
2949 var a=this.pageSize;
2950 while(this.pageSize>b){this.removeRow()
2951 }while(this.pageSize<b){this.appendBlankRow()
2952 }this.finishResize(a)
2953 },pluginWindowResize:function(){Rico.log("pluginWindowResize");
2954 this.resizeWindowHandler=Rico.eventHandle(this,"resizeWindow");
2955 Rico.eventBind(window,"resize",this.resizeWindowHandler,false)
2956 },unplugWindowResize:function(){if(!this.resizeWindowHandler){return
2957 }Rico.eventUnbind(window,"resize",this.resizeWindowHandler,false);
2958 this.resizeWindowHandler=null
2959 },resizeWindow:function(){Rico.log("resizeWindow "+this.tableId+" lastRow="+this.lastRowPos);
2960 if(this.resizeState=="finish"){Rico.log("resizeWindow postponed");
2961 this.resizeState="resize";
2962 return
2963 }if(!this.sizeTo||this.sizeTo=="fixed"){this.sizeDivs();
2964 return
2965 }if(this.sizeTo=="parent"&&Rico.getStyle(this.outerDiv.parentNode,"display")=="none"){return
2966 }var a=this.pageSize;
2967 this.adjustPageSize();
2968 this.finishResize(a)
2969 },finishResize:function(b){if(this.pageSize>b&&this.buffer.totalRows>0){this.isPartialBlank=true;
2970 var a=this.adjustRow(this.lastRowPos);
2971 this.buffer.fetch(a)
2972 }else{if(this.pageSize<b){if(this.options.onRefreshComplete){this.options.onRefreshComplete(this.contentStartPos,this.contentStartPos+this.pageSize-1)
2973 }}}this.resizeState="finish";
2974 Rico.runLater(20,this,"finishResize2");
2975 Rico.log("Resize "+this.tableId+" complete. old size="+b+" new size="+this.pageSize)
2976 },finishResize2:function(){this.sizeDivs();
2977 this.updateHeightDiv();
2978 if(this.resizeState=="resize"){this.resizeWindow()
2979 }else{this.resizeState=""
2980 }},topOfLastPage:function(){return Math.max(this.buffer.totalRows-this.pageSize,0)
2981 },updateHeightDiv:function(){var b=this.topOfLastPage();
2982 var a=b?this.scrollDiv.clientHeight+Math.floor(this.rowHeight*(b+0.4)):1;
2983 Rico.log("updateHeightDiv, ht="+a+" scrollDiv.clientHeight="+this.scrollDiv.clientHeight+" rowsNotDisplayed="+b);
2984 this.shadowDiv.style.height=a+"px"
2985 },autoRemoveRows:function(a){if(!this.rowHeight){return
2986 }var c=Math.ceil(a/this.rowHeight);
2987 if(this.sizeTo=="data"){c=Math.max(c,this.pageSize-this.buffer.totalRows)
2988 }Rico.log("autoRemoveRows overage="+a+" removeCnt="+c);
2989 for(var b=0;
2990 b<c;
2991 b++){this.removeRow()
2992 }},removeRow:function(){if(this.pageSize<=this.options.minPageRows){return
2993 }this.pageSize--;
2994 for(var b=0;
2995 b<this.headerColCnt;
2996 b++){var a=this.columns[b].cell(this.pageSize);
2997 this.columns[b].dataColDiv.removeChild(a)
2998 }},autoAppendRows:function(a){if(!this.rowHeight){return
2999 }var c=Math.floor(a/this.rowHeight);
3000 Rico.log("autoAppendRows overage="+a+" cnt="+c+" rowHt="+this.rowHeight);
3001 for(var b=0;
3002 b<c;
3003 b++){if(this.sizeTo=="data"&&this.pageSize>=this.buffer.totalRows){break
3004 }this.appendBlankRow()
3005 }},appendBlankRow:function(){if(this.pageSize>=this.options.maxPageRows){return
3006 }Rico.log("appendBlankRow #"+this.pageSize);
3007 var a=this.defaultRowClass(this.pageSize);
3008 for(var d=0;
3009 d<this.headerColCnt;
3010 d++){var b=document.createElement("div");
3011 b.className="ricoLG_cell "+a;
3012 b.id=this.tableId+"_"+this.pageSize+"_"+d;
3013 this.columns[d].dataColDiv.appendChild(b);
3014 if(this.columns[d].format.canDrag&&Rico.registerDraggable){Rico.registerDraggable(new Rico.LiveGridDraggable(this,this.pageSize,d),this.options.dndMgrIdx)
3015 }b.innerHTML="&nbsp;";
3016 if(this.columns[d]._create){this.columns[d]._create(b,this.pageSize)
3017 }}this.pageSize++
3018 },defaultRowClass:function(b){var a;
3019 if(b%2==0){a="ricoLG_evenRow"
3020 }else{a="ricoLG_oddRow"
3021 }return a
3022 },handleMenuClick:function(f){if(!this.menu){return
3023 }this.cancelMenu();
3024 this.unhighlight();
3025 var b;
3026 var a=Rico.eventElement(f);
3027 if(a.className=="ricoLG_highlightDiv"){b=this.highlightIdx
3028 }else{a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3029 if(!a){return
3030 }b=this.winCellIndex(a);
3031 if((this.options.highlightSection&(b.tabIdx+1))==0){return
3032 }}this.highlight(b);
3033 this.highlightEnabled=false;
3034 if(this.hideScroll){this.scrollDiv.style.overflow="hidden"
3035 }this.menuIdx=b;
3036 if(!this.menu.div){this.menu.createDiv()
3037 }this.menu.liveGrid=this;
3038 if(this.menu.buildGridMenu){var d=this.menu.buildGridMenu(b.row,b.column,b.tabIdx);
3039 if(!d){return
3040 }}if(this.options.highlightElem=="selection"&&!this.isSelected(b.cell)){this.selectCell(b.cell)
3041 }var c=this;
3042 this.menu.showmenu(f,function(){c.closeMenu()
3043 });
3044 return false
3045 },closeMenu:function(){if(!this.menuIdx){return
3046 }if(this.hideScroll){this.scrollDiv.style.overflow=""
3047 }this.highlightEnabled=true;
3048 this.menuIdx=null
3049 },winCellIndex:function(b){var d=b.id.lastIndexOf("_",b.id.length);
3050 var a=b.id.lastIndexOf("_",d-1)+1;
3051 var f=parseInt(b.id.substr(d+1));
3052 var e=parseInt(b.id.substr(a,d));
3053 return{row:e,column:f,tabIdx:this.columns[f].tabIdx,cell:b}
3054 },datasetIndex:function(b){var a=this.winCellIndex(b);
3055 a.row+=this.buffer.windowPos;
3056 a.onBlankRow=(a.row>=this.buffer.endPos());
3057 return a
3058 },attachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventBind(a,"mousedown",this.options.mouseDownHandler,false);
3059 a.ondrag=function(){return false
3060 };
3061 a.onselectstart=function(){return false
3062 };
3063 break;
3064 case"cursorRow":case"cursorCell":Rico.eventBind(a,"mouseover",this.options.rowOverHandler,false);
3065 break
3066 }},detachHighlightEvents:function(a){switch(this.options.highlightElem){case"selection":Rico.eventUnbind(a,"mousedown",this.options.mouseDownHandler,false);
3067 a.ondrag=null;
3068 a.onselectstart=null;
3069 break;
3070 case"cursorRow":case"cursorCell":Rico.eventUnbind(a,"mouseover",this.options.rowOverHandler,false);
3071 break
3072 }},getVisibleSelection:function(){var d=[];
3073 if(this.SelectIdxStart&&this.SelectIdxEnd){var b=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowStart);
3074 var a=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowEnd-1);
3075 var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3076 var f=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3077 for(var h=b;
3078 h<=a;
3079 h++){for(var j=g;
3080 j<=f;
3081 j++){d.push({row:h-this.buffer.windowStart,column:j})
3082 }}}if(this.SelectCtrl){for(var e=0;
3083 e<this.SelectCtrl.length;
3084 e++){if(this.SelectCtrl[e].row>=this.buffer.windowStart&&this.SelectCtrl[e].row<this.buffer.windowEnd){d.push({row:this.SelectCtrl[e].row-this.buffer.windowStart,column:this.SelectCtrl[e].column})
3085 }}}return d
3086 },updateSelectOutline:function(){if(!this.SelectIdxStart||!this.SelectIdxEnd){return
3087 }var d=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowStart);
3088 var c=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowEnd-1);
3089 if(d>c){this.HideSelection();
3090 return
3091 }var g=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3092 var e=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3093 var h=this.columns[g].cell(d-this.buffer.windowStart).offsetTop;
3094 var j=this.columns[g].cell(c-this.buffer.windowStart);
3095 var b=j.offsetTop+j.offsetHeight;
3096 var l=this.columns[g].dataCell.offsetLeft;
3097 var k=this.columns[e].dataCell.offsetLeft;
3098 var a=k+this.columns[e].dataCell.offsetWidth;
3099 this.highlightDiv[0].style.top=this.highlightDiv[3].style.top=this.highlightDiv[1].style.top=(this.hdrHt+h-1)+"px";
3100 this.highlightDiv[2].style.top=(this.hdrHt+b-1)+"px";
3101 this.highlightDiv[3].style.left=(l-2)+"px";
3102 this.highlightDiv[0].style.left=this.highlightDiv[2].style.left=(l-1)+"px";
3103 this.highlightDiv[1].style.left=(a-1)+"px";
3104 this.highlightDiv[0].style.width=this.highlightDiv[2].style.width=(a-l-1)+"px";
3105 this.highlightDiv[1].style.height=this.highlightDiv[3].style.height=(b-h)+"px";
3106 for(var f=0;
3107 f<4;
3108 f++){this.highlightDiv[f].style.display=""
3109 }},HideSelection:function(){var b;
3110 if(this.options.highlightMethod!="class"){for(b=0;
3111 b<this.highlightDiv.length;
3112 b++){this.highlightDiv[b].style.display="none"
3113 }}if(this.options.highlightMethod!="outline"){var a=this.getVisibleSelection();
3114 Rico.log("HideSelection "+a.length);
3115 for(b=0;
3116 b<a.length;
3117 b++){this.unhighlightCell(this.columns[a[b].column].cell(a[b].row))
3118 }}},ShowSelection:function(){if(this.options.highlightMethod!="class"){this.updateSelectOutline()
3119 }if(this.options.highlightMethod!="outline"){var a=this.getVisibleSelection();
3120 for(var b=0;
3121 b<a.length;
3122 b++){this.highlightCell(this.columns[a[b].column].cell(a[b].row))
3123 }}},ClearSelection:function(){Rico.log("ClearSelection");
3124 this.HideSelection();
3125 this.SelectIdxStart=null;
3126 this.SelectIdxEnd=null;
3127 this.SelectCtrl=[]
3128 },selectCell:function(a){this.ClearSelection();
3129 this.SelectIdxStart=this.SelectIdxEnd=this.datasetIndex(a);
3130 this.ShowSelection()
3131 },AdjustSelection:function(a){var b=this.datasetIndex(a);
3132 if(this.SelectIdxStart.tabIdx!=b.tabIdx){return
3133 }this.HideSelection();
3134 this.SelectIdxEnd=b;
3135 this.ShowSelection()
3136 },RefreshSelection:function(){var a=this.getVisibleSelection();
3137 for(var b=0;
3138 b<a.length;
3139 b++){this.columns[a[b].column].displayValue(a[b].row)
3140 }},FillSelection:function(b,f){if(this.SelectIdxStart&&this.SelectIdxEnd){var e=Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row);
3141 var d=Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row);
3142 var j=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3143 var g=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3144 for(var a=e;
3145 a<=d;
3146 a++){for(var k=j;
3147 k<=g;
3148 k++){this.buffer.setValue(a,k,b,f)
3149 }}}if(this.SelectCtrl){for(var h=0;
3150 h<this.SelectCtrl.length;
3151 h++){this.buffer.setValue(this.SelectCtrl[h].row,this.SelectCtrl[h].column,b,f)
3152 }}this.RefreshSelection()
3153 },selectMouseDown:function(d){if(this.highlightEnabled==false){return true
3154 }this.cancelMenu();
3155 var a=Rico.eventElement(d);
3156 if(!Rico.eventLeftClick(d)){return true
3157 }a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3158 if(!a){return true
3159 }Rico.eventStop(d);
3160 var c=this.datasetIndex(a);
3161 if(c.onBlankRow){return true
3162 }Rico.log("selectMouseDown @"+c.row+","+c.column);
3163 if(d.ctrlKey){if(!this.SelectIdxStart||this.options.highlightMethod!="class"){return true
3164 }if(!this.isSelected(a)){this.highlightCell(a);
3165 this.SelectCtrl.push(this.datasetIndex(a))
3166 }else{for(var b=0;
3167 b<this.SelectCtrl.length;
3168 b++){if(this.SelectCtrl[b].row==c.row&&this.SelectCtrl[b].column==c.column){this.unhighlightCell(a);
3169 this.SelectCtrl.splice(b,1);
3170 break
3171 }}}}else{if(d.shiftKey){if(!this.SelectIdxStart){return true
3172 }this.AdjustSelection(a)
3173 }else{this.selectCell(a);
3174 this.pluginSelect()
3175 }}return false
3176 },pluginSelect:function(){if(this.selectPluggedIn){return
3177 }var a=this.tbody[this.SelectIdxStart.tabIdx];
3178 Rico.eventBind(a,"mouseover",this.options.mouseOverHandler,false);
3179 Rico.eventBind(this.outerDiv,"mouseup",this.options.mouseUpHandler,false);
3180 this.selectPluggedIn=true
3181 },unplugSelect:function(){if(!this.selectPluggedIn){return
3182 }var a=this.tbody[this.SelectIdxStart.tabIdx];
3183 Rico.eventUnbind(a,"mouseover",this.options.mouseOverHandler,false);
3184 Rico.eventUnbind(this.outerDiv,"mouseup",this.options.mouseUpHandler,false);
3185 this.selectPluggedIn=false
3186 },selectMouseUp:function(b){this.unplugSelect();
3187 var a=Rico.eventElement(b);
3188 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3189 if(!a){return
3190 }if(this.SelectIdxStart&&this.SelectIdxEnd){this.AdjustSelection(a)
3191 }else{this.ClearSelection()
3192 }},selectMouseOver:function(b){var a=Rico.eventElement(b);
3193 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3194 if(!a){return
3195 }this.AdjustSelection(a);
3196 Rico.eventStop(b)
3197 },isSelected:function(a){if(this.options.highlightMethod!="outline"){return Rico.hasClass(a,this.options.highlightClass)
3198 }if(!this.SelectIdxStart||!this.SelectIdxEnd){return false
3199 }var c=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowStart);
3200 var b=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row),this.buffer.windowEnd-1);
3201 if(c>b){return false
3202 }var e=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3203 var d=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
3204 var f=this.datasetIndex(a);
3205 return(c<=f.row&&f.row<=b&&e<=f.column&&f.column<=d)
3206 },highlightCell:function(a){Rico.addClass(a,this.options.highlightClass)
3207 },unhighlightCell:function(a){if(a){Rico.removeClass(a,this.options.highlightClass)
3208 }},selectRow:function(a){for(var b=0;
3209 b<this.columns.length;
3210 b++){this.highlightCell(this.columns[b].cell(a))
3211 }},unselectRow:function(a){for(var b=0;
3212 b<this.columns.length;
3213 b++){this.unhighlightCell(this.columns[b].cell(a))
3214 }},rowMouseOver:function(c){if(!this.highlightEnabled){return
3215 }var a=Rico.eventElement(c);
3216 a=Rico.getParentByTagName(a,"div","ricoLG_cell");
3217 if(!a){return
3218 }var b=this.winCellIndex(a);
3219 if((this.options.highlightSection&(b.tabIdx+1))==0){return
3220 }this.highlight(b)
3221 },highlight:function(a){if(this.options.highlightMethod!="outline"){this.cursorSetClass(a)
3222 }if(this.options.highlightMethod!="class"){this.cursorOutline(a)
3223 }this.highlightIdx=a
3224 },cursorSetClass:function(e){switch(this.options.highlightElem){case"menuCell":case"cursorCell":if(this.highlightIdx){this.unhighlightCell(this.highlightIdx.cell)
3225 }this.highlightCell(e.cell);
3226 break;
3227 case"menuRow":case"cursorRow":if(this.highlightIdx){this.unselectRow(this.highlightIdx.row)
3228 }var b=this.options.highlightSection&1;
3229 var a=this.options.highlightSection&2;
3230 var f=b?0:this.options.frozenColumns;
3231 var d=a?this.columns.length:this.options.frozenColumns;
3232 for(var g=f;
3233 g<d;
3234 g++){this.highlightCell(this.columns[g].cell(e.row))
3235 }break;
3236 default:return
3237 }},cursorOutline:function(c){var d;
3238 switch(this.options.highlightElem){case"menuCell":case"cursorCell":d=this.highlightDiv[c.tabIdx];
3239 d.style.left=(this.columns[c.column].dataCell.offsetLeft-1)+"px";
3240 d.style.width=this.columns[c.column].colWidth;
3241 this.highlightDiv[1-c.tabIdx].style.display="none";
3242 break;
3243 case"menuRow":case"cursorRow":d=this.highlightDiv[0];
3244 var b=this.options.highlightSection&1;
3245 var a=this.options.highlightSection&2;
3246 d.style.left=b?"0px":this.frozenTabs.style.width;
3247 d.style.width=((b?this.frozenTabs.offsetWidth:0)+(a?this.innerDiv.offsetWidth:0)-4)+"px";
3248 break;
3249 default:return
3250 }d.style.top=(this.hdrHt+c.row*this.rowHeight-1)+"px";
3251 d.style.height=(this.rowHeight-1)+"px";
3252 d.style.display=""
3253 },unhighlight:function(){switch(this.options.highlightElem){case"menuCell":case"cursorCell":if(this.highlightIdx){this.unhighlightCell(this.highlightIdx.cell)
3254 }if(!this.highlightDiv){return
3255 }for(var a=0;
3256 a<2;
3257 a++){this.highlightDiv[a].style.display="none"
3258 }break;
3259 case"menuRow":case"cursorRow":if(this.highlightIdx){this.unselectRow(this.highlightIdx.row)
3260 }if(this.highlightDiv){this.highlightDiv[0].style.display="none"
3261 }break
3262 }},resetContents:function(){Rico.log("resetContents");
3263 this.ClearSelection();
3264 this.buffer.clear();
3265 this.clearRows();
3266 this.clearBookmark()
3267 },setImages:function(){for(var a=0;
3268 a<this.columns.length;
3269 a++){this.columns[a].setImage()
3270 }},findSortedColumn:function(){for(var a=0;
3271 a<this.columns.length;
3272 a++){if(this.columns[a].isSorted()){return a
3273 }}return -1
3274 },findColumnName:function(a){for(var b=0;
3275 b<this.columns.length;
3276 b++){if(this.columns[b].fieldName==a){return b
3277 }}return -1
3278 },findColumnsBySpec:function(b,c){var a=[];
3279 for(var d=0;
3280 d<this.options.columnSpecs.length;
3281 d++){if(this.options.columnSpecs[d][b]==c){a.push(d)
3282 }}return a
3283 },setSortUI:function(b,c){Rico.log("setSortUI: "+b+" "+c);
3284 var a=this.findSortedColumn();
3285 if(a>=0){c=this.columns[a].getSortDirection()
3286 }else{if(typeof c!="string"){c=Rico.ColumnConst.SORT_ASC
3287 }else{c=c.toUpperCase();
3288 if(c!=Rico.ColumnConst.SORT_DESC){c=Rico.ColumnConst.SORT_ASC
3289 }}switch(typeof b){case"string":a=this.findColumnName(b);
3290 break;
3291 case"number":a=b;
3292 break
3293 }}if(typeof(a)!="number"||a<0){return
3294 }this.clearSort();
3295 this.columns[a].setSorted(c);
3296 this.buffer.sortBuffer(a)
3297 },clearSort:function(){for(var a=0;
3298 a<this.columns.length;
3299 a++){this.columns[a].setUnsorted()
3300 }},clearFilters:function(){for(var a=0;
3301 a<this.columns.length;
3302 a++){this.columns[a].setUnfiltered(true)
3303 }if(this.options.filterHandler){this.options.filterHandler()
3304 }},filterCount:function(){for(var a=0,b=0;
3305 a<this.columns.length;
3306 a++){if(this.columns[a].isFiltered()){b++
3307 }}return b
3308 },sortHandler:function(){this.cancelMenu();
3309 this.ClearSelection();
3310 this.setImages();
3311 var a=this.findSortedColumn();
3312 if(a<0){return
3313 }Rico.log("sortHandler: sorting column "+a);
3314 this.buffer.sortBuffer(a);
3315 this.clearRows();
3316 this.scrollDiv.scrollTop=0;
3317 this.buffer.fetch(0)
3318 },filterHandler:function(){Rico.log("filterHandler");
3319 this.cancelMenu();
3320 if(this.buffer.processingRequest){this.queueFilter=true;
3321 return
3322 }this.unplugScroll();
3323 this.ClearSelection();
3324 this.setImages();
3325 this.clearBookmark();
3326 this.clearRows();
3327 this.buffer.fetch(-1);
3328 Rico.runLater(10,this,"pluginScroll")
3329 },clearBookmark:function(){if(this.bookmark){this.bookmark.innerHTML="&nbsp;"
3330 }},bookmarkHandler:function(a,d){var b;
3331 if(isNaN(a)||!this.bookmark){return
3332 }var c=this.buffer.totalRows;
3333 if(c<d){d=c
3334 }if(c<=0){b=Rico.getPhraseById("bookmarkNoMatch")
3335 }else{if(d<0){b=Rico.getPhraseById("bookmarkNoRec")
3336 }else{if(this.buffer.foundRowCount){b=Rico.getPhraseById("bookmarkExact",a,d,c)
3337 }else{b=Rico.getPhraseById("bookmarkAbout",a,d,c)
3338 }}}this.bookmark.innerHTML=b
3339 },clearRows:function(){if(this.isBlank==true){return
3340 }for(var a=0;
3341 a<this.columns.length;
3342 a++){this.columns[a].clearColumn()
3343 }this.isBlank=true
3344 },refreshContents:function(j){Rico.log("refreshContents1 "+this.tableId+": startPos="+j+" lastRow="+this.lastRowPos+" PartBlank="+this.isPartialBlank+" pageSize="+this.pageSize);
3345 this.hideMsg();
3346 this.cancelMenu();
3347 this.unhighlight();
3348 if(this.queueFilter){Rico.log("refreshContents: cancelling refresh because filter has changed");
3349 this.queueFilter=false;
3350 this.filterHandler();
3351 return
3352 }this.highlightEnabled=this.options.highlightSection!="none";
3353 var h=this.buffer.startPos>j;
3354 var d=h?this.buffer.startPos:j;
3355 this.contentStartPos=d+1;
3356 var b=Math.min(this.buffer.startPos+this.buffer.size,j+this.pageSize);
3357 this.buffer.setWindow(d,b);
3358 Rico.log("refreshContents2 "+this.tableId+": cStartPos="+d+" cEndPos="+b+" vPrecedesBuf="+h+" b.startPos="+this.buffer.startPos);
3359 if(j==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return
3360 }this.isBlank=false;
3361 var m=this.options.onRefreshComplete;
3362 if((j+this.pageSize<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<j)||(this.buffer.size==0)){this.clearRows();
3363 if(m){m(this.contentStartPos,b)
3364 }return
3365 }Rico.log("refreshContents: contentStartPos="+d+" contentEndPos="+b+" viewPrecedesBuffer="+h);
3366 var n=b-d;
3367 var f=this.pageSize-n;
3368 var k=h?0:n;
3369 var e=h?f:0;
3370 for(var a=0;
3371 a<n;
3372 a++){for(var l=0;
3373 l<this.columns.length;
3374 l++){this.columns[l].displayValue(a+e)
3375 }}for(var g=0;
3376 g<f;
3377 g++){this.blankRow(g+k)
3378 }if(this.options.highlightElem=="selection"){this.ShowSelection()
3379 }this.isPartialBlank=f>0;
3380 this.lastRowPos=j;
3381 Rico.log("refreshContents complete, startPos="+j);
3382 if(m){m(this.contentStartPos,b)
3383 }},scrollToRow:function(a){var b=this.rowToPixel(a);
3384 Rico.log("scrollToRow, rowOffset="+a+" pixel="+b);
3385 this.scrollDiv.scrollTop=b;
3386 if(this.options.onscroll){this.options.onscroll(this,a)
3387 }},scrollUp:function(){this.moveRelative(-1)
3388 },scrollDown:function(){this.moveRelative(1)
3389 },pageUp:function(){this.moveRelative(-this.pageSize)
3390 },pageDown:function(){this.moveRelative(this.pageSize)
3391 },adjustRow:function(a){var b=this.topOfLastPage();
3392 if(b==0||!a){return 0
3393 }return Math.min(b,a)
3394 },rowToPixel:function(a){return this.adjustRow(a)*this.rowHeight
3395 },pixeltorow:function(c){var b=this.topOfLastPage();
3396 if(b==0){return 0
3397 }var a=parseInt(c/this.rowHeight,10);
3398 return Math.min(b,a)
3399 },moveRelative:function(b){var a=Math.max(this.scrollDiv.scrollTop+b*this.rowHeight,0);
3400 a=Math.min(a,this.scrollDiv.scrollHeight);
3401 this.scrollDiv.scrollTop=a
3402 },pluginScroll:function(){if(this.scrollPluggedIn){return
3403 }Rico.log("pluginScroll: wheelEvent="+this.wheelEvent);
3404 Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
3405 for(var a=0;
3406 a<2;
3407 a++){Rico.eventBind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false)
3408 }this.scrollPluggedIn=true
3409 },unplugScroll:function(){if(!this.scrollPluggedIn){return
3410 }Rico.log("unplugScroll");
3411 Rico.eventUnbind(this.scrollDiv,"scroll",this.scrollEventFunc,false);
3412 for(var a=0;
3413 a<2;
3414 a++){Rico.eventUnbind(this.tabs[a],this.wheelEvent,this.wheelEventFunc,false)
3415 }this.scrollPluggedIn=false
3416 },handleWheel:function(a){var b=0;
3417 if(a.wheelDelta){if(Rico.isOpera){b=a.wheelDelta/120
3418 }else{if(Rico.isWebKit){b=-a.wheelDelta/12
3419 }else{b=-a.wheelDelta/120
3420 }}}else{if(a.detail){b=a.detail/3
3421 }}if(b){this.moveRelative(b)
3422 }Rico.eventStop(a);
3423 return false
3424 },handleScroll:function(g){if(this.scrollTimeout){clearTimeout(this.scrollTimeout)
3425 }this.setHorizontalScroll();
3426 var a=this.scrollDiv.scrollTop;
3427 var b=this.lastScrollPos-a;
3428 if(b==0){return
3429 }var d=this.pixeltorow(a);
3430 if(d==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){return
3431 }var f=new Date();
3432 Rico.log("handleScroll, newrow="+d+" scrtop="+a);
3433 if(this.options.highlightElem=="selection"){this.HideSelection()
3434 }this.buffer.fetch(d);
3435 if(this.options.onscroll){this.options.onscroll(this,d)
3436 }this.scrollTimeout=Rico.runLater(1200,this,"scrollIdle");
3437 this.lastScrollPos=this.scrollDiv.scrollTop;
3438 var c=new Date()
3439 },scrollIdle:function(){if(this.options.onscrollidle){this.options.onscrollidle()
3440 }}};
3441 Rico.LiveGridColumn=function(a,d,c,b){this.initialize(a,d,c,b)
3442 };
3443 Rico.LiveGridColumn.prototype={initialize:function(liveGrid,colIdx,hdrInfo,tabIdx){Rico.extend(this,new Rico.TableColumnBase());
3444 this.baseInit(liveGrid,colIdx,hdrInfo,tabIdx);
3445 this.buffer=liveGrid.buffer;
3446 if(typeof(this.format.type)!="string"||this.format.EntryType=="tinyMCE"){this.format.type="html"
3447 }if(typeof this.isNullable!="boolean"){this.isNullable=/number|date/.test(this.format.type)
3448 }this.isText=/html|text/.test(this.format.type);
3449 Rico.log(" sortable="+this.sortable+" filterable="+this.filterable+" hideable="+this.hideable+" isNullable="+this.isNullable+" isText="+this.isText);
3450 this.fixHeaders(this.liveGrid.tableId,this.options.hdrIconsFirst);
3451 if(this["format_"+this.format.type]){this._format=this["format_"+this.format.type]
3452 }if(this.format.control){if(typeof this.format.control=="string"){this.format.control=eval(this.format.control)
3453 }for(var property in this.format.control){if(property.charAt(0)=="_"){Rico.log("Copying control property "+property+" to "+this);
3454 this[property]=this.format.control[property]
3455 }}}},sortAsc:function(){this.setColumnSort(Rico.ColumnConst.SORT_ASC)
3456 },sortDesc:function(){this.setColumnSort(Rico.ColumnConst.SORT_DESC)
3457 },setColumnSort:function(a){this.liveGrid.clearSort();
3458 this.setSorted(a);
3459 if(this.liveGrid.options.saveColumnInfo.sort){this.liveGrid.setCookie()
3460 }if(this.options.sortHandler){this.options.sortHandler()
3461 }},isSortable:function(){return this.sortable
3462 },isSorted:function(){return this.currentSort!=Rico.ColumnConst.UNSORTED
3463 },getSortDirection:function(){return this.currentSort
3464 },toggleSort:function(){if(this.buffer&&this.buffer.totalRows==0){return
3465 }if(this.currentSort==Rico.ColumnConst.SORT_ASC){this.sortDesc()
3466 }else{this.sortAsc()
3467 }},setUnsorted:function(){this.setSorted(Rico.ColumnConst.UNSORTED)
3468 },setSorted:function(a){this.currentSort=a
3469 },canFilter:function(){return this.filterable
3470 },getFilterText:function(){var c=[];
3471 for(var b=0;
3472 b<this.filterValues.length;
3473 b++){var a=this.filterValues[b];
3474 c.push(a==""?Rico.getPhraseById("filterBlank"):a)
3475 }switch(this.filterOp){case"EQ":return"= "+c.join(", ");
3476 case"NE":return Rico.getPhraseById("filterNot",c.join(", "));
3477 case"LE":return"<= "+c[0];
3478 case"GE":return">= "+c[0];
3479 case"LIKE":return Rico.getPhraseById("filterLike",c[0]);
3480 case"NULL":return Rico.getPhraseById("filterEmpty");
3481 case"NOTNULL":return Rico.getPhraseById("filterNotEmpty")
3482 }return"?"
3483 },getFilterQueryParm:function(){if(this.filterType==Rico.ColumnConst.UNFILTERED){return""
3484 }var a="&f["+this.index+"][op]="+this.filterOp;
3485 a+="&f["+this.index+"][len]="+this.filterValues.length;
3486 for(var b=0;
3487 b<this.filterValues.length;
3488 b++){a+="&f["+this.index+"]["+b+"]="+escape(this.filterValues[b])
3489 }return a
3490 },setUnfiltered:function(a){this.filterType=Rico.ColumnConst.UNFILTERED;
3491 if(this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3492 }if(this.removeFilterFunc){this.removeFilterFunc()
3493 }if(this.options.filterHandler&&!a){this.options.filterHandler()
3494 }},setFilterEQ:function(){this.setUserFilter("EQ")
3495 },setFilterNE:function(){this.setUserFilter("NE")
3496 },addFilterNE:function(){this.filterValues.push(this.userFilter);
3497 if(this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3498 }if(this.options.filterHandler){this.options.filterHandler()
3499 }},setFilterGE:function(){this.setUserFilter("GE")
3500 },setFilterLE:function(){this.setUserFilter("LE")
3501 },setFilterKW:function(a){if(a!=""&&a!=null){this.setFilter("LIKE",a,Rico.ColumnConst.USERFILTER)
3502 }else{this.setUnfiltered(false)
3503 }},setUserFilter:function(a){this.setFilter(a,this.userFilter,Rico.ColumnConst.USERFILTER)
3504 },setSystemFilter:function(a,b){this.setFilter(a,b,Rico.ColumnConst.SYSTEMFILTER)
3505 },setFilter:function(a,c,b,d){this.filterValues=typeof(c)=="object"?c:[c];
3506 this.filterType=b;
3507 this.filterOp=a;
3508 if(b==Rico.ColumnConst.USERFILTER&&this.liveGrid.options.saveColumnInfo.filter){this.liveGrid.setCookie()
3509 }this.removeFilterFunc=d;
3510 if(this.options.filterHandler){this.options.filterHandler()
3511 }},isFiltered:function(){return this.filterType==Rico.ColumnConst.USERFILTER
3512 },filterChange:function(a){var b=Rico.eventElement(a);
3513 if(b.value==this.liveGrid.options.FilterAllToken){this.setUnfiltered()
3514 }else{this.setFilter("EQ",b.value,Rico.ColumnConst.USERFILTER,function(){b.selectedIndex=0
3515 })
3516 }},filterClear:function(a){this.filterField.value="";
3517 this.setUnfiltered()
3518 },filterKeypress:function(c){var a=Rico.eventElement(c);
3519 if(typeof this.lastKeyFilter!="string"){this.lastKeyFilter=""
3520 }if(this.lastKeyFilter==a.value){return
3521 }var b=a.value;
3522 Rico.log("filterKeypress: "+this.index+" "+b);
3523 this.lastKeyFilter=b;
3524 if(b==""||b=="*"){this.setUnfiltered()
3525 }else{this.setFilter("LIKE",b,Rico.ColumnConst.USERFILTER,function(){a.value=""
3526 })
3527 }},mFilterSelectClick:function(a){Rico.eventStop(a);
3528 if(this.mFilter.style.display!="none"){this.mFilterFinish(a);
3529 if(Rico.isIE&&Rico.ieVersion<=6){this.filterField.focus()
3530 }else{this.filterField.blur()
3531 }}else{var b=Rico.cumulativeOffset(this.filterField);
3532 this.mFilter.style.top=(b.top+this.filterField.offsetHeight)+"px";
3533 this.mFilter.style.left=b.left+"px";
3534 this.mFilter.style.width=Math.min(this.filterField.offsetWidth,parseInt(this.colWidth,10))+"px";
3535 Rico.show(this.mFilter);
3536 this.mFilterFocus.focus()
3537 }},mFilterFinish:function(g){if(!this.mFilterChange){Rico.hide(this.mFilter);
3538 return
3539 }if(this.mFilterInputs[0].checked){this.mFilterReset();
3540 Rico.hide(this.mFilter);
3541 this.setUnfiltered();
3542 return
3543 }var c=[];
3544 var a=[];
3545 for(var d=1;
3546 d<this.mFilterInputs.length;
3547 d++){if(this.mFilterInputs[d].checked){c.push(this.mFilterInputs[d].value);
3548 a.push(this.mFilterLabels[d].innerHTML)
3549 }}if(c.length>0){var f=a.join(", ");
3550 this.filterField.options[0].text=f;
3551 this.filterField.title=f;
3552 Rico.hide(this.mFilter);
3553 this.mFilterChange=false;
3554 var b=this;
3555 this.setFilter("EQ",c,Rico.ColumnConst.USERFILTER,function(){b.mFilterReset()
3556 })
3557 }else{alert("Please select at least one value")
3558 }},mFilterReset:function(){var a=this.mFilterLabels[0].innerHTML;
3559 this.filterField.options[0].text=a;
3560 this.filterField.title=a
3561 },mFilterAllClick:function(c){var a=this.mFilterInputs[0].checked;
3562 for(var b=1;
3563 b<this.mFilterInputs.length;
3564 b++){this.mFilterInputs[b].checked=a
3565 }this.mFilterChange=true
3566 },mFilterOtherClick:function(a){this.mFilterInputs[0].checked=false;
3567 this.mFilterChange=true
3568 },format_text:function(a){if(typeof a!="string"){return"&nbsp;"
3569 }else{return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")
3570 }},format_number:function(a){if(typeof a=="undefined"||a==""||a==null){return"&nbsp;"
3571 }else{return Rico.formatNumber(a,this.format)
3572 }},format_datetime:function(a){if(typeof a=="undefined"||a==""||a==null){return"&nbsp;"
3573 }else{var b=Rico.setISO8601(a);
3574 if(!b){return a
3575 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"")
3576 }},format_utcaslocaltime:function(a){if(typeof a=="undefined"||a==""||a==null){return"&nbsp;"
3577 }else{var c=new Date();
3578 var b=Rico.setISO8601(a,-c.getTimezoneOffset());
3579 if(!b){return a
3580 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDateTime")+(this.format.suffix||"")
3581 }},format_date:function(a){if(typeof a=="undefined"||a==null||a==""){return"&nbsp;"
3582 }else{var b=Rico.setISO8601(a);
3583 if(!b){return a
3584 }return(this.format.prefix||"")+Rico.formatDate(b,this.format.dateFmt||"translateDate")+(this.format.suffix||"")
3585 }},fixHeaders:function(d,e){if(this.sortable){var c=Rico.eventHandle(this,"toggleSort");
3586 switch(this.options.headingSort){case"link":var b=Rico.wrapChildren(this.hdrCellDiv,"ricoSort",undefined,"a");
3587 b.href="javascript:void(0)";
3588 Rico.eventBind(b,"click",c);
3589 break;
3590 case"hover":Rico.eventBind(this.hdrCellDiv,"click",c);
3591 break
3592 }}this.imgFilter=document.createElement("span");
3593 this.imgFilter.style.display="none";
3594 this.imgFilter.className="rico-icon ricoLG_filterCol";
3595 this.imgSort=document.createElement("span");
3596 this.imgSort.style.display="none";
3597 this.imgSort.style.verticalAlign="top";
3598 if(e){this.hdrCellDiv.insertBefore(this.imgSort,this.hdrCellDiv.firstChild);
3599 this.hdrCellDiv.insertBefore(this.imgFilter,this.hdrCellDiv.firstChild)
3600 }else{this.hdrCellDiv.appendChild(this.imgFilter);
3601 this.hdrCellDiv.appendChild(this.imgSort)
3602 }if(!this.format.filterUI){Rico.eventBind(this.imgFilter,"click",Rico.eventHandle(this,"filterClick"),false)
3603 }},filterClick:function(a){if(this.filterType==Rico.ColumnConst.USERFILTER&&this.filterOp=="LIKE"){this.liveGrid.openKeyword(this.index)
3604 }},getValue:function(a){return this.buffer.getWindowCell(a,this.index)
3605 },getBufferStyle:function(a){return this.buffer.getWindowStyle(a,this.index)
3606 },setValue:function(b,a){this.buffer.setWindowValue(b,this.index,a)
3607 },_format:function(a){return a
3608 },_display:function(a,b){b.innerHTML=this._format(a)
3609 },_export:function(a){return this._format(a)
3610 },exportBuffer:function(a){return this._export(this.buffer.getValue(a,this.index))
3611 },displayValue:function(c){var a=this.getValue(c);
3612 if(a==null){this.clearCell(c);
3613 return
3614 }var b=this.cell(c);
3615 this._display(a,b,c);
3616 if(this.buffer.options.acceptStyle){b.style.cssText=this.getBufferStyle(c)
3617 }}};
3618 Rico.TableColumn={};
3619 Rico.TableColumn.checkboxKey=function(a){this.initialize(a)
3620 };
3621 Rico.TableColumn.checkboxKey.prototype={initialize:function(a){this._checkboxes=[];
3622 this._spans=[];
3623 this._KeyHash={};
3624 this._showKey=a
3625 },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b);
3626 this._spans[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b);
3627 this._clear(a,b);
3628 Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick"))
3629 },_onclick:function(c){var b=Event.element(c);
3630 var d=parseInt(b.id.substr((b.id.lastIndexOf("_",b.id.length)+1)));
3631 var a=this.getValue(d);
3632 if(b.checked){this._addChecked(a)
3633 }else{this._remChecked(a)
3634 }},_clear:function(b,c){var a=this._checkboxes[c];
3635 a.checked=false;
3636 a.style.display="none";
3637 this._spans[c].innerHTML=""
3638 },_display:function(a,c,d){var b=this._checkboxes[d];
3639 b.style.display="";
3640 b.checked=this._KeyHash[a];
3641 if(this._showKey){this._spans[d].innerHTML=a
3642 }},_SelectedKeys:function(){return Rico.keys(this._KeyHash)
3643 },_addChecked:function(a){this._KeyHash[a]=1
3644 },_remChecked:function(a){delete this._KeyHash[a]
3645 }};
3646 Rico.TableColumn.checkbox=function(b,c,a,d){this.initialize(b,c,a,d)
3647 };
3648 Rico.TableColumn.checkbox.prototype={initialize:function(b,c,a,d){this._checkedValue=b;
3649 this._uncheckedValue=c;
3650 this._defaultValue=a||false;
3651 this._readOnly=d||false;
3652 this._checkboxes=[]
3653 },_create:function(a,b){this._checkboxes[b]=Rico.createFormField(a,"input","checkbox",this.liveGrid.tableId+"_chkbox_"+this.index+"_"+b);
3654 this._clear(a,b);
3655 if(this._readOnly){this._checkboxes[b].disabled=true
3656 }else{Rico.eventBind(this._checkboxes[b],"click",Rico.eventHandle(this,"_onclick"))
3657 }},_onclick:function(c){var a=Event.element(c);
3658 var d=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1)));
3659 var b=a.checked?this._checkedValue:this._uncheckedValue;
3660 this.setValue(d,b)
3661 },_clear:function(b,c){var a=this._checkboxes[c];
3662 a.checked=this._defaultValue;
3663 a.style.display="none"
3664 },_display:function(a,c,d){var b=this._checkboxes[d];
3665 b.style.display="";
3666 b.checked=(a==this._checkedValue)
3667 }};
3668 Rico.TableColumn.textbox=function(c,b,a){this.initialize(c,b,a)
3669 };
3670 Rico.TableColumn.textbox.prototype={initialize:function(c,b,a){this._boxSize=c;
3671 this._boxMaxLen=b;
3672 this._readOnly=a||false;
3673 this._textboxes=[]
3674 },_create:function(b,c){var a=Rico.createFormField(b,"input","text",this.liveGrid.tableId+"_txtbox_"+this.index+"_"+c);
3675 a.size=this._boxSize;
3676 a.maxLength=this._boxMaxLen;
3677 this._textboxes[c]=a;
3678 this._clear(b,c);
3679 if(this._readOnly){a.disabled=true
3680 }else{Rico.eventBind(a,"change",Rico.eventHandle(this,"_onchange"))
3681 }},_onchange:function(b){var a=Event.element(b);
3682 var c=parseInt(a.id.substr((a.id.lastIndexOf("_",a.id.length)+1)));
3683 this.setValue(c,a.value)
3684 },_clear:function(b,c){var a=this._textboxes[c];
3685 a.value="";
3686 a.style.display="none"
3687 },_display:function(a,c,d){var b=this._textboxes[d];
3688 b.style.display="";
3689 b.value=a
3690 }};
3691 Rico.TableColumn.HighlightCell=function(a,c,e,b,d){this.initialize(a,c,e,b,d)
3692 };
3693 Rico.TableColumn.HighlightCell.prototype={initialize:function(a,c,e,b,d){this._chkcol=a;
3694 this._chkval=c;
3695 this._chkop=d;
3696 this._highlightColor=e;
3697 this._highlightBackground=b
3698 },_clear:function(a,b){a.style.color="";
3699 a.style.backgroundColor="";
3700 a.innerHTML="&nbsp;"
3701 },_display:function(b,d,e){var a=this.liveGrid.buffer.getWindowValue(e,this._chkcol);
3702 var c;
3703 switch(this._chkop){case"!=":c=(a!=this._chkval);
3704 break;
3705 case">":c=(a>this._chkval);
3706 break;
3707 case"<":c=(a<this._chkval);
3708 break;
3709 case">=":c=(a>=this._chkval);
3710 break;
3711 case"<=":c=(a<=this._chkval);
3712 break;
3713 case"abs>":c=(Math.abs(a)>this._chkval);
3714 break;
3715 case"abs<":c=(Math.abs(a)<this._chkval);
3716 break;
3717 case"abs>=":c=(Math.abs(a)>=this._chkval);
3718 break;
3719 case"abs<=":c=(Math.abs(a)<=this._chkval);
3720 break;
3721 default:c=(a==this._chkval);
3722 break
3723 }d.style.color=c?this._highlightColor:"";
3724 d.style.backgroundColor=c?this._highlightBackground:"";
3725 d.innerHTML=this._format(b)
3726 }};
3727 Rico.TableColumn.bgColor=function(){};
3728 Rico.TableColumn.bgColor.prototype={_clear:function(a,b){a.style.backgroundColor=""
3729 },_display:function(a,b,c){b.style.backgroundColor=a
3730 }};
3731 Rico.TableColumn.link=function(a,c,b){this.initialize(a,c,b)
3732 };
3733 Rico.TableColumn.link.prototype={initialize:function(a,c,b){this._href=a;
3734 this._target=c;
3735 this._linktext=b;
3736 this._anchors=[]
3737 },_create:function(a,b){this._anchors[b]=Rico.createFormField(a,"a",null,this.liveGrid.tableId+"_a_"+this.index+"_"+b);
3738 if(this._target){this._anchors[b].target=this._target
3739 }this._clear(a,b)
3740 },_clear:function(a,b){this._anchors[b].href="";
3741 this._anchors[b].innerHTML=""
3742 },_display:function(b,d,f){var c=this.liveGrid.buffer;
3743 var a=this._href=="self"?b:this._href.replace(/\{\d+\}/g,function(g){var h=parseInt(g.substr(1),10);
3744 return encodeURIComponent(c.getWindowValue(f,h))
3745 });
3746 var e=this._linktext||b;
3747 if(a&&e){this._anchors[f].href=a;
3748 this._anchors[f].innerHTML=e
3749 }else{this._clear(d,f)
3750 }}};
3751 Rico.TableColumn.image=function(a,b){this.initialize(a,b)
3752 };
3753 Rico.TableColumn.image.prototype={initialize:function(a,b){this._img=[];
3754 this._prefix=a||"";
3755 this._suffix=b||""
3756 },_create:function(a,b){this._img[b]=Rico.createFormField(a,"img",null,this.liveGrid.tableId+"_img_"+this.index+"_"+b);
3757 this._clear(a,b)
3758 },_clear:function(b,c){var a=this._img[c];
3759 a.style.display="none";
3760 a.src=""
3761 },_display:function(b,c,d){var a=this._img[d];
3762 this._img[d].src=this._prefix+b+this._suffix;
3763 a.style.display=""
3764 }};
3765 Rico.TableColumn.lookup=function(c,a,b){this.initialize(c,a,b)
3766 };
3767 Rico.TableColumn.lookup.prototype={initialize:function(d,a,c){this._map=d;
3768 this._defaultCode=a||"";
3769 this._defaultDesc=c||"&nbsp;";
3770 var b=this;
3771 this._sortfunc=function(e){return b._sortvalue(e)
3772 };
3773 this._codes=[];
3774 this._descriptions=[]
3775 },_create:function(a,b){this._descriptions[b]=Rico.createFormField(a,"span",null,this.liveGrid.tableId+"_desc_"+this.index+"_"+b);
3776 this._codes[b]=Rico.createFormField(a,"input","hidden",this.liveGrid.tableId+"_code_"+this.index+"_"+b);
3777 this._clear(a,b)
3778 },_clear:function(a,b){this._codes[b].value=this._defaultCode;
3779 this._descriptions[b].innerHTML=this._defaultDesc
3780 },_sortvalue:function(a){return this._getdesc(a).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ")
3781 },_getdesc:function(a){var b=this._map[a];
3782 return(typeof b=="string")?b:this._defaultDesc
3783 },_export:function(a){return this._getdesc(a)
3784 },_display:function(a,b,c){this._codes[c].value=a;
3785 this._descriptions[c].innerHTML=this._getdesc(a)
3786 }};
3787 Rico.TableColumn.MultiLine=function(){};
3788 Rico.TableColumn.MultiLine.prototype={_display:function(a,c,d){var b=document.createElement("div");
3789 b.innerHTML=this._format(a);
3790 b.style.height="100%";
3791 if(c.firstChild){c.replaceChild(b,c.firstChild)
3792 }else{c.appendChild(b)
3793 }}};
3794 if(typeof Rico=="undefined"){throw ("GridMenu requires the Rico JavaScript framework")
3795 }Rico.GridMenu=function(a){this.initialize(a)
3796 };
3797 Rico.GridMenu.prototype={initialize:function(a){this.options={width:"18em",dataMenuHandler:null};
3798 Rico.extend(this.options,a||{});
3799 Rico.extend(this,new Rico.Menu(this.options));
3800 this.sortmenu=new Rico.Menu({width:"15em"});
3801 this.filtermenu=new Rico.Menu({width:"22em"});
3802 this.exportmenu=new Rico.Menu({width:"24em"});
3803 this.hideshowmenu=new Rico.Menu({width:"22em"});
3804 this.createDiv();
3805 this.sortmenu.createDiv();
3806 this.filtermenu.createDiv();
3807 this.exportmenu.createDiv();
3808 this.hideshowmenu.createDiv()
3809 },buildGridMenu:function(a,i){this.clearMenu();
3810 var o=this.liveGrid;
3811 var f=o.buffer;
3812 var m=f.totalRows;
3813 var n=o.options.maxPrint;
3814 var b=(a>=m);
3815 var d=o.columns[i];
3816 if(this.options.dataMenuHandler){var l=this.options.dataMenuHandler(o,a,i,b);
3817 if(!l){return(this.itemCount>0)
3818 }}if(d.sortable&&m>0){this.sortmenu.clearMenu();
3819 this.addSubMenuItem(Rico.getPhraseById("gridmenuSortBy",d.displayName),this.sortmenu,false);
3820 this.sortmenu.addMenuItemId("gridmenuSortAsc",function(){d.sortAsc()
3821 },true);
3822 this.sortmenu.addMenuItemId("gridmenuSortDesc",function(){d.sortDesc()
3823 },true)
3824 }this.filtermenu.clearMenu();
3825 if(d.canFilter()){this.addSubMenuItem(Rico.getPhraseById("gridmenuFilterBy",d.displayName),this.filtermenu,false);
3826 if(!d.format.filterUI&&(!b||d.filterType==Rico.ColumnConst.USERFILTER)){d.userFilter=d.getValue(a);
3827 if(d.filterType==Rico.ColumnConst.USERFILTER){this.filtermenu.addMenuItemId("gridmenuRemoveFilter",function(){d.setUnfiltered(false)
3828 },true);
3829 if(d.filterOp=="LIKE"){this.filtermenu.addMenuItemId("gridmenuChgKeyword",function(){o.openKeyword(i)
3830 },true)
3831 }if(d.filterOp=="NE"&&!b){this.filtermenu.addMenuItemId("gridmenuExcludeAlso",function(){d.addFilterNE()
3832 },true)
3833 }}else{if(!b){this.filtermenu.addMenuItemId("gridmenuInclude",function(){d.setFilterEQ()
3834 },true);
3835 this.filtermenu.addMenuItemId("gridmenuGreaterThan",function(){d.setFilterGE()
3836 },d.userFilter!="");
3837 this.filtermenu.addMenuItemId("gridmenuLessThan",function(){d.setFilterLE()
3838 },d.userFilter!="");
3839 if(d.isText){this.filtermenu.addMenuItemId("gridmenuContains",function(){o.openKeyword(i)
3840 },true)
3841 }this.filtermenu.addMenuItemId("gridmenuExclude",function(){d.setFilterNE()
3842 },true)
3843 }}}if(o.filterCount()>0){this.filtermenu.addMenuItemId("gridmenuRemoveAll",function(){o.clearFilters()
3844 },true)
3845 }this.filtermenu.addMenuItemId("gridmenuRefresh",function(){o.filterHandler()
3846 },true)
3847 }this.exportmenu.clearMenu();
3848 if(n>0){this.addSubMenuItem(Rico.getPhraseById("gridmenuExport"),this.exportmenu,false);
3849 if(f.printVisibleSQL&&typeof(f.dataSource)=="string"){this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisibleSQL("html")
3850 });
3851 this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAllSQL("html")
3852 },f.totalRows<=n);
3853 this.exportmenu.addMenuBreak();
3854 this.exportmenu.addMenuItemId("gridmenuExportVis2SS",function(){f.printVisibleSQL("xl")
3855 });
3856 this.exportmenu.addMenuItemId("gridmenuExportAll2SS",function(){f.printAllSQL("xl")
3857 },f.totalRows<=n)
3858 }else{this.exportmenu.addMenuItemId("gridmenuExportVis2Web",function(){f.printVisible()
3859 });
3860 this.exportmenu.addMenuItemId("gridmenuExportAll2Web",function(){f.printAll()
3861 },f.totalRows<=n)
3862 }}var k=o.listInvisible();
3863 for(var e=0,j=0;
3864 j<k.length;
3865 j++){if(k[j].canHideShow()){e++
3866 }}if(e>0||d.canHideShow()){this.hideshowmenu.clearMenu();
3867 this.addSubMenuItem(Rico.getPhraseById("gridmenuHideShow"),this.hideshowmenu,false);
3868 this.hideshowmenu.addMenuItemId("gridmenuChooseCols",function(){o.chooseColumns()
3869 },true,false);
3870 var h=o.columns.length-k.length;
3871 var g=(h>1&&d.visible&&d.canHideShow());
3872 this.hideshowmenu.addMenuItem(Rico.getPhraseById("gridmenuHide",d.displayName),function(){d.hideColumn()
3873 },g);
3874 if(k.length>1){this.hideshowmenu.addMenuItemId("gridmenuShowAll",function(){o.showAll()
3875 })
3876 }}return true
3877 }};
3878 if(typeof Rico=="undefined"){throw ("LiveGridAjax requires the Rico JavaScript framework")
3879 }if(!Rico.Buffer){Rico.Buffer={}
3880 }Rico.Buffer.AjaxXML=function(c,b,a){this.initialize(c,b,a)
3881 };
3882 Rico.Buffer.AjaxXML.prototype={initialize:function(c,b,a){Rico.extend(this,new Rico.Buffer.Base());
3883 Rico.extend(this,Rico.Buffer.AjaxXMLMethods);
3884 this.dataSource=c;
3885 this.options.bufferTimeout=20000;
3886 this.options.requestParameters=[];
3887 this.options.waitMsg=Rico.getPhraseById("waitForData");
3888 this.options.canFilter=true;
3889 this.options.fmt="xml";
3890 Rico.extend(this.options,b||{});
3891 this.ajaxOptions={parameters:null,method:"get"};
3892 Rico.extend(this.ajaxOptions,a||{});
3893 this.requestCount=0;
3894 this.processingRequest=false;
3895 this.pendingRequest=-2;
3896 this.fetchData=true;
3897 this.sortParm={}
3898 }};
3899 Rico.Buffer.AjaxXMLMethods={fetch:function(b){if(this.fetchData){this.foundRowCount=true;
3900 this.fetchData=false;
3901 this.processingRequest=true;
3902 this.liveGrid.showMsg(this.options.waitMsg);
3903 this.timeoutHandler=Rico.runLater(this.options.bufferTimeout,this,"handleTimedOut");
3904 this.ajaxOptions.parameters=this.formQueryHashXML(0,-1);
3905 Rico.log("sending request");
3906 var a=this;
3907 if(typeof this.dataSource=="string"){this.ajaxOptions.onComplete=function(c){a.ajaxUpdate(b,c)
3908 };
3909 new Rico.ajaxRequest(this.dataSource,this.ajaxOptions)
3910 }else{this.ajaxOptions.onComplete=function(d,f,c,e){a.jsUpdate(b,d,f,c,e)
3911 };
3912 this.dataSource(this.ajaxOptions)
3913 }}else{if(b<0){this.applyFilters();
3914 this.setTotalRows(this.size);
3915 b=0
3916 }this.liveGrid.refreshContents(b)
3917 }},handleTimedOut:function(){Rico.log("Request Timed Out");
3918 this.liveGrid.showMsg(Rico.getPhraseById("requestTimedOut"))
3919 },formQueryHashXML:function(e,c){var d={id:this.liveGrid.tableId,page_size:(typeof c=="number")?c:this.totalRows,offset:e.toString()};
3920 if(!this.foundRowCount){d.get_total="true"
3921 }if(this.options.requestParameters){for(var f=0;
3922 f<this.options.requestParameters.length;
3923 f++){var g=this.options.requestParameters[f];
3924 if(g.name!=undefined&&g.value!=undefined){d[g.name]=g.value
3925 }else{var b=g.indexOf("=");
3926 var h=g.substring(0,b);
3927 var a=g.substring(b+1);
3928 d[h]=a
3929 }}}return d
3930 },clearTimer:function(){if(typeof this.timeoutHandler!="number"){return
3931 }window.clearTimeout(this.timeoutHandler);
3932 delete this.timeoutHandler
3933 },jsUpdate:function(a,c,e,b,d){this.clearTimer();
3934 this.processingRequest=false;
3935 Rico.log("jsUpdate: "+arguments.length);
3936 if(d){Rico.log("jsUpdate: received error="+d);
3937 this.liveGrid.showMsg(Rico.getPhraseById("requestError",d));
3938 return
3939 }this.rcvdRows=c.length;
3940 if(typeof b=="number"){this.rowcntContent=b.toString();
3941 this.rcvdRowCount=true;
3942 this.foundRowCount=true;
3943 Rico.log("jsUpdate: found RowCount="+this.rowcntContent)
3944 }this.updateBuffer(a,c,e);
3945 if(this.options.onAjaxUpdate){this.options.onAjaxUpdate()
3946 }this.updateGrid(a);
3947 if(this.options.TimeOut&&this.timerMsg){this.restartSessionTimer()
3948 }if(this.pendingRequest>=-1){var f=this.pendingRequest;
3949 Rico.log("jsUpdate: found pending request for offset="+f);
3950 this.pendingRequest=-2;
3951 this.fetch(f)
3952 }},ajaxUpdate:function(a,c){this.clearTimer();
3953 this.processingRequest=false;
3954 if(c.status!=200){Rico.log("ajaxUpdate: received http error="+c.status);
3955 this.liveGrid.showMsg(Rico.getPhraseById("httpError",c.status));
3956 return
3957 }this._responseHandler=this["processResponse"+this.options.fmt.toUpperCase()];
3958 if(!this._responseHandler(a,c)){return
3959 }if(this.options.onAjaxUpdate){this.options.onAjaxUpdate()
3960 }this.updateGrid(a);
3961 if(this.options.TimeOut&&this.timerMsg){this.restartSessionTimer()
3962 }if(this.pendingRequest>=-1){var b=this.pendingRequest;
3963 Rico.log("ajaxUpdate: found pending request for offset="+b);
3964 this.pendingRequest=-2;
3965 this.fetch(b)
3966 }},processResponseXML:function(k,f){var o=f.responseXML;
3967 if(f.responseText.substring(0,4)=="<!--"){var m=f.responseText.indexOf("-->");
3968 if(m==-1){this.liveGrid.showMsg("Web server error - client side debugging may be enabled");
3969 return false
3970 }o=Rico.createXmlDocument();
3971 o.loadXML(f.responseText.substring(m+3))
3972 }if(!o){alert("Data provider returned an invalid XML response");
3973 Rico.log("Data provider returned an invalid XML response");
3974 return false
3975 }var d=o.getElementsByTagName("ajax-response");
3976 if(d==null||d.length!=1){alert("Received invalid response from server");
3977 return false
3978 }Rico.log("Processing ajax-response");
3979 this.rcvdRows=0;
3980 this.rcvdRowCount=false;
3981 var b=d[0];
3982 var a=b.getElementsByTagName("debug");
3983 for(var g=0;
3984 g<a.length;
3985 g++){Rico.log("ajaxUpdate: debug msg "+g+": "+Rico.getContentAsString(a[g],this.options.isEncoded))
3986 }var l=b.getElementsByTagName("error");
3987 if(l.length>0){var c=Rico.getContentAsString(l[0],this.options.isEncoded);
3988 alert("Data provider returned an error:\n"+c);
3989 Rico.log("Data provider returned an error:\n"+c);