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