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