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