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