Delete files that were moved to minsrc
authorMatt Brown <dowdybrown@yahoo.com>
Sat, 30 Apr 2011 17:54:52 +0000 (17:54 +0000)
committerMatt Brown <dowdybrown@yahoo.com>
Sat, 30 Apr 2011 17:54:52 +0000 (17:54 +0000)
git-svn-id: svn://svn.code.sf.net/p/openrico/code/trunk/rico3@75 53df2df2-7ab5-4331-af62-ea79255fa4e2

13 files changed:
ricoClient/js/ricoCalendar.js [deleted file]
ricoClient/js/ricoColorPicker.js [deleted file]
ricoClient/js/ricoDragDrop.js [deleted file]
ricoClient/js/ricoGridCommon.js [deleted file]
ricoClient/js/ricoLiveGrid.js [deleted file]
ricoClient/js/ricoLiveGridAjax.js [deleted file]
ricoClient/js/ricoLiveGridControls.js [deleted file]
ricoClient/js/ricoLiveGridForms.js [deleted file]
ricoClient/js/ricoLiveGridMenu.js [deleted file]
ricoClient/js/ricoSearch.js [deleted file]
ricoClient/js/ricoSimpleGrid.js [deleted file]
ricoClient/js/ricoTree.js [deleted file]
ricoClient/js/ricoUI.js [deleted file]

diff --git a/ricoClient/js/ricoCalendar.js b/ricoClient/js/ricoCalendar.js
deleted file mode 100644 (file)
index c0d5721..0000000
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-//  Inspired by code originally written by Tan Ling Wee on 2 Dec 2001
-//  Requires prototype.js and ricoCommon.js
-
-Rico.CalendarControl = function(id,options) {
-  this.initialize(id,options);
-};
-
-Rico.CalendarControl.prototype = {
-/**
- * @class Implements a pop-up Gregorian calendar.
- * Dates of adoption of the Gregorian calendar vary by country - accurate as a US & British calendar from 14 Sept 1752 to present.
- * Mark special dates with calls to addHoliday()
- * @extends Rico.Popup
- * @constructs
- * @param id unique identifier
- * @param options object may contain any of the following:<dl>
- *   <dt>startAt       </dt><dd> week starts with 0=sunday, 1=monday? default=0</dd>
- *   <dt>showWeekNumber</dt><dd> show week number in first column? default=0</dd>
- *   <dt>showToday     </dt><dd> show "Today is..." in footer? default=1</dd>
- *   <dt>repeatInterval</dt><dd> when left/right arrow is pressed, repeat action every x milliseconds, default=100</dd>
- *   <dt>dateFmt       </dt><dd> date format for return value (one of values accepted by {@link Date#formatDate}), default=ISO8601</dd>
- *   <dt>minDate       </dt><dd> earliest selectable date? default=today-50 years</dd>
- *   <dt>maxDate       </dt><dd> last selectable date? default=today+50 years</dd>
- *</dl>
- */
-  initialize: function(id,options) {
-    this.id=id;
-    var today=new Date();
-    Rico.extend(this, new Rico.Popup());
-    Rico.extend(this.options, {
-      ignoreClicks:true,
-      startAt : 0,
-      showWeekNumber : 0,
-      showToday : 1,
-      repeatInterval : 100,
-      dateFmt : 'ISO8601',
-      minDate : new Date(today.getFullYear()-50,0,1),
-      maxDate : new Date(today.getFullYear()+50,11,31)
-    });
-    Rico.extend(this.options, options || {});
-    /**
-     * alias for closePopup
-     * @function
-     */
-    this.close=this.closePopup;
-    this.bPageLoaded=false;
-    this.img=[];
-    this.Holidays={};
-    this.weekString=Rico.getPhraseById("calWeekHdg");
-    this.re=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
-    this.setDateFmt(this.options.dateFmt);
-  },
-
-
-  setDateFmt: function(fmt) {
-    this.dateFmt=(fmt=='rico') ? Rico.dateFmt : fmt;
-    Rico.log(this.id+' date format set to '+this.dateFmt);
-    this.dateParts={};
-    if (this.re.exec(this.dateFmt)) {
-      this.dateParts[RegExp.$1]=0;
-      this.dateParts[RegExp.$3]=1;
-      this.dateParts[RegExp.$5]=2;
-    }
-  },
-  
-/**
- * Call before displaying calendar to highlight special days
- * @param d day (1-31)
- * @param m month (1-12)
- * @param y year (0 implies a repeating holiday)
- * @param desc description
- * @param bgColor background color for cell displaying this day (CSS value, defaults to '#DDF')
- * @param txtColor text color for cell displaying this day (CSS value), if not specified it is displayed with the same color as other days
- */
-  addHoliday : function(d, m, y, desc, bgColor, txtColor) {
-    this.Holidays[this.holidayKey(y,m-1,d)]={desc:desc, txtColor:txtColor, bgColor:bgColor || '#DDF'};
-  },
-  
-/** @private */
-  holidayKey : function(y,m,d) {
-    return 'h'+Rico.zFill(y,4)+Rico.zFill(m,2)+Rico.zFill(d,2);
-  },
-
-  atLoad : function() {
-    Rico.log('Calendar#atLoad: '+this.id);
-    this.createContainer();
-    this.container.id=this.id;
-    //this.container.style.width="auto";
-    this.content.className=Rico.theme.calendar || 'ricoCalContainer';
-
-    this.maintab=document.createElement("table");
-    this.maintab.cellSpacing=2;
-    this.maintab.cellPadding=0;
-    this.maintab.border=0;
-    this.maintab.style.borderCollapse='separate';
-    this.maintab.className='ricoCalTab';
-    if (Rico.theme.calendarTable) Rico.addClass(this.maintab,Rico.theme.calendarTable)
-    this.tbody=Rico.getTBody(this.maintab);
-
-    var r,c,d,i,j,img,dow,a,s,tab;
-    this.colStart=this.options.showWeekNumber ? 1 : 0;
-    for (i=0; i<7; i++) {
-      r=this.tbody.insertRow(-1);
-      r.className='row'+i;
-      for (c=0; c<7+this.colStart; c++) {
-        r.insertCell(-1);
-      }
-    }
-    r=this.tbody.rows[0];
-    r.className='ricoCalDayNames';
-    if (this.options.showWeekNumber) {
-      r.cells[0].innerHTML=this.weekString;
-      for (i=0; i<7; i++) {
-        this.tbody.rows[i].cells[0].className='ricoCalWeekNum';
-      }
-    }
-    this.styles=[];
-    for (i=0; i<7; i++) {
-      dow=(i+this.options.startAt) % 7;
-      r.cells[i+this.colStart].innerHTML=Rico.dayAbbr(dow);
-      this.styles[i]='ricoCal'+dow;
-    }
-    
-    // table header (navigation controls)
-    this.thead=this.maintab.createTHead();
-    r=this.thead.insertRow(-1);
-    c=r.appendChild(document.createElement("th"));
-    c.colSpan=7+this.colStart;
-    d=c.appendChild(document.createElement("div"));
-    //d.style.padding='3px';
-    d.className=Rico.theme.calendarHeading || 'RicoCalHeading';
-    
-    d.appendChild(this._createTitleSection('Month'));
-    d.appendChild(this._createTitleSection('Year'));
-    new Rico.HoverSet(d.getElementsByTagName('a'));
-    new Rico.HoverSet(this.tbody.getElementsByTagName('td'),{ hoverNodes: function(e) { return e.innerHTML.match(/^\d+$/) ? [e] : []; } });
-    d.appendChild(Rico.closeButton(Rico.eventHandle(this,'close')));
-
-    // table footer (today)
-    if (this.options.showToday) {
-      this.tfoot=this.maintab.createTFoot();
-      r=this.tfoot.insertRow(-1);
-      this.todayCell=r.insertCell(-1);
-      this.todayCell.colSpan=7+this.colStart;
-      if (Rico.theme.calendarFooter) Rico.addClass(this.todayCell,Rico.theme.calendarFooter);
-      Rico.eventBind(this.todayCell,"click", Rico.eventHandle(this,'selectNow'), false);
-    }
-    this.content.appendChild(this.maintab);
-    var ie6=Rico.isIE && Rico.ieVersion < 7;
-    var selectOptions={shadow: !ie6};
-    
-    // month selector
-    this.monthPopup=new Rico.Popup(document.createElement("div"),selectOptions);
-    this.monthPopup.closePopup();
-    tab=document.createElement("table");
-    tab.className='ricoCalMenu';
-    if (Rico.theme.calendarPopdown) Rico.addClass(tab,Rico.theme.calendarPopdown);
-    tab.cellPadding=2;
-    tab.cellSpacing=0;
-    tab.border=0;
-    tab.style.borderCollapse='separate';
-    tab.style.margin='0px';
-    for (i=0; i<4; i++) {
-      r=tab.insertRow(-1);
-      for (j=0; j<3; j++) {
-        c=r.insertCell(-1);
-        a=document.createElement("a");
-        a.innerHTML=Rico.monthAbbr(i*3+j);
-        a.name=i*3+j;
-        if (Rico.theme.calendarDay) Rico.addClass(a,Rico.theme.calendarDay);
-        c.appendChild(a);
-        Rico.eventBind(a,"click", Rico.eventHandle(this,'selectMonth'), false);
-      }
-    }
-    new Rico.HoverSet(tab.getElementsByTagName('a'));
-    this.monthPopup.content.appendChild(tab);
-    this.content.appendChild(this.monthPopup.container);
-    
-    // year selector
-    this.yearPopup=new Rico.Popup(document.createElement("div"),selectOptions);
-    this.yearPopup.closePopup();
-    this.yearPopup.content.className='ricoCalYearPrompt';
-    if (Rico.theme.calendarPopdown) Rico.addClass(this.yearPopup.content,Rico.theme.calendarPopdown);
-    var tab=document.createElement("table");
-    tab.cellPadding=2;
-    tab.cellSpacing=0;
-    tab.border=0;
-    tab.style.borderCollapse='separate';
-    tab.style.margin='0px';
-    r=tab.insertRow(-1);
-    this.yearLabel=r.insertCell(-1);
-    this.yearLabel.colSpan=3;
-    r=tab.insertRow(-1);
-    c=r.insertCell(-1);
-    this.yearInput=c.appendChild(document.createElement("input"));
-    this.yearInput.maxlength=4;
-    this.yearInput.size=4;
-    Rico.eventBind(this.yearInput,"keypress", Rico.eventHandle(this,'yearKey'), false);
-    c=r.insertCell(-1);
-    c.appendChild(Rico.floatButton('Checkmark', Rico.eventHandle(this,'processPopUpYear')));
-    c=r.insertCell(-1);
-    c.appendChild(Rico.floatButton('Cancel', Rico.eventHandle(this,'popDownYear')));
-    this.yearPopup.content.appendChild(tab);
-    this.content.appendChild(this.yearPopup.container);
-
-    //this.yearLabel.className='ricoCalYearPromptText';
-
-    // fix anchors so they work in IE6
-    a=this.content.getElementsByTagName('a');
-    for (i=0; i<a.length; i++) {
-      a[i].href='javascript:void(0)';
-    }
-    
-    Rico.eventBind(this.tbody,"click", Rico.eventHandle(this,'saveAndClose'));
-    this.close();
-    this.bPageLoaded=true;
-  },
-
-  _createTitleSection : function(section) {
-    var s=document.createElement("span");
-    s.className='RicoCal'+section+'Heading';
-
-    var a=s.appendChild(document.createElement("a"));
-    a.className='Rico_leftArrow';
-    if (Rico.theme.leftArrowAnchor) Rico.addClass(a,Rico.theme.leftArrowAnchor);
-    a.appendChild(this.createNavArrow('dec'+section,'left'));
-
-    a=s.appendChild(document.createElement("a"));
-    a.style.display='inline';
-    Rico.eventBind(a,"click", Rico.eventHandle(this,'popUp'+section), false);
-    this['title'+section]=a;
-
-    a=s.appendChild(document.createElement("a"));
-    a.className='Rico_rightArrow';
-    if (Rico.theme.rightArrowAnchor) Rico.addClass(a,Rico.theme.rightArrowAnchor);
-    a.appendChild(this.createNavArrow('inc'+section,'right'));
-    return s
-  },
-  
-  selectNow : function() {
-    var today = new Date();
-    this.dateNow  = today.getDate();
-    this.monthNow = today.getMonth();
-    this.yearNow  = today.getFullYear();
-    this.monthSelected=this.monthNow;
-    this.yearSelected=this.yearNow;
-    this.constructCalendar();
-  },
-  
-/** @private */
-  createNavArrow: function(funcname,gifname) {
-    var img;
-    img=document.createElement("span");
-    img.className=Rico.theme[gifname+'Arrow'] || 'Rico_'+gifname+'Arrow';
-    Rico.eventBind(img,"click", Rico.eventHandle(this,funcname), false);
-    Rico.eventBind(img,"mousedown", Rico.eventHandle(this,'mouseDown'), false);
-    Rico.eventBind(img,"mouseup", Rico.eventHandle(this,'mouseUp'), false);
-    Rico.eventBind(img,"mouseout", Rico.eventHandle(this,'mouseUp'), false);
-    return img;
-  },
-
-/** @private */
-  mouseDown: function(e) {
-    var el=Rico.eventElement(e);
-    this.repeatFunc=Rico.bind(this,el.name);
-    this.timeoutID=Rico.runLater(500,this,'repeatStart');
-  },
-  
-/** @private */
-  mouseUp: function(e) {
-    clearTimeout(this.timeoutID);
-    clearInterval(this.intervalID);
-  },
-  
-/** @private */
-  repeatStart : function() {
-    clearInterval(this.intervalID);
-    this.intervalID=setInterval(this.repeatFunc,this.options.repeatInterval);
-  },
-  
-/**
- * @returns true if yr/mo is within minDate/MaxDate
- */
-  isValidMonth : function(yr,mo) {
-    if (yr < this.options.minDate.getFullYear()) return false;
-    if (yr == this.options.minDate.getFullYear() && mo < this.options.minDate.getMonth()) return false;
-    if (yr > this.options.maxDate.getFullYear()) return false;
-    if (yr == this.options.maxDate.getFullYear() && mo > this.options.maxDate.getMonth()) return false;
-    return true;
-  },
-
-  incMonth : function() {
-    var newMonth=this.monthSelected+1;
-    var newYear=this.yearSelected;
-    if (newMonth>11) {
-      newMonth=0;
-      newYear++;
-    }
-    if (!this.isValidMonth(newYear,newMonth)) return;
-    this.monthSelected=newMonth;
-    this.yearSelected=newYear;
-    this.constructCalendar();
-  },
-
-  decMonth : function() {
-    var newMonth=this.monthSelected-1;
-    var newYear=this.yearSelected;
-    if (newMonth<0) {
-      newMonth=11;
-      newYear--;
-    }
-    if (!this.isValidMonth(newYear,newMonth)) return;
-    this.monthSelected=newMonth;
-    this.yearSelected=newYear;
-    this.constructCalendar();
-  },
-  
-/** @private */
-  selectMonth : function(e) {
-    var el=Rico.eventElement(e);
-    this.monthSelected=parseInt(el.name,10);
-    this.constructCalendar();
-    Rico.eventStop(e);
-  },
-
-  popUpMonth : function() {
-    if (this.monthPopup.visible()) {
-      this.popDownMonth();
-      return;
-    }
-    this.popDownYear();
-    this.monthPopup.openPopup(this.titleMonth.parentNode.offsetLeft, this.thead.offsetHeight+2);
-  },
-
-  popDownMonth : function() {
-    this.monthPopup.closePopup();
-  },
-
-  popDownYear : function() {
-    this.yearPopup.closePopup();
-    this.yearInput.disabled=true;  // make sure this does not get submitted
-  },
-
-/**
- * Prompt for year
- */
-  popUpYear : function() {
-    if (this.yearPopup.visible()) {
-      this.popDownYear();
-      return;
-    }
-    this.popDownMonth();
-    this.yearPopup.openPopup(90, this.thead.offsetHeight+2);
-    this.yearLabel.innerHTML=Rico.getPhraseById("calYearRange",this.options.minDate.getFullYear(),this.options.maxDate.getFullYear());
-    this.yearInput.disabled=false;
-    this.yearInput.value='';   // this.yearSelected
-    this.yearInput.focus();
-  },
-  
-  yearKey : function(e) {
-    switch (Rico.eventKey(e)) {
-      case 27: this.popDownYear(); Rico.eventStop(e); return false;
-      case 13: this.processPopUpYear(); Rico.eventStop(e); return false;
-    }
-    return true;
-  },
-  
-  processPopUpYear : function() {
-    var newYear=this.yearInput.value;
-    newYear=parseInt(newYear,10);
-    if (isNaN(newYear) || newYear<this.options.minDate.getFullYear() || newYear>this.options.maxDate.getFullYear()) {
-      alert(Rico.getPhraseById("calInvalidYear"));
-    } else {
-      this.yearSelected=newYear;
-      this.popDownYear();
-      this.constructCalendar();
-    }
-  },
-  
-  incYear : function() {
-    if (this.yearSelected>=this.options.maxDate.getFullYear()) return;
-    this.yearSelected++;
-    this.constructCalendar();
-  },
-
-  decYear : function() {
-    if (this.yearSelected<=this.options.minDate.getFullYear()) return;
-    this.yearSelected--;
-    this.constructCalendar();
-  },
-
-  // tried a number of different week number functions posted on the net
-  // this is the only one that produced consistent results when comparing week numbers for December and the following January
-  WeekNbr : function(year,month,day) {
-    var when = new Date(year,month,day);
-    var newYear = new Date(year,0,1);
-    var offset = 7 + 1 - newYear.getDay();
-    if (offset == 8) offset = 1;
-    var daynum = ((Date.UTC(year,when.getMonth(),when.getDate(),0,0,0) - Date.UTC(year,0,1,0,0,0)) /1000/60/60/24) + 1;
-    var weeknum = Math.floor((daynum-offset+7)/7);
-    if (weeknum == 0) {
-      year--;
-      var prevNewYear = new Date(year,0,1);
-      var prevOffset = 7 + 1 - prevNewYear.getDay();
-      weeknum = (prevOffset == 2 || prevOffset == 8) ? 53 : 52;
-    }
-    return weeknum;
-  },
-
-  constructCalendar : function() {
-    var aNumDays = [31,0,31,30,31,30,31,31,30,31,30,31];
-    var startDate = new Date (this.yearSelected,this.monthSelected,1);
-    var endDate,numDaysInMonth,i,colnum;
-
-    if (typeof this.monthSelected!='number' || this.monthSelected>=12 || this.monthSelected<0) {
-      alert('ERROR in calendar: monthSelected='+this.monthSelected);
-      return;
-    }
-
-    if (this.monthSelected==1) {
-      endDate = new Date (this.yearSelected,this.monthSelected+1,1);
-      endDate = new Date (endDate - (24*60*60*1000));
-      numDaysInMonth = endDate.getDate();
-    } else {
-      numDaysInMonth = aNumDays[this.monthSelected];
-    }
-    var dayPointer = startDate.getDay() - this.options.startAt;
-    if (dayPointer<0) dayPointer+=7;
-    this.popDownMonth();
-    this.popDownYear();
-
-    //this.bgcolor=Rico.getStyle(this.tbody,'background-color');
-    //this.bgcolor=this.bgcolor.replace(/\"/g,'');
-    if (this.options.showWeekNumber) {
-      for (i=1; i<7; i++) {
-        this.tbody.rows[i].cells[0].innerHTML='&nbsp;';
-      }
-    }
-    for ( i=0; i<dayPointer; i++ ) {
-      this.resetCell(this.tbody.rows[1].cells[i+this.colStart]);
-    }
-
-    for ( var datePointer=1,r=1; datePointer<=numDaysInMonth; datePointer++,dayPointer++ ) {
-      colnum=dayPointer % 7;
-      if (this.options.showWeekNumber && colnum==0) {
-        this.tbody.rows[r].cells[0].innerHTML=this.WeekNbr(this.yearSelected,this.monthSelected,datePointer);
-      }
-      var c=this.tbody.rows[r].cells[colnum+this.colStart];
-      c.innerHTML=datePointer;
-      c.className=this.styles[colnum];
-      if ((datePointer==this.dateNow)&&(this.monthSelected==this.monthNow)&&(this.yearSelected==this.yearNow)) {
-        Rico.addClass(c,Rico.theme.calendarToday || 'ricoCalToday');
-      }
-      if (Rico.theme.calendarDay) Rico.addClass(c,Rico.theme.calendarDay);
-      if ((datePointer==this.odateSelected) && (this.monthSelected==this.omonthSelected) && (this.yearSelected==this.oyearSelected)) {
-        Rico.addClass(c,Rico.theme.calendarSelectedDay || 'ricoSelectedDay');
-      }
-      var h=this.Holidays[this.holidayKey(this.yearSelected,this.monthSelected,datePointer)];
-      if (!h)  {
-        h=this.Holidays[this.holidayKey(0,this.monthSelected,datePointer)];
-      }
-      c.style.color=h ? h.txtColor : '';
-      c.style.backgroundColor=h ? h.bgColor : '';
-      c.title=h ? h.desc : '';
-      if (colnum==6) r++;
-    }
-    while (dayPointer<42) {
-      colnum=dayPointer % 7;
-      this.resetCell(this.tbody.rows[r].cells[colnum+this.colStart]);
-      dayPointer++;
-      if (colnum==6) r++;
-    }
-
-    this.titleMonth.innerHTML = Rico.monthAbbr(this.monthSelected);
-    this.titleYear.innerHTML = this.yearSelected;
-    if (this.todayCell) {
-      this.todayCell.innerHTML = Rico.getPhraseById("calToday",this.dateNow,Rico.monthAbbr(this.monthNow),this.yearNow,this.monthNow+1);
-    }
-  },
-  
-/** @private */
-  resetCell: function(c) {
-    c.innerHTML="&nbsp;";
-    c.className='ricoCalEmpty';
-    c.style.color='';
-    c.style.backgroundColor='';
-    c.title='';
-  },
-  
-/** @private */
-  saveAndClose : function(e) {
-    Rico.eventStop(e);
-    var el=Rico.eventElement(e);
-    var s=el.innerHTML.replace(/&nbsp;/g,'');
-    if (s=='' || el.className=='ricoCalWeekNum') return;
-    var day=parseInt(s,10);
-    if (isNaN(day)) return;
-    var d=new Date(this.yearSelected,this.monthSelected,day);
-    var dateStr=Rico.formatDate(d,this.dateFmt=='ISO8601' ? 'yyyy-mm-dd' : this.dateFmt);
-    if (this.returnValue) {
-      this.returnValue(dateStr);
-      this.close();
-    }
-  },
-
-  open : function(curval) {
-    if (!this.bPageLoaded) return;
-    var today = new Date();
-    this.dateNow  = today.getDate();
-    this.monthNow = today.getMonth();
-    this.yearNow  = today.getFullYear();
-    this.oyearSelected = -1;
-    if (typeof curval=='object') {
-      this.odateSelected  = curval.getDate();
-      this.omonthSelected = curval.getMonth();
-      this.oyearSelected  = curval.getFullYear();
-    } else if (this.dateFmt=='ISO8601') {
-      var d=Rico.setISO8601(curval);
-      if (d) {
-        this.odateSelected  = d.getDate();
-        this.omonthSelected = d.getMonth();
-        this.oyearSelected  = d.getFullYear();
-      }
-    } else if (this.re.exec(curval)) {
-      var aDate = [ RegExp.$1, RegExp.$3, RegExp.$5 ];
-      this.odateSelected  = parseInt(aDate[this.dateParts.dd], 10);
-      this.omonthSelected = parseInt(aDate[this.dateParts.mm], 10) - 1;
-      this.oyearSelected  = parseInt(aDate[this.dateParts.yyyy], 10);
-      if (this.oyearSelected < 100) {
-        // apply a century to 2-digit years
-        this.oyearSelected+=this.yearNow - (this.yearNow % 100);
-        var maxyr=this.options.maxDate.getFullYear();
-        while (this.oyearSelected > maxyr) this.oyearSelected-=100;
-      }
-    } else {
-      if (curval) {
-        alert('ERROR: invalid date passed to calendar ('+curval+')');
-      }
-    }
-    if (this.oyearSelected > 0) {
-      this.dateSelected=this.odateSelected;
-      this.monthSelected=this.omonthSelected;
-      this.yearSelected=this.oyearSelected;
-    } else {
-      this.dateSelected=this.dateNow;
-      this.monthSelected=this.monthNow;
-      this.yearSelected=this.yearNow;
-    }
-    this.constructCalendar();
-    this.openPopup();
-  }
-};
-
-Rico.includeLoaded('ricoCalendar.js');
diff --git a/ricoClient/js/ricoColorPicker.js b/ricoClient/js/ricoColorPicker.js
deleted file mode 100644 (file)
index a1e64c3..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-// ===================================================================
-// Adapted to Rico by Matt Brown from code 
-//   published by Matt Kruse http://www.mattkruse.com/
-// ===================================================================
-
-Rico.ColorPicker = function(id,options) {
-  this.initialize(id,options);
-};
-
-Rico.ColorPicker.prototype = {
-/**
- * @class Implements a pop-up color picker control.
- * @extends Rico.Popup
- * @constructs
- * @param id unique identifier
- * @param options object may contain any of the following:<dl>
- *   <dt>showColorCode</dt><dd> show hex color code as user hovers over color grid? default=false</dd>
- *   <dt>cellsPerRow  </dt><dd> number of colors per row in the grid? default=18</dd>
- *   <dt>palette      </dt><dd> array of 6 digit hex values, default=216 "web safe" colors</dd>
- *</dl>
- */
-  initialize: function(id,options) {
-    this.id=id;
-    this.currentValue = "#FFFFFF";
-    Rico.extend(this, new Rico.Popup());
-    Rico.extend(this.options, {
-      showColorCode : false,
-      cellsPerRow   : 18,
-      palette       : []
-    });
-    var hexvals=['00','33','66','99','CC','FF'];
-    for (var g=0; g<hexvals.length; g++) {
-      for (var r=0; r<hexvals.length; r++) {
-        for (var b=0; b<hexvals.length; b++) {
-          this.options.palette.push(hexvals[r]+hexvals[g]+hexvals[b]);
-        }
-      }
-    }
-    Rico.extend(this.options, options || {});
-  },
-
-  atLoad : function() {
-    this.createContainer();
-    this.content.className='ricoColorPicker';
-    var width = this.options.cellsPerRow;
-    var cp_contents = "<TABLE BORDER='1' CELLSPACING='1' CELLPADDING='0'>";
-    for (var i=0; i<this.options.palette.length; i++) {
-      if ((i % width) == 0) { cp_contents += "<TR>"; }
-      cp_contents += '<TD BGCOLOR="#'+this.options.palette[i]+'">&nbsp;</TD>';
-      if ( ((i+1)>=this.options.palette.length) || (((i+1) % width) == 0)) {
-        cp_contents += "</TR>";
-      }
-    }
-    var halfwidth = Math.floor(width/2);
-    if (this.options.showColorCode) {
-      cp_contents += "<TR><TD COLSPAN='"+halfwidth+"' ID='colorPickerSelectedColor'>&nbsp;</TD><TD COLSPAN='"+(width-halfwidth)+"' ALIGN='CENTER' ID='colorPickerSelectedColorValue'>#FFFFFF</TD></TR>";
-    } else {
-      cp_contents += "<TR><TD COLSPAN='"+width+"' ID='colorPickerSelectedColor'>&nbsp;</TD></TR>";
-    }
-    cp_contents += "</TABLE>";
-    this.content.innerHTML=cp_contents;
-    /**
-     * alias for openPopup
-     * @function
-     */
-    this.open=this.openPopup;
-    /**
-     * alias for closePopup
-     * @function
-     */
-    this.close=this.closePopup;
-    Rico.eventBind(this.container,"mouseover", Rico.eventHandle(this,'highlightColor'), false);
-    Rico.eventBind(this.container,"click", Rico.eventHandle(this,'selectColor'), false);
-    this.close();
-  },
-
-/** @private */
-  selectColor: function(e) {
-    Rico.eventStop(e);
-    if (this.returnValue) this.returnValue(this.currentValue);
-    this.close();
-  },
-
-/* This function runs when you move your mouse over a color block */
-/** @private */
-  highlightColor: function(e) {
-    var elem = Rico.eventElement(e);
-    if (!elem.tagName || elem.tagName.toLowerCase() != 'td') return;
-    var c=Rico.Color.createColorFromBackground(elem).toString();
-    this.currentValue = c;
-    Rico.setStyle('colorPickerSelectedColor', {backgroundColor:c});
-    var d = Rico.$("colorPickerSelectedColorValue");
-    if (d) d.innerHTML = c;
-  }
-};
-
-Rico.includeLoaded('ricoColorPicker.js');
diff --git a/ricoClient/js/ricoDragDrop.js b/ricoClient/js/ricoDragDrop.js
deleted file mode 100644 (file)
index e0f8bc6..0000000
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-Rico.dndMgrList = [];
-
-Rico.registerDraggable = function(aDraggable, mgrIdx) {
-  if (typeof mgrIdx != 'number') mgrIdx=0;
-  if (typeof Rico.dndMgrList[mgrIdx] != 'object')
-    Rico.dndMgrList[mgrIdx] = new Rico.dndMgr();
-  Rico.dndMgrList[mgrIdx].registerDraggable(aDraggable);
-};
-
-Rico.registerDropZone = function(aDropZone, mgrIdx) {
-  if (typeof mgrIdx != 'number') mgrIdx=0;
-  if (typeof Rico.dndMgrList[mgrIdx] != 'object')
-    Rico.dndMgrList[mgrIdx] = new Rico.dndMgr();
-  Rico.dndMgrList[mgrIdx].registerDropZone(aDropZone);
-};
-
-Rico.dndMgr = function() {
-  this.initialize();
-};
-
-Rico.dndMgr.prototype = {
-/**
- * @class Implements drag-n-drop manager -- a group of linked draggables and drop zones
- * @constructs
- */
-   initialize: function() {
-      this.dropZones                = [];
-      this.draggables               = [];
-      this.currentDragObjects       = [];
-      this.dragElement              = null;
-      this.lastSelectedDraggable    = null;
-      this.currentDragObjectVisible = false;
-      this.interestedInMotionEvents = false;
-      this._mouseDown = Rico.eventHandle(this,'_mouseDownHandler');
-      this._mouseMove = Rico.eventHandle(this,'_mouseMoveHandler');
-      this._mouseUp = Rico.eventHandle(this,'_mouseUpHandler');
-   },
-
-   registerDropZone: function(aDropZone) {
-      this.dropZones[ this.dropZones.length ] = aDropZone;
-   },
-
-   deregisterDropZone: function(aDropZone) {
-      var newDropZones = new Array();
-      var j = 0;
-      for ( var i = 0 ; i < this.dropZones.length ; i++ ) {
-         if ( this.dropZones[i] != aDropZone )
-            newDropZones[j++] = this.dropZones[i];
-      }
-
-      this.dropZones = newDropZones;
-   },
-
-   clearDropZones: function() {
-      this.dropZones = new Array();
-   },
-
-   registerDraggable: function( aDraggable ) {
-      this.draggables[ this.draggables.length ] = aDraggable;
-      var htmlElement = aDraggable.getMouseDownHTMLElement();
-      if ( htmlElement != null ) { 
-         htmlElement.ricoDraggable = aDraggable;
-         Rico.eventBind(htmlElement, "mousedown", Rico.eventHandle(this,'_attachEvents'));
-         Rico.eventBind(htmlElement, "mousedown", this._mouseDown);
-      }
-   },
-
-   clearSelection: function() {
-      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
-         this.currentDragObjects[i].deselect();
-      this.currentDragObjects = new Array();
-      this.lastSelectedDraggable = null;
-   },
-
-   hasSelection: function() {
-      return this.currentDragObjects.length > 0;
-   },
-
-   setStartDragFromElement: function( e, mouseDownElement ) {
-      this.origPos = Rico.cumulativeOffset(mouseDownElement);
-      var coord=Rico.eventClient(e);
-      this.startx = coord.x - this.origPos.left;
-      this.starty = coord.y - this.origPos.top;
-
-      this.interestedInMotionEvents = this.hasSelection();
-      Rico.eventStop(e);
-   },
-
-   updateSelection: function( draggable, extendSelection ) {
-      if ( ! extendSelection )
-         this.clearSelection();
-
-      if ( draggable.isSelected() ) {
-         this.currentDragObjects=this.currentDragObjects.without(draggable);
-         draggable.deselect();
-         if ( draggable == this.lastSelectedDraggable )
-            this.lastSelectedDraggable = null;
-      }
-      else {
-         draggable.select();
-         if ( draggable.isSelected() ) {
-           this.currentDragObjects.push(draggable);
-           this.lastSelectedDraggable = draggable;
-         }
-      }
-   },
-
-   _mouseDownHandler: function(e) {
-      // if not button 1 ignore it...
-      if (!Rico.eventLeftClick(e)) return;
-
-      var eventTarget      = Rico.eventElement(e);
-      var draggableObject  = eventTarget.ricoDraggable;
-
-      var candidate = eventTarget;
-      while (draggableObject == null && candidate.parentNode) {
-         candidate = candidate.parentNode;
-         draggableObject = candidate.ricoDraggable;
-      }
-   
-      if ( draggableObject == null ) return;
-
-      this.updateSelection( draggableObject, e.ctrlKey );
-
-      // clear the drop zones postion cache...
-      if ( this.hasSelection() ) {
-         for ( var i = 0 ; i < this.dropZones.length ; i++ )
-            this.dropZones[i].clearPositionCache();
-      }
-      this.setStartDragFromElement( e, draggableObject.getMouseDownHTMLElement() );
-   },
-
-
-   _mouseMoveHandler: function(e) {
-      if ( !this.interestedInMotionEvents ) {
-         return;
-      }
-
-      if ( ! this.hasSelection() )
-         return;
-
-      if ( ! this.currentDragObjectVisible )
-         this._startDrag(e);
-
-      if ( !this.activatedDropZones )
-         this._activateRegisteredDropZones();
-
-      this._updateDraggableLocation(e);
-      this._updateDropZonesHover(e);
-
-      Rico.eventStop(e);
-   },
-
-   _makeDraggableObjectVisible: function(e) {
-      if ( !this.hasSelection() )
-         return;
-
-      var dragElement;
-      if ( this.currentDragObjects.length > 1 )
-         dragElement = this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects);
-      else
-         dragElement = this.currentDragObjects[0].getSingleObjectDragGUI();
-
-      // go ahead and absolute position it...
-      this.dragElemPosition=Rico.getStyle(dragElement, "position");
-      if (this.dragElemPosition != "absolute")
-         dragElement.style.position = "absolute";
-
-      // need to parent him into the document...
-      if ( dragElement.parentNode == null || dragElement.parentNode.nodeType == 11 )
-         document.body.appendChild(dragElement);
-
-      this.dragElement = dragElement;
-      this._updateDraggableLocation(e);
-
-      this.currentDragObjectVisible = true;
-   },
-
-   _leftOffset: function(e) {
-          return e.offsetX ? document.body.scrollLeft : 0;
-       },
-
-   _topOffset: function(e) {
-          return e.offsetY ? document.body.scrollTop : 0;
-       },
-
-               
-   _updateDraggableLocation: function(e) {
-      var dragObjectStyle = this.dragElement.style;
-      var coord=Rico.eventClient(e);
-      dragObjectStyle.left = (coord.x + this._leftOffset(e) - this.startx) + "px";
-      dragObjectStyle.top  = (coord.y + this._topOffset(e) - this.starty) + "px";
-   },
-
-   _updateDropZonesHover: function(e) {
-      var i,n = this.dropZones.length;
-      for ( i = 0 ; i < n ; i++ ) {
-         if ( ! this._mousePointInDropZone( e, this.dropZones[i] ) )
-            this.dropZones[i].hideHover();
-      }
-
-      for ( i = 0 ; i < n ; i++ ) {
-         if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
-            if ( this.dropZones[i].canAccept(this.currentDragObjects) )
-               this.dropZones[i].showHover();
-         }
-      }
-   },
-
-   _startDrag: function(e) {
-      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
-         this.currentDragObjects[i].startDrag();
-      this._makeDraggableObjectVisible(e);
-   },
-
-   _mouseUpHandler: function(e) {
-      if ( ! this.hasSelection() ) return;
-      if (!Rico.eventLeftClick(e)) return;
-
-      this.interestedInMotionEvents = false;
-
-      if ( this._placeDraggableInDropZone(e) )
-         this._completeDropOperation(e);
-      else if (this.dragElement != null) {
-         Rico.eventStop(e);
-         Rico.animate(this.dragElement, 
-                      {duration: 300, onEnd:Rico.bind(this,'_doCancelDragProcessing')}, 
-                      {left:this.origPos.left, top:this.origPos.top});
-      }
-
-     Rico.eventUnbind(document.body, "mousemove", this._mouseMove);
-     Rico.eventUnbind(document.body, "mouseup",  this._mouseUp);
-   },
-
-   _retTrue: function () {
-      return true;
-   },
-
-   _completeDropOperation: function(e) {
-      if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() ) {
-         if ( this.dragElement.parentNode != null )
-            this.dragElement.parentNode.removeChild(this.dragElement);
-      }
-
-      this._deactivateRegisteredDropZones();
-      this._endDrag();
-      this.clearSelection();
-      this.dragElement = null;
-      this.currentDragObjectVisible = false;
-      Rico.eventStop(e);
-   },
-
-   _doCancelDragProcessing: function() {
-      this._cancelDrag();
-      if ( this.dragElement == this.currentDragObjects[0].getMouseDownHTMLElement() ) {
-         this.dragElement.style.position=this.dragElemPosition;
-      } else {
-         if ( this.dragElement && this.dragElement.parentNode != null )
-            this.dragElement.parentNode.removeChild(this.dragElement);
-      }
-      this._deactivateRegisteredDropZones();
-      this.dragElement = null;
-      this.currentDragObjectVisible = false;
-   },
-
-   _placeDraggableInDropZone: function(e) {
-      var foundDropZone = false;
-      var n = this.dropZones.length;
-      for ( var i = 0 ; i < n ; i++ ) {
-         if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
-            if ( this.dropZones[i].canAccept(this.currentDragObjects) ) {
-               this.dropZones[i].hideHover();
-               this.dropZones[i].accept(this.currentDragObjects);
-               foundDropZone = true;
-               break;
-            }
-         }
-      }
-
-      return foundDropZone;
-   },
-
-   _cancelDrag: function() {
-      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
-         this.currentDragObjects[i].cancelDrag();
-   },
-
-   _endDrag: function() {
-      for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
-         this.currentDragObjects[i].endDrag();
-   },
-
-   _mousePointInDropZone: function( e, dropZone ) {
-
-      var absoluteRect = dropZone.getAbsoluteRect();
-      var coord=Rico.eventClient(e);
-
-      return coord.x  > absoluteRect.left + this._leftOffset(e) &&
-             coord.x  < absoluteRect.right + this._leftOffset(e) &&
-             coord.y  > absoluteRect.top + this._topOffset(e)   &&
-             coord.y  < absoluteRect.bottom + this._topOffset(e);
-   },
-
-   _activateRegisteredDropZones: function() {
-      var n = this.dropZones.length;
-      for ( var i = 0 ; i < n ; i++ ) {
-         var dropZone = this.dropZones[i];
-         if ( dropZone.canAccept(this.currentDragObjects) )
-            dropZone.activate();
-      }
-
-      this.activatedDropZones = true;
-   },
-
-   _deactivateRegisteredDropZones: function() {
-      var n = this.dropZones.length;
-      for ( var i = 0 ; i < n ; i++ )
-         this.dropZones[i].deactivate();
-      this.activatedDropZones = false;
-   },
-
-   _attachEvents: function () {
-     Rico.eventBind(document.body, "mousemove", this._mouseMove);
-     Rico.eventBind(document.body, "mouseup",  this._mouseUp);
-   }
-
-};
-
-
-Rico.Draggable = function(type, htmlElement) {
-  this.initialize(type, htmlElement);
-};
-
-Rico.Draggable.prototype = {
-/**
- * @class Implements behavior for a draggable element
- * @constructs
- */
-   initialize: function( type, htmlElement ) {
-      this.type          = type;
-      this.htmlElement   = Rico.$(htmlElement);
-      this.selected      = false;
-   },
-
-   /**
-    *   Returns the HTML element that should have a mouse down event
-    *   added to it in order to initiate a drag operation
-    **/
-   getMouseDownHTMLElement: function() {
-      return this.htmlElement;
-   },
-
-   select: function() {
-      this._select();
-   },
-
-   _select: function() {
-      this.selected = true;
-      if (this.showingSelected) return;
-      this.showingSelected = true;
-
-      var htmlElement = this.getMouseDownHTMLElement();
-      var color = Rico.Color.createColorFromBackground(htmlElement);
-      color.isBright() ? color.darken(0.033) : color.brighten(0.033);
-      this.saveBackground = Rico.getStyle(htmlElement, "backgroundColor", "background-color");
-      htmlElement.style.backgroundColor = color.asHex();
-   },
-
-   deselect: function() {
-      this.selected = false;
-      if (!this.showingSelected) return;
-      var htmlElement = this.getMouseDownHTMLElement();
-      htmlElement.style.backgroundColor = this.saveBackground;
-      this.showingSelected = false;
-   },
-
-   isSelected: function() {
-      return this.selected;
-   },
-
-   startDrag: function() {
-   },
-
-   cancelDrag: function() {
-   },
-
-   endDrag: function() {
-   },
-
-   getSingleObjectDragGUI: function() {
-      return this.htmlElement;
-   },
-
-   getMultiObjectDragGUI: function( draggables ) {
-      return this.htmlElement;
-   },
-
-   getDroppedGUI: function() {
-      return this.htmlElement;
-   },
-
-   toString: function() {
-      return this.type + ":" + this.htmlElement + ":";
-   }
-
-};
-
-
-Rico.LiveGridDraggable = function(grid, rownum, colnum) {
-  this.initialize(grid, rownum, colnum);
-};
-
-Rico.LiveGridDraggable.prototype = Rico.extend(new Rico.Draggable(), {
-/**
- * @class Enables draggable behavior for LiveGrid cells.
- * Called by LiveGrid#appendBlankRow for columns where canDrag is true.
- * @extends Rico.Draggable
- * @constructs
- */
-  initialize: function( grid, rownum, colnum) {\r
-    this.type        = 'RicoCell';\r
-    this.htmlElement = grid.cell(rownum,colnum);\r
-    this.liveGrid    = grid;\r
-    this.dragRow     = rownum;\r
-    this.dragCol     = colnum;\r
-  },\r
-  \r
-  select: function() {
-    if (this.dragRow >= this.liveGrid.buffer.totalRows) return;
-    this.selected = true;
-    this.showingSelected = true;
-  },
-
-  deselect: function() {
-    this.selected = false;
-    this.showingSelected = false;
-  },
-
-  getSingleObjectDragGUI: function() {\r
-    var div = document.createElement("div");\r
-    div.className = 'LiveGridDraggable';\r
-    div.style.width = (this.htmlElement.offsetWidth - 10) + "px";\r
-    div.innerHTML=this.htmlElement.innerHTML;
-    return div;\r
-  }\r
-});\r
-
-
-Rico.Dropzone = function(htmlElement) {
-  this.initialize(htmlElement);
-};
-
-Rico.Dropzone.prototype = {
-/**
- * @class Implements behavior for a drop zone
- * @constructs
- */
-   initialize: function( htmlElement ) {
-      this.htmlElement  = Rico.$(htmlElement);
-      this.absoluteRect = null;
-   },
-
-   getHTMLElement: function() {
-      return this.htmlElement;
-   },
-
-   clearPositionCache: function() {
-      this.absoluteRect = null;
-   },
-
-   getAbsoluteRect: function() {
-      if ( this.absoluteRect == null ) {
-         var htmlElement = this.getHTMLElement();
-         var pos = Rico.viewportOffset(htmlElement);
-
-         this.absoluteRect = {
-            top:    pos.top,
-            left:   pos.left,
-            bottom: pos.top + htmlElement.offsetHeight,
-            right:  pos.left + htmlElement.offsetWidth
-         };
-      }
-      return this.absoluteRect;
-   },
-
-   activate: function() {
-      var htmlElement = this.getHTMLElement();
-      if (htmlElement == null  || this.showingActive)
-         return;
-
-      this.showingActive = true;
-      this.saveBackgroundColor = htmlElement.style.backgroundColor;
-
-      var fallbackColor = "#ffea84";
-      var currentColor = Rico.Color.createColorFromBackground(htmlElement);
-      if ( currentColor == null )
-         htmlElement.style.backgroundColor = fallbackColor;
-      else {
-         currentColor.isBright() ? currentColor.darken(0.2) : currentColor.brighten(0.2);
-         htmlElement.style.backgroundColor = currentColor.asHex();
-      }
-   },
-
-   deactivate: function() {
-      var htmlElement = this.getHTMLElement();
-      if (htmlElement == null || !this.showingActive)
-         return;
-
-      htmlElement.style.backgroundColor = this.saveBackgroundColor;
-      this.showingActive = false;
-      this.saveBackgroundColor = null;
-   },
-
-   showHover: function() {
-      var htmlElement = this.getHTMLElement();
-      if ( htmlElement == null || this.showingHover )
-         return;
-
-      this.saveBorderWidth = htmlElement.style.borderWidth;
-      this.saveBorderStyle = htmlElement.style.borderStyle;
-      this.saveBorderColor = htmlElement.style.borderColor;
-
-      this.showingHover = true;
-      htmlElement.style.borderWidth = "1px";
-      htmlElement.style.borderStyle = "solid";
-      //htmlElement.style.borderColor = "#ff9900";
-      htmlElement.style.borderColor = "#ffff00";
-   },
-
-   hideHover: function() {
-      var htmlElement = this.getHTMLElement();
-      if ( htmlElement == null || !this.showingHover )
-         return;
-
-      htmlElement.style.borderWidth = this.saveBorderWidth;
-      htmlElement.style.borderStyle = this.saveBorderStyle;
-      htmlElement.style.borderColor = this.saveBorderColor;
-      this.showingHover = false;
-   },
-
-   canAccept: function(draggableObjects) {
-      return true;
-   },
-
-   accept: function(draggableObjects) {
-      var htmlElement = this.getHTMLElement();
-      if ( htmlElement == null )
-         return;
-
-      var n = draggableObjects.length;
-      for ( var i = 0 ; i < n ; i++ ) {
-         var theGUI = draggableObjects[i].getDroppedGUI();
-         if ( Rico.getStyle( theGUI, "position" ) == "absolute" ) {
-            theGUI.style.position = "static";
-            theGUI.style.top = "";
-            theGUI.style.top = "";
-         }
-         htmlElement.appendChild(theGUI);
-      }
-   }
-};
-
-Rico.includeLoaded('ricoDragDrop.js');
diff --git a/ricoClient/js/ricoGridCommon.js b/ricoClient/js/ricoGridCommon.js
deleted file mode 100644 (file)
index b665b47..0000000
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-if(typeof Rico=='undefined') throw("GridCommon requires the Rico JavaScript framework");
-
-/**
- * Define methods that are common to both SimpleGrid and LiveGrid
- */
-Rico.GridCommon = {
-
-  baseInit: function() {
-    this.options = {
-      resizeBackground : 'resize.gif',
-      saveColumnInfo   : {width:true, filter:false, sort:false},  // save info in cookies?
-      cookiePrefix     : 'RicoGrid.',
-      allowColResize   : true,      // allow user to resize columns
-      windowResize     : true,      // Resize grid on window.resize event? Set to false when embedded in an accordian.
-      click            : null,
-      dblclick         : null,
-      contextmenu      : null,
-      menuEvent        : 'dblclick',  // event that triggers menus - click, dblclick, contextmenu, or none (no menus)
-      defaultWidth     : -1,          // if -1, then use unformatted column width
-      scrollBarWidth   : 19,          // this is the value used in positioning calculations, it does not actually change the width of the scrollbar
-      minScrollWidth   : 100,         // min scroll area width when width of frozen columns exceeds window width
-      frozenColumns    : 0,
-      exportWindow     : "height=400,width=500,scrollbars=1,menubar=1,resizable=1",
-      exportStyleList  : ['background-color','color','text-align','font-weight','font-size','font-family'],
-      exportImgTags    : false,       // applies to grid header and to SimpleGrid cells (not LiveGrid cells)
-      exportFormFields : true,
-      FilterLocation   : null,        // heading row number to place filters. -1=add a new heading row.
-      FilterAllToken   : '___ALL___', // select box value to use to indicate ALL
-      columnSpecs      : []
-    };
-    this.colWidths = [];
-    this.hdrCells=[];
-    this.headerColCnt=0;
-    this.headerRowIdx=0;       // row in header which gets resizers (no colspan's in this row)
-    this.tabs=new Array(2);
-    this.thead=new Array(2);
-    this.tbody=new Array(2);
-  },
-
-  attachMenuEvents: function() {
-    var i;
-    if (!this.options.menuEvent || this.options.menuEvent=='none') return;
-    this.hideScroll=navigator.userAgent.match(/Macintosh\b.*\b(Firefox|Camino)\b/i) || (Rico.isOpera && parseFloat(window.opera.version())<9.5);
-    this.options[this.options.menuEvent]=Rico.eventHandle(this,'handleMenuClick');
-    if (this.highlightDiv) {
-      switch (this.options.highlightElem) {
-        case 'cursorRow':
-          this.attachMenu(this.highlightDiv[0]);
-          break;
-        case 'cursorCell':
-          for (i=0; i<2; i++) {
-            this.attachMenu(this.highlightDiv[i]);
-          }
-          break;
-      }
-    }
-    for (i=0; i<2; i++) {
-      this.attachMenu(this.tbody[i]);
-    }
-  },
-
-  attachMenu: function(elem) {
-    if (this.options.click)
-      Rico.eventBind(elem, 'click', this.options.click, false);
-    if (this.options.dblclick) {
-      if (Rico.isWebKit || Rico.isOpera)
-        Rico.eventBind(elem, 'click', Rico.eventHandle(this,'handleDblClick'), false);
-      else
-        Rico.eventBind(elem, 'dblclick', this.options.dblclick, false);
-    }
-    if (this.options.contextmenu) {
-      if (Rico.isOpera || Rico.isKonqueror)
-        Rico.eventBind(elem, 'click', Rico.eventHandle(this,'handleContextMenu'), false);
-      else
-        Rico.eventBind(elem, 'contextmenu', this.options.contextmenu, false);
-    }
-  },
-
-/**
- * implement double-click for browsers that don't support a double-click event (e.g. Safari)
- */
-  handleDblClick: function(e) {
-    var elem=Rico.eventElement(e);
-    if (this.dblClickElem == elem) {
-      this.options.dblclick(e);
-    } else {
-      this.dblClickElem = elem;
-      this.safariTimer=Rico.runLater(300,this,'clearDblClick');
-    }
-  },
-
-  clearDblClick: function() {
-    this.dblClickElem=null;
-  },
-
-/**
- * implement right-click for browsers that don't support contextmenu event (e.g. Opera, Konqueror)
- * use control-click instead
- */
-  handleContextMenu: function(e) {
-    var b;
-    if( typeof( e.which ) == 'number' )
-      b = e.which; //Netscape compatible
-    else if( typeof( e.button ) == 'number' )
-      b = e.button; //DOM
-    else
-      return;
-    if (b==1 && e.ctrlKey) {
-      this.options.contextmenu(e);
-    }
-  },
-
-  cancelMenu: function() {
-    if (this.menu) this.menu.cancelmenu();
-  },
-
-/**
- * gather info from original headings
- */
-  getColumnInfo: function(hdrSrc) {
-    Rico.log('getColumnInfo: len='+hdrSrc.length);
-    if (hdrSrc.length == 0) return 0;
-    this.headerRowCnt=hdrSrc.length;
-    var r,c,colcnt;
-    for (r=0; r<this.headerRowCnt; r++) {
-      var headerRow = hdrSrc[r];
-      var headerCells=headerRow.cells;
-      if (r >= this.hdrCells.length) this.hdrCells[r]=[];
-      for (c=0; c<headerCells.length; c++) {
-        var obj={};
-        obj.cell=headerCells[c];
-        obj.colSpan=headerCells[c].colSpan || 1;  // Safari & Konqueror return default colspan of 0
-        if (this.options.defaultWidth < 0) obj.initWidth=headerCells[c].offsetWidth;
-        this.hdrCells[r].push(obj);
-      }
-      if (headerRow.id.slice(-5)=='_main') {
-        colcnt=this.hdrCells[r].length;
-        this.headerRowIdx=r;
-      }
-    }
-    if (!colcnt) {
-      this.headerRowIdx=this.headerRowCnt-1;
-      colcnt=this.hdrCells[this.headerRowIdx].length;
-    }
-    Rico.log("getColumnInfo: colcnt="+colcnt);
-    return colcnt;
-  },
-
-  addHeadingRow: function(className) {
-    var r=this.headerRowCnt++;
-    this.hdrCells[r]=[];
-    for( var h=0; h < 2; h++ ) {
-      var row = this.thead[h].insertRow(-1);
-      var newClass='ricoLG_hdg '+this.tableId+'_hdg'+r;
-      if (className) newClass+=' '+className;
-      row.className=newClass;
-      var limit= h==0 ? this.options.frozenColumns : this.headerColCnt-this.options.frozenColumns;
-      for( var c=0; c < limit; c++ ) {
-        var hdrCell=row.insertCell(-1);
-        var colDiv=Rico.wrapChildren(hdrCell,'ricoLG_col');
-        Rico.wrapChildren(colDiv,'ricoLG_cell');
-        this.hdrCells[r].push({cell:hdrCell,colSpan:1});
-      }
-    }
-    return r;
-  },
-  
-/**
- * create column array
- */
-  createColumnArray: function(columnType) {
-    this.direction=Rico.getStyle(this.outerDiv,'direction').toLowerCase();  // ltr or rtl
-    this.align=this.direction=='rtl' ? ['right','left'] : ['left','right'];
-    Rico.log('createColumnArray: dir='+this.direction);
-    this.columns = [];
-    for (var c=0; c < this.headerColCnt; c++) {
-      Rico.log("createColumnArray: c="+c);
-      var tabidx=c<this.options.frozenColumns ? 0 : 1;
-      var col=new Rico[columnType](this, c, this.hdrCells[this.headerRowIdx][c], tabidx);
-      this.columns.push(col);
-      if (c > 0) this.columns[c-1].next=col;
-    }
-    this.getCookie();
-    Rico.runLater(100,this,'insertResizers');  // avoids peek-a-boo bug in column 1 in IE6/7
-  },
-
-/**
- * Insert resizing handles
- */
-  insertResizers: function() {
-    if (!this.options.allowColResize) return;
-    for (var x=0;x<this.columns.length;x++) {
-      this.columns[x].insertResizer();
-    }
-  },
-
-/**
- * Create div structure
- */
-  createDivs: function() {
-    Rico.log("createDivs start");
-    this.outerDiv   = this.createDiv("outer");
-    if (Rico.theme.widget) Rico.addClass(this.outerDiv,Rico.theme.widget);
-    if (this.outerDiv.firstChild && this.outerDiv.firstChild.tagName && this.outerDiv.firstChild.tagName.toUpperCase()=='TABLE') {
-      this.structTab=this.outerDiv.firstChild;
-      this.structTabLeft=this.structTab.rows[0].cells[0];
-      this.structTabUR=this.structTab.rows[0].cells[1];
-      this.structTabLR=this.structTab.rows[1].cells[0];
-    } else {
-      this.structTab = document.createElement("table");
-      this.structTab.border=0;
-      this.structTab.cellPadding=0;
-      this.structTab.cellSpacing=0;
-      var tr1=this.structTab.insertRow(-1);
-      tr1.vAlign='top';
-      this.structTabLeft=tr1.insertCell(-1);
-      this.structTabLeft.rowSpan=2;
-      var tr2=this.structTab.insertRow(-1);
-      tr2.vAlign='top';
-      this.structTabUR=tr1.insertCell(-1);
-      this.structTabLR=tr2.insertCell(-1);
-      this.outerDiv.appendChild(this.structTab);
-    }
-    //this.structTabLR.style.overflow='hidden';
-    //if (Rico.isOpera) this.outerDiv.style.overflow="hidden";
-    this.frozenTabs = this.createDiv("frozenTabs",this.structTabLeft);
-    this.innerDiv   = this.createDiv("inner",this.structTabUR);
-    this.scrollDiv  = this.createDiv("scroll",this.structTabLR);
-    this.resizeDiv  = this.createDiv("resize",this.outerDiv,true);
-    this.exportDiv  = this.createDiv("export",this.outerDiv,true);
-
-    this.messagePopup=new Rico.Popup();
-    this.messagePopup.createContainer({hideOnEscape:false, hideOnClick:false, parent:this.outerDiv});
-    this.messagePopup.content.className='ricoLG_messageDiv';
-    if (Rico.theme.gridMessage) Rico.addClass(this.messagePopup.content,Rico.theme.gridMessage);
-
-    this.keywordPopup=new Rico.Window('', {zIndex:-1, parent:this.outerDiv});
-    this.keywordPopup.container.className='ricoLG_keywordDiv';
-    var instructions=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
-    instructions.innerHTML=Rico.getPhraseById("keywordPrompt");
-    this.keywordBox=this.keywordPopup.contentDiv.appendChild(document.createElement("input"));
-    this.keywordBox.size=20;
-    Rico.eventBind(this.keywordBox,"keypress", Rico.eventHandle(this,'keywordKey'), false);
-    this.keywordPopup.contentDiv.appendChild(Rico.floatButton('Checkmark', Rico.eventHandle(this,'processKeyword')));
-    var s=this.keywordPopup.contentDiv.appendChild(document.createElement("p"));
-    Rico.setStyle(s,{clear:'both'});
-
-    //this.frozenTabs.style[this.align[0]]='0px';
-    //this.innerDiv.style[this.align[0]]='0px';
-    Rico.log("createDivs end");
-  },
-  
-  keywordKey: function(e) {
-    switch (Rico.eventKey(e)) {
-      case 27: this.closeKeyword(); Rico.eventStop(e); return false;
-      case 13: this.processKeyword(); Rico.eventStop(e); return false;
-    }
-    return true;
-  },
-  
-  openKeyword: function(colnum) {
-    this.keywordCol=colnum;
-    this.keywordBox.value='';
-    this.keywordPopup.setTitle(this.columns[colnum].displayName);
-    this.keywordPopup.centerPopup();
-    this.keywordBox.focus();
-  },
-  
-  closeKeyword: function() {
-    this.keywordPopup.closePopup();
-    this.cancelMenu();
-  },
-  
-  processKeyword: function() {
-    var keyword=this.keywordBox.value;
-    this.closeKeyword();
-    this.columns[this.keywordCol].setFilterKW(keyword);
-  },
-
-/**
- * Create a div and give it a standardized id and class name.
- * If the div already exists, then just assign the class name.
- */
-  createDiv: function(elemName,elemParent,hidden) {
-    var id=this.tableId+"_"+elemName+"Div";
-    var newdiv=document.getElementById(id);
-    if (!newdiv) {
-      newdiv = document.createElement("div");
-      newdiv.id = id;
-      if (elemParent) elemParent.appendChild(newdiv);
-    }
-    newdiv.className = "ricoLG_"+elemName+"Div";
-    if (hidden) Rico.hide(newdiv);
-    return newdiv;
-  },
-
-/**
- * Common code used to size & position divs in both SimpleGrid & LiveGrid
- */
-  baseSizeDivs: function() {
-    this.setOtherHdrCellWidths();
-
-    if (this.options.frozenColumns) {
-      Rico.show(this.tabs[0]);
-      Rico.show(this.frozenTabs);
-      // order of next 3 lines is critical in IE6
-      this.hdrHt=Math.max(Rico.nan2zero(this.thead[0].offsetHeight),this.thead[1].offsetHeight);
-      this.dataHt=Math.max(Rico.nan2zero(this.tbody[0].offsetHeight),this.tbody[1].offsetHeight);
-      this.frzWi=this.borderWidth(this.tabs[0]);
-    } else {
-      Rico.hide(this.tabs[0]);
-      Rico.hide(this.frozenTabs);
-      this.frzWi=0;
-      this.hdrHt=this.thead[1].offsetHeight;
-      this.dataHt=this.tbody[1].offsetHeight;
-    }
-
-    var wiLimit,i;
-    var borderWi=this.borderWidth(this.columns[0].dataCell);
-    Rico.log('baseSizeDivs '+this.tableId+': hdrHt='+this.hdrHt+' dataHt='+this.dataHt);
-    Rico.log(this.tableId+' frzWi='+this.frzWi+' borderWi='+borderWi);
-    for (i=0; i<this.options.frozenColumns; i++) {
-      if (this.columns[i].visible) this.frzWi+=parseInt(this.columns[i].colWidth,10)+borderWi;
-    }
-    this.scrTabWi=this.borderWidth(this.tabs[1]);
-    this.scrTabWi0=this.scrTabWi;
-    Rico.log('scrTabWi: '+this.scrTabWi);
-    for (i=this.options.frozenColumns; i<this.columns.length; i++) {
-      if (this.columns[i].visible) this.scrTabWi+=parseInt(this.columns[i].colWidth,10)+borderWi;
-    }
-    this.scrWi=this.scrTabWi+this.options.scrollBarWidth;
-    if (this.sizeTo=='parent') {
-      if (Rico.isIE) Rico.hide(this.outerDiv);
-      wiLimit=this.outerDiv.parentNode.offsetWidth;
-      if (Rico.isIE) Rico.show(this.outerDiv);
-    }  else {
-      wiLimit=Rico.windowWidth()-this.options.scrollBarWidth-8;
-    }
-    if (this.outerDiv.parentNode.clientWidth > 0)
-      wiLimit=Math.min(this.outerDiv.parentNode.clientWidth, wiLimit);
-    var overage=this.frzWi+this.scrWi-wiLimit;
-    Rico.log('baseSizeDivs '+this.tableId+': scrWi='+this.scrWi+' wiLimit='+wiLimit+' overage='+overage+' clientWidth='+this.outerDiv.parentNode.clientWidth);
-    if (overage > 0 && this.options.frozenColumns < this.columns.length)
-      this.scrWi=Math.max(this.scrWi-overage, this.options.minScrollWidth);
-    this.scrollDiv.style.width=this.scrWi+'px';
-    //this.scrollDiv.style.top=this.hdrHt+'px';
-    //this.frozenTabs.style.width=this.scrollDiv.style[this.align[0]]=this.innerDiv.style[this.align[0]]=this.frzWi+'px';
-    this.frozenTabs.style.width=this.frzWi+'px';
-    this.outerDiv.style.width=(this.frzWi+this.scrWi)+'px';
-  },
-
-/**
- * Returns the sum of the left & right border widths of an element
- */
-  borderWidth: function(elem) {
-    var l=Rico.nan2zero(Rico.getStyle(elem,'borderLeftWidth'));
-    var r=Rico.nan2zero(Rico.getStyle(elem,'borderRightWidth'));
-    Rico.log((elem.id || elem.tagName)+' borderWidth: L='+l+', R='+r);
-    return l + r;
-//    return Rico.nan2zero(Rico.getStyle(elem,'borderLeftWidth')) + Rico.nan2zero(Rico.getStyle(elem,'borderRightWidth'));
-  },
-
-  setOtherHdrCellWidths: function() {
-    var c,i,j,r,w,hdrcell,cell,origSpan,newSpan,divs;
-    for (r=0; r<this.hdrCells.length; r++) {
-      if (r==this.headerRowIdx) continue;
-      Rico.log('setOtherHdrCellWidths: r='+r);
-      c=i=0;
-      while (i<this.headerColCnt && c<this.hdrCells[r].length) {
-        hdrcell=this.hdrCells[r][c];
-        cell=hdrcell.cell;
-        origSpan=newSpan=hdrcell.colSpan;
-        for (w=j=0; j<origSpan; j++, i++) {
-          if (this.columns[i].hdrCell.style.display=='none')
-            newSpan--;
-          else if (this.columns[i].hdrColDiv.style.display!='none')
-            w+=parseInt(this.columns[i].colWidth,10);
-        }
-        if (!hdrcell.hdrColDiv || !hdrcell.hdrCellDiv) {
-          divs=cell.getElementsByTagName('div');
-          hdrcell.hdrColDiv=(divs.length<1) ? Rico.wrapChildren(cell,'ricoLG_col') : divs[0];
-          hdrcell.hdrCellDiv=(divs.length<2) ? Rico.wrapChildren(hdrcell.hdrColDiv,'ricoLG_cell') : divs[1];
-        }
-        if (newSpan==0) {
-          cell.style.display='none';
-        } else if (w==0) {
-          hdrcell.hdrColDiv.style.display='none';
-          cell.colSpan=newSpan;
-        } else {
-          cell.style.display='';
-          hdrcell.hdrColDiv.style.display='';
-          cell.colSpan=newSpan;
-          hdrcell.hdrColDiv.style.width=w+'px';
-        }
-        c++;
-      }
-    }
-  },
-
-  initFilterImage: function(filterRowNum){
-    this.filterAnchor=document.getElementById(this.tableId+'_filterLink');
-    if (!this.filterAnchor) return;
-    this.filterRows=Rico.select('tr.'+this.tableId+'_hdg'+filterRowNum);
-    if (this.filterRows.length!=2) return;
-    for (var i=0, r=[]; i<2; i++) r[i]=Rico.select('.ricoLG_cell',this.filterRows[i]);
-    this.filterElements=r[0].concat(r[1]);
-    this.saveHeight = this.filterElements[0].offsetHeight;
-    var pt=Rico.getStyle(this.filterElements[0],'paddingTop');
-    var pb=Rico.getStyle(this.filterElements[0],'paddingBottom');
-    if (pt) this.saveHeight-=parseInt(pt,10);
-    if (pb) this.saveHeight-=parseInt(pb,10);
-    this.rowNum = filterRowNum;
-    this.setFilterImage(false);
-    //Rico.eventBind(this.filterAnchor, 'click', Rico.eventHandle(this,'toggleFilterRow'), false);
-  },
-
-  toggleFilterRow: function() {
-    if ( Rico.visible(this.filterRows[0]) )
-      this.slideFilterUp();
-    else
-      this.slideFilterDown();
-  },
-
-  setFilterImage: function(expandFlag) {
-    var altText=Rico.getPhraseById((expandFlag ? 'show' : 'hide')+'FilterRow');
-    this.filterAnchor.innerHTML = '<img src="'+Rico.imgDir+'tableFilter'+(expandFlag ? 'Expand' : 'Collapse')+'.gif" alt="'+altText+'" border="0">';
-  },
-
-/**
- * Returns a div for the cell at the specified row and column index.
- * In SimpleGrid, r can refer to any row in the grid.
- * In LiveGrid, r refers to a visible row (row 0 is the first visible row).
- */
-  cell: function(r,c) {
-    return (0<=c && c<this.columns.length && r>=0) ? this.columns[c].cell(r) : null;
-  },
-
-/**
- * Returns the screen height available for a grid
- */
-  availHt: function() {
-    var divPos=Rico.cumulativeOffset(this.outerDiv);
-    return Rico.windowHeight()-divPos.top-2*this.options.scrollBarWidth-15;  // allow for scrollbar and some margin
-  },
-
-  setHorizontalScroll: function() {
-    var newLeft=(-this.scrollDiv.scrollLeft)+'px';
-    this.hdrTabs[1].style.marginLeft=newLeft;
-  },
-
-  pluginScroll: function() {
-     if (this.scrollPluggedIn) return;
-     Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc, false);
-     this.scrollPluggedIn=true;
-  },
-
-  unplugScroll: function() {
-     Rico.eventUnbind(this.scrollDiv,"scroll", this.scrollEventFunc , false);
-     this.scrollPluggedIn=false;
-  },
-
-  hideMsg: function() {
-    this.messagePopup.closePopup();
-  },
-
-  showMsg: function(msg) {
-    this.messagePopup.setContent(msg);
-    this.messagePopup.centerPopup();
-    Rico.log("showMsg: "+msg);
-  },
-
-/**
- * @return array of column objects which have invisible status
- */
-  listInvisible: function(attr) {
-    var hiddenColumns=[];
-    for (var x=0;x<this.columns.length;x++) {
-      if (!this.columns[x].visible)
-        hiddenColumns.push(attr ? this.columns[x][attr] : this.columns[x]);
-    }
-    return hiddenColumns;
-  },
-
-/**
- * @return index of left-most visibile column, or -1 if there are no visible columns
- */
-  firstVisible: function() {
-    for (var x=0;x<this.columns.length;x++) {
-      if (this.columns[x].visible) return x;
-    }
-    return -1;
-  },
-
-/**
- * Show all columns
- */
-  showAll: function() {
-    var invisible=this.listInvisible();
-    for (var x=0;x<invisible.length;x++)
-      invisible[x].showColumn();
-  },
-  
-  chooseColumns: function() {
-    this.menu.cancelmenu();
-    var x,z,col,itemDiv,span,contentDiv;\r
-    if (!this.columnChooser) {
-      Rico.log('creating columnChooser');
-      z=Rico.getStyle(this.outerDiv.offsetParent,'zIndex');
-      if (typeof z!='number') z=0;
-      this.columnChooser=new Rico.Window(Rico.getPhraseById('gridChooseCols'), {zIndex:z+2, parent:this.outerDiv});
-      this.columnChooser.container.className='ricoLG_chooserDiv';
-      contentDiv=this.columnChooser.contentDiv;
-      for (x=0;x<this.columns.length;x++) {
-        col=this.columns[x];
-        itemDiv=contentDiv.appendChild(document.createElement('div'));
-        col.ChooserBox=Rico.createFormField(itemDiv,'input','checkbox');
-        span=itemDiv.appendChild(document.createElement('span'));
-        span.innerHTML=col.displayName;
-        Rico.eventBind(col.ChooserBox, 'click', Rico.eventHandle(col,'chooseColumn'), false);
-      }
-    }
-    Rico.log('opening columnChooser');
-    this.columnChooser.openPopup(1,this.hdrHt);
-    for (x=0;x<this.columns.length;x++) {
-      this.columns[x].ChooserBox.checked=this.columns[x].visible;
-      this.columns[x].ChooserBox.disabled = !this.columns[x].canHideShow();
-    }
-  },
-
-  blankRow: function(r) {
-    for (var c=0; c < this.columns.length; c++) {
-      this.columns[c].clearCell(r);
-    }
-  },
-  
-  getExportStyles: function(chkelem) {
-    var exportStyles=this.options.exportStyleList;
-    var bgImg=Rico.getStyle(chkelem,'backgroundImage');
-    if (!bgImg || bgImg=='none') return exportStyles;
-    for (var styles=[],i=0; i<exportStyles.length; i++)
-      if (exportStyles[i]!='background-color' && exportStyles[i]!='color') styles.push(exportStyles[i]);
-    return styles;
-  },
-
-/**
- * Support function for printVisible()
- */
-  exportStart: function() {
-    var r,c,i,j,hdrcell,newSpan,divs,cell;
-    var exportStyles=this.getExportStyles(this.thead[0]);
-    //alert(exportStyles.join('\n'));
-    this.exportRows=[];
-    this.exportText="<table border='1' cellspacing='0'>";\r
-    for (c=0; c<this.columns.length; c++) {\r
-      if (this.columns[c].visible) this.exportText+="<col width='"+parseInt(this.columns[c].colWidth,10)+"'>";
-    }\r
-    this.exportText+="<thead style='display: table-header-group;'>";
-    if (this.exportHeader) this.exportText+=this.exportHeader;
-    for (r=0; r<this.hdrCells.length; r++) {
-      if (this.hdrCells[r].length==0 || !Rico.visible(this.hdrCells[r][0].cell.parentNode)) continue;
-      this.exportText+="<tr>";
-      for (c=0,i=0; c<this.hdrCells[r].length; c++) {
-        hdrcell=this.hdrCells[r][c];
-        newSpan=hdrcell.colSpan;
-        for (j=0; j<hdrcell.colSpan; j++, i++) {
-          if (!this.columns[i].visible) newSpan--;
-        }
-        if (newSpan > 0) {
-          divs=Rico.select('.ricoLG_cell',hdrcell.cell);
-          cell=divs && divs.length>0 ? divs[0] : hdrcell.cell;
-          this.exportText+="<td style='"+this.exportStyle(cell,exportStyles)+"'";
-          if (hdrcell.colSpan > 1) this.exportText+=" colspan='"+newSpan+"'";
-          this.exportText+=">"+Rico.getInnerText(cell,!this.options.exportImgTags, !this.options.exportFormFields, 'NoExport')+"</td>";
-        }
-      }
-      this.exportText+="</tr>";
-    }
-    this.exportText+="</thead><tbody>";
-  },
-
-/**
- * Support function for printVisible().
- * exportType is optional and defaults 'plain'; 'owc' can be used for IE users with Office Web Components.
- */
-  exportFinish: function(exportType) {
-    if (this.hideMsg) this.hideMsg();
-    window.status=Rico.getPhraseById('exportComplete');
-    if (this.exportRows.length > 0) this.exportText+='<tr>'+this.exportRows.join('</tr><tr>')+'</tr>';
-    if (this.exportFooter) this.exportText+=this.exportFooter;
-    this.exportText+="</tbody></table>";
-    this.exportDiv.innerHTML=this.exportText;
-    this.exportText=undefined;
-    this.exportRows=undefined;
-    if (this.cancelMenu) this.cancelMenu();
-    var w=window.open(Rico.htmDir+'export-'+(exportType || 'plain')+'.html?'+this.exportDiv.id,'',this.options.exportWindow);
-    if (w == null) alert(Rico.getPhraseById('disableBlocker'));
-  },
-
-/**
- * Support function for printVisible()
- */
-  exportStyle: function(elem,styleList) {
-    for (var i=0,s=''; i < styleList.length; i++) {
-      try {
-        var curstyle=Rico.getStyle(elem,styleList[i]);
-        if (curstyle) s+=styleList[i]+':'+curstyle+';';
-      } catch(e) {};
-    }
-    return s;
-  },
-
-/**
- * Gets the value of the grid cookie and interprets the contents.
- * All information for a particular grid is stored in a single cookie.
- * This may include column widths, column hide/show status, current sort, and any column filters.
- */
-  getCookie: function() {
-    var c=Rico.getCookie(this.options.cookiePrefix+this.tableId);
-    if (!c) return;
-    var cookieVals=c.split(',');
-    for (var i=0; i<cookieVals.length; i++) {
-      var v=cookieVals[i].split(':');
-      if (v.length!=2) continue;
-      var colnum=parseInt(v[0].slice(1),10);
-      if (colnum < 0 || colnum >= this.columns.length) continue;
-      var col=this.columns[colnum];
-      switch (v[0].charAt(0)) {
-        case 'w':
-          col.setColWidth(v[1]);
-          col.customWidth=true;
-          break;
-        case 'h':
-          if (v[1].toLowerCase()=='true')
-            col.hideshow(true,true);
-          else
-            col.hideshow(false,true);
-          break;
-        case 's':
-          if (!this.options.saveColumnInfo.sort || !col.sortable) break;
-          col.setSorted(v[1]);
-          break;
-        case 'f':
-          if (!this.options.saveColumnInfo.filter || !col.filterable) break;
-          var filterTemp=v[1].split('~');
-          col.filterOp=filterTemp.shift();
-          col.filterValues = [];
-          col.filterType = Rico.ColumnConst.USERFILTER;
-          for (var j=0; j<filterTemp.length; j++)
-            col.filterValues.push(unescape(filterTemp[j]));
-          break;
-      }
-    }
-  },
-
-/**
- * Sets the grid cookie.
- * All information for a particular grid is stored in a single cookie.
- * This may include column widths, column hide/show status, current sort, and any column filters.
- */
-  setCookie: function() {
-    var cookieVals=[];
-    for (var i=0; i<this.columns.length; i++) {
-      var col=this.columns[i];
-      if (this.options.saveColumnInfo.width) {
-        if (col.customWidth) cookieVals.push('w'+i+':'+col.colWidth);
-        if (col.customVisible) cookieVals.push('h'+i+':'+col.visible);
-      }
-      if (this.options.saveColumnInfo.sort) {
-        if (col.currentSort != Rico.ColumnConst.UNSORTED)
-          cookieVals.push('s'+i+':'+col.currentSort);
-      }
-      if (this.options.saveColumnInfo.filter && col.filterType == Rico.ColumnConst.USERFILTER) {
-        var filterTemp=[col.filterOp];
-        for (var j=0; j<col.filterValues.length; j++)
-          filterTemp.push(escape(col.filterValues[j]));
-        cookieVals.push('f'+i+':'+filterTemp.join('~'));
-      }
-    }
-    Rico.setCookie(this.options.cookiePrefix+this.tableId, cookieVals.join(','), this.options.cookieDays, this.options.cookiePath, this.options.cookieDomain);
-  }
-
-};
-
-
-Rico.ColumnConst = {
-  UNFILTERED:   0,
-  SYSTEMFILTER: 1,
-  USERFILTER:   2,
-
-  UNSORTED:  0,
-  SORT_ASC:  "ASC",
-  SORT_DESC: "DESC",
-
-  MINWIDTH: 10,
-  DOLLAR:  {type:'number', prefix:'$', decPlaces:2, ClassName:'alignright'},
-  EURO:    {type:'number', prefix:'&euro;', decPlaces:2, ClassName:'alignright'},
-  PERCENT: {type:'number', suffix:'%', decPlaces:2, multiplier:100, ClassName:'alignright'},
-  QTY:     {type:'number', decPlaces:0, ClassName:'alignright'},
-  DEFAULT: {type:"showTags"}
-}
-
-
-/**
- * @class Define methods that are common to columns in both SimpleGrid and LiveGrid
- */
-Rico.TableColumnBase = function() {};
-
-Rico.TableColumnBase.prototype = {
-
-/**
- * Common code used to initialize the column in both SimpleGrid & LiveGrid
- */
-  baseInit: function(liveGrid,colIdx,hdrInfo,tabIdx) {
-    Rico.log("TableColumnBase.init index="+colIdx+" tabIdx="+tabIdx);
-    this.liveGrid  = liveGrid;
-    this.index     = colIdx;
-    this.hideWidth = Rico.isKonqueror || Rico.isWebKit || liveGrid.headerRowCnt>1 ? 5 : 2;  // column width used for "hidden" columns. Anything less than 5 causes problems with Konqueror. Best to keep this greater than padding used inside cell.
-    this.options   = liveGrid.options;
-    this.tabIdx    = tabIdx;
-    this.hdrCell   = hdrInfo.cell;
-    this.body = document.getElementsByTagName("body")[0];
-    this.displayName  = this.getDisplayName(this.hdrCell);
-    var divs=this.hdrCell.getElementsByTagName('div');
-    this.hdrColDiv=(divs.length<1) ? Rico.wrapChildren(this.hdrCell,'ricoLG_col') : divs[0];
-    this.hdrCellDiv=(divs.length<2) ? Rico.wrapChildren(this.hdrColDiv,'ricoLG_cell') : divs[1];
-    var sectionIndex= tabIdx==0 ? colIdx : colIdx-liveGrid.options.frozenColumns;
-    this.dataCell = liveGrid.tbody[tabIdx].rows[0].cells[sectionIndex];
-    divs=this.dataCell.getElementsByTagName('div');
-    this.dataColDiv=(divs.length<1) ? Rico.wrapChildren(this.dataCell,'ricoLG_col') : divs[0];
-
-    this.mouseDownHandler= Rico.eventHandle(this,'handleMouseDown');
-    this.mouseMoveHandler= Rico.eventHandle(this,'handleMouseMove');
-    this.mouseUpHandler  = Rico.eventHandle(this,'handleMouseUp');
-    this.mouseOutHandler = Rico.eventHandle(this,'handleMouseOut');
-
-    this.fieldName = 'col'+this.index;
-    var spec = liveGrid.options.columnSpecs[colIdx];
-    this.format=Rico.extend( {}, Rico.ColumnConst.DEFAULT);
-    switch (typeof spec) {
-      case 'object':
-        if (typeof spec.format=='string') Rico.extend(this.format, Rico.ColumnConst[spec.format.toUpperCase()]);
-        Rico.extend(this.format, spec);
-        break;
-      case 'string':
-        if (spec.slice(0,4)=='spec') spec=spec.slice(4).toUpperCase();  // for backwards compatibility
-        if (typeof Rico.ColumnConst[spec]=='object') Rico.extend(this.format, Rico.ColumnConst[spec]);
-        break;
-    }
-    Rico.addClass(this.dataColDiv, this.colClassName());
-    this.visible=true;
-    if (typeof this.format.visible=='boolean') this.visible=this.format.visible;
-    Rico.log("TableColumn.init index="+colIdx+" fieldName="+this.fieldName);
-    this.sortable     = typeof this.format.canSort=='boolean' ? this.format.canSort : liveGrid.options.canSortDefault;
-    this.currentSort  = Rico.ColumnConst.UNSORTED;
-    this.filterable   = typeof this.format.canFilter=='boolean' ? this.format.canFilter : liveGrid.options.canFilterDefault;
-    this.filterType   = Rico.ColumnConst.UNFILTERED;
-    this.hideable     = typeof this.format.canHide=='boolean' ? this.format.canHide : liveGrid.options.canHideDefault;
-
-    var wi=(typeof(this.format.width)=='number') ? this.format.width : hdrInfo.initWidth;
-    wi=(typeof(wi)=='number') ? Math.max(wi,Rico.ColumnConst.MINWIDTH) : liveGrid.options.defaultWidth;
-    this.setColWidth(wi);
-    if (!this.visible) this.setDisplay('none');
-  },
-  
-  colClassName: function() {
-    return this.format.ClassName ? this.format.ClassName : this.liveGrid.tableId+'_col'+this.index;
-  },
-
-  insertResizer: function() {
-    //this.hdrCell.style.width='';
-    if (this.format.noResize) return;
-    var resizer=document.createElement('div');
-    resizer.className='ricoLG_Resize';
-    resizer.style[this.liveGrid.align[1]]='0px';
-    if (this.options.resizeBackground) {
-      var resizePath=Rico.imgDir+this.liveGrid.options.resizeBackground;
-      if (Rico.isIE && Rico.ieVersion < 8)
-        resizePath=location.protocol+resizePath; // IE6+7 only
-      resizer.style.backgroundImage='url('+resizePath+')';
-    }
-    this.hdrCellDiv.appendChild(resizer);
-    Rico.eventBind(resizer,"mousedown", this.mouseDownHandler, false);
-  },
-
-/**
- * get the display name of a column
- */
-  getDisplayName: function(el) {
-    var anchors=el.getElementsByTagName("A");
-    //Check the existance of A tags
-    if (anchors.length > 0)
-      return anchors[0].innerHTML;
-    else
-      return Rico.stripTags(el.innerHTML);
-  },
-
-  _clear: function(gridCell) {
-    gridCell.innerHTML='&nbsp;';
-  },
-
-  clearCell: function(rowIndex) {
-    var gridCell=this.cell(rowIndex);
-    this._clear(gridCell,rowIndex);
-    if (!this.liveGrid.buffer) return;
-    var acceptAttr=this.liveGrid.buffer.options.acceptAttr;
-    for (var k=0; k<acceptAttr.length; k++) {
-      switch (acceptAttr[k]) {
-        case 'style': gridCell.style.cssText=''; break;
-        case 'class': gridCell.className=''; break;
-        default:      gridCell['_'+acceptAttr[k]]=''; break;
-      }
-    }
-  },
-
-  dataTable: function() {
-    return this.liveGrid.tabs[this.tabIdx];
-  },
-
-  numRows: function() {
-    return this.dataColDiv.childNodes.length;
-  },
-
-  clearColumn: function() {
-    var childCnt=this.numRows();
-    for (var r=0; r<childCnt; r++)
-      this.clearCell(r);
-  },
-
-  cell: function(r) {
-    return this.dataColDiv.childNodes[r];
-  },
-
-  getFormattedValue: function(r,xImg,xForm,xClass) {
-    return Rico.getInnerText(this.cell(r),xImg,xForm,xClass);
-  },
-
-  setColWidth: function(wi) {
-    if (typeof wi=='number') {
-      wi=parseInt(wi,10);
-      if (wi < Rico.ColumnConst.MINWIDTH) return;
-      wi=wi+'px';
-    }
-    Rico.log('setColWidth '+this.index+': '+wi);
-    this.colWidth=wi;
-    this.hdrColDiv.style.width=wi;
-    this.dataColDiv.style.width=wi;
-  },
-
-  pluginMouseEvents: function() {
-    if (this.mousePluggedIn==true) return;
-    Rico.eventBind(this.body,"mousemove", this.mouseMoveHandler, false);
-    Rico.eventBind(this.body,"mouseup",   this.mouseUpHandler  , false);
-    Rico.eventBind(this.body,"mouseout",  this.mouseOutHandler , false);
-    this.mousePluggedIn=true;
-  },
-
-  unplugMouseEvents: function() {
-    Rico.eventUnbind(this.body,"mousemove", this.mouseMoveHandler, false);
-    Rico.eventUnbind(this.body,"mouseup",   this.mouseUpHandler  , false);
-    Rico.eventUnbind(this.body,"mouseout",  this.mouseOutHandler , false);
-    this.mousePluggedIn=false;
-  },
-
-  handleMouseDown: function(e) {
-    this.resizeStart=Rico.eventClient(e).x;
-    this.origWidth=parseInt(this.colWidth,10);
-    var p=Rico.positionedOffset(this.hdrCell);
-    if (this.liveGrid.direction=='rtl') {
-      this.edge=p.left+this.liveGrid.options.scrollBarWidth;
-      switch (this.tabIdx) {
-        case 0: this.edge+=this.liveGrid.innerDiv.offsetWidth; break;
-        case 1: this.edge-=this.liveGrid.scrollDiv.scrollLeft; break;
-      }
-    } else {
-      this.edge=p.left+this.hdrCell.offsetWidth;
-      if (this.tabIdx>0) this.edge+=Rico.nan2zero(this.liveGrid.tabs[0].offsetWidth);
-    }
-    this.liveGrid.resizeDiv.style.left=this.edge+"px";
-    this.liveGrid.resizeDiv.style.display="";
-    this.liveGrid.outerDiv.style.cursor='e-resize';
-    this.tmpHighlight=this.liveGrid.highlightEnabled;
-    this.liveGrid.highlightEnabled=false;
-    this.pluginMouseEvents();
-    Rico.eventStop(e);
-  },
-
-  handleMouseMove: function(e) {
-    var delta=Rico.eventClient(e).x-this.resizeStart;
-    var newWidth=(this.liveGrid.direction=='rtl') ? this.origWidth-delta : this.origWidth+delta;
-    if (newWidth < Rico.ColumnConst.MINWIDTH) return;
-    this.liveGrid.resizeDiv.style.left=(this.edge+delta)+"px";
-    this.colWidth=newWidth;
-    Rico.eventStop(e);
-  },
-
-  handleMouseUp: function(e) {
-    this.unplugMouseEvents();
-    Rico.log('handleMouseUp '+this.liveGrid.tableId);
-    this.liveGrid.outerDiv.style.cursor='';
-    this.liveGrid.resizeDiv.style.display="none";
-    this.setColWidth(this.colWidth);
-    this.customWidth=true;
-    this.liveGrid.setCookie();
-    this.liveGrid.highlightEnabled=this.tmpHighlight;
-    this.liveGrid.sizeDivs();
-    Rico.eventStop(e);
-  },
-
-  handleMouseOut: function(e) {
-    var reltg = Rico.eventRelatedTarget(e) || e.toElement;
-    while (reltg != null && reltg.nodeName.toLowerCase() != 'body')
-      reltg=reltg.parentNode;
-    if (reltg!=null && reltg.nodeName.toLowerCase() == 'body') return true;
-    this.handleMouseUp(e);
-    return true;
-  },
-
-  setDisplay: function(d) {
-    this.hdrCell.style.display=d;
-    this.hdrColDiv.style.display=d;
-    this.dataCell.style.display=d;
-    this.dataColDiv.style.display=d;
-  },
-  
-  hideshow: function(visible,noresize) {
-    this.setDisplay(visible ? '' : 'none');
-    this.liveGrid.cancelMenu();
-    this.visible=visible;
-    this.customVisible=true;
-    if (noresize) return;
-    this.liveGrid.setCookie();
-    this.liveGrid.sizeDivs();
-  },
-
-  hideColumn: function() {
-    Rico.log('hideColumn '+this.liveGrid.tableId);
-    this.hideshow(false,false);
-  },
-
-  showColumn: function() {
-    Rico.log('showColumn '+this.liveGrid.tableId);
-    this.hideshow(true,false);
-  },
-
-  chooseColumn: function(e) {
-    var elem=Rico.eventElement(e);
-    this.hideshow(elem.checked,false);
-  },
-
-  setImage: function() {
-    if ( this.currentSort == Rico.ColumnConst.SORT_ASC ) {
-       this.imgSort.style.display='inline-block';
-       this.imgSort.className=Rico.theme.sortAsc || 'ricoLG_sortAsc';
-    } else if ( this.currentSort == Rico.ColumnConst.SORT_DESC ) {
-       this.imgSort.style.display='inline-block';
-       this.imgSort.className=Rico.theme.sortDesc || 'ricoLG_sortDesc';
-    } else {
-       this.imgSort.style.display='none';
-    }
-    if (this.filterType == Rico.ColumnConst.USERFILTER) {
-       this.imgFilter.style.display='';
-       this.imgFilter.title=this.getFilterText();
-    } else {
-       this.imgFilter.style.display='none';
-    }
-  },
-
-  canHideShow: function() {
-    return this.hideable;
-  }
-
-};
-
-Rico.includeLoaded('ricoGridCommon.js');
diff --git a/ricoClient/js/ricoLiveGrid.js b/ricoClient/js/ricoLiveGrid.js
deleted file mode 100644 (file)
index 15a08ad..0000000
+++ /dev/null
@@ -1,2433 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-if(typeof Rico=='undefined') throw("LiveGrid requires the Rico JavaScript framework");
-
-
-/** @namespace */
-if (!Rico.Buffer) Rico.Buffer = {};
-
-Rico.Buffer.Base = function(dataTable, options) {
-  this.initialize(dataTable, options);
-}
-/** @lends Rico.Buffer.Base# */
-Rico.Buffer.Base.prototype = {
-/**
- * @class Defines the static buffer class (no AJAX).
- * Loads buffer with data that already exists in the document as an HTML table or passed via javascript.
- * Also serves as a base class for AJAX-enabled buffers.
- * @constructs
- */
-  initialize: function(dataTable, options) {
-    this.clear();
-    this.updateInProgress = false;
-    this.lastOffset = 0;
-    this.rcvdRowCount = false;  // true if an eof element was included in the last xml response
-    this.foundRowCount = false; // true if an xml response is ever received with eof true
-    this.totalRows = 0;
-    this.rowcntContent = "";
-    this.rcvdOffset = -1;
-    this.options = {
-      fixedHdrRows     : 0,
-      canFilter        : true,  // does buffer object support filtering?
-      isEncoded        : true,  // is the data received via ajax html encoded?
-      acceptAttr       : []     // attributes that can be copied from original/ajax data (e.g. className, style, id)
-    };
-    Rico.extend(this.options, options || {});
-    if (dataTable) {
-      this.loadRowsFromTable(dataTable,this.options.fixedHdrRows);
-    } else {
-      this.clear();
-    }
-  },
-
-  registerGrid: function(liveGrid) {
-    this.liveGrid = liveGrid;
-  },
-
-  setTotalRows: function( newTotalRows ) {
-    if (typeof(newTotalRows)!='number') newTotalRows=this.size;
-    if (this.totalRows == newTotalRows) return;
-    this.totalRows = newTotalRows;
-    if (!this.liveGrid) return;
-    Rico.log("setTotalRows, newTotalRows="+newTotalRows);
-    switch (this.liveGrid.sizeTo) {
-      case 'data':
-        this.liveGrid.resizeWindow();
-        break;
-      case 'datamax':
-        this.liveGrid.setPageSize(newTotalRows);
-        break;
-      default:
-        this.liveGrid.updateHeightDiv();
-        break;
-    }
-  },
-
-  loadRowsFromTable: function(tableElement,firstRow) {
-    var newRows = new Array();
-    var trs = tableElement.getElementsByTagName("tr");
-    for ( var i=firstRow || 0; i < trs.length; i++ ) {
-      var row = new Array();
-      var cells = trs[i].getElementsByTagName("td");
-      for ( var j=0; j < cells.length ; j++ )
-        row[j]=cells[j].innerHTML;
-      newRows.push( row );
-    }
-    this.loadRows(newRows);
-  },
-
-  loadRowsFromArray: function(array2D) {
-    for ( var i=0; i < array2D.length; i++ ) {
-      for ( var j=0; j < array2D[i].length ; j++ ) {
-        array2D[i][j]=array2D[i][j].toString();
-      }
-    }
-    this.loadRows(array2D);
-  },
-
-  loadRows: function(jstable) {
-    this.baseRows = jstable;
-    this.startPos = 0;
-    this.size = this.baseRows.length;
-  },
-
-  dom2jstable: function(rowsElement) {
-    Rico.log('dom2jstable: encoded='+this.options.isEncoded);
-    var newRows = new Array();
-    var trs = rowsElement.getElementsByTagName("tr");
-    for ( var i=0; i < trs.length; i++ ) {
-      var row = new Array();
-      var cells = trs[i].getElementsByTagName("td");
-      for ( var j=0; j < cells.length ; j++ )
-        row[j]=Rico.getContentAsString(cells[j],this.options.isEncoded);
-      newRows.push( row );
-    }
-    return newRows;
-  },
-
-  dom2jstableAttr: function(rowsElement,firstRow) {
-    var acceptAttr=this.options.acceptAttr;
-    Rico.log("dom2jstableAttr start, # attr="+acceptAttr.length);
-    var newRows = new Array();
-    var trs = rowsElement.getElementsByTagName("tr");
-    for ( var i=firstRow || 0; i < trs.length; i++ ) {
-      var row = new Array();
-      var cells = trs[i].getElementsByTagName("td");
-      for ( var j=0; j < cells.length ; j++ ) {
-        row[j]={};
-        for (var k=0; k<acceptAttr.length; k++)
-          row[j]['_'+acceptAttr[k]]=cells[j].getAttribute(acceptAttr[k]);
-        if (Rico.isIE) row[j]._class=cells[j].getAttribute('className');
-      }
-      newRows.push( row );
-    }
-    Rico.log("dom2jstableAttr end");
-    return newRows;
-  },
-
-  _blankRow: function() {
-    var newRow=[];
-    for (var i=0; i<this.liveGrid.columns.length; i++) {
-      newRow[i]='';
-    }
-    return newRow;
-  },
-
-  deleteRows: function(rowIndex,cnt) {
-    this.baseRows.splice(rowIndex,typeof(cnt)=='number' ? cnt : 1);
-    this.liveGrid.isPartialBlank=true;
-    this.size=this.baseRows.length;
-  },
-
-  insertRow: function(beforeRowIndex) {
-    var r=this._blankRow();
-    this.baseRows.splice(beforeRowIndex,0,r);
-    this.size=this.baseRows.length;
-    this.liveGrid.isPartialBlank=true;
-    if (this.startPos < 0) this.startPos=0;
-    return r;
-  },
-
-  appendRows: function(cnt) {
-    var newRows=[];
-    for (var i=0; i<cnt; i++) {
-      var r=this._blankRow();
-      this.baseRows.push(r);
-      newRows.push(r);
-    }
-    this.size=this.baseRows.length;
-    this.liveGrid.isPartialBlank=true;
-    if (this.startPos < 0) this.startPos=0;
-    return newRows;
-  },
-  
-  sortFunc: function(coltype) {
-    switch (coltype) {
-      case 'number': return Rico.bind(this,'_sortNumeric');
-      case 'control':return Rico.bind(this,'_sortControl');
-      default:       return Rico.bind(this,'_sortAlpha');
-    }
-  },
-
-  sortBuffer: function(colnum) {
-    if (!this.baseRows) {
-      this.delayedSortCol=colnum;
-      return;
-    }
-    this.liveGrid.showMsg(Rico.getPhraseById("sorting"));
-    this.sortColumn=colnum;
-    var col=this.liveGrid.columns[colnum];
-    this.getValFunc=col._sortfunc;
-    this.baseRows.sort(this.sortFunc(col.format.type));
-    if (col.getSortDirection()=='DESC') this.baseRows.reverse();
-  },
-  
-  _sortAlpha: function(a,b) {
-    var aa = this.sortColumn<a.length ? Rico.getInnerText(a[this.sortColumn]) : '';
-    var bb = this.sortColumn<b.length ? Rico.getInnerText(b[this.sortColumn]) : '';
-    if (aa==bb) return 0;
-    if (aa<bb) return -1;
-    return 1;
-  },
-
-  _sortNumeric: function(a,b) {
-    var aa = this.sortColumn<a.length ? this.nan2zero(Rico.getInnerText(a[this.sortColumn])) : 0;
-    var bb = this.sortColumn<b.length ? this.nan2zero(Rico.getInnerText(b[this.sortColumn])) : 0;
-    return aa-bb;
-  },
-
-  nan2zero: function(n) {
-    if (typeof(n)=='string') n=parseFloat(n);
-    return isNaN(n) || typeof(n)=='undefined' ? 0 : n;
-  },
-  
-  _sortControl: function(a,b) {
-    var aa = this.sortColumn<a.length ? Rico.getInnerText(a[this.sortColumn]) : '';
-    var bb = this.sortColumn<b.length ? Rico.getInnerText(b[this.sortColumn]) : '';
-    if (this.getValFunc) {
-      aa=this.getValFunc(aa);
-      bb=this.getValFunc(bb);
-    }
-    if (aa==bb) return 0;
-    if (aa<bb) return -1;
-    return 1;
-  },
-
-  clear: function() {
-    this.baseRows = [];
-    this.rows = [];
-    this.startPos = -1;
-    this.size = 0;
-    this.windowPos = 0;
-  },
-
-  isInRange: function(position) {
-    var lastRow=Math.min(this.totalRows, position + this.liveGrid.pageSize);
-    return (position >= this.startPos) && (lastRow <= this.endPos()); // && (this.size != 0);
-  },
-
-  endPos: function() {
-    return this.startPos + this.rows.length;
-  },
-
-  fetch: function(offset) {
-    Rico.log('fetch '+this.liveGrid.tableId+': offset='+offset);
-    this.applyFilters();
-    this.setTotalRows();
-    this.rcvdRowCount = true;
-    this.foundRowCount = true;
-    if (offset < 0) offset=0;
-    this.liveGrid.refreshContents(offset);
-    return;
-  },
-
-/**
- * @return a 2D array of buffer data representing the rows that are currently visible on the grid
- */
-  visibleRows: function() {
-    return this.rows.slice(this.windowStart,this.windowEnd);
-  },
-
-  setWindow: function(startrow, endrow) {
-    this.windowStart = startrow - this.startPos;  // position in the buffer of first visible row
-    Rico.log('setWindow '+this.liveGrid.tableId+': '+startrow+', '+endrow+', newstart='+this.windowStart);
-    this.windowEnd = Math.min(endrow,this.size);  // position in the buffer of last visible row containing data+1
-    this.windowPos = startrow;                    // position in the dataset of first visible row
-  },
-
-/**
- * @return true if bufRow is currently visible in the grid
- */
-  isVisible: function(bufRow) {
-    return bufRow < this.rows.length && bufRow >= this.windowStart && bufRow < this.windowEnd;
-  },
-  
-/**
- * takes a window row index and returns the corresponding buffer row index
- */
-  bufferRow: function(windowRow) {
-    return this.windowStart+windowRow;
-  },
-
-/**
- * @return buffer cell at the specified visible row/col index
- */
-  getWindowCell: function(windowRow,col) {
-    var bufrow=this.bufferRow(windowRow);
-    return this.isVisible(bufrow) && col < this.rows[bufrow].length ? this.rows[bufrow][col] : null;
-  },
-
-  getWindowAttr: function(windowRow,col) {
-    var bufrow=this.bufferRow(windowRow);
-    return this.attr && this.isVisible(bufrow) && col < this.attr[bufrow].length ? this.attr[bufrow][col] : null;
-  },
-
-  getWindowValue: function(windowRow,col) {
-    return this.getWindowCell(windowRow,col);
-  },
-
-  setWindowValue: function(windowRow,col,newval) {
-    var bufrow=this.bufferRow(windowRow);
-    if (bufrow >= this.windowEnd) return false;
-    return this.setValue(bufrow,col,newval);
-  },
-
-  getCell: function(bufRow,col) {
-    return bufRow < this.size ? this.rows[bufRow][col] : null;
-  },
-
-  getValue: function(bufRow,col) {
-    return this.getCell(bufRow,col);
-  },
-
-  setValue: function(bufRow,col,newval,newstyle) {
-    if (bufRow>=this.size) return false;
-    if (!this.rows[bufRow][col]) this.rows[bufRow][col]={};
-    this.rows[bufRow][col]=newval;
-    if (typeof newstyle=='string') this.rows[bufRow][col]._style=newstyle;
-    this.rows[bufRow][col].modified=true;
-    return true;
-  },
-
-  getRows: function(start, count) {
-    var begPos = start - this.startPos;
-    var endPos = Math.min(begPos + count,this.size);
-    var results = new Array();
-    for ( var i=begPos; i < endPos; i++ ) {
-      results.push(this.rows[i]);
-    }
-    return results;
-  },
-
-  applyFilters: function() {
-    var newRows=[],re=[];
-    var r,c,n,i,showRow,filtercnt;
-    var cols=this.liveGrid.columns;
-    for (n=0,filtercnt=0; n<cols.length; n++) {
-      c=cols[n];
-      if (c.filterType == Rico.ColumnConst.UNFILTERED) continue;
-      filtercnt++;
-      if (c.filterOp=='LIKE') re[n]=new RegExp(c.filterValues[0],'i');
-    }
-    Rico.log('applyFilters: # of filters='+filtercnt);
-    if (filtercnt==0) {
-      this.rows = this.baseRows;
-    } else {
-      for (r=0; r<this.baseRows.length; r++) {
-        showRow=true;
-        for (n=0; n<cols.length && showRow; n++) {
-          c=cols[n];
-          if (c.filterType == Rico.ColumnConst.UNFILTERED) continue;
-          switch (c.filterOp) {
-            case 'LIKE':
-              showRow=re[n].test(this.baseRows[r][n]);
-              break;
-            case 'EQ':
-              showRow=this.baseRows[r][n]==c.filterValues[0];
-              break;
-            case 'NE':
-              for (i=0; i<c.filterValues.length && showRow; i++)
-                showRow=this.baseRows[r][n]!=c.filterValues[i];
-              break;
-            case 'LE':
-              if (c.format.type=='number')
-                showRow=this.nan2zero(this.baseRows[r][n])<=this.nan2zero(c.filterValues[0]);
-              else
-                showRow=this.baseRows[r][n]<=c.filterValues[0];
-              break;
-            case 'GE':
-              if (c.format.type=='number')
-                showRow=this.nan2zero(this.baseRows[r][n])>=this.nan2zero(c.filterValues[0]);
-              else
-                showRow=this.baseRows[r][n]>=c.filterValues[0];
-              break;
-            case 'NULL':
-              showRow=this.baseRows[r][n]=='';
-              break;
-            case 'NOTNULL':
-              showRow=this.baseRows[r][n]!='';
-              break;
-          }
-        }
-        if (showRow) newRows.push(this.baseRows[r]);
-      }
-      this.rows = newRows;
-    }
-    this.rowcntContent = this.size = this.rows.length;
-  },
-
-  printAll: function(exportType) {
-    this.liveGrid.showMsg(Rico.getPhraseById('exportInProgress'));
-    Rico.runLater(10,this,'_printAll',exportType);  // allow message to paint
-  },
-
-/**
- * Support function for printAll()
- */
-  _printAll: function(exportType) {
-    this.liveGrid.exportStart();
-    this.exportBuffer(this.getRows(0,this.totalRows));
-    this.liveGrid.exportFinish(exportType);
-  },
-
-/**
- * Copies visible rows to a new window as a simple html table.
- */
-  printVisible: function(exportType) {
-    this.liveGrid.showMsg(Rico.getPhraseById('exportInProgress'));
-    Rico.runLater(10,this,'_printVisible',exportType);  // allow message to paint
-  },
-
-  _printVisible: function(exportType) {
-    this.liveGrid.exportStart();
-    this.exportBuffer(this.visibleRows());
-    this.liveGrid.exportFinish(exportType);
-  },
-
-/**
- * Send all rows to print/export window
- */
-  exportBuffer: function(rows,startPos) {
-    var r,c,v,col,exportText;
-    Rico.log("exportBuffer: "+rows.length+" rows");
-    var exportStyles=this.liveGrid.getExportStyles(this.liveGrid.tbody[0]);
-    var tdstyle=[];
-    var totalcnt=startPos || 0;
-    var cols=this.liveGrid.columns;
-    for (c=0; c<cols.length; c++) {
-      if (cols[c].visible) tdstyle[c]=this.liveGrid.exportStyle(cols[c].cell(0),exportStyles);  // assumes row 0 style applies to all rows
-    }
-    for(r=0; r < rows.length; r++) {
-      exportText='';
-      for (c=0; c<cols.length; c++) {
-        if (!cols[c].visible) continue;
-        col=cols[c];
-        col.expStyle=tdstyle[c];
-        v=col._export(rows[r][c],rows[r]);
-        if (v=='') v='&nbsp;';
-        exportText+="<td style='"+col.expStyle+"'>"+v+"</td>";
-      }
-      this.liveGrid.exportRows.push(exportText);
-      totalcnt++;
-      if (totalcnt % 10 == 0) window.status=Rico.getPhraseById('exportStatus',totalcnt);
-    }
-  }
-
-};
-
-
-// Rico.LiveGrid -----------------------------------------------------
-
-Rico.LiveGrid = function(tableId, buffer, options) {
-  this.initialize(tableId, buffer, options);
-}
-
-/** 
- * @lends Rico.LiveGrid#
- * @property tableId id string for this grid
- * @property options the options object passed to the constructor extended with defaults
- * @property buffer the buffer object containing the data for this grid
- * @property columns array of {@link Rico.LiveGridColumn} objects
- */
-Rico.LiveGrid.prototype = {
-/**
- * @class Buffered LiveGrid component
- * @extends Rico.GridCommon
- * @constructs
- */
-  initialize: function( tableId, buffer, options ) {
-    Rico.extend(this, Rico.GridCommon);
-    Rico.extend(this, Rico.LiveGridMethods);
-    this.baseInit();
-    this.tableId = tableId;
-    this.buffer = buffer;
-    this.actionId='_action_'+tableId;
-    Rico.setDebugArea(tableId+"_debugmsgs");    // if used, this should be a textarea
-
-    Rico.extend(this.options, {
-      visibleRows      : -3,    // -1 or 'window'=size grid to client window; -2 or 'data'=size grid to min(window,data); -3 or 'body'=size so body does not have a scrollbar; -4 or 'parent'=size to parent element (e.g. if grid is inside a div)
-      frozenColumns    : 0,
-      offset           : 0,     // first row to be displayed
-      prefetchBuffer   : true,  // load table on page load?
-      minPageRows      : 2,
-      maxPageRows      : 50,
-      canSortDefault   : true,  // can be overridden in the column specs
-      canFilterDefault : buffer.options.canFilter, // can be overridden in the column specs
-      canHideDefault   : true,  // can be overridden in the column specs
-
-      // highlight & selection parameters
-      highlightElem    : 'none',// what gets highlighted/selected (cursorRow, cursorCell, menuRow, menuCell, selection, or none)
-      highlightSection : 3,     // which section gets highlighted (frozen=1, scrolling=2, all=3, none=0)
-      highlightMethod  : 'class', // outline, class, both (outline is less CPU intensive on the client)
-      highlightClass   : Rico.theme.gridHighlightClass || 'ricoLG_selection',
-
-      // export/print parameters
-      maxPrint         : 5000,  // max # of rows that can be printed/exported, 0=disable print/export feature
-
-      // heading parameters
-      headingSort      : 'link', // link: make headings a link that will sort column, hover: make headings a hoverset, none: events on headings are disabled
-      hdrIconsFirst    : true,   // true: put sort & filter icons before header text, false: after
-      filterImg        : 'filtercol.gif'
-    });
-    // other options:
-    //   sortCol: initial sort column
-
-    this.options.sortHandler = Rico.bind(this,'sortHandler');
-    this.options.filterHandler = Rico.bind(this,'filterHandler');
-    this.options.onRefreshComplete = Rico.bind(this,'bookmarkHandler');
-    this.options.rowOverHandler = Rico.eventHandle(this,'rowMouseOver');
-    this.options.mouseDownHandler = Rico.eventHandle(this,'selectMouseDown');
-    this.options.mouseOverHandler = Rico.eventHandle(this,'selectMouseOver');
-    this.options.mouseUpHandler  = Rico.eventHandle(this,'selectMouseUp');
-    Rico.extend(this.options, options || {});
-
-    switch (typeof this.options.visibleRows) {
-      case 'string':
-        this.sizeTo=this.options.visibleRows;
-        switch (this.options.visibleRows) {
-          case 'data':   this.options.visibleRows=-2; break;
-          case 'body':   this.options.visibleRows=-3; break;
-          case 'parent': this.options.visibleRows=-4; break;
-          case 'datamax':this.options.visibleRows=-5; break;
-          default:       this.options.visibleRows=-1; break;
-        }
-        break;
-      case 'number':
-        switch (this.options.visibleRows) {
-          case -1: this.sizeTo='window'; break;
-          case -2: this.sizeTo='data'; break;
-          case -3: this.sizeTo='body'; break;
-          case -4: this.sizeTo='parent'; break;
-          case -5: this.sizeTo='datamax'; break;
-          default: this.sizeTo='fixed'; break;
-        }
-        break;
-      default:
-        this.sizeTo='body';
-        this.options.visibleRows=-3;
-        break;
-    }
-    this.highlightEnabled=this.options.highlightSection>0;
-    this.pageSize=0;
-    this.createTables();
-    if (this.headerColCnt==0) {
-      alert('ERROR: no columns found in "'+this.tableId+'"');
-      return;
-    }
-    this.createColumnArray('LiveGridColumn');
-    if (this.options.headingSort=='hover')
-      this.createHoverSet();
-
-    this.bookmark=document.getElementById(this.tableId+"_bookmark");
-    this.sizeDivs();
-    var filterUIrow=this.buffer.options.canFilter ? this.options.FilterLocation : false;
-    if (typeof(filterUIrow)=='number' && filterUIrow<0)
-      filterUIrow=this.addHeadingRow('ricoLG_FilterRow');
-    this.createDataCells(this.options.visibleRows);
-    if (this.pageSize == 0) return;
-    this.buffer.registerGrid(this);
-    if (this.buffer.setBufferSize) this.buffer.setBufferSize(this.pageSize);
-    this.scrollTimeout = null;
-    this.lastScrollPos = 0;
-    this.attachMenuEvents();
-
-    // preload the images...
-    new Image().src = Rico.imgDir+this.options.filterImg;
-    Rico.log("images preloaded");
-
-    this.setSortUI( this.options.sortCol, this.options.sortDir );
-    this.setImages();
-    if (this.listInvisible().length==this.columns.length)
-      this.columns[0].showColumn();
-    this.sizeDivs();
-    this.scrollDiv.style.display="";
-    if (this.buffer.totalRows>0)
-      this.updateHeightDiv();
-    if (this.options.prefetchBuffer) {
-      if (this.bookmark) this.bookmark.innerHTML = Rico.getPhraseById('bookmarkLoading');
-      if (this.options.canFilterDefault && this.options.getQueryParms)
-        this.checkForFilterParms();
-      this.scrollToRow(this.options.offset);
-      this.buffer.fetch(this.options.offset);
-    }
-    if (typeof(filterUIrow)=='number')
-      this.createFilters(filterUIrow);
-    this.scrollEventFunc=Rico.eventHandle(this,'handleScroll');
-    this.wheelEventFunc=Rico.eventHandle(this,'handleWheel');
-    this.wheelEvent=(Rico.isIE || Rico.isOpera || Rico.isWebKit) ? 'mousewheel' : 'DOMMouseScroll';
-    if (this.options.offset && this.options.offset < this.buffer.totalRows)
-      Rico.runLater(50,this,'scrollToRow',this.options.offset);  // Safari requires a delay
-    this.pluginScroll();
-    this.setHorizontalScroll();
-    Rico.log("setHorizontalScroll done");
-    if (this.options.windowResize)
-      Rico.runLater(100,this,'pluginWindowResize');
-    Rico.log("initialize complete for "+this.tableId);
-  }
-};
-
-
-Rico.LiveGridMethods = {
-/** @lends Rico.LiveGrid# */
-
-  createHoverSet: function() {
-    var hdrs=[];
-    for( var c=0; c < this.headerColCnt; c++ ) {
-      if (this.columns[c].sortable) {\r
-        hdrs.push(this.columns[c].hdrCellDiv);
-      }
-    }
-    this.hoverSet = new Rico.HoverSet(hdrs);
-  },
-
-  checkForFilterParms: function() {
-    var s=window.location.search;
-    if (s.charAt(0)=='?') s=s.substring(1);
-    var pairs = s.split('&');
-    for (var i=0; i<pairs.length; i++) {
-      if (pairs[i].match(/^f\[\d+\]/)) {
-        this.buffer.options.requestParameters.push(pairs[i]);
-      }
-    }
-  },
-
-/**
- * Refreshes a detail grid from a master grid
- * @returns row index on master table on success, -1 otherwise
- */
-  drillDown: function(e,masterColNum,detailColNum) {
-    var cell=Rico.eventElement(e || window.event);
-    cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-    if (!cell) return -1;
-    var idx=this.winCellIndex(cell);
-    if (idx.row >= this.buffer.totalRows) return -1
-    this.unhighlight();
-    this.menuIdx=idx;  // ensures selection gets cleared when menu is displayed
-    this.highlight(idx);
-    var drillValue=this.buffer.getWindowCell(idx.row,masterColNum);
-    for (var i=3; i<arguments.length; i++)
-      arguments[i].setDetailFilter(detailColNum,drillValue);
-    return idx.row;
-  },
-
-/**
- * set filter on a detail grid that is in a master-detail relationship
- */
-  setDetailFilter: function(colNumber,filterValue) {
-    var c=this.columns[colNumber];
-    c.format.ColData=filterValue;
-    c.setSystemFilter('EQ',filterValue);
-  },
-
-/**
- * Create one table for frozen columns and one for scrolling columns.
- * Also create div's to contain them.
- * @returns true on success
- */
-  createTables: function() {
-    var insertloc,hdrSrc,i;
-    var table = document.getElementById(this.tableId) || document.getElementById(this.tableId+'_outerDiv');
-    if (!table) return false;
-    if (table.tagName.toLowerCase()=='table') {
-      var theads=table.getElementsByTagName("thead");
-      if (theads.length == 1) {
-        Rico.log("createTables: using thead section, id="+this.tableId);
-        if (this.options.PanelNamesOnTabHdr && this.options.panels) {
-          var r=theads[0].insertRow(0);
-          this.insertPanelNames(r, 0, this.options.frozenColumns, 'ricoFrozen');
-          this.insertPanelNames(r, this.options.frozenColumns, this.options.columnSpecs.length);
-        }
-        hdrSrc=theads[0].rows;
-      } else {
-        Rico.log("createTables: using tbody section, id="+this.tableId);
-        hdrSrc=new Array(table.rows[0]);
-      }
-      insertloc=table;
-    } else if (this.options.columnSpecs.length > 0) {
-      if (!table.id.match(/_outerDiv$/)) insertloc=table;
-      Rico.log("createTables: inserting at "+table.tagName+", id="+this.tableId);
-    } else {
-      alert("ERROR!\n\nUnable to initialize '"+this.tableId+"'\n\nLiveGrid terminated");
-      return false;
-    }
-
-    this.createDivs();
-    this.scrollContainer = this.createDiv("scrollContainer",this.structTabLR);
-    this.scrollContainer.appendChild(this.scrollDiv); // move scrollDiv
-    this.scrollTab = this.createDiv("scrollTab",this.scrollContainer);
-    this.shadowDiv  = this.createDiv("shadow",this.scrollDiv);
-    this.shadowDiv.style.direction='ltr';  // avoid FF bug
-    this.scrollDiv.style.display="none";
-    this.scrollDiv.scrollTop=0;
-    if (this.options.highlightMethod!='class') {
-      this.highlightDiv=[];
-      switch (this.options.highlightElem) {
-        case 'menuRow':
-        case 'cursorRow':
-          this.highlightDiv[0] = this.createDiv("highlight",this.outerDiv);
-          this.highlightDiv[0].style.display="none";
-          break;
-        case 'menuCell':
-        case 'cursorCell':
-          for (i=0; i<2; i++) {
-            this.highlightDiv[i] = this.createDiv("highlight",i==0 ? this.frozenTabs : this.scrollTab);
-            this.highlightDiv[i].style.display="none";
-            this.highlightDiv[i].id+=i;
-          }
-          break;
-        case 'selection':
-          // create one div for each side of the rectangle
-          var parentDiv=this.options.highlightSection==1 ? this.frozenTabs : this.scrollTab;
-          for (i=0; i<4; i++) {
-            this.highlightDiv[i] = this.createDiv("highlight",parentDiv);
-            this.highlightDiv[i].style.display="none";
-            this.highlightDiv[i].style.overflow="hidden";
-            this.highlightDiv[i].id+=i;
-            this.highlightDiv[i].style[i % 2==0 ? 'height' : 'width']="0px";
-          }
-          break;
-      }
-    }
-
-    // create new tables
-    for (i=0; i<3; i++) {
-      this.tabs[i] = document.createElement("table");
-      this.tabs[i].className = 'ricoLG_table';
-      this.tabs[i].border=0;
-      this.tabs[i].cellPadding=0;
-      this.tabs[i].cellSpacing=0;
-      this.tabs[i].id = this.tableId+"_tab"+i;
-    }
-    // set headings
-    for (i=0; i<2; i++) {
-      this.thead[i]=this.tabs[i].createTHead();
-      Rico.addClass(this.tabs[i],'ricoLG_top');
-      //this.thead[i].className='ricoLG_top';
-      if (Rico.theme.gridheader) Rico.addClass(this.thead[i],Rico.theme.gridheader);
-    }
-    // set bodies
-    for (i=0; i<2; i++) {
-      this.tbody[i]=Rico.getTBody(this.tabs[i==0?0:2]);
-      this.tbody[i].className='ricoLG_bottom';
-      if (Rico.theme.gridcontent) Rico.addClass(this.tbody[i],Rico.theme.gridcontent);
-      this.tbody[i].insertRow(-1);
-    }
-    this.frozenTabs.appendChild(this.tabs[0]);
-    this.innerDiv.appendChild(this.tabs[1]);
-    this.scrollTab.appendChild(this.tabs[2]);
-    if (insertloc) insertloc.parentNode.insertBefore(this.outerDiv,insertloc);
-    if (hdrSrc) {
-      this.headerColCnt = this.getColumnInfo(hdrSrc);
-      this.loadHdrSrc(hdrSrc);
-    } else {
-      this.createHdr(0,0,this.options.frozenColumns);
-      this.createHdr(1,this.options.frozenColumns,this.options.columnSpecs.length);
-      if (this.options.PanelNamesOnTabHdr && this.options.panels) {
-        this.insertPanelNames(this.thead[0].insertRow(0), 0, this.options.frozenColumns);
-        this.insertPanelNames(this.thead[1].insertRow(0), this.options.frozenColumns, this.options.columnSpecs.length);
-      }
-      for (i=0; i<2; i++)
-        this.headerColCnt = this.getColumnInfo(this.thead[i].rows);
-    }
-    for( var c=0; c < this.headerColCnt; c++ )
-      this.tbody[c<this.options.frozenColumns ? 0 : 1].rows[0].insertCell(-1);
-    if (insertloc) table.parentNode.removeChild(table);
-    Rico.log('createTables end');
-    return true;
-  },
-
-  createDataCells: function(visibleRows) {
-    if (visibleRows < 0) {
-      for (var i=0; i<this.options.minPageRows; i++)
-        this.appendBlankRow();
-      this.sizeDivs();
-      this.autoAppendRows(this.remainingHt());
-    } else {
-      for( var r=0; r < visibleRows; r++ )
-        this.appendBlankRow();
-    }
-    var s=this.options.highlightSection;
-    if (s & 1) this.attachHighlightEvents(this.tbody[0]);
-    if (s & 2) this.attachHighlightEvents(this.tbody[1]);
-  },
-
-/**
- * @param colnum column number
- * @return id string for a filter element
- */
-  filterId: function(colnum) {
-    return 'RicoFilter_'+this.tableId+'_'+colnum;
-  },
-
-/**
- * Create filter elements in heading
- * Reads this.columns[].filterUI to determine type of filter element for each column (t=text box, s=select list, c=custom)
- * @param r heading row where filter elements will be placed
- */
-  createFilters: function(r) {
-    for( var c=0; c < this.headerColCnt; c++ ) {
-      var col=this.columns[c];
-      var fmt=col.format;
-      if (typeof fmt.filterUI!='string') continue;
-      var cell=this.hdrCells[r][c].cell;
-      var field,name=this.filterId(c);\r
-      var divs=cell.getElementsByTagName('div');
-      // copy text alignment from data cell
-      var align=Rico.getStyle(this.cell(0,c),'textAlign');
-      divs[1].style.textAlign=align;
-      switch (fmt.filterUI.charAt(0)) {
-        case 't':
-          // text field
-          field=Rico.createFormField(divs[1],'input','text',name,name);
-          var size=fmt.filterUI.match(/\d+/);
-          field.maxLength=fmt.Length || 50;\r
-          field.size=size ? parseInt(size,10) : 10;
-          divs[1].appendChild(Rico.clearButton(Rico.eventHandle(col,'filterClear')));
-          if (col.filterType==Rico.ColumnConst.USERFILTER && col.filterOp=='LIKE') {
-            var v=col.filterValues[0];
-            if (v.charAt(0)=='*') v=v.substr(1);
-            if (v.slice(-1)=='*') v=v.slice(0,-1);
-            field.value=v;
-            col.lastKeyFilter=v;
-          }
-          Rico.eventBind(field,'keyup',Rico.eventHandle(col,'filterKeypress'),false);
-          col.filterField=field;\r
-          break;\r
-        case 'm':
-          // multi-select
-        case 's':
-          // drop-down select
-          field=Rico.createFormField(divs[1],'select',null,name);\r
-          Rico.addSelectOption(field,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));\r
-          col.filterField=field;
-          var options={};\r
-          Rico.extend(options, this.buffer.ajaxOptions);
-          var colnum=typeof(fmt.filterCol)=='number' ? fmt.filterCol : c;
-          options.parameters = {id: this.tableId, distinct:colnum};
-          options.parameters[this.actionId]="query";
-          options.onComplete = Rico.bind(this,'filterValuesUpdate',c);
-          new Rico.ajaxRequest(this.buffer.dataSource, options);
-          break;\r
-        case 'c':
-          // custom
-          if (typeof col._createFilters == 'function')
-            col._createFilters(divs[1], name);
-          break;
-      }
-    }
-    this.initFilterImage(r);
-  },
-
-/**
- * update select list filter with values in AJAX response
- * @returns true on success
- */
-  filterValuesUpdate: function(colnum,request) {
-    var response = request.responseXML.getElementsByTagName("ajax-response");
-    Rico.log("filterValuesUpdate: "+request.status);
-    if (response == null || response.length != 1) return false;
-    response=response[0];
-    var error = response.getElementsByTagName('error');
-    if (error.length > 0) {
-      Rico.log("Data provider returned an error:\n"+Rico.getContentAsString(error[0],this.buffer.isEncoded));
-      alert(Rico.getPhraseById("requestError",Rico.getContentAsString(error[0],this.buffer.isEncoded)));
-      return false;
-    }\r
-    response=response.getElementsByTagName('response')[0];\r
-    var rowsElement = response.getElementsByTagName('rows')[0];\r
-    var col=this.columns[parseInt(colnum,10)];
-    var rows = this.buffer.dom2jstable(rowsElement);\r
-    var c,opt,v;
-    if (col.filterType==Rico.ColumnConst.USERFILTER && col.filterOp=='EQ') v=col.filterValues[0];
-    Rico.log('filterValuesUpdate: col='+colnum+' rows='+rows.length);
-    switch (col.format.filterUI.charAt(0)) {
-      case 'm':
-        // multi-select
-        col.mFilter = document.body.appendChild(document.createElement("div"));
-        col.mFilter.className = 'ricoLG_mFilter'
-        Rico.hide(col.mFilter);
-        var contentDiv = col.mFilter.appendChild(document.createElement("div"));
-        contentDiv.className = 'ricoLG_mFilter_content'
-        var buttonDiv = col.mFilter.appendChild(document.createElement("div"));
-        buttonDiv.className = 'ricoLG_mFilter_button'
-        col.mFilterButton=buttonDiv.appendChild(document.createElement("button"));
-        col.mFilterButton.innerHTML=Rico.getPhraseById("ok");
-        var eventName=Rico.isWebKit ? 'mousedown' : 'click';
-        Rico.eventBind(col.filterField,eventName,Rico.eventHandle(col,'mFilterSelectClick'));
-        Rico.eventBind(col.mFilterButton,'click',Rico.eventHandle(col,'mFilterFinish'));
-        //col.filterField.options[0].text=$('AllLabel').innerHTML;
-        tab = contentDiv.appendChild(document.createElement("table"));
-        tab.border=0;
-        tab.cellPadding=2;
-        tab.cellSpacing=0;
-        //tbody=(tab.tBodies.length==0) ? tab.appendChild(document.createElement("tbody")) : tab.tBodies[0];
-        var baseId=this.filterId(colnum)+'_';
-        this.createMFilterItem(tab,this.options.FilterAllToken,Rico.getPhraseById("filterAll"),baseId+'all',Rico.eventHandle(col,'mFilterAllClick'));
-        var handle=Rico.eventHandle(col,'mFilterOtherClick')
-        for (var i=0; i<rows.length; i++) {
-          if (rows[i].length>0) {
-            c=rows[i][0];
-            this.createMFilterItem(tab,c,c || Rico.getPhraseById("filterBlank"),baseId+i,handle);
-          }
-        }
-        col.mFilterInputs=contentDiv.getElementsByTagName('input');
-        col.mFilterLabels=contentDiv.getElementsByTagName('label');
-        col.mFilterFocus=col.mFilterInputs.length ? col.mFilterInputs[0] : col.mFilterButton;
-        break;
-
-      case 's':
-        // drop-down select
-        for (var i=0; i<rows.length; i++) {
-          if (rows[i].length>0) {
-            c=rows[i][0];
-            opt=Rico.addSelectOption(col.filterField,c,c || Rico.getPhraseById("filterBlank"));
-            if (col.filterType==Rico.ColumnConst.USERFILTER && c==v) opt.selected=true;
-          }
-        }
-        Rico.eventBind(col.filterField,'change',Rico.eventHandle(col,'filterChange'));
-        break;
-    }
-    return true;\r
-  },
-  
-  createMFilterItem: function(table,code,description,id,eventHandle) {
-    var tr=table.insertRow(-1);
-    tr.vAlign='top';
-    if (tr.rowIndex % 2 == 1) tr.className='ricoLG_mFilter_oddrow';
-    var td1=tr.insertCell(-1)
-    var td2=tr.insertCell(-1)
-    var field=Rico.createFormField(td1,'input','checkbox',id);
-    field.value=code;
-    field.checked=true;
-    var label = td2.appendChild(document.createElement("label"));
-    label.htmlFor = id;
-    label.innerHTML=description;
-    Rico.eventBind(field,'click',eventHandle);
-  },
-
-  unplugHighlightEvents: function() {
-    var s=this.options.highlightSection;
-    if (s & 1) this.detachHighlightEvents(this.tbody[0]);
-    if (s & 2) this.detachHighlightEvents(this.tbody[1]);
-  },
-
-/**
- * place panel names on first row of grid header (used by LiveGridForms)
- */
-  insertPanelNames: function(r,start,limit,cellClass) {
-    Rico.log('insertPanelNames: start='+start+' limit='+limit);
-    r.className='ricoLG_hdg';
-    var lastIdx=-1, span, newCell=null, spanIdx=0;
-    for( var c=start; c < limit; c++ ) {
-      if (lastIdx == this.options.columnSpecs[c].panelIdx) {
-        span++;
-      } else {
-        if (newCell) newCell.colSpan=span;
-        newCell = r.insertCell(-1);
-        if (cellClass) newCell.className=cellClass;
-        span=1;
-        lastIdx=this.options.columnSpecs[c].panelIdx;
-        newCell.innerHTML=this.options.panels[lastIdx];
-      }
-    }
-    if (newCell) newCell.colSpan=span;
-  },
-
-/**
- * create grid header for table i (if none was provided)
- */
-  createHdr: function(i,start,limit) {
-    Rico.log('createHdr: i='+i+' start='+start+' limit='+limit);
-    var mainRow = this.thead[i].insertRow(-1);
-    mainRow.id=this.tableId+'_tab'+i+'h_main';
-    mainRow.className='ricoLG_hdg';
-    for( var c=start; c < limit; c++ ) {
-      var newCell = mainRow.insertCell(-1);
-      newCell.innerHTML=this.options.columnSpecs[c].Hdg;
-    }
-  },
-
-/**
- * move header cells in original table to grid
- */
-  loadHdrSrc: function(hdrSrc) {
-    var i,h,c,r,newrow,cells;
-    Rico.log('loadHdrSrc start');
-    for (i=0; i<2; i++) {
-      for (r=0; r<hdrSrc.length; r++) {
-        newrow = this.thead[i].insertRow(-1);
-        newrow.className='ricoLG_hdg '+this.tableId+'_hdg'+r;
-      }
-    }
-    if (hdrSrc.length==1) {
-      cells=hdrSrc[0].cells;
-      for (c=0; cells.length > 0; c++)
-        this.thead[c<this.options.frozenColumns ? 0 : 1].rows[0].appendChild(cells[0]);
-    } else {
-      for (r=0; r<hdrSrc.length; r++) {
-        cells=hdrSrc[r].cells;
-        for (c=0,h=0; cells.length > 0; c++) {
-          if (cells[0].className=='ricoFrozen') {
-            if (r==this.headerRowIdx) this.options.frozenColumns=c+1;
-          } else {
-            h=1;
-          }
-          this.thead[h].rows[r].appendChild(cells[0]);
-        }
-      }
-    }
-    Rico.log('loadHdrSrc end');
-  },
-
-/**
- * Size div elements
- */
-  sizeDivs: function() {
-    Rico.log('sizeDivs: '+this.tableId);
-    //this.cancelMenu();
-    this.unhighlight();
-    this.baseSizeDivs();
-    var firstVisible=this.firstVisible();
-    if (this.pageSize == 0 || firstVisible < 0) return;
-    var totRowHt=this.columns[firstVisible].dataColDiv.offsetHeight;
-    this.rowHeight = Math.round(totRowHt/this.pageSize);
-    var scrHt=this.dataHt;
-    if (this.scrTabWi0 == this.scrTabWi) {
-      // no scrolling columns - horizontal scroll bar not needed
-      this.innerDiv.style.height=(this.hdrHt+1)+'px';
-      this.scrollDiv.style.overflowX='hidden';
-    } else {
-      this.scrollDiv.style.overflowX='scroll';
-      scrHt+=this.options.scrollBarWidth;
-    }
-    this.scrollDiv.style.height=scrHt+'px';
-    this.innerDiv.style.width=(this.scrWi)+'px';
-    this.scrollTab.style.width=(this.scrWi-this.options.scrollBarWidth)+'px';
-    //this.resizeDiv.style.height=this.frozenTabs.style.height=this.innerDiv.style.height=(this.hdrHt+this.dataHt+1)+'px';
-    this.resizeDiv.style.height=(this.hdrHt+this.dataHt+1)+'px';
-    Rico.log('sizeDivs scrHt='+scrHt+' innerHt='+this.innerDiv.style.height+' rowHt='+this.rowHeight+' pageSize='+this.pageSize);
-    var pad=(this.scrWi-this.scrTabWi < this.options.scrollBarWidth) ? 2 : 0;
-    this.shadowDiv.style.width=(this.scrTabWi+pad)+'px';
-    this.outerDiv.style.height=(this.hdrHt+scrHt)+'px';
-    this.setHorizontalScroll();
-  },
-
-  setHorizontalScroll: function() {
-    var newLeft=(-this.scrollDiv.scrollLeft)+'px';
-    this.tabs[1].style.marginLeft=newLeft;
-    this.tabs[2].style.marginLeft=newLeft;
-  },
-
-  remainingHt: function() {
-    var tabHt;
-    var winHt=Rico.windowHeight();
-    var margin=Rico.isIE ? 15 : 10;
-    // if there is a horizontal scrollbar take it into account
-    if (!Rico.isIE && window.frameElement && window.frameElement.scrolling=='yes' && this.sizeTo!='parent') margin+=this.options.scrollBarWidth;
-    switch (this.sizeTo) {
-      case 'window':
-        var divTop=Rico.cumulativeOffset(this.outerDiv).top;
-        tabHt=Math.max(this.tabs[0].offsetHeight,this.tabs[1].offsetHeight);
-        Rico.log("remainingHt, winHt="+winHt+' tabHt='+tabHt+' gridY='+divTop);
-        return winHt-divTop-tabHt-this.options.scrollBarWidth-margin;  // allow for scrollbar and some margin
-      case 'parent':
-        var offset=this.offsetFromParent(this.outerDiv);
-        tabHt=Math.max(this.tabs[0].offsetHeight,this.tabs[1].offsetHeight);
-        if (Rico.isIE) Rico.hide(this.outerDiv);
-        var parentHt=this.outerDiv.parentNode.offsetHeight;
-        if (Rico.isIE) Rico.show(this.outerDiv);
-        Rico.log("remainingHt, parentHt="+parentHt+' gridY='+offset+' winHt='+winHt+' tabHt='+tabHt);
-        return parentHt - tabHt - offset - this.options.scrollBarWidth;
-      case 'data':
-      case 'body':
-        var bodyHt=Rico.isIE ? document.body.scrollHeight : document.body.offsetHeight;
-        //alert("remainingHt\n document.height="+document.height+"\n body.offsetHeight="+document.body.offsetHeight+"\n body.scrollHeight="+document.body.scrollHeight+"\n documentElement.scrollHeight="+document.documentElement.scrollHeight);
-        var remHt=winHt-bodyHt-margin;
-        if (!Rico.isWebKit) remHt-=this.options.scrollBarWidth;
-        Rico.log("remainingHt, winHt="+winHt+' pageHt='+bodyHt+' remHt='+remHt);
-        return remHt;
-      default:
-        tabHt=Math.max(this.tabs[0].offsetHeight,this.tabs[1].offsetHeight);
-        Rico.log("remainingHt, winHt="+winHt+' tabHt='+tabHt);
-        if (this.sizeTo.slice(-1)=='%') winHt*=parseFloat(this.sizeTo)/100.0;
-        else if (this.sizeTo.slice(-2)=='px') winHt=parseInt(this.sizeTo,10);
-        return winHt-tabHt-this.options.scrollBarWidth-margin;  // allow for scrollbar and some margin
-    }
-  },
-
-  offsetFromParent: function(element) {
-    var valueT = 0;
-    var elParent=element.parentNode;
-    do {
-      //Rico.log("offsetFromParent: "+element.tagName+' id='+element.id+' otop='+element.offsetTop);
-      valueT += element.offsetTop  || 0;
-      element = element.offsetParent;
-      if (!element || element==null) break;
-      var p = Rico.getStyle(element, 'position');
-      if (element.tagName=='BODY' || element.tagName=='HTML' || p=='absolute') return valueT-elParent.offsetTop;
-    } while (element != elParent);
-    return valueT;
-  },
-
-  adjustPageSize: function() {
-    var remHt=this.remainingHt();
-    Rico.log('adjustPageSize remHt='+remHt+' lastRow='+this.lastRowPos);
-    if (remHt > this.rowHeight)
-      this.autoAppendRows(remHt);
-    else if (remHt < 0 || this.sizeTo=='data')
-      this.autoRemoveRows(-remHt);
-  },
-  
-  setPageSize: function(newRowCount) {
-    newRowCount=Math.min(newRowCount,this.options.maxPageRows);
-    newRowCount=Math.max(newRowCount,this.options.minPageRows);
-    this.sizeTo='fixed';
-    var oldSize=this.pageSize;
-    while (this.pageSize > newRowCount) {
-      this.removeRow();
-    }
-    while (this.pageSize < newRowCount) {
-      this.appendBlankRow();
-    }
-    this.finishResize(oldSize);
-  },
-
-  pluginWindowResize: function() {
-    Rico.log("pluginWindowResize");
-    this.resizeWindowHandler=Rico.eventHandle(this,'resizeWindow');
-    Rico.eventBind(window, "resize", this.resizeWindowHandler, false);
-  },
-
-  unplugWindowResize: function() {
-    if (!this.resizeWindowHandler) return;
-    Rico.eventUnbind(window,"resize", this.resizeWindowHandler, false);
-    this.resizeWindowHandler=null;
-  },
-
-  resizeWindow: function() {
-    Rico.log('resizeWindow '+this.tableId+' lastRow='+this.lastRowPos);
-    if (this.resizeState=='finish') {
-      Rico.log('resizeWindow postponed');
-      this.resizeState='resize';
-      return;
-    }
-    if (!this.sizeTo || this.sizeTo=='fixed') {
-      this.sizeDivs();
-      return;
-    }
-    if (this.sizeTo=='parent' && Rico.getStyle(this.outerDiv.parentNode,'display') == 'none') return;
-    var oldSize=this.pageSize;
-    this.adjustPageSize();
-    this.finishResize(oldSize);
-  },
-
-  finishResize: function(oldSize) {
-    if (this.pageSize > oldSize && this.buffer.totalRows>0) {
-      this.isPartialBlank=true;
-      var adjStart=this.adjustRow(this.lastRowPos);
-      this.buffer.fetch(adjStart);
-    } else if (this.pageSize < oldSize) {
-      if (this.options.onRefreshComplete) this.options.onRefreshComplete(this.contentStartPos,this.contentStartPos+this.pageSize-1);  // update bookmark
-    }
-    this.resizeState='finish';
-    Rico.runLater(20,this,'finishResize2');
-    Rico.log('Resize '+this.tableId+' complete. old size='+oldSize+' new size='+this.pageSize);
-  },
-
-  finishResize2: function() {
-    this.sizeDivs();
-    this.updateHeightDiv();
-    if (this.resizeState=='resize') {
-      this.resizeWindow();
-    } else {
-      this.resizeState='';
-    }
-  },
-
-  topOfLastPage: function() {
-    return Math.max(this.buffer.totalRows-this.pageSize,0);
-  },
-
-  updateHeightDiv: function() {
-    var notdisp=this.topOfLastPage();
-    var ht = notdisp ? this.scrollDiv.clientHeight + Math.floor(this.rowHeight * (notdisp + 0.4)) : 1;
-    Rico.log("updateHeightDiv, ht="+ht+' scrollDiv.clientHeight='+this.scrollDiv.clientHeight+' rowsNotDisplayed='+notdisp);
-    this.shadowDiv.style.height=ht+'px';
-  },
-
-  autoRemoveRows: function(overage) {
-    if (!this.rowHeight) return;
-    var removeCnt=Math.ceil(overage / this.rowHeight);
-    if (this.sizeTo=='data')
-      removeCnt=Math.max(removeCnt,this.pageSize-this.buffer.totalRows);
-    Rico.log("autoRemoveRows overage="+overage+" removeCnt="+removeCnt);
-    for (var i=0; i<removeCnt; i++)
-      this.removeRow();
-  },
-
-  removeRow: function() {
-    if (this.pageSize <= this.options.minPageRows) return;
-    this.pageSize--;
-    for( var c=0; c < this.headerColCnt; c++ ) {
-      var cell=this.columns[c].cell(this.pageSize);
-      this.columns[c].dataColDiv.removeChild(cell);
-    }
-  },
-
-  autoAppendRows: function(overage) {
-    if (!this.rowHeight) return;
-    var addCnt=Math.floor(overage / this.rowHeight);
-    Rico.log("autoAppendRows overage="+overage+" cnt="+addCnt+" rowHt="+this.rowHeight);
-    for (var i=0; i<addCnt; i++) {
-      if (this.sizeTo=='data' && this.pageSize>=this.buffer.totalRows) break;
-      this.appendBlankRow();
-    }
-  },
-
-/**
- * on older systems, this can be fairly slow
- */
-  appendBlankRow: function() {
-    if (this.pageSize >= this.options.maxPageRows) return;
-    Rico.log("appendBlankRow #"+this.pageSize);
-    var cls=this.defaultRowClass(this.pageSize);
-    for( var c=0; c < this.headerColCnt; c++ ) {
-      var newdiv = document.createElement("div");
-      newdiv.className = 'ricoLG_cell '+cls;
-      newdiv.id=this.tableId+'_'+this.pageSize+'_'+c;
-      this.columns[c].dataColDiv.appendChild(newdiv);
-      if (this.columns[c].format.canDrag && Rico.registerDraggable)
-        Rico.registerDraggable( new Rico.LiveGridDraggable(this, this.pageSize, c), this.options.dndMgrIdx );
-      newdiv.innerHTML='&nbsp;';   // this seems to be required by IE
-      if (this.columns[c]._create) {
-        this.columns[c]._create(newdiv,this.pageSize);
-      }
-    }
-    this.pageSize++;
-  },
-
-  defaultRowClass: function(rownum) {
-    var cls
-    if (rownum % 2==0) {
-      cls='ricoLG_evenRow';
-      //if (Rico.theme.primary) cls+=' '+Rico.theme.primary;
-    } else {
-      cls='ricoLG_oddRow';
-      //if (Rico.theme.secondary) cls+=' '+Rico.theme.secondary;
-    }
-    return cls;
-  },
-
-  handleMenuClick: function(e) {
-    if (!this.menu) return;
-    this.cancelMenu();
-    this.unhighlight(); // in case highlighting was invoked externally
-    var idx;
-    var cell=Rico.eventElement(e);
-    if (cell.className=='ricoLG_highlightDiv') {
-      idx=this.highlightIdx;
-    } else {
-      cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-      if (!cell) return;
-      idx=this.winCellIndex(cell);
-      if ((this.options.highlightSection & (idx.tabIdx+1))==0) return;
-    }
-    this.highlight(idx);
-    this.highlightEnabled=false;
-    if (this.hideScroll) this.scrollDiv.style.overflow="hidden";
-    this.menuIdx=idx;
-    if (!this.menu.div) this.menu.createDiv();
-    this.menu.liveGrid=this;
-    if (this.menu.buildGridMenu) {
-      var showMenu=this.menu.buildGridMenu(idx.row, idx.column, idx.tabIdx);
-      if (!showMenu) return;
-    }
-    if (this.options.highlightElem=='selection' && !this.isSelected(idx.cell)) {
-      this.selectCell(idx.cell);
-    }
-    this.menu.showmenu(e,Rico.bind(this,'closeMenu'));
-  },
-
-  closeMenu: function() {
-    if (!this.menuIdx) return;
-    if (this.hideScroll) this.scrollDiv.style.overflow="";
-    //this.unhighlight();
-    this.highlightEnabled=true;
-    this.menuIdx=null;
-  },
-
-/**
- * @return index of cell within the window
- */
-  winCellIndex: function(cell) {
-    var l=cell.id.lastIndexOf('_',cell.id.length);
-    var l2=cell.id.lastIndexOf('_',l-1)+1;
-    var c=parseInt(cell.id.substr(l+1));
-    var r=parseInt(cell.id.substr(l2,l));
-    return {row:r, column:c, tabIdx:this.columns[c].tabIdx, cell:cell};
-  },
-
-/**
- * @return index of cell within the dataset
- */
-  datasetIndex: function(cell) {
-    var idx=this.winCellIndex(cell);
-    idx.row+=this.buffer.windowPos;
-    idx.onBlankRow=(idx.row >= this.buffer.endPos());
-    return idx;
-  },
-
-  attachHighlightEvents: function(tBody) {
-    switch (this.options.highlightElem) {
-      case 'selection':
-        Rico.eventBind(tBody,"mousedown", this.options.mouseDownHandler, false);
-        /** @ignore */
-        tBody.ondrag = function () { return false; };
-        /** @ignore */
-        tBody.onselectstart = function () { return false; };
-        break;
-      case 'cursorRow':
-      case 'cursorCell':
-        Rico.eventBind(tBody,"mouseover", this.options.rowOverHandler, false);
-        break;
-    }
-  },
-
-  detachHighlightEvents: function(tBody) {
-    switch (this.options.highlightElem) {
-      case 'selection':
-        Rico.eventUnbind(tBody,"mousedown", this.options.mouseDownHandler, false);
-        tBody.ondrag = null;
-        tBody.onselectstart = null;
-        break;
-      case 'cursorRow':
-      case 'cursorCell':
-        Rico.eventUnbind(tBody,"mouseover", this.options.rowOverHandler, false);
-        break;
-    }
-  },
-
-/**
- * @return array of objects containing row/col indexes (index values are relative to the start of the window)
- */
-  getVisibleSelection: function() {
-    var cellList=[];
-    if (this.SelectIdxStart && this.SelectIdxEnd) {
-      var r1=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowStart);
-      var r2=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row)-this.buffer.startPos,this.buffer.windowEnd-1);
-      var c1=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-      var c2=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-      //Rico.log("getVisibleSelection "+r1+','+c1+' to '+r2+','+c2+' ('+this.SelectIdxStart.row+',startPos='+this.buffer.startPos+',windowPos='+this.buffer.windowPos+',windowEnd='+this.buffer.windowEnd+')');
-      for (var r=r1; r<=r2; r++) {
-        for (var c=c1; c<=c2; c++)
-          cellList.push({row:r-this.buffer.windowStart,column:c});
-      }
-    }
-    if (this.SelectCtrl) {
-      for (var i=0; i<this.SelectCtrl.length; i++) {
-        if (this.SelectCtrl[i].row>=this.buffer.windowStart && this.SelectCtrl[i].row<this.buffer.windowEnd)
-          cellList.push({row:this.SelectCtrl[i].row-this.buffer.windowStart,column:this.SelectCtrl[i].column});
-      }
-    }
-    return cellList;
-  },
-
-  updateSelectOutline: function() {
-    if (!this.SelectIdxStart || !this.SelectIdxEnd) return;
-    var r1=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row), this.buffer.windowStart);
-    var r2=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row), this.buffer.windowEnd-1);
-    if (r1 > r2) {
-      this.HideSelection();
-      return;
-    }
-    var c1=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-    var c2=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-    var top1=this.columns[c1].cell(r1-this.buffer.windowStart).offsetTop;
-    var cell2=this.columns[c1].cell(r2-this.buffer.windowStart);
-    var bottom2=cell2.offsetTop+cell2.offsetHeight;
-    var left1=this.columns[c1].dataCell.offsetLeft;
-    var left2=this.columns[c2].dataCell.offsetLeft;
-    var right2=left2+this.columns[c2].dataCell.offsetWidth;
-    //window.status='updateSelectOutline: '+r1+' '+r2+' top='+top1+' bot='+bottom2;
-    this.highlightDiv[0].style.top=this.highlightDiv[3].style.top=this.highlightDiv[1].style.top=(this.hdrHt+top1-1) + 'px';
-    this.highlightDiv[2].style.top=(this.hdrHt+bottom2-1)+'px';
-    this.highlightDiv[3].style.left=(left1-2)+'px';
-    this.highlightDiv[0].style.left=this.highlightDiv[2].style.left=(left1-1)+'px';
-    this.highlightDiv[1].style.left=(right2-1)+'px';
-    this.highlightDiv[0].style.width=this.highlightDiv[2].style.width=(right2-left1-1) + 'px';
-    this.highlightDiv[1].style.height=this.highlightDiv[3].style.height=(bottom2-top1) + 'px';
-    //this.highlightDiv[0].style.right=this.highlightDiv[2].style.right=this.highlightDiv[1].style.right=()+'px';
-    //this.highlightDiv[2].style.bottom=this.highlightDiv[3].style.bottom=this.highlightDiv[1].style.bottom=(this.hdrHt+bottom2) + 'px';
-    for (var i=0; i<4; i++)
-      this.highlightDiv[i].style.display='';
-  },
-
-  HideSelection: function() {
-    var i;
-    if (this.options.highlightMethod!='class') {
-      for (i=0; i<this.highlightDiv.length; i++)
-        this.highlightDiv[i].style.display='none';
-    }
-    if (this.options.highlightMethod!='outline') {
-      var cellList=this.getVisibleSelection();
-      Rico.log("HideSelection "+cellList.length);
-      for (i=0; i<cellList.length; i++)
-        this.unhighlightCell(this.columns[cellList[i].column].cell(cellList[i].row));
-    }
-  },
-
-  ShowSelection: function() {
-    if (this.options.highlightMethod!='class')
-      this.updateSelectOutline();
-    if (this.options.highlightMethod!='outline') {
-      var cellList=this.getVisibleSelection();
-      for (var i=0; i<cellList.length; i++)
-        this.highlightCell(this.columns[cellList[i].column].cell(cellList[i].row));
-    }
-  },
-
-  ClearSelection: function() {
-    Rico.log("ClearSelection");
-    this.HideSelection();
-    this.SelectIdxStart=null;
-    this.SelectIdxEnd=null;
-    this.SelectCtrl=[];
-  },
-
-  selectCell: function(cell) {
-    this.ClearSelection();
-    this.SelectIdxStart=this.SelectIdxEnd=this.datasetIndex(cell);
-    this.ShowSelection();
-  },
-
-  AdjustSelection: function(cell) {
-    var newIdx=this.datasetIndex(cell);
-    if (this.SelectIdxStart.tabIdx != newIdx.tabIdx) return;
-    this.HideSelection();
-    this.SelectIdxEnd=newIdx;
-    this.ShowSelection();
-  },
-
-  RefreshSelection: function() {
-    var cellList=this.getVisibleSelection();
-    for (var i=0; i<cellList.length; i++) {
-      this.columns[cellList[i].column].displayValue(cellList[i].row);
-    }
-  },
-
-  FillSelection: function(newVal,newStyle) {
-    if (this.SelectIdxStart && this.SelectIdxEnd) {
-      var r1=Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row);
-      var r2=Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row);
-      var c1=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-      var c2=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-      for (var r=r1; r<=r2; r++) {
-        for (var c=c1; c<=c2; c++) {
-          this.buffer.setValue(r,c,newVal,newStyle);
-        }
-      }
-    }
-    if (this.SelectCtrl) {
-      for (var i=0; i<this.SelectCtrl.length; i++) {
-        this.buffer.setValue(this.SelectCtrl[i].row,this.SelectCtrl[i].column,newVal,newStyle);
-      }
-    }
-    this.RefreshSelection();
-  },
-
-/**
- * Process mouse down event
- * @param e event object
- */
-  selectMouseDown: function(e) {
-    if (this.highlightEnabled==false) return true;
-    this.cancelMenu();
-    var cell=Rico.eventElement(e);
-    if (!Rico.eventLeftClick(e)) return true;
-    cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-    if (!cell) return true;
-    Rico.eventStop(e);
-    var newIdx=this.datasetIndex(cell);
-    if (newIdx.onBlankRow) return true;
-    Rico.log("selectMouseDown @"+newIdx.row+','+newIdx.column);
-    if (e.ctrlKey) {
-      if (!this.SelectIdxStart || this.options.highlightMethod!='class') return true;
-      if (!this.isSelected(cell)) {
-        this.highlightCell(cell);
-        this.SelectCtrl.push(this.datasetIndex(cell));
-      } else {
-        for (var i=0; i<this.SelectCtrl.length; i++) {
-          if (this.SelectCtrl[i].row==newIdx.row && this.SelectCtrl[i].column==newIdx.column) {
-            this.unhighlightCell(cell);
-            this.SelectCtrl.splice(i,1);
-            break;
-          }
-        }
-      }
-    } else if (e.shiftKey) {
-      if (!this.SelectIdxStart) return true;
-      this.AdjustSelection(cell);
-    } else {
-      this.selectCell(cell);
-      this.pluginSelect();
-    }
-    return false;
-  },
-
-  pluginSelect: function() {
-    if (this.selectPluggedIn) return;
-    var tBody=this.tbody[this.SelectIdxStart.tabIdx];
-    Rico.eventBind(tBody,"mouseover", this.options.mouseOverHandler, false);
-    Rico.eventBind(this.outerDiv,"mouseup",  this.options.mouseUpHandler,  false);
-    this.selectPluggedIn=true;
-  },
-
-  unplugSelect: function() {
-    if (!this.selectPluggedIn) return;
-    var tBody=this.tbody[this.SelectIdxStart.tabIdx];
-    Rico.eventUnbind(tBody,"mouseover", this.options.mouseOverHandler , false);
-    Rico.eventUnbind(this.outerDiv,"mouseup", this.options.mouseUpHandler , false);
-    this.selectPluggedIn=false;
-  },
-
-  selectMouseUp: function(e) {
-    this.unplugSelect();
-    var cell=Rico.eventElement(e);
-    cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-    if (!cell) return;
-    if (this.SelectIdxStart && this.SelectIdxEnd)
-      this.AdjustSelection(cell);
-    else
-      this.ClearSelection();
-  },
-
-  selectMouseOver: function(e) {
-    var cell=Rico.eventElement(e);
-    cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-    if (!cell) return;
-    this.AdjustSelection(cell);
-    Rico.eventStop(e);
-  },
-
-  isSelected: function(cell) {
-    if (this.options.highlightMethod!='outline') return Rico.hasClass(cell,this.options.highlightClass);
-    if (!this.SelectIdxStart || !this.SelectIdxEnd) return false;
-    var r1=Math.max(Math.min(this.SelectIdxEnd.row,this.SelectIdxStart.row), this.buffer.windowStart);
-    var r2=Math.min(Math.max(this.SelectIdxEnd.row,this.SelectIdxStart.row), this.buffer.windowEnd-1);
-    if (r1 > r2) return false;
-    var c1=Math.min(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-    var c2=Math.max(this.SelectIdxEnd.column,this.SelectIdxStart.column);
-    var curIdx=this.datasetIndex(cell);
-    return (r1<=curIdx.row && curIdx.row<=r2 && c1<=curIdx.column && curIdx.column<=c2);
-  },
-
-  highlightCell: function(cell) {
-    Rico.addClass(cell,this.options.highlightClass);
-  },
-
-  unhighlightCell: function(cell) {
-    if (cell==null) return;
-    Rico.removeClass(cell,this.options.highlightClass);
-  },
-
-  selectRow: function(r) {
-    for (var c=0; c<this.columns.length; c++)
-      this.highlightCell(this.columns[c].cell(r));
-  },
-
-  unselectRow: function(r) {
-    for (var c=0; c<this.columns.length; c++)
-      this.unhighlightCell(this.columns[c].cell(r));
-  },
-
-  rowMouseOver: function(e) {
-    if (!this.highlightEnabled) return;
-    var cell=Rico.eventElement(e);
-    cell=Rico.getParentByTagName(cell,'div','ricoLG_cell');
-    if (!cell) return;
-    var newIdx=this.winCellIndex(cell);
-    if ((this.options.highlightSection & (newIdx.tabIdx+1))==0) return;
-    this.highlight(newIdx);
-  },
-
-  highlight: function(newIdx) {
-    if (this.options.highlightMethod!='outline') this.cursorSetClass(newIdx);
-    if (this.options.highlightMethod!='class') this.cursorOutline(newIdx);
-    this.highlightIdx=newIdx;
-  },
-
-  cursorSetClass: function(newIdx) {
-    switch (this.options.highlightElem) {
-      case 'menuCell':
-      case 'cursorCell':
-        if (this.highlightIdx) this.unhighlightCell(this.highlightIdx.cell);
-        this.highlightCell(newIdx.cell);
-        break;
-      case 'menuRow':
-      case 'cursorRow':
-        if (this.highlightIdx) this.unselectRow(this.highlightIdx.row);
-        var s1=this.options.highlightSection & 1;
-        var s2=this.options.highlightSection & 2;
-        var c0=s1 ? 0 : this.options.frozenColumns;
-        var c1=s2 ? this.columns.length : this.options.frozenColumns;
-        for (var c=c0; c<c1; c++)
-          this.highlightCell(this.columns[c].cell(newIdx.row));
-        break;
-      default: return;
-    }
-  },
-
-  cursorOutline: function(newIdx) {
-    var div;
-    switch (this.options.highlightElem) {
-      case 'menuCell':
-      case 'cursorCell':
-        div=this.highlightDiv[newIdx.tabIdx];
-        div.style.left=(this.columns[newIdx.column].dataCell.offsetLeft-1)+'px';
-        div.style.width=this.columns[newIdx.column].colWidth;
-        this.highlightDiv[1-newIdx.tabIdx].style.display='none';
-        break;
-      case 'menuRow':
-      case 'cursorRow':
-        div=this.highlightDiv[0];
-        var s1=this.options.highlightSection & 1;
-        var s2=this.options.highlightSection & 2;
-        div.style.left=s1 ? '0px' : this.frozenTabs.style.width;
-        div.style.width=((s1 ? this.frozenTabs.offsetWidth : 0) + (s2 ? this.innerDiv.offsetWidth : 0) - 4)+'px';
-        break;
-      default: return;
-    }
-    div.style.top=(this.hdrHt+newIdx.row*this.rowHeight-1)+'px';
-    div.style.height=(this.rowHeight-1)+'px';
-    div.style.display='';
-  },
-
-  unhighlight: function() {
-    switch (this.options.highlightElem) {
-      case 'menuCell':
-        //this.highlightIdx=this.menuIdx;
-        /*jsl:fallthru*/
-      case 'cursorCell':
-        if (this.highlightIdx) this.unhighlightCell(this.highlightIdx.cell);
-        if (!this.highlightDiv) return;
-        for (var i=0; i<2; i++)
-          this.highlightDiv[i].style.display='none';
-        break;
-      case 'menuRow':
-        //this.highlightIdx=this.menuIdx;
-        /*jsl:fallthru*/
-      case 'cursorRow':
-        if (this.highlightIdx) this.unselectRow(this.highlightIdx.row);
-        if (this.highlightDiv) this.highlightDiv[0].style.display='none';
-        break;
-    }
-  },
-
-  resetContents: function() {
-    Rico.log("resetContents");
-    this.ClearSelection();
-    this.buffer.clear();
-    this.clearRows();
-    this.clearBookmark();
-  },
-
-  setImages: function() {
-    for (var n=0; n<this.columns.length; n++)
-      this.columns[n].setImage();
-  },
-
-/**
- * @return column index, or -1 if there are no sorted columns
- */
-  findSortedColumn: function() {
-    for (var n=0; n<this.columns.length; n++) {
-      if (this.columns[n].isSorted()) return n;
-    }
-    return -1;
-  },
-
-  findColumnName: function(name) {
-    for (var n=0; n<this.columns.length; n++) {
-      if (this.columns[n].fieldName == name) return n;
-    }
-    return -1;
-  },
-  
-/**
- * Searches options.columnSpecs colAttr for matching colValue
- * @return array of matching column indexes
- */
-  findColumnsBySpec: function(colAttr, colValue) {
-    var result=[]
-    for (var n=0; n<this.options.columnSpecs.length; n++) {
-      if (this.options.columnSpecs[n][colAttr] == colValue) result.push(n);
-    }
-    return result;
-  },
-
-/**
- * Set initial sort
- */
-  setSortUI: function( columnNameOrNum, sortDirection ) {
-    Rico.log("setSortUI: "+columnNameOrNum+' '+sortDirection);
-    var colnum=this.findSortedColumn();
-    if (colnum >= 0) {
-      sortDirection=this.columns[colnum].getSortDirection();
-    } else {
-      if (typeof sortDirection!='string') {
-        sortDirection=Rico.ColumnConst.SORT_ASC;
-      } else {
-        sortDirection=sortDirection.toUpperCase();
-        if (sortDirection != Rico.ColumnConst.SORT_DESC) sortDirection=Rico.ColumnConst.SORT_ASC;
-      }
-      switch (typeof columnNameOrNum) {
-        case 'string':
-          colnum=this.findColumnName(columnNameOrNum);
-          break;
-        case 'number':
-          colnum=columnNameOrNum;
-          break;
-      }
-    }
-    if (typeof(colnum)!='number' || colnum < 0) return;
-    this.clearSort();
-    this.columns[colnum].setSorted(sortDirection);
-    this.buffer.sortBuffer(colnum);
-  },
-
-/**
- * clear sort flag on all columns
- */
-  clearSort: function() {
-    for (var x=0;x<this.columns.length;x++)
-      this.columns[x].setUnsorted();
-  },
-
-/**
- * clear filters on all columns
- */
-  clearFilters: function() {
-    for (var x=0;x<this.columns.length;x++) {
-      this.columns[x].setUnfiltered(true);
-    }
-    if (this.options.filterHandler) {
-      this.options.filterHandler();
-    }
-  },
-
-/**
- * returns number of columns with a user filter set
- */
-  filterCount: function() {
-    for (var x=0,cnt=0;x<this.columns.length;x++) {
-      if (this.columns[x].isFiltered()) cnt++;
-    }
-    return cnt;
-  },
-
-  sortHandler: function() {
-    this.cancelMenu();
-    this.ClearSelection();
-    this.setImages();
-    var n=this.findSortedColumn();
-    if (n < 0) return;
-    Rico.log("sortHandler: sorting column "+n);
-    this.buffer.sortBuffer(n);
-    this.clearRows();
-    this.scrollDiv.scrollTop = 0;
-    this.buffer.fetch(0);
-  },
-
-  filterHandler: function() {
-    Rico.log("filterHandler");
-    this.cancelMenu();
-    if (this.buffer.processingRequest) {
-      this.queueFilter=true;
-      return;
-    }
-    this.unplugScroll();
-    this.ClearSelection();
-    this.setImages();
-    this.clearBookmark();
-    this.clearRows();
-    this.buffer.fetch(-1);
-    Rico.runLater(10,this,'pluginScroll'); // resetting ht div can cause a scroll event, triggering an extra fetch
-  },
-
-  clearBookmark: function() {
-    if (this.bookmark) this.bookmark.innerHTML="&nbsp;";
-  },
-
-  bookmarkHandler: function(firstrow,lastrow) {
-    var newhtml;
-    if (isNaN(firstrow) || !this.bookmark) return;
-    var totrows=this.buffer.totalRows;
-    if (totrows < lastrow) lastrow=totrows;
-    if (totrows<=0) {
-      newhtml = Rico.getPhraseById('bookmarkNoMatch');
-    } else if (lastrow<0) {
-      newhtml = Rico.getPhraseById('bookmarkNoRec');
-    } else if (this.buffer.foundRowCount) {
-      newhtml = Rico.getPhraseById('bookmarkExact',firstrow,lastrow,totrows);
-    } else {
-      newhtml = Rico.getPhraseById('bookmarkAbout',firstrow,lastrow,totrows);
-    }
-    this.bookmark.innerHTML = newhtml;
-  },
-
-  clearRows: function() {
-    if (this.isBlank==true) return;
-    for (var c=0; c < this.columns.length; c++)
-      this.columns[c].clearColumn();
-    this.isBlank = true;
-  },
-
-  refreshContents: function(startPos) {
-    Rico.log("refreshContents1 "+this.tableId+": startPos="+startPos+" lastRow="+this.lastRowPos+" PartBlank="+this.isPartialBlank+" pageSize="+this.pageSize);
-    this.hideMsg();
-    this.cancelMenu();
-    this.unhighlight(); // in case highlighting was manually invoked
-    if (this.queueFilter) {
-      Rico.log("refreshContents: cancelling refresh because filter has changed");
-      this.queueFilter=false;
-      this.filterHandler();
-      return;
-    }
-    this.highlightEnabled=this.options.highlightSection!='none';
-    var viewPrecedesBuffer = this.buffer.startPos > startPos;
-    var contentStartPos = viewPrecedesBuffer ? this.buffer.startPos: startPos;
-    this.contentStartPos = contentStartPos+1;
-    var contentEndPos = Math.min(this.buffer.startPos + this.buffer.size, startPos + this.pageSize);
-    this.buffer.setWindow(contentStartPos, contentEndPos);
-    Rico.log('refreshContents2 '+this.tableId+': cStartPos='+contentStartPos+' cEndPos='+contentEndPos+' vPrecedesBuf='+viewPrecedesBuffer+' b.startPos='+this.buffer.startPos);
-    if (startPos == this.lastRowPos && !this.isPartialBlank && !this.isBlank) return;
-    this.isBlank = false;
-    var onRefreshComplete = this.options.onRefreshComplete;
-
-    if ((startPos + this.pageSize < this.buffer.startPos) ||
-        (this.buffer.startPos + this.buffer.size < startPos) ||
-        (this.buffer.size == 0)) {
-      this.clearRows();
-      if (onRefreshComplete) onRefreshComplete(this.contentStartPos,contentEndPos);  // update bookmark
-      return;
-    }
-
-    Rico.log('refreshContents: contentStartPos='+contentStartPos+' contentEndPos='+contentEndPos+' viewPrecedesBuffer='+viewPrecedesBuffer);
-    var rowSize = contentEndPos - contentStartPos;
-    var blankSize = this.pageSize - rowSize;
-    var blankOffset = viewPrecedesBuffer ? 0: rowSize;
-    var contentOffset = viewPrecedesBuffer ? blankSize: 0;
-
-    for (var r=0; r < rowSize; r++) { //initialize what we have
-      for (var c=0; c < this.columns.length; c++)
-        this.columns[c].displayValue(r + contentOffset);
-    }
-    for (var i=0; i < blankSize; i++)     // blank out the rest
-      this.blankRow(i + blankOffset);
-    if (this.options.highlightElem=='selection') this.ShowSelection();
-    this.isPartialBlank = blankSize > 0;
-    this.lastRowPos = startPos;
-    Rico.log("refreshContents complete, startPos="+startPos);
-    if (onRefreshComplete) onRefreshComplete(this.contentStartPos,contentEndPos);  // update bookmark
-  },
-
-  scrollToRow: function(rowOffset) {
-     var p=this.rowToPixel(rowOffset);
-     Rico.log("scrollToRow, rowOffset="+rowOffset+" pixel="+p);
-     this.scrollDiv.scrollTop = p; // this causes a scroll event
-     if ( this.options.onscroll )
-        this.options.onscroll( this, rowOffset );
-  },
-
-  scrollUp: function() {
-     this.moveRelative(-1);
-  },
-
-  scrollDown: function() {
-     this.moveRelative(1);
-  },
-
-  pageUp: function() {
-     this.moveRelative(-this.pageSize);
-  },
-
-  pageDown: function() {
-     this.moveRelative(this.pageSize);
-  },
-
-  adjustRow: function(rowOffset) {
-     var notdisp=this.topOfLastPage();
-     if (notdisp == 0 || !rowOffset) return 0;
-     return Math.min(notdisp,rowOffset);
-  },
-
-  rowToPixel: function(rowOffset) {
-     return this.adjustRow(rowOffset) * this.rowHeight;
-  },
-
-/**
- * @returns row to display at top of scroll div
- */
-  pixeltorow: function(p) {
-     var notdisp=this.topOfLastPage();
-     if (notdisp == 0) return 0;
-     var prow=parseInt(p/this.rowHeight,10);
-     return Math.min(notdisp,prow);
-  },
-
-  moveRelative: function(relOffset) {
-     var newoffset=Math.max(this.scrollDiv.scrollTop+relOffset*this.rowHeight,0);
-     newoffset=Math.min(newoffset,this.scrollDiv.scrollHeight);
-     //Rico.log("moveRelative, newoffset="+newoffset);
-     this.scrollDiv.scrollTop=newoffset;
-  },
-
-  pluginScroll: function() {
-     if (this.scrollPluggedIn) return;
-     Rico.log("pluginScroll: wheelEvent="+this.wheelEvent);
-     Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc, false);
-     for (var t=0; t<2; t++)
-       Rico.eventBind(this.tabs[t],this.wheelEvent,this.wheelEventFunc, false);
-     this.scrollPluggedIn=true;
-  },
-
-  unplugScroll: function() {
-     if (!this.scrollPluggedIn) return;
-     Rico.log("unplugScroll");
-     Rico.eventUnbind(this.scrollDiv,"scroll", this.scrollEventFunc , false);
-     for (var t=0; t<2; t++)
-       Rico.eventUnbind(this.tabs[t],this.wheelEvent,this.wheelEventFunc, false);
-     this.scrollPluggedIn=false;
-  },
-
-  handleWheel: function(e) {
-    var delta = 0;
-    if (e.wheelDelta) {
-      if (Rico.isOpera)
-        delta = e.wheelDelta/120;
-      else if (Rico.isWebKit)
-        delta = -e.wheelDelta/12;
-      else
-        delta = -e.wheelDelta/120;
-    } else if (e.detail) {
-      delta = e.detail/3; /* Mozilla/Gecko */
-    }
-    if (delta) this.moveRelative(delta);
-    Rico.eventStop(e);
-    return false;
-  },
-
-  handleScroll: function(e) {
-     if ( this.scrollTimeout )
-       clearTimeout( this.scrollTimeout );
-     this.setHorizontalScroll();
-     var scrtop=this.scrollDiv.scrollTop;
-     var vscrollDiff = this.lastScrollPos-scrtop;
-     if (vscrollDiff == 0.00) return;
-     var newrow=this.pixeltorow(scrtop);
-     if (newrow == this.lastRowPos && !this.isPartialBlank && !this.isBlank) return;
-     var stamp1 = new Date();
-     Rico.log("handleScroll, newrow="+newrow+" scrtop="+scrtop);
-     if (this.options.highlightElem=='selection') this.HideSelection();
-     this.buffer.fetch(newrow);
-     if (this.options.onscroll) this.options.onscroll(this, newrow);
-     this.scrollTimeout = Rico.runLater(1200,this,'scrollIdle');
-     this.lastScrollPos = this.scrollDiv.scrollTop;
-     var stamp2 = new Date();
-     //Rico.log("handleScroll, time="+(stamp2.getTime()-stamp1.getTime()));
-  },
-
-  scrollIdle: function() {
-     if ( this.options.onscrollidle )
-        this.options.onscrollidle();
-  }
-
-};
-
-
-Rico.LiveGridColumn = function(grid,colIdx,hdrInfo,tabIdx) {
-  this.initialize(grid,colIdx,hdrInfo,tabIdx);
-};
-
-Rico.LiveGridColumn.prototype = 
-/** @lends Rico.LiveGridColumn# */
-{
-/**
- * Implements a LiveGrid column. Also contains static properties used by SimpleGrid columns.
- * @extends Rico.TableColumnBase
- * @constructs
- */
-initialize: function(liveGrid,colIdx,hdrInfo,tabIdx) {
-  Rico.extend(this, new Rico.TableColumnBase());
-  this.baseInit(liveGrid,colIdx,hdrInfo,tabIdx);
-  this.buffer=liveGrid.buffer;
-  if (typeof(this.format.type)!='string' || this.format.EntryType=='tinyMCE') this.format.type='raw';
-  if (typeof this.isNullable!='boolean') this.isNullable = /number|date/.test(this.format.type);
-  this.isText = /raw|text|showTags/.test(this.format.type);
-  Rico.log(" sortable="+this.sortable+" filterable="+this.filterable+" hideable="+this.hideable+" isNullable="+this.isNullable+' isText='+this.isText);
-  this.fixHeaders(this.liveGrid.tableId, this.options.hdrIconsFirst);
-  if (this['format_'+this.format.type]) {
-    this._format=this['format_'+this.format.type];
-    //this._format=Rico.bind(this,'format_'+this.format.type);
-  }
-  if (this.format.control) {
-    // copy all properties/methods that start with '_'
-    if (typeof this.format.control=='string') {
-      this.format.control=eval(this.format.control);
-    }
-    for (var property in this.format.control) {
-      if (property.charAt(0)=='_') {
-        Rico.log("Copying control property "+property+ ' to ' + this);
-        this[property] = this.format.control[property];
-      }
-    }
-  }
-},
-
-/**
- * Sorts the column in ascending order
- */
-sortAsc: function() {
-  this.setColumnSort(Rico.ColumnConst.SORT_ASC);
-},
-
-/**
- * Sorts the column in descending order
- */
-sortDesc: function() {
-  this.setColumnSort(Rico.ColumnConst.SORT_DESC);
-},
-
-/**
- * Sorts the column in the specified direction
- * @param direction must be one of Rico.ColumnConst.UNSORTED, .SORT_ASC, or .SORT_DESC
- */
-setColumnSort: function(direction) {
-  this.liveGrid.clearSort();
-  this.setSorted(direction);
-  if (this.liveGrid.options.saveColumnInfo.sort)
-    this.liveGrid.setCookie();
-  if (this.options.sortHandler)
-    this.options.sortHandler();
-},
-
-/**
- * @returns true if this column is allowed to be sorted
- */
-isSortable: function() {
-  return this.sortable;
-},
-
-/**
- * @returns true if this column is currently sorted
- */
-isSorted: function() {
-  return this.currentSort != Rico.ColumnConst.UNSORTED;
-},
-
-/**
- * @returns Rico.ColumnConst.UNSORTED, .SORT_ASC, or .SORT_DESC
- */
-getSortDirection: function() {
-  return this.currentSort;
-},
-
-/**
- * toggle the sort sequence for this column
- */
-toggleSort: function() {
-  if (this.buffer && this.buffer.totalRows==0) return;
-  if (this.currentSort == Rico.ColumnConst.SORT_ASC)
-    this.sortDesc();
-  else
-    this.sortAsc();
-},
-
-/**
- * Flags that this column is not sorted
- */
-setUnsorted: function() {
-  this.setSorted(Rico.ColumnConst.UNSORTED);
-},
-
-/**
- * Flags that this column is sorted, but doesn't actually carry out the sort
- * @param direction must be one of Rico.ColumnConst.UNSORTED, .SORT_ASC, or .SORT_DESC
- */
-setSorted: function(direction) {
-  this.currentSort = direction;
-},
-
-/**
- * @returns true if this column is allowed to be filtered
- */
-canFilter: function() {
-  return this.filterable;
-},
-
-/**
- * @returns a textual representation of how this column is filtered
- */
-getFilterText: function() {
-  var vals=[];
-  for (var i=0; i<this.filterValues.length; i++) {
-    var v=this.filterValues[i];
-    vals.push(v=='' ? Rico.getPhraseById('filterBlank') : v);
-  }
-  switch (this.filterOp) {
-    case 'EQ':   return '= '+vals.join(', ');
-    case 'NE':   return Rico.getPhraseById('filterNot',vals.join(', '));
-    case 'LE':   return '<= '+vals[0];
-    case 'GE':   return '>= '+vals[0];
-    case 'LIKE': return Rico.getPhraseById('filterLike',vals[0]);
-    case 'NULL': return Rico.getPhraseById('filterEmpty');
-    case 'NOTNULL': return Rico.getPhraseById('filterNotEmpty');
-  }
-  return '?';
-},
-
-/**
- * @returns returns the query string representation of the filter
- */
-getFilterQueryParm: function() {
-  if (this.filterType == Rico.ColumnConst.UNFILTERED) return '';
-  var retval='&f['+this.index+'][op]='+this.filterOp;
-  retval+='&f['+this.index+'][len]='+this.filterValues.length;
-  for (var i=0; i<this.filterValues.length; i++) {
-    retval+='&f['+this.index+']['+i+']='+escape(this.filterValues[i]);
-  }
-  return retval;
-},
-
-/**
- * removes the filter from this column
- */
-setUnfiltered: function(skipHandler) {
-  this.filterType = Rico.ColumnConst.UNFILTERED;
-  if (this.liveGrid.options.saveColumnInfo.filter)
-    this.liveGrid.setCookie();
-  if (this.removeFilterFunc)
-    this.removeFilterFunc();
-  if (this.options.filterHandler && !skipHandler)
-    this.options.filterHandler();
-},
-
-setFilterEQ: function() {
-  this.setUserFilter('EQ');
-},
-setFilterNE: function() {
-  this.setUserFilter('NE');
-},
-addFilterNE: function() {
-  this.filterValues.push(this.userFilter);
-  if (this.liveGrid.options.saveColumnInfo.filter)
-    this.liveGrid.setCookie();
-  if (this.options.filterHandler)
-    this.options.filterHandler();
-},
-setFilterGE: function() { this.setUserFilter('GE'); },
-setFilterLE: function() { this.setUserFilter('LE'); },
-setFilterKW: function(keyword) {
-  if (keyword!='' && keyword!=null) {
-    this.setFilter('LIKE',keyword,Rico.ColumnConst.USERFILTER);
-  } else {
-    this.setUnfiltered(false);
-  }
-},
-
-setUserFilter: function(relop) {
-  this.setFilter(relop,this.userFilter,Rico.ColumnConst.USERFILTER);
-},
-
-setSystemFilter: function(relop,filter) {
-  this.setFilter(relop,filter,Rico.ColumnConst.SYSTEMFILTER);
-},
-
-setFilter: function(relop,filter,type,removeFilterFunc) {
-  this.filterValues = typeof(filter)=='object' ? filter : [filter];
-  this.filterType = type;
-  this.filterOp = relop;
-  if (type == Rico.ColumnConst.USERFILTER && this.liveGrid.options.saveColumnInfo.filter)
-    this.liveGrid.setCookie();
-  this.removeFilterFunc=removeFilterFunc;
-  if (this.options.filterHandler)
-    this.options.filterHandler();
-},
-
-isFiltered: function() {
-  return this.filterType == Rico.ColumnConst.USERFILTER;
-},
-
-filterChange: function(e) {\r
-  var selbox=Rico.eventElement(e);
-  if (selbox.value==this.liveGrid.options.FilterAllToken)\r
-    this.setUnfiltered();\r
-  else
-    this.setFilter('EQ',selbox.value,Rico.ColumnConst.USERFILTER,function() {selbox.selectedIndex=0;});\r
-},
-
-filterClear: function(e) {\r
-  this.filterField.value='';
-  this.setUnfiltered();\r
-},
-
-filterKeypress: function(e) {\r
-  var txtbox=Rico.eventElement(e);
-  if (typeof this.lastKeyFilter != 'string') this.lastKeyFilter='';\r
-  if (this.lastKeyFilter==txtbox.value) return;\r
-  var v=txtbox.value;\r
-  Rico.log("filterKeypress: "+this.index+' '+v);\r
-  this.lastKeyFilter=v;
-  if (v=='' || v=='*')\r
-    this.setUnfiltered();\r
-  else {
-    this.setFilter('LIKE', v, Rico.ColumnConst.USERFILTER, function() {txtbox.value='';});
-  }\r
-},\r
-
-mFilterSelectClick: function(e) {
-  Rico.eventStop(e);
-  if (this.mFilter.style.display!='none') {
-    this.mFilterFinish(e);
-    if (Rico.isIE && Rico.ieVersion <= 6) {
-      this.filterField.focus();
-    } else {
-      this.filterField.blur();
-    }
-  } else {
-    var offset=Rico.cumulativeOffset(this.filterField);
-    this.mFilter.style.top=(offset.top+this.filterField.offsetHeight)+'px';
-    this.mFilter.style.left=offset.left+'px';
-    this.mFilter.style.width=Math.min(this.filterField.offsetWidth,parseInt(this.colWidth,10))+'px';
-    Rico.show(this.mFilter);
-    this.mFilterFocus.focus();
-  }
-},
-
-mFilterFinish: function(e) {
-  if (!this.mFilterChange) {
-    Rico.hide(this.mFilter);
-    return;
-  }
-  if (this.mFilterInputs[0].checked) {
-    this.mFilterReset();
-    Rico.hide(this.mFilter);
-    this.setUnfiltered();
-    return;
-  }
-  var newValues=[];
-  var newLabels=[];
-  for (var i=1; i<this.mFilterInputs.length; i++) {
-    if (this.mFilterInputs[i].checked) {
-      newValues.push(this.mFilterInputs[i].value)
-      newLabels.push(this.mFilterLabels[i].innerHTML)
-    }
-  }
-  if (newValues.length > 0) {
-    var newText=newLabels.join(', ');
-    this.filterField.options[0].text=newText;
-    this.filterField.title=newText;
-    Rico.hide(this.mFilter);
-    this.mFilterChange=false;
-    this.setFilter('EQ',newValues,Rico.ColumnConst.USERFILTER,Rico.bind(this,'mFilterReset'));
-  } else {
-    alert('Please select at least one value');
-  }
-},
-
-mFilterReset: function() {
-  var newText=this.mFilterLabels[0].innerHTML;  // all
-  this.filterField.options[0].text=newText;
-  this.filterField.title=newText;
-},
-
-mFilterAllClick: function(e) {
-  var allChecked=this.mFilterInputs[0].checked;
-  for (var i=1; i<this.mFilterInputs.length; i++) {
-    this.mFilterInputs[i].checked=allChecked;
-  }
-  this.mFilterChange=true;
-},
-
-mFilterOtherClick: function(e) {
-  this.mFilterInputs[0].checked=false;
-  this.mFilterChange=true;
-},
-
-format_text: function(v) {
-  if (typeof v!='string')
-    return '&nbsp;';
-  else
-    return Rico.stripTags(v);
-},
-
-format_showTags: function(v) {
-  if (typeof v!='string')
-    return '&nbsp;';
-  else
-    return v.replace(/&/g, '&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
-},
-
-format_number: function(v) {
-  if (typeof v=='undefined' || v=='' || v==null)
-    return '&nbsp;';
-  else
-    return Rico.formatNumber(v,this.format);
-},
-
-format_datetime: function(v) {
-  if (typeof v=='undefined' || v=='' || v==null)
-    return '&nbsp;';
-  else {
-    var d=Rico.setISO8601(v);
-    if (!d) return v;
-    return (this.format.prefix || '')+Rico.formatDate(d,this.format.dateFmt || 'translateDateTime')+(this.format.suffix || '');
-  }
-},
-
-// converts GMT/UTC to local time
-format_UTCasLocalTime: function(v) {
-  if (typeof v=='undefined' || v=='' || v==null)
-    return '&nbsp;';
-  else {
-    var tz=new Date();
-    var d=Rico.setISO8601(v,-tz.getTimezoneOffset());
-    if (!d) return v;
-    return (this.format.prefix || '')+Rico.formatDate(d,this.format.dateFmt || 'translateDateTime')+(this.format.suffix || '');
-  }
-},
-
-format_date: function(v) {
-  if (typeof v=='undefined' || v==null || v=='')
-    return '&nbsp;';
-  else {
-    var d=Rico.setISO8601(v);
-    if (!d) return v;
-    return (this.format.prefix || '')+Rico.formatDate(d,this.format.dateFmt || 'translateDate')+(this.format.suffix || '');
-  }
-},
-
-fixHeaders: function(prefix, iconsfirst) {
-  if (this.sortable) {
-    var handler=Rico.eventHandle(this,'toggleSort');
-    switch (this.options.headingSort) {
-      case 'link':
-        var a=Rico.wrapChildren(this.hdrCellDiv,'ricoSort',undefined,'a');
-        a.href = "javascript:void(0)";
-        Rico.eventBind(a,"click", handler);
-        break;
-      case 'hover':
-        Rico.eventBind(this.hdrCellDiv,"click", handler);
-        break;
-    }
-  }
-  this.imgFilter = document.createElement('img');
-  this.imgFilter.style.display='none';
-  this.imgFilter.src=Rico.imgDir+this.options.filterImg;
-  this.imgFilter.className='ricoLG_HdrIcon';
-  this.imgSort = document.createElement('span');
-  this.imgSort.style.display='none';
-  if (iconsfirst) {
-    this.hdrCellDiv.insertBefore(this.imgSort,this.hdrCellDiv.firstChild);
-    this.hdrCellDiv.insertBefore(this.imgFilter,this.hdrCellDiv.firstChild);
-  } else {
-    this.hdrCellDiv.appendChild(this.imgFilter);
-    this.hdrCellDiv.appendChild(this.imgSort);
-  }
-  if (!this.format.filterUI) {
-    Rico.eventBind(this.imgFilter, 'click', Rico.eventHandle(this,'filterClick'), false);
-  }
-},
-
-filterClick: function(e) {
-  if (this.filterType==Rico.ColumnConst.USERFILTER && this.filterOp=='LIKE') {
-    this.liveGrid.openKeyword(this.index);
-  }
-},
-
-getValue: function(windowRow) {
-  return this.buffer.getWindowCell(windowRow,this.index);
-},
-
-getBufferAttr: function(windowRow) {
-  return this.buffer.getWindowAttr(windowRow,this.index);
-},
-
-setValue: function(windowRow,newval) {
-  this.buffer.setWindowValue(windowRow,this.index,newval);
-},
-
-_format: function(v) {
-  return v;
-},
-
-_display: function(v,gridCell) {
-  gridCell.innerHTML=this._format(v);
-},
-
-_export: function(v) {
-  return this._format(v);
-},
-
-exportBuffer: function(bufRow) {
-  return this._export(this.buffer.getValue(bufRow,this.index));
-},
-
-displayValue: function(windowRow) {
-  var bufval=this.getValue(windowRow);
-  if (bufval==null) {
-    this.clearCell(windowRow);
-    return;
-  }
-  var gridCell=this.cell(windowRow);
-  this._display(bufval,gridCell,windowRow);
-  var acceptAttr=this.buffer.options.acceptAttr;
-  if (acceptAttr.length==0) return;
-  var bufAttr=this.getBufferAttr(windowRow);
-  if (bufAttr==null) return;
-  for (var k=0; k<acceptAttr.length; k++) {
-    bufAttr=bufAttr['_'+acceptAttr[k]] || '';
-    switch (acceptAttr[k]) {
-      case 'style': gridCell.style.cssText=bufAttr; break;
-      case 'class': gridCell.className=bufAttr; break;
-      default:      gridCell['_'+acceptAttr[k]]=bufAttr; break;
-    }
-  }
-}
-
-};
-
-Rico.includeLoaded('ricoLiveGrid.js');
diff --git a/ricoClient/js/ricoLiveGridAjax.js b/ricoClient/js/ricoLiveGridAjax.js
deleted file mode 100644 (file)
index b778bd7..0000000
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-if(typeof Rico=='undefined') throw("LiveGridAjax requires the Rico JavaScript framework");
-
-if (!Rico.Buffer) Rico.Buffer = {};
-
-Rico.Buffer.AjaxXML = function(url,options,ajaxOptions) {
-  this.initialize(url,options,ajaxOptions);
-}
-
-Rico.Buffer.AjaxXML.prototype = {
-/**
- * @class Implements buffer for LiveGrid. Loads data from server via a single AJAX call.
- * @extends Rico.Buffer.Base
- * @constructs
- */
-  initialize: function(url,options,ajaxOptions) {
-    Rico.extend(this, new Rico.Buffer.Base());
-    Rico.extend(this, Rico.Buffer.AjaxXMLMethods);
-    this.dataSource=url;
-    this.options.bufferTimeout=20000;            // time to wait for ajax response (milliseconds)
-    this.options.requestParameters=[];
-    this.options.waitMsg=Rico.getPhraseById("waitForData");  // replace this with an image tag if you prefer
-    this.options.canFilter=true;
-    this.options.fmt='xml';
-    Rico.extend(this.options, options || {});
-    this.ajaxOptions = { parameters: null, method : 'get' };
-    Rico.extend(this.ajaxOptions, ajaxOptions || {});
-    this.requestCount=0;
-    this.processingRequest=false;
-    this.pendingRequest=-2;
-    this.fetchData=true;
-    this.sortParm={};
-  }
-}
-
-Rico.Buffer.AjaxXMLMethods = {
-
-/** @lends Rico.Buffer.AjaxXML# */
-  fetch: function(offset) {
-    if (this.fetchData) {
-      this.foundRowCount=true;
-      this.fetchData=false;
-      this.processingRequest=true;
-      this.liveGrid.showMsg(this.options.waitMsg);
-      this.timeoutHandler = Rico.runLater(this.options.bufferTimeout,this,'handleTimedOut');
-      this.ajaxOptions.parameters = this.formQueryHashXML(0,-1);
-      Rico.log('sending request');
-      if (typeof this.dataSource=='string') {
-        this.ajaxOptions.onComplete = Rico.bind(this,'ajaxUpdate',offset);
-        new Rico.ajaxRequest(this.dataSource, this.ajaxOptions);
-      } else {
-        this.ajaxOptions.onComplete = Rico.bind(this,'jsUpdate',offset);
-        this.dataSource(this.ajaxOptions);
-      }
-    } else {
-      if (offset < 0) {
-        this.applyFilters();
-        this.setTotalRows(this.size);
-        offset=0;
-      }
-      this.liveGrid.refreshContents(offset);
-    }
-  },
-
-/**
- * Server did not respond in time... assume that there could have been
- * an error, and allow requests to be processed again.
- */
-  handleTimedOut: function() {
-    Rico.log("Request Timed Out");
-    this.liveGrid.showMsg(Rico.getPhraseById("requestTimedOut"));
-  },
-
-  formQueryHashXML: function(startPos,fetchSize) {
-    var queryHash= {
-      id: this.liveGrid.tableId,
-      page_size: (typeof fetchSize=='number') ? fetchSize : this.totalRows,
-      offset: startPos.toString()
-    };
-    if (!this.foundRowCount) queryHash['get_total']='true';
-    if (this.options.requestParameters) {
-      for ( var i=0; i < this.options.requestParameters.length; i++ ) {
-        var anArg = this.options.requestParameters[i];
-        if ( anArg.name != undefined && anArg.value != undefined ) {
-          queryHash[anArg.name]=anArg.value;
-        } else {
-          var ePos  = anArg.indexOf('=');
-          var argName  = anArg.substring( 0, ePos );
-          var argValue = anArg.substring( ePos + 1 );
-          queryHash[argName]=argValue;
-        }
-      }
-    }
-    return queryHash;
-  },
-
-  clearTimer: function() {
-    if(typeof this.timeoutHandler != "number") return;
-    window.clearTimeout(this.timeoutHandler);
-    delete this.timeoutHandler;
-  },
-
-  // used by both XML and SQL buffers
-  jsUpdate: function(startPos, newRows, newAttr, totalRows, errMsg) {
-    this.clearTimer();
-    this.processingRequest=false;
-    Rico.log("jsUpdate: "+arguments.length);
-    if (errMsg) {
-      Rico.log("jsUpdate: received error="+errMsg);
-      this.liveGrid.showMsg(Rico.getPhraseById("requestError",errMsg));
-      return;
-    }
-    this.rcvdRows = newRows.length;
-    if (typeof totalRows=='number') {
-      this.rowcntContent = totalRows.toString();
-      this.rcvdRowCount = true;
-      this.foundRowCount = true;
-      Rico.log("jsUpdate: found RowCount="+this.rowcntContent);
-    }
-    this.updateBuffer(startPos, newRows, newAttr);
-    if (this.options.onAjaxUpdate)
-      this.options.onAjaxUpdate();
-    this.updateGrid(startPos);
-    if (this.options.TimeOut && this.timerMsg)
-      this.restartSessionTimer();
-    if (this.pendingRequest>=-1) {
-      var offset=this.pendingRequest;
-      Rico.log("jsUpdate: found pending request for offset="+offset);
-      this.pendingRequest=-2;
-      this.fetch(offset);
-    }
-  },
-
-  // used by both XML and SQL buffers
-  ajaxUpdate: function(startPos,xhr) {
-    this.clearTimer();
-    this.processingRequest=false;
-    if (xhr.status != 200) {
-      Rico.log("ajaxUpdate: received http error="+xhr.status);
-      this.liveGrid.showMsg(Rico.getPhraseById("httpError",xhr.status));
-      return;
-    }
-    this._responseHandler=this['processResponse'+this.options.fmt.toUpperCase()];
-    if (!this._responseHandler(startPos,xhr)) return;
-    if (this.options.onAjaxUpdate)
-      this.options.onAjaxUpdate();
-    this.updateGrid(startPos);
-    if (this.options.TimeOut && this.timerMsg)
-      this.restartSessionTimer();
-    if (this.pendingRequest>=-1) {
-      var offset=this.pendingRequest;
-      Rico.log("ajaxUpdate: found pending request for offset="+offset);
-      this.pendingRequest=-2;
-      this.fetch(offset);
-    }
-  },
-  
-  // used by both XML and SQL buffers
-  processResponseXML: function(startPos,request) {
-    // The response text may contain META DATA for debugging if client side debugging is enabled in VS\r
-    var xmlDoc = request.responseXML;\r
-    if (request.responseText.substring(0, 4) == "<!--") {\r
-      var nEnd = request.responseText.indexOf("-->");\r
-      if (nEnd == -1) {\r
-        this.liveGrid.showMsg('Web server error - client side debugging may be enabled');\r
-        return false;\r
-      }\r
-      xmlDoc = Rico.createXmlDocument();\r
-      xmlDoc.loadXML(request.responseText.substring(nEnd+3));\r
-    }
-    
-    if (!xmlDoc) {
-      alert("Data provider returned an invalid XML response");
-      Rico.log("Data provider returned an invalid XML response");
-      return false;
-    }
-
-    // process children of <ajax-response>
-    var response = xmlDoc.getElementsByTagName("ajax-response");
-    if (response == null || response.length != 1) return false;
-    this.rcvdRows = 0;
-    this.rcvdRowCount = false;
-    var ajaxResponse=response[0];
-    var debugtags = ajaxResponse.getElementsByTagName('debug');
-    for (var i=0; i<debugtags.length; i++)
-      Rico.log("ajaxUpdate: debug msg "+i+": "+Rico.getContentAsString(debugtags[i],this.options.isEncoded));
-    var error = ajaxResponse.getElementsByTagName('error');
-    if (error.length > 0) {
-      var msg=Rico.getContentAsString(error[0],this.options.isEncoded);
-      alert("Data provider returned an error:\n"+msg);
-      Rico.log("Data provider returned an error:\n"+msg);
-      return false;
-    }
-    var rowsElement = ajaxResponse.getElementsByTagName('rows')[0];
-    if (!rowsElement) {
-      Rico.log("ajaxUpdate: invalid response");
-      this.liveGrid.showMsg(Rico.getPhraseById("invalidResponse"));
-      return false;
-    }
-    var rowcnttags = ajaxResponse.getElementsByTagName('rowcount');
-    if (rowcnttags && rowcnttags.length==1) {
-      this.rowcntContent = Rico.getContentAsString(rowcnttags[0],this.options.isEncoded);
-      this.rcvdRowCount = true;
-      this.foundRowCount = true;
-      Rico.log("ajaxUpdate: found RowCount="+this.rowcntContent);
-    }
-
-    // process <rows>
-    this.updateUI = rowsElement.getAttribute("update_ui") == "true";
-    this.rcvdOffset = rowsElement.getAttribute("offset");
-    Rico.log("ajaxUpdate: rcvdOffset="+this.rcvdOffset);
-    var newRows = this.dom2jstable(rowsElement);
-    var newAttr = (this.options.acceptAttr.length > 0) ? this.dom2jstableAttr(rowsElement) : false;
-    this.rcvdRows = newRows.length;
-    this.updateBuffer(startPos, newRows, newAttr);
-    return true;
-  },
-
-  processResponseJSON: function(startPos,request) {
-    var json = Rico.getJSON(request);
-    if (!json || json == null) {
-      alert("Data provider returned an invalid JSON response");
-      Rico.log("Data provider returned an invalid JSON response");
-      return false;
-    }
-
-    if (json.debug) {
-      for (var i=0; i<json.debug.length; i++)
-        Rico.writeDebugMsg("debug msg "+i+": "+json.debug[i]);
-    }
-    if (json.error) {
-      alert("Data provider returned an error:\n"+json.error);
-      Rico.writeDebugMsg("Data provider returned an error:\n"+json.error);
-      return false;
-    }
-
-    if (json.rowcount) {
-      this.rowcntContent = json.rowcount;
-      this.rcvdRowCount = true;
-      this.foundRowCount = true;
-      Rico.writeDebugMsg("loadRows, found RowCount="+json.rowcount);
-    }
-
-    this.rcvdRows = json.rows.length;
-    this.updateBuffer(startPos, json.rows);
-    return true;
-  },
-
-  // specific to XML buffer
-  updateBuffer: function(start, newRows, newAttr) {
-    this.baseRows = newRows;
-    this.attr = newAttr;
-    Rico.log("updateBuffer: # of rows="+this.rcvdRows);
-    this.rcvdRowCount=true;
-    this.rowcntContent=this.rcvdRows;
-    if (typeof this.delayedSortCol=='number')
-      this.sortBuffer(this.delayedSortCol);
-    this.applyFilters();
-    this.startPos = 0;
-  },
-
-  // used by both XML and SQL buffers
-  updateGrid: function(offset) {
-    Rico.log("updateGrid, size="+this.size+' rcv cnt type='+typeof(this.rowcntContent));
-    var newpos;
-    if (this.rcvdRowCount==true) {
-      Rico.log("found row cnt: "+this.rowcntContent);
-      var eofrow=parseInt(this.rowcntContent,10);
-      var lastTotalRows=this.totalRows;
-      if (!isNaN(eofrow) && eofrow!=lastTotalRows) {
-        this.setTotalRows(eofrow);
-        newpos=Math.min(this.liveGrid.topOfLastPage(),offset);
-        Rico.log("updateGrid: new rowcnt="+eofrow+" newpos="+newpos);
-        if (lastTotalRows==0 && this.liveGrid.sizeTo=='data')
-          Rico.runLater(100,this.liveGrid,'adjustPageSize');  // FF takes a long time to calc initial size
-        this.liveGrid.scrollToRow(newpos);
-        if ( this.isInRange(newpos) ) {
-          this.liveGrid.refreshContents(newpos);
-        } else {
-          this.fetch(newpos);
-        }
-        return;
-      }
-    } else {
-      var lastbufrow=offset+this.rcvdRows;
-      if (lastbufrow>this.totalRows) {
-        var newcnt=lastbufrow;
-        Rico.log("extending totrows to "+newcnt);
-        this.setTotalRows(newcnt);
-      }
-    }
-    newpos=this.liveGrid.pixeltorow(this.liveGrid.scrollDiv.scrollTop);
-    Rico.log("updateGrid: newpos="+newpos);
-    this.liveGrid.refreshContents(newpos);
-  }
-
-};
-
-
-
-Rico.Buffer.AjaxSQL = function(url,options,ajaxOptions) {
-  this.initialize(url,options,ajaxOptions);
-}
-
-Rico.Buffer.AjaxSQL.prototype = {
-/**
- * @class Implements buffer for LiveGrid. Loads data from server in chunks as user scrolls through the grid.
- * @extends Rico.Buffer.AjaxXML
- * @constructs
- */
-  initialize: function(url,options,ajaxOptions) {
-    Rico.extend(this, new Rico.Buffer.AjaxXML());
-    Rico.extend(this, Rico.Buffer.AjaxSQLMethods);
-    this.dataSource=url;
-    this.options.canFilter=true;
-    this.options.largeBufferSize  = 7.0;   // 7 pages
-    this.options.nearLimitFactor  = 1.0;   // 1 page
-    Rico.extend(this.options, options || {});
-    Rico.extend(this.ajaxOptions, ajaxOptions || {});
-  }
-}
-
-Rico.Buffer.AjaxSQLMethods = {
-/** @lends Rico.Buffer.AjaxSQL# */
-
-  registerGrid: function(liveGrid) {
-    this.liveGrid = liveGrid;
-    this.sessionExpired=false;
-    this.timerMsg=document.getElementById(liveGrid.tableId+'_timer');
-    if (this.options.TimeOut && this.timerMsg) {
-      if (!this.timerMsg.title) this.timerMsg.title=Rico.getPhraseById("sessionExpireMinutes");
-      this.restartSessionTimer();
-    }
-  },
-
-  setBufferSize: function(pageSize) {
-    this.maxFetchSize = Math.max(50,parseInt(this.options.largeBufferSize * pageSize,10));
-    this.nearLimit = parseInt(this.options.nearLimitFactor * pageSize,10);
-    this.maxBufferSize = this.maxFetchSize * 3;
-  },
-
-  restartSessionTimer: function() {
-    if (this.sessionExpired==true) return;
-    this.sessionEndTime = (new Date()).getTime() + this.options.TimeOut*60000;
-    if (this.sessionTimer) clearTimeout(this.sessionTimer);
-    this.updateSessionTimer();
-  },
-
-  updateSessionTimer: function() {
-    var now=(new Date()).getTime();
-    if (now > this.sessionEndTime) {
-      this.displaySessionTimer(Rico.getPhraseById("sessionExpired"));
-      this.timerMsg.style.backgroundColor="red";
-      this.sessionExpired=true;
-    } else {
-      var timeRemaining=Math.ceil((this.sessionEndTime - now) / 60000);
-      this.displaySessionTimer(timeRemaining);
-      this.sessionTimer=Rico.runLater(10000,this,'updateSessionTimer');
-    }
-  },
-
-  displaySessionTimer: function(msg) {
-    this.timerMsg.innerHTML='&nbsp;'+msg+'&nbsp;';
-  },
-
-  /**
-   * Update the grid with fresh data from the database, maintaining scroll position.
-   * @param resetRowCount indicates whether the total row count should be refreshed as well
-   */
-  refresh: function(resetRowCount) {
-    var lastGridPos=this.liveGrid.lastRowPos;\r
-    this.clear();
-    if (resetRowCount) {
-      this.setTotalRows(0);
-      this.foundRowCount = false;
-    }
-    this.liveGrid.clearBookmark();
-    this.liveGrid.clearRows();
-    this.fetch(lastGridPos);
-  },
-
-  /**
-   * Fetch data from database.
-   * @param offset position (row) within the dataset (-1=clear existing buffer before issuing request)
-   */
-  fetch: function(offset) {
-    Rico.log("AjaxSQL fetch: offset="+offset+', lastOffset='+this.lastOffset);
-    if (this.processingRequest) {
-      Rico.log("AjaxSQL fetch: queue request");
-      this.pendingRequest=offset;
-      return;
-    }
-    if (offset < 0) {
-      this.clear();
-      this.setTotalRows(0);
-      this.foundRowCount = false;
-      offset=0;
-    }
-    var lastOffset = this.lastOffset;
-    this.lastOffset = offset;
-    if (this.isInRange(offset)) {
-      Rico.log("AjaxSQL fetch: in buffer");
-      this.liveGrid.refreshContents(offset);
-      if (offset > lastOffset) {
-        if (offset+this.liveGrid.pageSize < this.endPos()-this.nearLimit) return;
-        if (this.endPos()==this.totalRows && this.foundRowCount) return;
-      } else if (offset < lastOffset) {
-        if (offset > this.startPos+this.nearLimit) return;
-        if (this.startPos==0) return;
-      } else return;
-    }
-    if (offset >= this.totalRows && this.foundRowCount) return;
-
-    this.processingRequest=true;
-    Rico.log("AjaxSQL fetch: processing offset="+offset);
-    var bufferStartPos = this.getFetchOffset(offset);
-    var fetchSize = this.getFetchSize(bufferStartPos);
-    var partialLoaded = false;
-
-    this.liveGrid.showMsg(this.options.waitMsg);
-    this.timeoutHandler = Rico.runLater(this.options.bufferTimeout, this, 'handleTimedOut');
-    this.ajaxOptions.parameters = this.formQueryHashSQL(bufferStartPos,fetchSize,this.options.fmt);
-    this.requestCount++;
-    Rico.log('sending req #'+this.requestCount);
-    if (typeof this.dataSource=='string') {
-      this.ajaxOptions.onComplete = Rico.bind(this,'ajaxUpdate',bufferStartPos);
-      new Rico.ajaxRequest(this.dataSource, this.ajaxOptions);
-    } else {
-      this.ajaxOptions.onComplete = Rico.bind(this,'jsUpdate',bufferStartPos);
-      this.dataSource(this.ajaxOptions);
-    }
-  },
-
-  formQueryHashSQL: function(startPos,fetchSize,fmt) {
-    var queryHash=this.formQueryHashXML(startPos,fetchSize);
-    queryHash[this.liveGrid.actionId]="query";
-    if (fmt) queryHash._fmt=fmt;
-
-    // sort
-    Rico.extend(queryHash,this.sortParm);
-
-    // filters
-    for (var n=0; n<this.liveGrid.columns.length; n++) {
-      var c=this.liveGrid.columns[n];
-      if (c.filterType == Rico.ColumnConst.UNFILTERED) continue;
-      var colnum=typeof(c.format.filterCol)=='number' ? c.format.filterCol : c.index;
-      queryHash['f['+colnum+'][op]']=c.filterOp;
-      queryHash['f['+colnum+'][len]']=c.filterValues.length;
-      for (var i=0; i<c.filterValues.length; i++) {
-        var fval=c.filterValues[i];
-        if (c.filterOp=='LIKE' && fval.indexOf('*')==-1) fval='*'+fval+'*';
-        queryHash['f['+colnum+']['+i+']']=fval;
-      }
-    }
-    return queryHash;
-  },
-
-  getFetchSize: function(adjustedOffset) {
-    var adjustedSize = 0;
-    if (adjustedOffset >= this.startPos) { //appending
-      var endFetchOffset = this.maxFetchSize + adjustedOffset;
-      adjustedSize = endFetchOffset - adjustedOffset;
-      if(adjustedOffset == 0 && adjustedSize < this.maxFetchSize)
-        adjustedSize = this.maxFetchSize;
-      Rico.log("getFetchSize/append, adjustedSize="+adjustedSize+" adjustedOffset="+adjustedOffset+' endFetchOffset='+endFetchOffset);
-    } else { //prepending
-      adjustedSize = Math.min(this.startPos - adjustedOffset,this.maxFetchSize);
-    }
-    return adjustedSize;
-  },
-
-  getFetchOffset: function(offset) {
-    var adjustedOffset = offset;
-    if (offset > this.startPos)
-      adjustedOffset = Math.max(offset, this.endPos());  //appending
-    else if (offset + this.maxFetchSize >= this.startPos)
-      adjustedOffset = Math.max(this.startPos - this.maxFetchSize, 0);  //prepending
-    return adjustedOffset;
-  },
-
-  updateBuffer: function(start, newRows, newAttr) {
-    Rico.log("updateBuffer: start="+start+", # of rows="+this.rcvdRows);
-    if (this.rows.length == 0) { // initial load
-      this.rows = newRows;
-      this.attr = newAttr;
-      this.startPos = start;
-    } else if (start > this.startPos) { //appending
-      if (this.startPos + this.rows.length < start) {
-        this.rows =  newRows;
-        this.attr = newAttr;
-        this.startPos = start;
-      } else {
-        this.rows = this.rows.concat( newRows.slice(0, newRows.length));
-        if (this.attr) this.attr = this.attr.concat( newAttr.slice(0, newAttr.length));
-        if (this.rows.length > this.maxBufferSize) {
-          var fullSize = this.rows.length;
-          this.rows = this.rows.slice(this.rows.length - this.maxBufferSize, this.rows.length);
-          if (this.attr) this.attr = this.attr.slice(this.attr.length - this.maxBufferSize, this.attr.length);
-          this.startPos = this.startPos +  (fullSize - this.rows.length);
-        }
-      }
-    } else { //prepending
-      if (start + newRows.length < this.startPos) {
-        this.rows =  newRows;
-      } else {
-        this.rows = newRows.slice(0, this.startPos).concat(this.rows);
-        if (this.maxBufferSize && this.rows.length > this.maxBufferSize)
-          this.rows = this.rows.slice(0, this.maxBufferSize);
-      }
-      this.startPos =  start;
-    }
-    this.size = this.rows.length;
-  },
-
-  sortBuffer: function(colnum) {
-    this.sortParm={};
-    var col=this.liveGrid.columns[colnum];
-    if (this.options.sortParmFmt) {
-      this.sortParm['sort_col']=col[this.options.sortParmFmt];
-      this.sortParm['sort_dir']=col.getSortDirection();
-    } else {
-      this.sortParm['s'+colnum]=col.getSortDirection();
-    }
-    this.clear();
-  },
-
-  printAllSQL: function(exportType) {
-    var parms=this.formQueryHashSQL(0,this.liveGrid.options.maxPrint,exportType);
-    parms.hidden=this.liveGrid.listInvisible('index').join(',');
-    var url=this.dataSource+'?'+Rico.toQueryString(parms);
-    window.open(url,'',this.liveGrid.options.exportWindow);
-  },
-
-  printVisibleSQL: function(exportType) {
-    var parms=this.formQueryHashSQL(this.liveGrid.contentStartPos-1, this.liveGrid.pageSize, exportType);
-    parms.hidden=this.liveGrid.listInvisible('index').join(',');
-    var url=this.dataSource+'?'+Rico.toQueryString(parms);
-    window.open(url,'',this.liveGrid.options.exportWindow);
-  },
-
-  // for datasource that is a javascript function
-  _printAll: function(exportType) {
-    this.liveGrid.exportStart();
-    this.ajaxOptions.parameters = this.formQueryHashSQL(0,this.liveGrid.options.maxPrint);
-    this.ajaxOptions.onComplete = Rico.bind(this,'_jsExport',exportType);
-    this.dataSource(this.ajaxOptions);
-  },
-
-  _jsExport: function(exportType, newRows, newAttr, totalRows, errMsg) {
-    Rico.log("_jsExport: "+arguments.length);
-    if (errMsg) {
-      Rico.log("_jsExport: received error="+errMsg);
-      this.liveGrid.showMsg(Rico.getPhraseById("requestError",errMsg));
-      return;
-    }
-    this.exportBuffer(newRows,0);
-    this.liveGrid.exportFinish(exportType);
-  }
-
-};
-
-Rico.includeLoaded('ricoLiveGridAjax.js');
diff --git a/ricoClient/js/ricoLiveGridControls.js b/ricoClient/js/ricoLiveGridControls.js
deleted file mode 100644 (file)
index 6299a48..0000000
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-\r
-// -----------------------------------------------------\r
-//\r
-// Custom formatting for LiveGrid columns\r
-//\r
-// columnSpecs Usage: { type:'control', control:new Rico.TableColumn.CONTROLNAME() }\r
-//\r
-// -----------------------------------------------------\r
-
-Rico.TableColumn = {};
-\r
-Rico.TableColumn.checkboxKey = function(showKey) {
-  this.initialize(showKey);
-}
-
-Rico.TableColumn.checkboxKey.prototype = {
-/**
- * @class Custom formatting for a LiveGrid column.
- * Display unique key column as: &lt;checkbox&gt; &lt;key value&gt;
- * and keep track of which keys the user selects
- * Key values should not contain &lt;, &gt;, or &amp;
- * @constructs
- */
-  initialize: function(showKey) {
-    this._checkboxes=[];
-    this._spans=[];
-    this._KeyHash={};
-    this._showKey=showKey;\r
-  },
-
-  _create: function(gridCell,windowRow) {
-    this._checkboxes[windowRow]=Rico.createFormField(gridCell,'input','checkbox',this.liveGrid.tableId+'_chkbox_'+this.index+'_'+windowRow);
-    this._spans[windowRow]=Rico.createFormField(gridCell,'span',null,this.liveGrid.tableId+'_desc_'+this.index+'_'+windowRow);
-    this._clear(gridCell,windowRow);
-    Rico.eventBind(this._checkboxes[windowRow], 'click', Rico.eventHandle(this,'_onclick'));
-  },
-
-  _onclick: function(e) {
-    var elem=Event.element(e);
-    var windowRow=parseInt(elem.id.substr((elem.id.lastIndexOf('_',elem.id.length)+1)));  //faster than split
-    var v=this.getValue(windowRow);
-    if (elem.checked)
-      this._addChecked(v);
-    else
-      this._remChecked(v);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    var box=this._checkboxes[windowRow];
-    box.checked=false;
-    box.style.display='none';
-    this._spans[windowRow].innerHTML='';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    var box=this._checkboxes[windowRow];
-    box.style.display='';
-    box.checked=this._KeyHash[v];
-    if (this._showKey) this._spans[windowRow].innerHTML=v;
-  },
-
-  _SelectedKeys: function() {
-    return Rico.keys(this._KeyHash);
-  },
-
-  _addChecked: function(k){\r
-    this._KeyHash[k]=1;\r
-  },\r
-\r
-  _remChecked: function(k){\r
-    delete this._KeyHash[k];\r
-  }\r
-}
-
-
-Rico.TableColumn.checkbox = function(checkedValue, uncheckedValue, defaultValue, readOnly)
-{
-  this.initialize(checkedValue, uncheckedValue, defaultValue, readOnly);
-}
-
-Rico.TableColumn.checkbox.prototype = {
-/**
- * @class display checkboxes for two-valued column (e.g. yes/no)
- * @constructs
- */
-  initialize: function(checkedValue, uncheckedValue, defaultValue, readOnly) {
-    this._checkedValue=checkedValue;
-    this._uncheckedValue=uncheckedValue;
-    this._defaultValue=defaultValue || false;
-    this._readOnly=readOnly || false;
-    this._checkboxes=[];
-  },
-
-  _create: function(gridCell,windowRow) {
-    this._checkboxes[windowRow]=Rico.createFormField(gridCell,'input','checkbox',this.liveGrid.tableId+'_chkbox_'+this.index+'_'+windowRow);
-    this._clear(gridCell,windowRow);
-    if (this._readOnly)
-      this._checkboxes[windowRow].disabled=true;
-    else
-      Rico.eventBind(this._checkboxes[windowRow], 'click', Rico.eventHandle(this,'_onclick'));
-  },
-
-  _onclick: function(e) {
-    var elem=Event.element(e);
-    var windowRow=parseInt(elem.id.substr((elem.id.lastIndexOf('_',elem.id.length)+1)));  //faster than split
-    var newval=elem.checked ? this._checkedValue : this._uncheckedValue;
-    this.setValue(windowRow,newval);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    var box=this._checkboxes[windowRow];
-    box.checked=this._defaultValue;
-    box.style.display='none';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    var box=this._checkboxes[windowRow];
-    box.style.display='';
-    box.checked=(v==this._checkedValue);
-  }
-
-}
-
-
-Rico.TableColumn.textbox = function(boxSize, boxMaxLen, readOnly) {
-  this.initialize(boxSize, boxMaxLen, readOnly);
-}
-
-Rico.TableColumn.textbox.prototype = {
-/**
- * @class display value in a text box
- * @constructs
- */
-  initialize: function(boxSize, boxMaxLen, readOnly) {
-    this._boxSize=boxSize;
-    this._boxMaxLen=boxMaxLen;
-    this._readOnly=readOnly || false;
-    this._textboxes=[];
-  },
-
-  _create: function(gridCell,windowRow) {
-    var box=Rico.createFormField(gridCell,'input','text',this.liveGrid.tableId+'_txtbox_'+this.index+'_'+windowRow);
-    box.size=this._boxSize;
-    box.maxLength=this._boxMaxLen;
-    this._textboxes[windowRow]=box;
-    this._clear(gridCell,windowRow);
-    if (this._readOnly)
-      box.disabled=true;
-    else
-      Rico.eventBind(box, 'change', Rico.eventHandle(this,'_onchange'));
-  },
-
-  _onchange: function(e) {
-    var elem=Event.element(e);
-    var windowRow=parseInt(elem.id.substr((elem.id.lastIndexOf('_',elem.id.length)+1)));  //faster than split
-    this.setValue(windowRow,elem.value);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    var box=this._textboxes[windowRow];
-    box.value='';
-    box.style.display='none';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    var box=this._textboxes[windowRow];
-    box.style.display='';
-    box.value=v;
-  }
-
-}
-
-
-Rico.TableColumn.HighlightCell = function(chkcol,chkval,highlightColor,highlightBackground,chkop) {
-  this.initialize(chkcol,chkval,highlightColor,highlightBackground,chkop);
-}
-
-Rico.TableColumn.HighlightCell.prototype = {
-/**
- * @class highlight a grid cell when a particular value is present in the specified column
- * @constructs
- */
-  initialize: function(chkcol,chkval,highlightColor,highlightBackground,chkop) {\r
-    this._chkcol=chkcol;\r
-    this._chkval=chkval;
-    this._chkop=chkop;\r
-    this._highlightColor=highlightColor;\r
-    this._highlightBackground=highlightBackground;\r
-  },\r
-\r
-  _clear: function(gridCell,windowRow) {\r
-    gridCell.style.color='';\r
-    gridCell.style.backgroundColor='';\r
-    gridCell.innerHTML='&nbsp;';\r
-  },\r
-\r
-  _display: function(v,gridCell,windowRow) {\r
-    var gridval=this.liveGrid.buffer.getWindowValue(windowRow,this._chkcol);\r
-    var match;\r
-    switch(this._chkop){
-        case '!=':
-          match=(gridval!=this._chkval);
-          break;
-        case '>':
-          match=(gridval>this._chkval);
-          break;
-        case '<':
-          match=(gridval<this._chkval);
-          break;
-        case '>=':
-          match=(gridval>=this._chkval);
-          break;
-        case '<=':
-          match=(gridval<=this._chkval);
-          break;
-        case 'abs>':
-          match=(Math.abs(gridval)>this._chkval);
-          break;
-        case 'abs<':
-          match=(Math.abs(gridval)<this._chkval);
-          break;
-        case 'abs>=':
-          match=(Math.abs(gridval)>=this._chkval);
-          break;
-        case 'abs<=':
-          match=(Math.abs(gridval)<=this._chkval);
-          break;
-        default:
-          match=(gridval==this._chkval);
-          break;
-    }
-    gridCell.style.color=match ? this._highlightColor : '';\r
-    gridCell.style.backgroundColor=match ? this._highlightBackground : '';\r
-    gridCell.innerHTML=this._format(v);\r
-  }\r
-}
-
-
-Rico.TableColumn.bgColor = function() {
-}
-
-Rico.TableColumn.bgColor.prototype = {
-/**
- * @class database value contains a css color name/value
- */
- _clear: function(gridCell,windowRow) {
-    gridCell.style.backgroundColor='';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    gridCell.style.backgroundColor=v;
-  }
-
-}
-
-
-Rico.TableColumn.link = function(href,target,linktext) {
-  this.initialize(href,target,linktext);
-}
-
-Rico.TableColumn.link.prototype = {
-/**
- * @class database value contains a url to another page
- * @constructs
- */
-  initialize: function(href,target,linktext) {
-    this._href=href;
-    this._target=target;
-    this._linktext=linktext;
-    this._anchors=[];
-  },
-
-  _create: function(gridCell,windowRow) {
-    this._anchors[windowRow]=Rico.createFormField(gridCell,'a',null,this.liveGrid.tableId+'_a_'+this.index+'_'+windowRow);
-    if (this._target) this._anchors[windowRow].target=this._target;
-    this._clear(gridCell,windowRow);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    this._anchors[windowRow].href='';
-    this._anchors[windowRow].innerHTML='';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    var getWindowValue=Rico.bind(this.liveGrid.buffer,'getWindowValue');
-    var href=this._href=='self' ? v : this._href.replace(/\{\d+\}/g,
-      function ($1) {
-        var colIdx=parseInt($1.substr(1),10);
-        return encodeURIComponent(getWindowValue(windowRow,colIdx));
-      }
-    );
-    var desc=this._linktext || v;
-    if (href && desc) {
-      this._anchors[windowRow].href=href;
-      this._anchors[windowRow].innerHTML=desc;
-    } else {
-      this._clear(gridCell,windowRow);
-    }
-  }
-
-};
-
-
-Rico.TableColumn.image = function(prefix,suffix) {
-  this.initialize(prefix,suffix);
-};
-
-Rico.TableColumn.image.prototype = {
-/**
- * @class database value contains a url to an image
- * @constructs
- */
-  initialize: function(prefix,suffix) {
-    this._img=[];
-    this._prefix=prefix || '';
-    this._suffix=suffix || '';
-  },
-
-  _create: function(gridCell,windowRow) {
-    this._img[windowRow]=Rico.createFormField(gridCell,'img',null,this.liveGrid.tableId+'_img_'+this.index+'_'+windowRow);
-    this._clear(gridCell,windowRow);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    var img=this._img[windowRow];
-    img.style.display='none';
-    img.src='';
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    var img=this._img[windowRow];
-    this._img[windowRow].src=this._prefix+v+this._suffix;
-    img.style.display='';
-  }
-
-};
-
-
-Rico.TableColumn.lookup = function(map, defaultCode, defaultDesc) {
-  this.initialize(map, defaultCode, defaultDesc);
-};
-
-Rico.TableColumn.lookup.prototype = {
-/**
- * @class map a database value to a display value
- * @constructs
- */
-  initialize: function(map, defaultCode, defaultDesc) {
-    this._map=map;
-    this._defaultCode=defaultCode || '';
-    this._defaultDesc=defaultDesc || '&nbsp;';
-    this._sortfunc=Rico.bind(this,'_sortvalue');
-    this._codes=[];
-    this._descriptions=[];
-  },
-
-  _create: function(gridCell,windowRow) {
-    this._descriptions[windowRow]=Rico.createFormField(gridCell,'span',null,this.liveGrid.tableId+'_desc_'+this.index+'_'+windowRow);
-    this._codes[windowRow]=Rico.createFormField(gridCell,'input','hidden',this.liveGrid.tableId+'_code_'+this.index+'_'+windowRow);
-    this._clear(gridCell,windowRow);
-  },
-
-  _clear: function(gridCell,windowRow) {
-    this._codes[windowRow].value=this._defaultCode;
-    this._descriptions[windowRow].innerHTML=this._defaultDesc;
-  },
-
-  _sortvalue: function(v) {
-    return this._getdesc(v).replace(/&amp;/g, '&').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&nbsp;/g,' ');
-  },
-
-  _getdesc: function(v) {
-    var desc=this._map[v];
-    return (typeof desc=='string') ? desc : this._defaultDesc;
-  },
-
-  _export: function(v) {
-    return this._getdesc(v);
-  },
-
-  _display: function(v,gridCell,windowRow) {
-    this._codes[windowRow].value=v;
-    this._descriptions[windowRow].innerHTML=this._getdesc(v);
-  }
-
-};
-
-
-
-Rico.TableColumn.MultiLine = function() {
-};
-
-Rico.TableColumn.MultiLine.prototype = {
-/**
- * @class Fix issues with multiline content in IE
- */
-  _display: function(v,gridCell,windowRow) {\r
-    var newdiv = document.createElement("div");\r
-    newdiv.innerHTML = this._format(v);\r
-    newdiv.style.height='100%';\r
-    if (gridCell.firstChild)\r
-      gridCell.replaceChild(newdiv, gridCell.firstChild);\r
-    else\r
-      gridCell.appendChild(newdiv);\r
-  }\r
-
-};
-
-Rico.includeLoaded('ricoLiveGridControls.js');
diff --git a/ricoClient/js/ricoLiveGridForms.js b/ricoClient/js/ricoLiveGridForms.js
deleted file mode 100644 (file)
index c675913..0000000
+++ /dev/null
@@ -1,1129 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-if(typeof Rico=='undefined') throw("LiveGridForms requires the Rico JavaScript framework");
-
-
-Rico.TableEdit = function(liveGrid) {
-  this.initialize(liveGrid);
-}
-
-Rico.TableEdit.prototype = {
-/**
- * @class Supports editing LiveGrid data.
- * @constructs
- */
-  initialize: function(liveGrid) {
-    Rico.log('Rico.TableEdit initialize: '+liveGrid.tableId);
-    this.grid=liveGrid;
-    this.options = {
-      maxDisplayLen    : 20,    // max displayed text field length
-      panelHeight      : 200,   // size of tabbed panels
-      panelWidth       : 500,
-      compact          : false,    // compact corners
-      RecordName       : Rico.getPhraseById("record"),
-      updateURL        : window.location.href, // default is that updates post back to the generating page
-      showSaveMsg      : 'errors'  // disposition of database update responses (full - show full response, errors - show full response for errors and short response otherwise)
-    };
-    Rico.extend(this.options, liveGrid.options);
-    this.hasWF2=(document.implementation && document.implementation.hasFeature && document.implementation.hasFeature('WebForms', '2.0'));
-    this.menu=liveGrid.menu;
-    this.menu.options.dataMenuHandler=Rico.bind(this,'editMenu');
-    this.menu.ignoreClicks();
-    this.editText=Rico.getPhraseById("editRecord",this.options.RecordName);
-    this.cloneText=Rico.getPhraseById("cloneRecord",this.options.RecordName);
-    this.delText=Rico.getPhraseById("deleteRecord",this.options.RecordName);
-    this.addText=Rico.getPhraseById("addRecord",this.options.RecordName);
-    this.buttonHover=new Rico.HoverSet();
-    this.dateRegExp=/^\s*(\w+)(\W)(\w+)(\W)(\w+)/i;
-    Rico.EditControls.atLoad();
-    this.createKeyArray();
-    this.createEditDiv();
-    this.saveMsg=Rico.$(liveGrid.tableId+'_savemsg');
-    Rico.eventBind(document,"click", Rico.eventHandle(this,'clearSaveMsg'));
-    this.extraMenuItems=[];
-    this.responseHandler=Rico.bind(this,'processResponse');
-    Rico.log("Rico.TableEdit.initialize complete, hasWF2="+this.hasWF2);
-  },
-
-  createKeyArray: function() {
-    this.keys=[];
-    for (var i=0; i<this.grid.columns.length; i++) {
-      if (this.grid.columns[i].format && this.grid.columns[i].format.isKey)
-        this.keys.push({colidx:i});
-    }
-  },
-
-  createEditDiv: function() {
-
-    // create popup form
-
-    this.requestCount=1;
-    this.formPopup=new Rico.Window('', {overflow: this.options.panels ? 'hidden' : 'auto'});
-    this.formPopup.contentCell.className='ricoLG_editDiv';
-    if (this.options.canEdit || this.options.canAdd) {
-      this.startForm();
-      this.createForm(this.form);
-    } else {
-      var buttonClose=this.createButton(Rico.getPhraseById("close"));
-      Rico.eventBind(buttonClose,"click", Rico.eventHandle(this,'cancelEdit'), false);
-      this.createForm(this.formPopup.contentDiv);
-    }
-    this.editDivCreated=true;
-
-    // create responseDialog
-
-    this.responseDialog = this.grid.createDiv('editResponse',document.body);
-    this.responseDialog.style.display='none';
-
-    var buttonOK = document.createElement('button');
-    buttonOK.appendChild(document.createTextNode('OK'));
-    Rico.eventBind(buttonOK,"click", Rico.eventHandle(this,'ackResponse'));
-    this.responseDialog.appendChild(buttonOK);
-
-    this.responseDiv = this.grid.createDiv('editResponseText',this.responseDialog);
-
-    if (this.panelGroup) {
-      Rico.log("createEditDiv complete, requestCount="+this.requestCount);
-      Rico.runLater(50,this,'initPanelGroup');
-    }
-  },
-
-  initPanelGroup: function() {
-    this.requestCount--;
-    Rico.log("initPanelGroup: "+this.requestCount);
-    if (this.requestCount>0) return;
-    var wi=parseInt(this.options.panelWidth,10);
-    if (this.form) {
-      //this.form.style.width=(wi+10)+'px';
-      if (Rico.isWebKit) this.formPopup.container.style.display='block';  // this causes display to flash briefly
-      this.options.bgColor = Rico.Color.createColorFromBackground(this.form).toString();
-    }
-    this.formPopup.container.style.display='none';
-    //this.options.panelHdrWidth=(Math.floor(wi / this.options.panels.length)-20)+'px';
-    this.formPanels=new Rico.TabbedPanel(this.panelGroup, this.options);
-  },
-
-  notEmpty: function(v) {
-    return typeof(v)!='undefined';
-  },
-
-  startForm: function() {
-    this.form = document.createElement('form');
-    /** @ignore */
-    this.form.onsubmit=function() {return false;};
-    this.form.autocomplete="off"; // seems to fix "Permission denied..." errors in FF
-    this.formPopup.contentDiv.appendChild(this.form);
-
-    var tab = document.createElement('div');
-    tab.className='ButtonBar';
-    var button=tab.appendChild(this.createButton(Rico.getPhraseById("saveRecord",this.options.RecordName)));
-    Rico.eventBind(button,"click", Rico.eventHandle(this,'TESubmit'), false);
-    button=tab.appendChild(this.createButton(Rico.getPhraseById("cancel")));
-    Rico.eventBind(button,"click", Rico.eventHandle(this,'cancelEdit'), false);
-    this.form.appendChild(tab);
-
-    // hidden fields
-    this.hiddenFields = document.createElement('div');
-    this.hiddenFields.style.display='none';
-    this.action = this.appendHiddenField(this.grid.actionId,'');
-    var i,fldSpec;
-    for (i=0; i<this.grid.columns.length; i++) {
-      fldSpec=this.grid.columns[i].format;
-      if (fldSpec && fldSpec.FormView && fldSpec.FormView=="hidden")
-        this.appendHiddenField(fldSpec.FieldName,fldSpec.ColData);
-    }
-    for (var k=0; k<this.keys.length; k++) {
-      this.keys[k].keyField = this.appendHiddenField('_k'+this.keys[k].colidx,'');
-    }
-    this.form.appendChild(this.hiddenFields);
-  },
-
-  createButton: function(buttonLabel) {
-    var button = document.createElement('a');
-    button.href='javascript:void(0)';
-    button.innerHTML=buttonLabel;
-    button.className='RicoButton';
-    if (Rico.theme.button) Rico.addClass(button,Rico.theme.button);
-    this.buttonHover.add(button);
-    return button;
-  },
-
-  createPanel: function(i) {
-    var hasFields=false;
-    for (var j=0; j<this.grid.columns.length; j++) {
-      var fldSpec=this.grid.columns[j].format;
-      if (!fldSpec) continue;
-      if (!fldSpec.EntryType) continue;
-      if (fldSpec.EntryType=='H') continue;
-      if (fldSpec.FormView && fldSpec.FormView=="hidden") continue;
-      var panelIdx=fldSpec.panelIdx || 0;
-      if (panelIdx==i) {
-        hasFields=true;
-        break;
-      }
-    }
-    if (!hasFields) return null;
-    this.panelHdr[i] = document.createElement('li');
-    this.panelHdr[i].innerHTML=this.options.panels[i];
-    this.panelHdrs.appendChild(this.panelHdr[i]);
-    this.panelContent[i] = document.createElement('div');
-    this.panelContents.appendChild(this.panelContent[i]);
-    this.panelActualIdx[i]=this.panelCnt++;
-    return this.createFormTable(this.panelContent[i],'tabContent');
-  },
-
-  createForm: function(parentDiv) {
-    var i,div,fldSpec,panelIdx,tables=[];
-    this.panelCnt=0;
-    this.panelHdr=[];
-    this.panelContent=[];
-    if (this.options.panels) {
-      this.panelGroup = document.createElement('div');
-      this.panelGroup.className='tabPanelGroup';
-      this.panelHdrs = document.createElement('ul');
-      this.panelGroup.appendChild(this.panelHdrs);
-      this.panelContents = document.createElement('div');
-      this.panelContents.className='tabContentContainer';
-      this.panelGroup.appendChild(this.panelContents);
-      this.panelActualIdx=[];
-      parentDiv.appendChild(this.panelGroup);
-      if (this.grid.direction=='rtl') {
-        for (i=this.options.panels.length-1; i>=0; i--) {
-          tables[i]=this.createPanel(i);
-        }
-      } else {
-        for (i=0; i<this.options.panels.length; i++) {
-          tables[i]=this.createPanel(i);
-        }
-      }
-      parentDiv.appendChild(this.panelGroup);
-    } else {
-      div=document.createElement('div');
-      div.className='noTabContent';
-      tables[0]=this.createFormTable(div);
-      parentDiv.appendChild(div);
-    }
-    for (i=0; i<this.grid.columns.length; i++) {
-      fldSpec=this.grid.columns[i].format;
-      if (!fldSpec) continue;
-      panelIdx=fldSpec.panelIdx || 0;
-      if (tables[panelIdx]) this.appendFormField(this.grid.columns[i],tables[panelIdx]);
-      if (typeof fldSpec.pattern=='string') {
-        switch (fldSpec.pattern) {
-          case 'email':
-            fldSpec.regexp=/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
-            break;
-          case 'float-unsigned':
-            fldSpec.regexp=/^\d+(\.\d+)?$/;
-            break;
-          case 'float-signed':
-            fldSpec.regexp=/^[-+]?\d+(\.\d+)?$/;
-            break;
-          case 'int-unsigned':
-            fldSpec.regexp=/^\d+$/;
-            break;
-          case 'int-signed':
-            fldSpec.regexp=/^[-+]?\d+$/;
-            break;
-          default:
-            fldSpec.regexp=new RegExp(fldSpec.pattern);
-            break;
-        }
-      }
-    }
-  },
-
-  createFormTable: function(div) {
-    var tab=document.createElement('table');
-    tab.border=0;
-    div.appendChild(tab);
-    return tab;
-  },
-
-  appendHiddenField: function(name,value) {
-    var field=Rico.createFormField(this.hiddenFields,'input','hidden',name,name);
-    field.value=value;
-    return field;
-  },
-
-  appendFormField: function(column, table) {
-    var fmt=column.format;
-    if (!fmt.EntryType) return;
-    if (fmt.EntryType=="H") return;
-    if (fmt.FormView) return;
-    Rico.log('appendFormField: '+column.displayName+' - '+fmt.EntryType);
-    var row = fmt.noFormBreak && table.rows.length > 0 ? table.rows[table.rows.length-1] : table.insertRow(-1);
-    var hdr = row.insertCell(-1);
-    column.formLabel=hdr;
-    if (hdr.noWrap) hdr.noWrap=true;
-    var entry = row.insertCell(-1);
-    if (entry.noWrap) entry.noWrap=true;
-    hdr.id='lbl_'+fmt.FieldName;
-    var field, name=fmt.FieldName;
-    switch (fmt.EntryType) {
-      case 'TA':
-      case 'tinyMCE':
-        field=Rico.createFormField(entry,'textarea',null,name);
-        field.cols=fmt.TxtAreaCols;
-        field.rows=fmt.TxtAreaRows;
-        field.innerHTML=fmt.ColData;
-        hdr.style.verticalAlign='top';
-        break;
-      case 'R':
-      case 'RL':
-        field=Rico.createFormField(entry,'div',null,name);
-        if (fmt.DescriptionField) field.RicoUpdate=fmt.DescriptionField;
-        if (fmt.MultiSelect) Rico.addClass(field, 'MultiSelect');
-        if (fmt.isNullable && !fmt.MultiSelect) this.addSelectNone(field);
-        this.selectValuesRequest(field,column);
-        break;
-      case 'N':
-        field=Rico.createFormField(entry,'select',null,name);
-        if (fmt.isNullable) this.addSelectNone(field);
-        Rico.eventBind(field,"change", Rico.eventHandle(this,'checkSelectNew'));
-        this.selectValuesRequest(field,column);
-        field=document.createElement('span');
-        field.className='ricoEditLabel';
-        field.id='labelnew__'+fmt.FieldName;
-        field.innerHTML='&nbsp;&nbsp;&nbsp;'+Rico.getPhraseById('formNewValue').replace(' ','&nbsp;');
-        entry.appendChild(field);
-        name='textnew__'+fmt.FieldName;
-        field=Rico.createFormField(entry,'input','text',name,name);
-        break;
-      case 'S':
-      case 'SL':
-        if (fmt.ReadOnly) {
-          field=Rico.createFormField(entry,'input','text',name,name);
-          this.initField(field,fmt);
-        } else {
-          field=Rico.createFormField(entry,'select',null,name);
-          if (fmt.MultiSelect) field.multiple=true;
-          if (fmt.SelectRows) field.size=parseInt(fmt.SelectRows,10);
-          if (fmt.isNullable && !fmt.MultiSelect) this.addSelectNone(field);
-          if (fmt.DescriptionField) {
-            field.RicoUpdate=fmt.DescriptionField;
-            Rico.eventBind(field,"change", Rico.eventHandle(this,'selectClick'), false);
-          }
-          this.selectValuesRequest(field,column);
-        }
-        break;
-      case 'D':
-        if (!fmt.isNullable) fmt.required=true;
-        if (!fmt.dateFmt) fmt.dateFmt=Rico.dateFmt;
-        if (!fmt.Help) fmt.Help=fmt.dateFmt;
-        if (typeof fmt.min=='string') fmt.min=Rico.setISO8601(fmt.min) || new Date(fmt.min);
-        if (typeof fmt.max=='string') fmt.max=Rico.setISO8601(fmt.max) || new Date(fmt.max);
-        if (this.hasWF2) {
-          field=Rico.createFormField(entry,'input','date',name,name);
-          field.required=fmt.required;
-          if (fmt.min) field.min=Rico.toISO8601String(fmt.min,3);
-          if (fmt.max) field.max=Rico.toISO8601String(fmt.max,3);
-          field.required=fmt.required;
-          fmt.SelectCtl=null;  // use the WebForms calendar instead of the Rico calendar
-        } else {
-          field=Rico.createFormField(entry,'input','text',name,name);
-        }
-        this.initField(field,fmt);
-        break;
-      case 'I':
-        if (!fmt.isNullable) fmt.required=true;
-        if (!fmt.pattern) fmt.pattern='int-signed';
-        if (this.hasWF2) {
-          field=Rico.createFormField(entry,'input','number',name,name);
-          field.required=fmt.required;
-          field.min=fmt.min;
-          field.max=fmt.max;
-          field.step=1;
-        } else {
-          field=Rico.createFormField(entry,'input','text',name,name);
-        }
-        if (typeof fmt.min=='string') fmt.min=parseInt(fmt.min,10);
-        if (typeof fmt.max=='string') fmt.max=parseInt(fmt.max,10);
-        this.initField(field,fmt);
-        break;
-      case 'F':
-        if (!fmt.isNullable) fmt.required=true;
-        if (!fmt.pattern) fmt.pattern='float-signed';
-        field=Rico.createFormField(entry,'input','text',name,name);
-        this.initField(field,fmt);
-        if (typeof fmt.min=='string') fmt.min=parseFloat(fmt.min);
-        if (typeof fmt.max=='string') fmt.max=parseFloat(fmt.max);
-        break;
-      default:
-        field=Rico.createFormField(entry,'input','text',name,name);
-        if (!fmt.isNullable && fmt.EntryType!='T') fmt.required=true;
-        this.initField(field,fmt);
-        break;
-    }
-    if (field) {
-      if (fmt.SelectCtl)
-        Rico.EditControls.applyTo(column,field);
-    }
-    var hdrSuffix='';
-    hdr.className='ricoEditLabel';
-    if (fmt.Help) {
-      hdr.title=fmt.Help;
-      hdrSuffix="&nbsp;<img src='"+Rico.imgDir+"info_icon.gif'>";
-      Rico.addClass(hdr,'ricoHelp');
-    }
-    var hdrText=fmt.EntryType.length>1 && fmt.EntryType.charAt(1)=='L' ? column.next.displayName : column.displayName;
-    hdr.innerHTML=hdrText+hdrSuffix;
-  },
-
-  addSelectNone: function(field) {
-    this.addSelectOption(field,this.options.TableSelectNone,Rico.getPhraseById("selectNone"));
-  },
-
-  initField: function(field,fmt) {
-    if (fmt.Length) {
-      field.maxLength=fmt.Length;
-      field.size=Math.min(fmt.Length, this.options.maxDisplayLen);
-    }
-    field.value=fmt.ColData;
-  },
-  
-  selectClick: function(e) {
-    var SelObj=Rico.eventElement(e);
-    if (SelObj.readOnly) {
-      Rico.eventStop(e);
-      return false;
-    }
-    if (SelObj.RicoUpdate) {
-      var opt=SelObj.options[SelObj.selectedIndex];
-      Rico.$(SelObj.RicoUpdate).value=opt.innerHTML;
-    }
-  },
-  
-  radioClick: function(e) {
-    var ChkBoxObj=Rico.eventElement(e);
-    if (ChkBoxObj.readOnly) {
-      Rico.eventStop(e);
-      return false;
-    }
-    var container=Rico.getParentByTagName(ChkBoxObj,'div');
-    if (container.RicoUpdate) {
-      Rico.$(container.RicoUpdate).value=ChkBoxObj.nextSibling.innerHTML;
-    }
-  },
-
-  checkSelectNew: function(e) {
-    this.updateSelectNew(Rico.eventElement(e));
-  },
-
-  updateSelectNew: function(SelObj) {
-    var vis=(SelObj.value==this.options.TableSelectNew) ? "" : "hidden";
-    Rico.$("labelnew__" + SelObj.id).style.visibility=vis;
-    Rico.$("textnew__" + SelObj.id).style.visibility=vis;
-  },
-
-  selectValuesRequest: function(elem,column) {
-    var fldSpec=column.format;
-    if (fldSpec.SelectValues) {
-      var valueList=fldSpec.SelectValues.split(',');
-      for (var i=0; i<valueList.length; i++)
-        this.addSelectOption(elem,valueList[i],valueList[i],i);
-    } else {
-      this.requestCount++;
-      var options={};
-      Rico.extend(options, this.grid.buffer.ajaxOptions);
-      options.parameters = {id: this.grid.tableId, offset: '0', page_size: '-1', edit: column.index};
-      options.parameters[this.grid.actionId]="query";
-      options.onComplete = Rico.bind(this,'selectValuesUpdate',elem);
-      new Rico.ajaxRequest(this.grid.buffer.dataSource, options);
-      Rico.log("selectValuesRequest: "+fldSpec.FieldName);
-    }
-  },
-
-  selectValuesUpdate: function(elem,request) {
-    var response = request.responseXML.getElementsByTagName("ajax-response");
-    Rico.log("selectValuesUpdate: "+request.status);
-    if (response == null || response.length != 1) return;
-    response=response[0];
-    var error = response.getElementsByTagName('error');
-    if (error.length > 0) {
-      var errmsg=Rico.getContentAsString(error[0],this.grid.buffer.isEncoded);
-      Rico.log("Data provider returned an error:\n"+errmsg);
-      alert(Rico.getPhraseById("requestError",errmsg));
-      return null;
-    }
-    response=response.getElementsByTagName('response')[0];
-    var rowsElement = response.getElementsByTagName('rows')[0];
-    var rows = this.grid.buffer.dom2jstable(rowsElement);
-    Rico.log("selectValuesUpdate: id="+elem.id+' rows='+rows.length);
-    for (var i=0; i<rows.length; i++) {
-      if (rows[i].length>0) {
-        var c0=rows[i][0];
-        var c1=(rows[i].length>1) ? rows[i][1] : c0;
-        this.addSelectOption(elem,c0,c1,i);
-      }
-    }
-    if (Rico.$('textnew__'+elem.id))
-      this.addSelectOption(elem,this.options.TableSelectNew,Rico.getPhraseById("selectNewVal"));
-    if (this.panelGroup)
-      Rico.runLater(50,this,'initPanelGroup');
-  },
-
-  addSelectOption: function(elem,value,text,idx) {
-    switch (elem.tagName.toLowerCase()) {
-      case 'div':
-        var opt=Rico.createFormField(elem,'input', Rico.hasClass(elem, 'MultiSelect') ? 'checkbox' : 'radio', elem.id+'_'+idx, elem.id);
-        opt.value=value;
-        var lbl=document.createElement('label');
-        lbl.innerHTML=text;
-        lbl.htmlFor=opt.id;
-        elem.appendChild(lbl);
-        Rico.eventBind(opt,"click", Rico.eventHandle(this,'radioClick'), false);
-        break;
-      case 'select':
-        Rico.addSelectOption(elem,value,text);
-        break;
-    }
-  },
-
-  clearSaveMsg: function() {
-    if (this.saveMsg) this.saveMsg.innerHTML="";
-  },
-
-  addMenuItem: function(menuText,menuAction,enabled) {
-    this.extraMenuItems.push({menuText:menuText,menuAction:menuAction,enabled:enabled});
-  },
-
-  editMenu: function(grid,r,c,onBlankRow) {
-    this.clearSaveMsg();
-    if (this.grid.buffer.sessionExpired==true || this.grid.buffer.startPos<0) return false;
-    this.rowIdx=r;
-    var elemTitle=Rico.$('pageTitle');
-    var pageTitle=elemTitle ? elemTitle.innerHTML : document.title;
-    this.menu.addMenuHeading(pageTitle);
-    if (onBlankRow==false) {
-      for (var i=0; i<this.extraMenuItems.length; i++) {
-        this.menu.addMenuItem(this.extraMenuItems[i].menuText,this.extraMenuItems[i].menuAction,this.extraMenuItems[i].enabled);
-      }
-      this.menu.addMenuItem(this.editText,Rico.bind(this,'editRecord'),this.canEdit(r));
-      this.menu.addMenuItem(this.delText,Rico.bind(this,'deleteRecord'),this.canDelete(r));
-      if (this.options.canClone) {
-        this.menu.addMenuItem(this.cloneText,Rico.bind(this,'cloneRecord'),this.canAdd(r) && this.canEdit(r));
-      }
-    }
-    this.menu.addMenuItem(this.addText,Rico.bind(this,'addRecord'),this.canAdd(r));
-    return true;
-  },
-  
-  canAdd: function(r) {
-    return (typeof this.options.canAdd=='function') ? this.options.canAdd(r) : this.options.canAdd;
-  },
-
-  canEdit: function(r) {
-    return (typeof this.options.canEdit=='function') ? this.options.canEdit(r) : this.options.canEdit;
-  },
-
-  canDelete: function(r) {
-    return (typeof this.options.canDelete=='function') ? this.options.canDelete(r) : this.options.canDelete;
-  },
-
-  cancelEdit: function(e) {
-    Rico.eventStop(e);
-    for (var i=0; i<this.grid.columns.length; i++) {
-      if (this.grid.columns[i].format && this.grid.columns[i].format.SelectCtl)
-        Rico.EditControls.close(this.grid.columns[i].format.SelectCtl);
-    }
-    this.makeFormInvisible();
-    this.grid.highlightEnabled=true;
-    this.menu.cancelmenu();
-    return false;
-  },
-
-  setField: function(fldnum,fldvalue) {
-    var fldSpec=this.grid.columns[fldnum].format;
-    var e=Rico.$(fldSpec.FieldName);
-    var a,i,o,elems,opts,txt;
-    if (!e) return;
-    Rico.log('setField: '+fldSpec.FieldName+'='+fldvalue);
-    switch (e.tagName.toUpperCase()) {
-      case 'DIV':
-        elems=e.getElementsByTagName('INPUT');
-        o={}
-        if (fldSpec.MultiSelect && fldvalue) {
-          a=fldvalue.split(',');
-          for (var i=0; i<a.length; i++) o[a[i]]=1;
-        } else {
-          o[fldvalue]=1;
-        }
-        for (i=0; i<elems.length; i++)
-          elems[i].checked=o[elems[i].value]==1;
-        break;
-      case 'INPUT':
-        if (fldSpec.EntryType=='D' && fldvalue!=fldSpec.ColData) {
-          // remove time data if it exists
-          a=fldvalue.split(/\s|T/);
-          fldvalue=a[0];
-          if (this.isTextInput(e)) {
-            var d=Rico.setISO8601(fldvalue);
-            if (d) fldvalue=Rico.formatDate(d,fldSpec.dateFmt);
-          }
-        }
-        e.value=fldvalue;
-        break;
-      case 'SELECT':
-        opts=e.options;
-        //alert('setField SELECT: id='+e.id+'\nvalue='+fldvalue+'\nopt cnt='+opts.length)
-        o={}
-        if (fldSpec.MultiSelect && fldvalue) {
-          a=fldvalue.split(',');
-          for (var i=0; i<a.length; i++) o[a[i]]=1;
-          for (i=0; i<opts.length; i++)
-            opts[i].selected=o[opts[i].value]==1;
-        } else {
-          for (i=0; i<opts.length; i++) {
-            if (opts[i].value==fldvalue) {
-              e.selectedIndex=i;
-              break;
-            }
-          }
-        }
-        if (fldSpec.EntryType=='N') {
-          txt=Rico.$('textnew__'+e.id);
-          if (!txt) alert('Warning: unable to find id "textnew__'+e.id+'"');
-          txt.value=fldvalue;
-          if (e.selectedIndex!=i) e.selectedIndex=opts.length-1;
-          this.updateSelectNew(e);
-        }
-        return;
-      case 'TEXTAREA':
-        e.value=fldvalue;
-        if (fldSpec.EntryType=='tinyMCE' && typeof(tinyMCE)!='undefined' && this.initialized) {
-          if (tinyMCE.updateContent) {
-            tinyMCE.updateContent(e.id);  // version 2.x
-          } else {
-            tinyMCE.execInstanceCommand(e.id, 'mceSetContent', false, fldvalue);  // version 3.x
-          }
-        }
-        return;
-    }
-  },
-
-  setReadOnly: function(action) {
-    for (var ro,i=0; i<this.grid.columns.length; i++) {
-      var fldSpec=this.grid.columns[i].format;
-      if (!fldSpec) continue;
-      var e=Rico.$(fldSpec.FieldName);
-      if (!e) continue;
-      switch (action) {
-        case 'ins': ro=!fldSpec.Writeable || fldSpec.ReadOnly || fldSpec.UpdateOnly; break;
-        case 'upd': ro=!fldSpec.Writeable || fldSpec.ReadOnly || fldSpec.InsertOnly; break;
-        default:    ro=false; break;
-      }
-      switch (e.tagName.toUpperCase()) {
-        case 'DIV':
-          var elems=e.getElementsByTagName('INPUT');
-          for (var j=0; j<elems.length; j++) {
-            elems[j].disabled=ro;
-          }
-          break;
-        case 'SELECT':
-          if (fldSpec.EntryType=='N') {
-            var txt=Rico.$('textnew__'+e.id);
-            txt.disabled=ro;
-          }
-          e.disabled=ro;
-          break;
-        case 'TEXTAREA':
-        case 'INPUT':
-          e.disabled=ro;
-          if (fldSpec.selectIcon) fldSpec.selectIcon.style.display=ro ? 'none' : '';
-          break;
-      }
-    }
-  },
-
-  hideResponse: function(msg) {
-    this.responseDiv.innerHTML=msg;
-    this.responseDialog.style.display='none';
-  },
-
-  showResponse: function() {
-    var offset=Rico.cumulativeOffset(this.grid.outerDiv);
-    offset.top+=Rico.docScrollTop();
-    this.responseDialog.style.top=offset.top+"px";
-    this.responseDialog.style.left=offset.left+"px";
-    this.responseDialog.style.display='';
-  },
-
-  processResponse: function(xhr) {
-    var responseText,success=true;
-    Rico.log('Processing response from form submittal');
-    this.responseDiv.innerHTML=xhr.responseText;
-    var respNodes=Rico.select('.ricoFormResponse',this.responseDiv);
-    if (respNodes) {
-      // generate a translated response
-      var phraseId=Rico.trim(respNodes[0].className).split(/\s+/)[1];
-      responseText=Rico.getPhraseById(phraseId,this.options.RecordName);
-    } else {
-      // present the response as sent from the server (untranslated)
-      var ch=this.responseDiv.childNodes;
-      for (var i=ch.length-1; i>=0; i--) {
-        if (ch[i].nodeType==1 && ch[i].nodeName!='P' && ch[i].nodeName!='DIV' && ch[i].nodeName!='BR')
-          this.responseDiv.removeChild(ch[i]);
-      }
-      responseText=Rico.stripTags(this.responseDiv.innerHTML);
-      success=(responseText.toLowerCase().indexOf('error')==-1);
-    }
-    if (success && this.options.showSaveMsg!='full') {
-      this.hideResponse('');
-      this.grid.resetContents();
-      this.grid.buffer.foundRowCount = false;
-      this.grid.buffer.fetch(this.grid.lastRowPos || 0);
-      if (this.saveMsg) this.saveMsg.innerHTML='&nbsp;'+responseText+'&nbsp;';
-    }
-    this.processCallback(this.options.onSubmitResponse);
-    Rico.log('Processing response completed');
-  },
-
-  processCallback: function(callback) {
-    switch (typeof callback) {
-      case 'string': return eval(callback);
-      case 'function': return callback();
-    }
-  },
-
-  // called when ok pressed on error response message
-  ackResponse: function(e) {
-    this.hideResponse('');
-    this.grid.highlightEnabled=true;
-  },
-
-  cloneRecord: function() {
-    this.formPopup.setTitle(this.cloneText);
-    this.displayEditForm("ins");
-  },
-
-  editRecord: function() {
-    this.formPopup.setTitle(this.editText);
-    this.displayEditForm("upd");
-  },
-
-  displayEditForm: function(action) {
-    this.grid.highlightEnabled=false;
-    this.menu.cancelmenu();
-    this.hideResponse(Rico.getPhraseById('saving'));
-    this.grid.outerDiv.style.cursor = 'auto';
-    this.action.value=action;
-    for (var i=0; i<this.grid.columns.length; i++) {
-      var c=this.grid.columns[i];
-      if (c.format) {
-        var v=c.getValue(this.rowIdx);
-        this.setField(i,v);
-        if (c.format.selectDesc) {
-          if (c.format.EntryType.length>1 && c.format.EntryType.charAt(1)=='L')
-            v=this.grid.columns[i+1].getValue(this.rowIdx);
-          v=c._format(v);
-          if (v==='') v='&nbsp;';
-          c.format.selectDesc.innerHTML=v;
-        }
-        if (c.format.SelectCtl)
-          Rico.EditControls.displayClrImg(c, !c.format.InsertOnly);
-      }
-    }
-    this.setReadOnly(action);
-    for (var k=0; k<this.keys.length; k++) {
-      this.keys[k].keyField.value = this.grid.buffer.getWindowValue(this.rowIdx,this.keys[k].colidx);
-    }
-    this.makeFormVisible(this.rowIdx);
-  },
-  
-  addPrepare: function() {
-    this.hideResponse(Rico.getPhraseById('saving'));
-    this.form.reset();
-    this.setReadOnly("ins");
-    this.action.value="ins";
-    for (var i=0; i<this.grid.columns.length; i++) {
-      var c=this.grid.columns[i];
-      if (c.format) {
-        this.setField(i,c.format.ColData);
-        if (c.format.SelectCtl) {
-          Rico.EditControls.resetValue(c);
-          Rico.EditControls.displayClrImg(c, !c.format.UpdateOnly);
-        }
-      }
-    }
-  },
-
-  addRecord: function() {
-    this.menu.cancelmenu();
-    this.formPopup.setTitle(this.addText);
-    this.addPrepare();
-    this.makeFormVisible(-1);
-    if (this.formPanels) this.formPanels.select(0);
-  },
-
-  drillDown: function(e,masterColNum,detailColNum) {
-    return this.grid.drillDown.apply(this.grid, arguments);
-  },
-
-  // set filter on a detail grid that is in a master-detail relationship
-  setDetailFilter: function(colNumber,filterValue) {
-    this.grid.setDetailFilter(colNumber,filterValue);
-  },
-
-  makeFormVisible: function(row) {
-    this.formPopup.container.style.display='block';
-
-    // set left position
-    var editWi=this.formPopup.container.offsetWidth;
-    var odOffset=Rico.cumulativeOffset(this.grid.outerDiv);
-    var winWi=Rico.windowWidth();
-    this.formPopup.container.style.left=editWi+odOffset.left > winWi ? (winWi-editWi)+'px' : (odOffset.left+1)+'px';
-
-    // set top position
-    var scrTop=Rico.docScrollTop();
-    var editHt=this.formPopup.container.offsetHeight;
-    var newTop=odOffset.top+this.grid.hdrHt+scrTop;
-    var bottom=Rico.windowHeight()+scrTop;
-    if (row >= 0) {
-      newTop+=(row+1)*this.grid.rowHeight;
-      if (newTop+editHt>bottom) newTop-=(this.formPopup.contentCell.offsetHeight+this.grid.rowHeight);
-    } else {
-      if (newTop+editHt>bottom) newTop=bottom-editHt-2;
-    }
-
-    if (this.processCallback(this.options.formOpen) === false) return;
-    this.formPopup.openPopup(null,Math.max(newTop,scrTop));
-    this.formPopup.container.style.visibility='visible';
-    Rico.EditControls.setZ(Rico.getStyle(this.formPopup.container,'zIndex'));
-    if (this.initialized) return;
-
-    var i, spec;
-    for (i = 0; i < this.grid.columns.length; i++) {
-      spec=this.grid.columns[i].format;
-      if (!spec || !spec.EntryType || !spec.FieldName) continue;
-      switch (spec.EntryType) {
-        case 'tinyMCE':
-          if (typeof tinyMCE!='undefined') tinyMCE.execCommand('mceAddControl', true, spec.FieldName);
-          break;
-      }
-    }
-    this.initialized=true;
-  },
-
-  makeFormInvisible: function() {
-    this.formPopup.container.style.visibility='hidden';
-    this.formPopup.closePopup();
-    this.processCallback(this.options.formClose);
-  },
-
-  getConfirmDesc: function(rowIdx) {
-    return Rico.stripTags(this.grid.cell(rowIdx,this.options.ConfirmDeleteCol).innerHTML).replace('&nbsp;',' '); //.unescapeHTML();
-  },
-
-  deleteRecord: function() {
-    this.menu.cancelmenu();
-    var desc;
-    switch(this.options.ConfirmDeleteCol){
-      case -1 :
-        desc=Rico.getPhraseById("thisRecord",this.options.RecordName);
-        break;
-      case -2 : // Use key/column header to identify the row
-        for (var k=0; k<this.keys.length; k++) {
-          var i=this.keys[k].colidx;
-          var fmt=this.grid.columns[i].format;
-          if (fmt.EntryType.length>1 && fmt.EntryType.charAt(1)=='L') i++;
-          var value=Rico.stripTags(this.grid.cell(rowIdx,i).innerHTML).replace(/&nbsp;/g,' ');
-          if (desc) desc+=', ';
-          desc+=this.grid.columns[i].displayName+" "+value;
-        }
-        break;
-      default   :
-        desc='\"' + Rico.truncate(this.getConfirmDesc(this.rowIdx),50) + '\"';
-        break;
-    }
-    if (!this.options.ConfirmDelete.valueOf || confirm(Rico.getPhraseById("confirmDelete",desc))) {
-      this.hideResponse(Rico.getPhraseById('deleting'));
-      this.showResponse();
-      var parms={};
-      parms[this.grid.actionId]="del";
-      for (var k=0; k<this.keys.length; k++) {
-        var i=this.keys[k].colidx;
-        var value=this.grid.columns[i].getValue(this.rowIdx);
-        parms['_k'+i]=value;  // prototype does the encoding automatically
-        //parms['_k'+i]=encodeURIComponent(value);
-      }
-      new Rico.ajaxRequest(this.options.updateURL, {parameters:parms,method:'post',onComplete:this.responseHandler});
-    }
-    this.menu.cancelmenu();
-  },
-
-  validationMsg: function(elem,colnum,phraseId) {
-    var col=this.grid.columns[colnum];
-    if (this.formPanels) this.formPanels.select(this.panelActualIdx[col.format.panelIdx]);
-    var label=Rico.stripTags(col.formLabel.innerHTML).replace(/&nbsp;/g,' ');
-    var msg=Rico.getPhraseById(phraseId," \"" + label + "\"");
-    Rico.log(' Validation error: '+msg);
-    if (col.format.Help) msg+="\n\n"+col.format.Help;
-    alert(msg);
-    setTimeout(function() { try { elem.focus(); elem.select(); } catch(e) {}; }, 10);
-    return false;
-  },
-  
-  isTextInput: function(elem) {
-    if (!elem) return false;
-    if (elem.tagName.toLowerCase()!='input') return false;
-    if (elem.type.toLowerCase()!='text') return false;
-    if (elem.readOnly) return false;
-    if (!Rico.visible(elem)) return false;
-    return true;
-  },
-  
-  parseDate: function(v, dateFmt) {
-    dateParts={};
-    if (!this.dateRegExp.exec(dateFmt)) return NaN;
-    dateParts[RegExp.$1]=0;
-    dateParts[RegExp.$3]=1;
-    dateParts[RegExp.$5]=2;
-    var aDate = v.split(/\D/);
-    var d=new Date();
-    var curyr=d.getFullYear();
-    if (aDate.length==2 && dateParts.yyyy==2) aDate.push(curyr);
-    if (aDate.length!=3) return NaN;
-    var dd=parseInt(aDate[dateParts.dd], 10);
-    if (dd==0 || dd>31) return NaN;
-    var mm=parseInt(aDate[dateParts.mm], 10) - 1;
-    if (mm > 11) return NaN;
-    var yy=parseInt(aDate[dateParts.yyyy], 10);
-    if (yy < 100) {
-      // apply a century to 2-digit years
-      yy+=curyr - (curyr % 100);
-    }
-    d.setFullYear(yy,mm,dd);
-    return d;
-  },
-
-  TESubmit: function(e) {
-    var i,ro,lbl,spec,elem,n,dateValues=[];
-
-    Rico.eventStop(e);
-    Rico.log('Event: TESubmit called to validate input');
-
-    // check fields that are supposed to be non-blank
-
-    for (i = 0; i < this.grid.columns.length; i++) {
-      spec=this.grid.columns[i].format;
-      if (!spec || !spec.EntryType || !spec.FieldName) continue;
-      elem=Rico.$(spec.FieldName);
-      if (!this.isTextInput(elem)) continue;
-      switch (this.action.value) {
-        case 'ins': ro=!spec.Writeable || spec.ReadOnly || spec.UpdateOnly; break;
-        case 'upd': ro=!spec.Writeable || spec.ReadOnly || spec.InsertOnly; break;
-        default:    ro=false; break;
-      }
-      if (ro) continue;  // readonly, so don't validate
-      Rico.log(' Validating field #'+i+' EntryType='+spec.EntryType+' ('+spec.FieldName+')');
-
-      // check for blanks
-      if (elem.value.length == 0) {
-        if (spec.required)
-          return this.validationMsg(elem,i,"formPleaseEnter");
-        else
-          continue;
-      }
-
-      // check pattern
-      if (elem.value.length > 0 && spec.regexp && !spec.regexp.test(elem.value))
-        return this.validationMsg(elem,i,"formInvalidFmt");
-
-      // check min/max and date values
-      switch (spec.EntryType.charAt(0)) {
-        case 'I': n=parseInt(elem.value,10); break;
-        case 'F': n=parseFloat(elem.value); break;
-        case 'D': 
-          n=this.parseDate(elem.value,spec.dateFmt);
-          if (isNaN(n)) return this.validationMsg(elem,i,"formInvalidFmt");
-          dateValues.push({e:elem,v:n});
-          break;
-        default:  n=NaN; break;
-      }
-      if (typeof spec.min!='undefined' && !isNaN(n) && n < spec.min)
-        return this.validationMsg(elem,i,"formOutOfRange");
-      if (typeof spec.max!='undefined' && !isNaN(n) && n > spec.max)
-        return this.validationMsg(elem,i,"formOutOfRange");
-    }
-    if (this.processCallback(this.options.formSubmit) === false) return false;
-
-    // update drop-down for any columns with entry type of N
-
-    for (i = 0; i < this.grid.columns.length; i++) {
-      spec=this.grid.columns[i].format;
-      if (!spec || !spec.EntryType || !spec.FieldName) continue;
-      if (spec.EntryType.charAt(0) != 'N') continue;
-      var SelObj=Rico.$(spec.FieldName);
-      if (!SelObj || SelObj.value!=this.options.TableSelectNew) continue;
-      var newtext=Rico.$("textnew__" + SelObj.id).value;
-      this.addSelectOption(SelObj,newtext,newtext);
-    }
-    
-    // set date values to ISO format
-    for (i = 0; i < dateValues.length; i++) {
-      dateValues[i].e.value = Rico.formatDate(dateValues[i].v,'yyyy-mm-dd');
-    }
-
-    if (typeof tinyMCE!='undefined') tinyMCE.triggerSave();
-    this.makeFormInvisible();
-    this.sendForm();
-    this.menu.cancelmenu();
-    return false;
-  },
-  
-  sendForm: function() {
-    this.setReadOnly("reset");  // reset disabled flag so that all fields are sent to server
-    this.showResponse();
-    Rico.log("sendForm: "+this.grid.tableId);
-    Rico.ajaxSubmit(this.form, this.options.updateURL, {method:'post',onComplete:this.responseHandler});
-  }
-};
-
-
-/**
- * @namespace Registers custom popup widgets to fill in a text box (e.g. ricoCalendar and ricoTree)
- * <pre>
- * Custom widget must implement:
- *   open() method (make control visible)
- *   close() method (hide control)
- *   container property (div element that contains the control)
- *   id property (uniquely identifies the widget class)
- *
- * widget calls returnValue method to return a value to the caller
- *
- * this object handles clicks on the control's icon and positions the control appropriately.
- * </pre>
- */
-Rico.EditControls = {
-  widgetList : {},
-  elemList   : {},
-  zIndex     : 0,
-
-  register: function(widget, imgsrc) {
-    this.widgetList[widget.id] = {imgsrc:imgsrc, widget:widget, currentEl:''};
-    widget.returnValue=Rico.bind(this,'setValue',widget);
-    Rico.log("Rico.EditControls.register:"+widget.id);
-  },
-  
-  setZ: function(z) {
-    this.zIndex=Math.max(this.zIndex,z+10);
-  },
-
-  atLoad: function() {
-    for (var id in this.widgetList) {
-      var widget=this.widgetList[id].widget;
-      if (widget.atLoad && !widget.atLoadComplete) {
-        Rico.log("Rico.EditControls.atLoad: "+id);
-        widget.atLoad();
-        widget.atLoadComplete=true;
-      }
-    }
-  },
-
-  applyTo: function(column,inputCtl) {
-    var wInfo=this.widgetList[column.format.SelectCtl];
-    if (!wInfo) return;
-    Rico.log('Rico.EditControls.applyTo: '+column.displayName+' : '+column.format.SelectCtl);
-    var descSpan = document.createElement('span');
-    var newimg = document.createElement('img');
-    newimg.style.paddingLeft='4px';
-    newimg.style.cursor='pointer';
-    newimg.align='top';
-    newimg.src=wInfo.imgsrc;
-    newimg.id=this.imgId(column.format.FieldName);
-    Rico.eventBind(newimg,"click", Rico.eventHandle(this,'processClick'));
-    inputCtl.parentNode.appendChild(descSpan);
-    inputCtl.parentNode.appendChild(newimg);
-    inputCtl.style.display='none';    // comment out this line for debugging
-    var clr;
-    if (column.format.isNullable) {
-      clr=Rico.clearButton(Rico.eventHandle(this,'processClear'));
-      clr.id=newimg.id+'_clear';
-      inputCtl.parentNode.appendChild(clr);
-    }
-    this.elemList[newimg.id] = {descSpan:descSpan, inputCtl:inputCtl, widget:wInfo.widget, listObj:wInfo, column:column, clrimg:clr};
-    column.format.selectIcon=newimg;
-    column.format.selectDesc=descSpan;
-  },
-
-  displayClrImg: function(column,bShow) {
-    var el=this.elemList[this.imgId(column.format.FieldName)];
-    //alert(column.format.FieldName+': '+bShow+' '+typeof(el.clrimg));
-    if (el && el.clrimg) el.clrimg.style.display=bShow ? 'inline-block' : 'none';
-  },
-
-  processClear: function(e) {
-    var elem=Rico.eventElement(e);
-    var el=this.elemList[elem.id.slice(0,-6)];
-    if (!el) return;
-    el.inputCtl.value='';
-    el.descSpan.innerHTML=el.column._format('');
-  },
-
-  processClick: function(e) {
-    var elem=Rico.eventElement(e);
-    var el=this.elemList[elem.id];
-    if (!el) return;
-    if (el.listObj.currentEl==elem.id && el.widget.container.style.display!='none') {
-      el.widget.close();
-      el.listObj.currentEl='';
-    } else {
-      el.listObj.currentEl=elem.id;
-      Rico.log('Rico.EditControls.processClick: '+el.widget.id+' : '+el.inputCtl.value);
-      el.widget.container.style.zIndex=this.zIndex;
-      el.widget.open(el.inputCtl.value,el.column);     // this may change the size of the widget
-      Rico.positionCtlOverIcon(el.widget.container,elem);
-    }
-  },
-
-  imgId: function(fieldname) {
-    return 'icon_'+fieldname;
-  },
-
-  resetValue: function(column) {
-    var el=this.elemList[this.imgId(column.format.FieldName)];
-    if (!el) return;
-    el.inputCtl.value=column.format.ColData;
-    var v=column._format(column.format.ColData);
-    if (v==='') v='&nbsp;';
-    el.descSpan.innerHTML=v;
-  },
-
-  setValue: function(widget,newVal,newDesc) {
-    var wInfo=this.widgetList[widget.id];
-    if (!wInfo) return null;
-    var id=wInfo.currentEl;
-    if (!id) return null;
-    var el=this.elemList[id];
-    if (!el) return null;
-    el.inputCtl.value=newVal;
-    if (!newDesc) newDesc=el.column._format(newVal);
-    el.descSpan.innerHTML=newDesc;
-    if (el.column.format.DescriptionField)
-      Rico.$(el.column.format.DescriptionField).value = newDesc;
-    //alert(widget.id+':'+id+':'+el.inputCtl.id+':'+el.inputCtl.value+':'+newDesc);
-  },
-
-  close: function(id) {
-    var wInfo=this.widgetList[id];
-    if (!wInfo) return;
-    if (wInfo.widget.container.style.display!='none')
-      wInfo.widget.close();
-  }
-};
-
-Rico.includeLoaded('ricoLiveGridForms.js');
diff --git a/ricoClient/js/ricoLiveGridMenu.js b/ricoClient/js/ricoLiveGridMenu.js
deleted file mode 100644 (file)
index 7ca9385..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
- if(typeof Rico=='undefined')
-  throw("GridMenu requires the Rico JavaScript framework");
-
-/**
- * Standard menu for LiveGrid
- */
-Rico.GridMenu = function(options) {
-  this.initialize(options);
-};
-
-Rico.GridMenu.prototype = {
-
-initialize: function(options) {
-  this.options = {
-    width           : '18em',
-    dataMenuHandler : null          // put custom items on the menu
-  };
-  Rico.extend(this.options, options || {});
-  Rico.extend(this, new Rico.Menu(this.options));
-  this.sortmenu = new Rico.Menu({ width: '15em' });
-  this.filtermenu = new Rico.Menu({ width: '22em' });
-  this.exportmenu = new Rico.Menu({ width: '24em' });
-  this.hideshowmenu = new Rico.Menu({ width: '22em' });
-  this.createDiv();
-  this.sortmenu.createDiv();
-  this.filtermenu.createDiv();
-  this.exportmenu.createDiv();
-  this.hideshowmenu.createDiv();
-},
-
-// Build context menu for grid
-buildGridMenu: function(r,c) {
-  this.clearMenu();
-  var totrows=this.liveGrid.buffer.totalRows;
-  var onBlankRow=r >= totrows;
-  var column=this.liveGrid.columns[c];
-  if (this.options.dataMenuHandler) {
-     var showDefaultMenu=this.options.dataMenuHandler(this.liveGrid,r,c,onBlankRow);
-     if (!showDefaultMenu) return (this.itemCount > 0);
-  }
-
-  // menu items for sorting
-  if (column.sortable && totrows>0) {
-    this.sortmenu.clearMenu();
-    this.addSubMenuItem(Rico.getPhraseById("gridmenuSortBy",column.displayName), this.sortmenu, false);
-    this.sortmenu.addMenuItemId("gridmenuSortAsc", Rico.bind(column,'sortAsc'), true);
-    this.sortmenu.addMenuItemId("gridmenuSortDesc", Rico.bind(column,'sortDesc'), true);
-  }
-
-  // menu items for filtering
-  this.filtermenu.clearMenu();
-  if (column.canFilter() && !column.format.filterUI && (!onBlankRow || column.filterType == Rico.ColumnConst.USERFILTER)) {
-    this.addSubMenuItem(Rico.getPhraseById("gridmenuFilterBy",column.displayName), this.filtermenu, false);
-    column.userFilter=column.getValue(r);
-    if (column.filterType == Rico.ColumnConst.USERFILTER) {
-      this.filtermenu.addMenuItemId("gridmenuRemoveFilter", Rico.bind(column,'setUnfiltered',false), true);
-      if (column.filterOp=='LIKE')
-        this.filtermenu.addMenuItemId("gridmenuChgKeyword", Rico.bind(this.liveGrid,'openKeyword',c), true);
-      if (column.filterOp=='NE' && !onBlankRow)
-        this.filtermenu.addMenuItemId("gridmenuExcludeAlso", Rico.bind(column,'addFilterNE'), true);
-    } else if (!onBlankRow) {
-      this.filtermenu.addMenuItemId("gridmenuInclude", Rico.bind(column,'setFilterEQ'), true);
-      this.filtermenu.addMenuItemId("gridmenuGreaterThan", Rico.bind(column,'setFilterGE'), column.userFilter!='');
-      this.filtermenu.addMenuItemId("gridmenuLessThan", Rico.bind(column,'setFilterLE'), column.userFilter!='');
-      if (column.isText)
-        this.filtermenu.addMenuItemId("gridmenuContains", Rico.bind(this.liveGrid,'openKeyword',c), true);
-      this.filtermenu.addMenuItemId("gridmenuExclude", Rico.bind(column,'setFilterNE'), true);
-    }
-    if (this.liveGrid.filterCount() > 0) {
-      this.filtermenu.addMenuItemId("gridmenuRefresh", Rico.bind(this.liveGrid,'filterHandler'), true);
-      this.filtermenu.addMenuItemId("gridmenuRemoveAll", Rico.bind(this.liveGrid,'clearFilters'), true);
-    }
-  } else if (this.liveGrid.filterCount() > 0) {
-    this.addSubMenuItem(Rico.getPhraseById("gridmenuFilterBy",column.displayName), this.filtermenu, false);
-    this.filtermenu.addMenuItemId("gridmenuRemoveAll", Rico.bind(this.liveGrid,'clearFilters'), true);
-  }
-
-  // menu items for Print/Export
-  this.exportmenu.clearMenu();
-  if (this.liveGrid.buffer.printVisibleSQL && typeof(this.liveGrid.buffer.dataSource)=='string') {
-    // SQL buffer
-    this.addSubMenuItem(Rico.getPhraseById('gridmenuExport'),this.exportmenu,false);
-    this.exportmenu.addMenuItemId("gridmenuExportVis2Web", Rico.bind(this.liveGrid.buffer,'printVisibleSQL','html'));
-    this.exportmenu.addMenuItemId("gridmenuExportAll2Web", Rico.bind(this.liveGrid.buffer,'printAllSQL','html'), this.liveGrid.buffer.totalRows <= this.liveGrid.options.maxPrint);
-    this.exportmenu.addMenuBreak();
-    this.exportmenu.addMenuItemId("gridmenuExportVis2SS", Rico.bind(this.liveGrid.buffer,'printVisibleSQL','xl'));
-    this.exportmenu.addMenuItemId("gridmenuExportAll2SS", Rico.bind(this.liveGrid.buffer,'printAllSQL','xl'), this.liveGrid.buffer.totalRows <= this.liveGrid.options.maxPrint);
-  } else if (this.liveGrid.options.maxPrint > 0 && totrows>0) {
-    // any other buffer
-    this.addSubMenuItem(Rico.getPhraseById('gridmenuExport'),this.exportmenu,false);
-    this.exportmenu.addMenuItemId("gridmenuExportVis2Web", Rico.bind(this.liveGrid.buffer,'printVisible','plain'));
-    this.exportmenu.addMenuItemId("gridmenuExportAll2Web", Rico.bind(this.liveGrid.buffer,'printAll','plain'), this.liveGrid.buffer.totalRows <= this.liveGrid.options.maxPrint);
-    if (Rico.isIE) {
-      this.exportmenu.addMenuBreak();
-      this.exportmenu.addMenuItemId("gridmenuExportVis2SS", Rico.bind(this.liveGrid.buffer,'printVisible','owc'));
-      this.exportmenu.addMenuItemId("gridmenuExportAll2SS", Rico.bind(this.liveGrid.buffer,'printAll','owc'), this.liveGrid.buffer.totalRows <= this.liveGrid.options.maxPrint);
-    }
-  }
-
-  // menu items for hide/unhide
-  var hiddenCols=this.liveGrid.listInvisible();
-  for (var showableCnt=0,x=0; x<hiddenCols.length; x++) {
-    if (hiddenCols[x].canHideShow()) showableCnt++;
-  }
-  if (showableCnt > 0 || column.canHideShow()) {
-    this.hideshowmenu.clearMenu();
-    this.addSubMenuItem(Rico.getPhraseById('gridmenuHideShow'),this.hideshowmenu,false);
-    this.hideshowmenu.addMenuItemId('gridmenuChooseCols', Rico.bind(this.liveGrid,'chooseColumns'),true,false);
-    var visibleCnt=this.liveGrid.columns.length-hiddenCols.length;
-    var enabled=(visibleCnt>1 && column.visible && column.canHideShow());
-    this.hideshowmenu.addMenuItem(Rico.getPhraseById('gridmenuHide',column.displayName), Rico.bind(column,'hideColumn'), enabled);
-    for (var cnt=0,x=0; x<hiddenCols.length; x++) {
-      if (hiddenCols[x].canHideShow()) {
-        if (cnt++==0) this.hideshowmenu.addMenuBreak();
-        this.hideshowmenu.addMenuItem(Rico.getPhraseById('gridmenuShow',hiddenCols[x].displayName), Rico.bind(hiddenCols[x],'showColumn'), true);
-      }
-    }
-    if (hiddenCols.length > 1)
-      this.hideshowmenu.addMenuItemId('gridmenuShowAll', Rico.bind(this.liveGrid,'showAll'));
-  }
-  return true;
-}
-
-}
-
-Rico.includeLoaded('ricoLiveGridMenu.js');
diff --git a/ricoClient/js/ricoSearch.js b/ricoClient/js/ricoSearch.js
deleted file mode 100644 (file)
index 3e90dd7..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-Rico.KeywordSearch = function(id,options) {
-  this.initialize(id,options);
-};
-
-Rico.KeywordSearch.prototype = {
-/**
- * @class Implements a pop-up keyword search control.
- * @extends Rico.Popup
- * @constructs
- * @param id unique identifier
- * @param options object may contain any of the following:<dl>
- *   <dt>showColorCode</dt><dd> show hex color code as user hovers over color grid? default=false</dd>
- *   <dt>cellsPerRow  </dt><dd> number of colors per row in the grid? default=18</dd>
- *   <dt>palette      </dt><dd> array of 6 digit hex values, default=216 "web safe" colors</dd>
- *</dl>
- */
-  initialize: function(id,options) {
-    this.id=id;
-    Rico.extend(this, new Rico.Window(Rico.getPhraseById("keywordTitle"),options));
-    this.contentCell.className='ricoKeywordSearch';
-    Rico.extend(this.options, {
-      listLength : 10,
-      maxSuggest : 20,
-      width: '12em'
-    });
-  },
-
-  atLoad : function() {
-    this.searchField=Rico.createFormField(this.contentDiv,'input','text',this.id+'_search');
-    this.searchField.style.display="block";
-    this.searchField.style.width=this.options.width;
-    Rico.eventBind(this.searchField,'keyup',Rico.eventHandle(this,'filterKeypress'),false);
-    this.selectList=Rico.createFormField(this.contentDiv,'select',null,this.id+'_list');
-    this.selectList.size=this.options.listLength;
-    this.selectList.style.display="block";
-    this.selectList.style.width=this.options.width;
-    Rico.eventBind(this.selectList,'change',Rico.eventHandle(this,'listClick'),false);
-    /**
-     * alias for closePopup
-     * @function
-     */
-    this.close=this.closePopup;
-    this.close();
-  },
-  
-  open: function(currentVal,column) {
-    this.column=column;
-    this.grid=this.column.liveGrid;
-    this.searchField.value='';
-    this.selectList.options.length=0;
-    this.openPopup();
-    this.searchField.focus();
-    this.selectValuesRequest('');
-  },
-
-  selectValuesRequest: function(filter) {
-    var colnum=this.column.index;
-    var options={};
-    Rico.extend(options, this.grid.buffer.ajaxOptions);
-    options.parameters = {id: this.grid.tableId, offset: '0', page_size: this.options.maxSuggest, edit: colnum};
-    options.parameters[this.grid.actionId]="query";
-    if (filter!='' && filter!='*') {
-      if (filter.indexOf('*')==-1) filter='*'+filter+'*';
-      options.parameters['f[1][op]']="LIKE";
-      options.parameters['f[1][len]']=1;
-      options.parameters['f[1][0]']=filter;
-    }
-    options.onComplete = Rico.bind(this,'selectValuesUpdate');
-    new Rico.ajaxRequest(this.grid.buffer.dataSource, options);
-  },
-
-  selectValuesUpdate: function(request) {
-    var response = request.responseXML.getElementsByTagName("ajax-response");
-    Rico.log("selectValuesUpdate: "+request.status);
-    if (response == null || response.length != 1) return;
-    response=response[0];
-    var error = response.getElementsByTagName('error');
-    if (error.length > 0) {
-      var errmsg=Rico.getContentAsString(error[0],this.grid.buffer.isEncoded);
-      Rico.log("Data provider returned an error:\n"+errmsg);
-      alert(Rico.getPhraseById("requestError",errmsg));
-      return null;
-    }
-    this.selectList.options.length=0;
-    response=response.getElementsByTagName('response')[0];
-    var rowsElement = response.getElementsByTagName('rows')[0];
-    var rows = this.grid.buffer.dom2jstable(rowsElement);
-    Rico.log("selectValuesUpdate: id="+this.selectList.id+' rows='+rows.length);
-    for (var i=0; i<rows.length; i++) {
-      if (rows[i].length>0) {
-        var c0=rows[i][0];
-        var c1=(rows[i].length>1) ? rows[i][1] : c0;
-        Rico.addSelectOption(this.selectList,c0,c1);
-      }
-    }
-  },
-
-  filterKeypress: function(e) {
-    var txtbox=Rico.eventElement(e);
-    if (typeof this.lastKeyFilter != 'string') this.lastKeyFilter='';
-    if (this.lastKeyFilter==txtbox.value) return;
-    var v=txtbox.value;
-    Rico.log("filterKeypress: "+this.index+' '+v);
-    this.lastKeyFilter=v;
-    this.selectValuesRequest(v);
-  },
-  
-  listClick: function(e) {
-    var elem=Rico.eventElement(e);
-    if (elem.tagName.toLowerCase() != 'select') return;
-    if (this.returnValue) {
-      var opt=elem.options[elem.selectedIndex];
-      this.returnValue(opt.value,opt.innerHTML);
-    }
-    this.close();
-  }
-
-};
-
-Rico.includeLoaded('ricoSearch.js');
diff --git a/ricoClient/js/ricoSimpleGrid.js b/ricoClient/js/ricoSimpleGrid.js
deleted file mode 100644 (file)
index 5c16afd..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-if(typeof Rico=='undefined') throw("SimpleGrid requires the Rico JavaScript framework");
-
-Rico.SimpleGrid = function(tableId, options) {
-  this.initialize(tableId, options);
-}
-
-Rico.SimpleGrid.prototype = {
-/**
- * @class Create & manage an unbuffered grid.
- * Supports: frozen columns & headings, resizable columns.
- * @extends Rico.GridCommon
- * @constructs
- */
-  initialize: function( tableId, options ) {
-    Rico.extend(this, Rico.GridCommon);
-    this.baseInit();
-    Rico.setDebugArea(tableId+"_debugmsgs");    // if used, this should be a textarea
-    Rico.extend(this.options, options || {});
-    this.tableId = tableId;
-    Rico.log("SimpleGrid initialize start: "+tableId);\r
-    this.createDivs();
-    this.hdrTabs=new Array(2);
-    this.simpleGridInit();
-    Rico.log("SimpleGrid initialize end: "+tableId);\r
-  },
-
-  simpleGridInit: function() {
-    var i;
-    for (i=0; i<2; i++) {
-      Rico.log("simpleGridInit "+i);\r
-      this.tabs[i]=document.getElementById(this.tableId+'_tab'+i);
-      if (!this.tabs[i]) return;
-      this.hdrTabs[i]=document.getElementById(this.tableId+'_tab'+i+'h');
-      if (!this.hdrTabs[i]) return;
-      //if (i==0) this.tabs[i].style.position='absolute';
-      //if (i==0) this.tabs[i].style.left='0px';
-      //this.hdrTabs[i].style.position='absolute';
-      //this.hdrTabs[i].style.top='0px';
-      //this.hdrTabs[i].style.zIndex=1;
-      this.thead[i]=this.hdrTabs[i];
-      this.tbody[i]=this.tabs[i];
-      this.headerColCnt = this.getColumnInfo(this.hdrTabs[i].rows);
-      if (i==0) this.options.frozenColumns=this.headerColCnt;
-      if (Rico.theme.gridheader) Rico.addClass(this.thead[i],Rico.theme.gridheader);
-      if (Rico.theme.gridcontent) Rico.addClass(this.tbody[i],Rico.theme.gridcontent);
-    }
-    if (this.headerColCnt==0) {
-      alert('ERROR: no columns found in "'+this.tableId+'"');
-      return;
-    }
-    //this.hdrHt=Math.max(Rico.nan2zero(this.hdrTabs[0].offsetHeight),this.hdrTabs[1].offsetHeight);
-    //for (i=0; i<2; i++) {
-    //  if (i==0) this.tabs[i].style.top=this.hdrHt+'px';
-    //}
-    this.createColumnArray('SimpleGridColumn');
-    this.pageSize=this.columns[0].dataColDiv.childNodes.length;
-    this.sizeDivs();
-    if (typeof(this.options.FilterLocation)=='number')
-      this.createFilters(this.options.FilterLocation);
-    this.attachMenuEvents();
-    this.scrollEventFunc=Rico.eventHandle(this,'handleScroll');
-    this.pluginScroll();
-    if (this.options.windowResize)
-      Rico.eventBind(window,"resize", Rico.eventHandle(this,'sizeDivs'), false);
-  },
-
-  // return id string for a filter element
-  filterId: function(colnum) {
-    return 'RicoFilter_'+this.tableId+'_'+colnum;
-  },
-  
-  // create filter elements on heading row r
-  createFilters: function(r) {
-    if (r < 0) {
-      r=this.addHeadingRow();
-      this.sizeDivs();
-    }
-    for( var c=0; c < this.headerColCnt; c++ ) {
-      var col=this.columns[c];
-      var fmt=col.format;
-      if (typeof fmt.filterUI!='string') continue;
-      var cell=this.hdrCells[r][c].cell;
-      var field,name=this.filterId(c);\r
-      var divs=cell.getElementsByTagName('div');
-      switch (fmt.filterUI.charAt(0)) {
-        case 't':
-          field=Rico.createFormField(divs[1],'input','text',name,name);
-          var size=fmt.filterUI.match(/\d+/);
-          field.maxLength=fmt.Length || 50;\r
-          field.size=size ? parseInt(size,10) : 10;
-          Rico.eventBind(field,'keyup',Rico.eventHandle(col,'filterKeypress'),false);\r
-          break;\r
-        case 's':
-          field=Rico.createFormField(divs[1],'select',null,name);\r
-          Rico.addSelectOption(field,this.options.FilterAllToken,Rico.getPhraseById("filterAll"));
-          this.getFilterValues(col);
-          var keys=Rico.keys(col.filterHash);
-          keys.sort();
-          for (var i=0; i<keys.length; i++)
-            Rico.addSelectOption(field,keys[i],keys[i] || Rico.getPhraseById("filterBlank"));\r
-          Rico.eventBind(field,'change',Rico.eventHandle(col,'filterChange'),false);\r
-          break;\r
-      }
-    }
-    this.initFilterImage(r);
-  },
-  
-  getFilterValues: function(col) {
-    var h={};
-    var n=col.numRows();
-    for (var i=0; i<n; i++) {
-      var v=Rico.getInnerText(col.cell(i));
-      var hval=h[v];
-      if (hval)
-        hval.push(i);
-      else
-        h[v]=[i];
-    }
-    col.filterHash=h;\r
-  },
-  
-  // hide filtered rows
-  applyFilters: function() {
-    // rows to display will be the intersection of all filterRows arrays
-    var fcols=[];
-    for (var c=0; c<this.columns.length; c++) {
-      if (this.columns[c].filterRows)
-        fcols.push(this.columns[c].filterRows);
-    }
-    if (fcols.length==0) {
-      // no filters are set
-      this.showAllRows();
-      return;
-    }
-    for (var r=0; r<this.pageSize; r++) {
-      var showflag=true;
-      for (var j=0; j<fcols.length; j++) {
-        if (fcols[j].indexOf(r)==-1) {
-          showflag=false;
-          break;
-        }
-      }
-      if (showflag)
-        this.showRow(r);
-      else
-        this.hideRow(r);
-    }
-    this.sizeDivs();\r
-  },
-
-  handleScroll: function(e) {
-    var newTop=(-this.scrollDiv.scrollTop)+'px';
-    this.tabs[0].style.marginTop=newTop;
-    this.setHorizontalScroll();
-  },
-
-  /**
-   * Register a menu that will only be used in the scrolling part of the grid.
-   * If submenus are used, they must be registered after the main menu.
-   */
-  registerScrollMenu: function(menu) {
-    if (!this.menu) this.menu=menu;
-    menu.grid=this;
-    menu.showmenu=menu.showSimpleMenu;
-    menu.showSubMenu=menu.showSimpleSubMenu;
-    menu.createDiv(this.outerDiv);
-  },
-
-  handleMenuClick: function(e) {
-    if (!this.menu) return;
-    this.cancelMenu();
-    this.menuCell=Rico.getParentByTagName(Rico.eventElement(e),'div');
-    this.highlightEnabled=false;
-    if (this.hideScroll) this.scrollDiv.style.overflow="hidden";
-    if (this.menu.buildGridMenu) this.menu.buildGridMenu(this.menuCell);
-    this.menu.showmenu(e,this.closeMenu.bind(this));
-  },
-
-  closeMenu: function() {
-    if (this.hideScroll) this.scrollDiv.style.overflow="";
-    this.highlightEnabled=true;
-  },
-
-  sizeDivs: function() {
-    if (this.outerDiv.offsetParent.style.display=='none') return;
-    this.baseSizeDivs();
-    var maxHt=Math.max(this.options.maxHt || this.availHt(), 50);
-    var totHt=Math.min(this.hdrHt+this.dataHt, maxHt);
-    Rico.log('sizeDivs '+this.tableId+': hdrHt='+this.hdrHt+' dataHt='+this.dataHt);
-    this.dataHt=totHt-this.hdrHt;
-    if (this.scrWi>0) this.dataHt+=this.options.scrollBarWidth;
-    this.scrollDiv.style.height=this.dataHt+'px';
-    this.frozenTabs.style.height=this.scrollDiv.clientHeight+'px';
-    var divAdjust=2;
-    this.innerDiv.style.width=(this.scrWi-this.options.scrollBarWidth+divAdjust)+'px';
-    //this.innerDiv.style.height=(this.hdrHt+1)+'px';
-    totHt+=divAdjust;
-    this.resizeDiv.style.height=totHt+'px';
-    
-    //this.outerDiv.style.height=(totHt+this.options.scrollBarWidth)+'px';
-    this.handleScroll();
-  },
-  
-/**
- * Copies all rows to a new window as a simple html table.
- */
-  printVisible: function(exportType) {
-    this.showMsg(Rico.getPhraseById('exportInProgress'));
-    Rico.runLater(10,this,'_printVisible',exportType);  // allow message to paint
-  },
-
-  _printVisible: function(exportType) {
-    this.exportStart();
-    var exportStyles=this.getExportStyles(this.tbody[0]);
-    for(var r=0; r < this.pageSize; r++) {
-      if (this.columns[0].cell(r).style.display=='none') continue;
-      var exportText='';
-      for (var c=0; c<this.columns.length; c++) {
-        var col=this.columns[c];
-        if (col.visible) {
-          var v=col.getFormattedValue(r, !this.options.exportImgTags, !this.options.exportFormFields, 'NoExport');
-          if (col.format.exportPrefix) v=col.format.exportPrefix+v;
-          if (v=='') v='&nbsp;';
-          exportText+="<td style='"+this.exportStyle(col.cell(r),exportStyles)+"'>"+v+"</td>";
-        }
-      }
-      this.exportRows.push(exportText);
-    }
-    this.exportFinish(exportType);
-  },
-
-  /**
-   * Hide a row in the grid.
-   * sizeDivs() should be called after this function has completed.
-   */
-  hideRow: function(rownum) {
-    if (this.columns[0].cell(rownum).style.display=='none') return;
-    for (var i=0; i<this.columns.length; i++)
-      this.columns[i].cell(rownum).style.display='none';
-  },
-
-  /**
-   * Unhide a row in the grid.
-   * sizeDivs() should be called after this function has completed.
-   */
-  showRow: function(rownum) {
-    if (this.columns[0].cell(rownum).style.display=='') return;
-    for (var i=0; i<this.columns.length; i++)
-      this.columns[i].cell(rownum).style.display='';
-  },
-
-  /**
-   * Search for rows that contain SearchString in column ColIdx.
-   * If ShowMatch is false, then matching rows are hidden, if true then mismatching rows are hidden.
-   */
-  searchRows: function(ColIdx,SearchString,ShowMatch) {\r
-    if (!SearchString) return;\r
-    var re=new RegExp(SearchString);\r
-    var rowcnt=this.columns[ColIdx].numRows();\r
-    for(var r=0; r<rowcnt; r++) {\r
-      var txt=this.cell(r,ColIdx).innerHTML;\r
-      var matched=(txt.match(re) != null);\r
-      if (matched != ShowMatch) this.hideRow(r);\r
-    }
-    this.sizeDivs();
-    this.handleScroll();\r
-  },\r
-\r
-  /**
-   * Unhide all rows in the grid
-   */
-  showAllRows: function() {
-    for (var i=0; i<this.pageSize; i++)
-      this.showRow(i);
-    this.sizeDivs();\r
-  },
-  
-  openPopup: function(elem,popupobj) {
-    while (elem && !Rico.hasClass(elem,'ricoLG_cell'))
-      elem=elem.parentNode;
-    if (!elem) return false;
-    var td=Rico.getParentByTagName(elem,'td');
-  
-    var newLeft=Math.floor(td.offsetLeft-this.scrollDiv.scrollLeft+td.offsetWidth/2);
-    if (this.direction == 'rtl') {
-      if (newLeft > this.width) newLeft-=this.width;
-    } else {
-      if (newLeft+this.width+this.options.margin > this.scrollDiv.clientWidth) newLeft-=this.width;
-    }
-    popupobj.divPopup.style.visibility="hidden";
-    popupobj.divPopup.style.display="block";
-    var contentHt=popupobj.divPopup.offsetHeight;
-    var newTop=Math.floor(elem.offsetTop-this.scrollDiv.scrollTop+elem.offsetHeight/2);
-    if (newTop+contentHt+popupobj.options.margin > this.scrollDiv.clientHeight)
-      newTop=Math.max(newTop-contentHt,0);
-    popupobj.openPopup(this.frzWi+newLeft,this.hdrHt+newTop);
-    popupobj.divPopup.style.visibility ="visible";
-    return elem;
-  }
-
-}
-
-if (Rico.Menu) {
-Rico.extend(Rico.Menu.prototype, {
-
-showSimpleMenu: function(e,hideFunc) {
-  Rico.eventStop(e);
-  this.hideFunc=hideFunc;
-  if (this.div.childNodes.length==0) {
-    this.cancelmenu();
-    return false;
-  }
-  var elem=Rico.eventElement(e);
-  this.grid.openPopup(elem,this);
-  return elem;
-},
-
-showSimpleSubMenu: function(a,submenu) {
-  if (this.openSubMenu) this.hideSubMenu();
-  this.openSubMenu=submenu;
-  this.openMenuAnchor=a;
-  if (a.className=='ricoSubMenu') a.className='ricoSubMenuOpen';
-  var top=parseInt(this.div.style.top,10);
-  var left=parseInt(this.div.style.left,10);
-  submenu.openPopup(left+a.offsetWidth,top+a.offsetTop);
-  submenu.div.style.visibility ="visible";
-}
-
-});
-}
-
-
-Rico.SimpleGridColumn = function(grid,colIdx,hdrInfo,tabIdx) {
-  this.initialize(grid,colIdx,hdrInfo,tabIdx);
-}
-
-Rico.SimpleGridColumn.prototype = {
-/**
- * @class Implements a SimpleGrid column
- * @extends Rico.TableColumnBase
- * @constructs
- */
-initialize: function(grid,colIdx,hdrInfo,tabIdx) {
-  Rico.extend(this, new Rico.TableColumnBase());
-  this.baseInit(grid,colIdx,hdrInfo,tabIdx);
-},
-
-setUnfiltered: function() {
-  this.filterRows=null;
-},
-
-filterChange: function(e) {\r
-  var selbox=Rico.eventElement(e);
-  if (selbox.value==this.liveGrid.options.FilterAllToken)\r
-    this.setUnfiltered();\r
-  else
-    this.filterRows=this.filterHash[selbox.value];
-  this.liveGrid.applyFilters();
-},
-
-filterKeypress: function(e) {\r
-  var txtbox=Rico.eventElement(e);
-  if (typeof this.lastKeyFilter != 'string') this.lastKeyFilter='';\r
-  if (this.lastKeyFilter==txtbox.value) return;\r
-  var v=txtbox.value;\r
-  Rico.log("filterKeypress: "+this.index+' '+v);\r
-  this.lastKeyFilter=v;
-  if (v) {
-    v=v.replace('\\','\\\\');
-    v=v.replace('(','\\(').replace(')','\\)');
-    v=v.replace('.','\\.');
-    if (this.format.filterUI.indexOf('^') > 0) v='^'+v;
-    var re=new RegExp(v,'i');\r
-    this.filterRows=[];
-    var n=this.numRows();
-    for (var i=0; i<n; i++) {
-      var celltxt=Rico.getInnerText(this.cell(i));
-      if (celltxt.match(re)) this.filterRows.push(i);
-    }
-  } else {
-    this.setUnfiltered();\r
-  }
-  this.liveGrid.applyFilters();
-}
-
-}
-
-Rico.includeLoaded('ricoSimpleGrid.js');
diff --git a/ricoClient/js/ricoTree.js b/ricoClient/js/ricoTree.js
deleted file mode 100644 (file)
index 1ed804b..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-
-//  Rico Tree Control
-//  Requires prototype.js and ricoCommon.js
-//  Data for the tree can be obtained via AJAX requests
-//  Each record in the AJAX response should contain 5 or 6 cells:
-//   cells[0]=parent node id
-//   cells[1]=node id
-//   cells[2]=description
-//   cells[3]=L/zero (leaf), C/non-zero (container)
-//   cells[4]=0->not selectable, 1->selectable (use default action), otherwise the node is selectable and cells[4] contains the action
-//   cells[5]=leafIcon (optional)
-
-
-Rico.TreeControl = function(id,url,options) {
-  this.initialize(id,url,options);
-};
-
-Rico.TreeControl.prototype = {
-/**
- * @class Implements a pop-up tree control.
- * @extends Rico.Popup
- * @constructs
- * @param id unique identifier
- * @param url data source
- * @param options object may contain any of the following:<dl>
- *   <dt>nodeIdDisplay</dt><dd> first, last, tooltip, or none? default=none</dd>
- *   <dt>showCheckBox </dt><dd> show checkbox next to each item? default=false</dd>
- *   <dt>showFolders  </dt><dd> show folder icons? default=false</dd>
- *   <dt>showPlusMinus</dt><dd> show +/- icons to open/close branches? default=true</dd>
- *   <dt>showLines    </dt><dd> show vertical lines connecting each level? default=true</dd>
- *   <dt>defaultAction</dt><dd> Rico event handle to call when user clicks on an item, default is to call returnValue method</dd>
- *   <dt>height       </dt><dd> control height? default=300px</dd>
- *   <dt>width        </dt><dd> control width? default=300px</dd>
- *   <dt>leafIcon     </dt><dd> url to img, default=doc.gif ('none'=no leaf icon)</dd>
- *</dl>
- */
-  initialize: function(id,url,options) {
-    Rico.extend(this, new Rico.Popup());
-    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.imgDir+'doc.gif'
-    });
-    Rico.extend(this.options, options || {});
-    this.id=id;
-    this.dataSource=url;
-    this.close=this.closePopup;
-    this.hoverSet = new Rico.HoverSet([]);
-  },
-
-  atLoad : function() {
-    var imgsrc = ["node.gif","nodelast.gif","folderopen.gif","folderclosed.gif"];
-    // preload images
-    for (var i=0;i<imgsrc.length;i++) {
-      var img=new Image();
-      img.src = Rico.imgDir+imgsrc[i];
-    }
-    this.treeDiv=document.createElement("div");
-    this.treeDiv.id=this.id;
-    this.treeDiv.className='ricoTree';
-    if (Rico.theme.treeContent) Rico.addClass(this.treeDiv,Rico.theme.treeContent);
-    this.treeDiv.style.height=this.options.height;
-    this.treeDiv.style.width=this.options.width;
-    this.createContainer();
-    this.content.className=Rico.theme.tree || 'ricoTreeContainer';
-    this.content.appendChild(this.treeDiv);
-    if (this.options.showCheckBox) {
-      this.buttonDiv=document.createElement("div");
-      this.buttonDiv.style.width=this.options.width;
-      this.buttonDiv.className='ricoTreeButtons';
-      if (Rico.getStyle(this.container,'position')=='absolute') {
-        var span=document.createElement("span");
-        span.innerHTML=RicoTranslate.getPhraseById('treeSave');
-        Rico.setStyle(span,{'float':'left',cursor:'pointer'});
-        this.buttonDiv.appendChild(span);
-        Rico.eventBind(span, 'click', Rico.eventHandle(this,'saveSelection'));
-      }
-      var span=document.createElement("span");
-      span.innerHTML=RicoTranslate.getPhraseById('treeClear');
-      Rico.setStyle(span,{'float':'right',cursor:'pointer'});
-      this.buttonDiv.appendChild(span);
-      this.content.appendChild(this.buttonDiv);
-      Rico.eventBind(span, 'click', Rico.eventHandle(this,'clrCheckBoxEvent'));
-    }
-    this.close();
-  },
-
-  setTreeDiv: function(divId) {
-    this.treeDiv = Rico.$(divId);
-    this.openPopup = function() {};
-  },
-
-  open: function() {
-    this.openPopup();
-    if (this.treeDiv.childNodes.length == 0 && this.dataSource) {
-      this.loadXMLDoc();
-    }
-  },
-
-  loadXMLDoc: function(branchPin) {
-    var parms = { id: this.id };
-    if (branchPin) parms.Parent=branchPin;
-    Rico.log('Tree loadXMLDoc: '+this.id);
-    new Rico.ajaxRequest(this.dataSource, {parameters:parms,method:'get',onComplete:Rico.bind(this,'processResponse')});
-  },
-
-  domID: function(nodeID,part) {
-    return 'RicoTree_'+part+'_'+this.id+'_'+nodeID;
-  },
-
-  processResponse: function(request) {
-    var response = request.responseXML.getElementsByTagName("ajax-response");
-    if (response == null || response.length != 1) return;
-    var rowsElement = response[0].getElementsByTagName('rows')[0];
-    var trs = rowsElement.getElementsByTagName("tr");
-    var rowdata=[];
-    for (var i=0; i < trs.length; i++) {
-      var cells = trs[i].getElementsByTagName("td");
-      if (cells.length < 5) continue;
-      var content=[];
-      content[5]=this.options.leafIcon;
-      for (var j=0; j<cells.length; j++) {
-        content[j]=Rico.getContentAsString(cells[j],true);
-      }
-      content[3] = content[3].match(/^0|L$/i) ? 0 : 1;
-      content[4] = parseInt(content[4]);
-      rowdata.push(content);
-    }
-    for (var i=0; i < rowdata.length; i++) {
-      var moreChildren=(i < rowdata.length-1) && (rowdata[i][0]==rowdata[i+1][0]);
-      this.addNode(rowdata[i][0],rowdata[i][1],rowdata[i][2],rowdata[i][3],rowdata[i][4],rowdata[i][5],!moreChildren);
-    }
-  },
-
-  DisplayImages: function(row,arNames) {
-    var i,img,td;
-    for(i=0;i<arNames.length;i++) {
-      img = document.createElement("img");
-      img.src=Rico.imgDir+arNames[i] + ".gif";
-      td=row.insertCell(-1);
-      td.appendChild(img);
-    }
-  },
-
-  addNode: function(parentId, nodeId, nodeDesc, isContainer, isSelectable, leafIcon, isLast) {
-    var parentNode=Rico.$(this.domID(parentId,'Parent'));
-    var parentChildren=Rico.$(this.domID(parentId,'Children'));
-    var level=parentNode ? parentNode.TreeLevel+1 : 0;
-    //alert("addNode at level " + level + " (" + nodeId + ")")
-    var tab = document.createElement("table");
-    var div = document.createElement("div");
-    div.id=this.domID(nodeId,'Children');
-    div.className='ricoTreeBranch';
-    div.style.display=parentNode ? 'none' : '';
-    tab.border=0;
-    tab.cellSpacing=0;
-    tab.cellPadding=0;
-    tab.id=this.domID(nodeId,'Parent');
-    tab.TreeLevel=level;
-    tab.TreeContainer=isContainer;
-    tab.TreeFetchedChildren=this.dataSource ? false : true;
-    var row=tab.insertRow(0);
-    var td=[];
-    for (var i=0; i<level-1; i++) {
-      td[i]=row.insertCell(-1);
-    }
-    if (level>1) {
-      var tdParent=parentNode.getElementsByTagName('td');
-      for (var i=0; i<level-2; i++) {
-        td[i].innerHTML=tdParent[i].innerHTML;
-      }
-      var img = document.createElement("img");
-      img.src=Rico.imgDir+(parentChildren.nextSibling && this.options.showLines ? "nodeline" : "nodeblank")+".gif";
-      td[level-2].appendChild(img);
-    }
-    if (level>0) {
-      var suffix=isLast && this.options.showLines ? 'last' : '';
-      var prefix=this.options.showLines ? 'node' : '';
-      if (this.options.showPlusMinus && isContainer) {
-        var img = document.createElement("img");
-        img.name=nodeId;
-        img.style.cursor='pointer';
-        Rico.eventBind(img, 'click', Rico.eventHandle(this,'clickBranch'));
-        img.src=Rico.imgDir+prefix+"p"+suffix+".gif";
-        row.insertCell(-1).appendChild(img);
-      } else if (this.options.showLines) {
-        var img = document.createElement("img");
-        img.src=Rico.imgDir+"node"+suffix+".gif";
-        row.insertCell(-1).appendChild(img);
-      }
-      if (this.options.showFolders && (isContainer || (leafIcon && leafIcon!='none'))) {
-        var img = document.createElement("img");
-        if (!isContainer) {
-          img.src=leafIcon;
-        } else {
-          img.name=nodeId;
-          img.style.cursor='pointer';
-          Rico.eventBind(img, 'click', Rico.eventHandle(this,'clickBranch'));
-          img.src=Rico.imgDir+"folderclosed.gif";
-        }
-        row.insertCell(-1).appendChild(img);
-      }
-    }
-    if (isSelectable && this.options.showCheckBox) {
-      var chkbx=document.createElement("input");
-      chkbx.type="checkbox";
-      chkbx.value=nodeId;
-      row.insertCell(-1).appendChild(chkbx);
-    }
-
-    if (isSelectable && !this.options.showCheckBox) {
-      var span=document.createElement('a');
-      if (typeof isSelectable=='string') {
-        span.href=isSelectable;
-      } else {
-        span.href='javascript:void(0)';
-        Rico.eventBind(span, 'click', this.options.defaultAction);
-      }
-      this.hoverSet.add(span);
-    } else {
-      var span=document.createElement('p');
-    }
-    span.id=this.domID(nodeId,'Desc');
-    span.className='ricoTreeLevel'+level;
-    switch (this.options.nodeIdDisplay) {
-      case 'last': nodeDesc+=' ('+nodeId+')'; break;
-      case 'first': nodeDesc=nodeId+' - '+nodeDesc; break;
-      case 'tooltip': span.title=nodeId; break;
-    }
-       span.appendChild(document.createTextNode(nodeDesc));
-    row.insertCell(-1).appendChild(span);
-
-    var parent=parentChildren || this.treeDiv;
-    parent.appendChild(tab);
-    parent.appendChild(div);
-  },
-
-  nodeClick: function(e) {
-    var node=Rico.eventElement(e);
-    if (this.returnValue) {
-      var t=this.domID('','Desc');
-      this.returnValue(node.id.substr(t.length),node.innerHTML);
-    }
-    this.close();
-  },
-
-  saveSelection: function(e) {
-    if (this.returnValue) {
-      this.returnValue(this.getCheckedItems());
-    }
-    this.close();
-  },
-
-  getCheckedItems: function() {
-    var inp=this.treeDiv.getElementsByTagName('input');
-    var vals=[];
-    for (var i=0; i<inp.length; i++) {
-      if (inp[i].type=='checkbox' && inp[i].checked) {
-        vals.push(inp[i].value);
-      }
-    }
-    return vals;
-  },
-
-  setCheckBoxes: function(val) {
-    var inp=this.treeDiv.getElementsByTagName('input');
-    for (var i=0; i<inp.length; i++) {
-      if (inp[i].type=='checkbox') {
-        inp[i].checked=val;
-      }
-    }
-  },
-
-  clrCheckBoxEvent: function(e) {
-    Rico.eventStop(e);
-    this.setCheckBoxes(false);
-  },
-
-  clickBranch: function(e) {
-    var node=Rico.eventElement(e);
-    var tab=Rico.getParentByTagName(node,'table');
-    if (!tab || !tab.TreeContainer) return;
-    var a=tab.id.split('_');
-    a[1]='Children';
-    var childDiv=Rico.$(a.join('_'));
-    Rico.toggle(childDiv);
-    if (node.tagName=='IMG') {
-      var v=Rico.visible(childDiv);
-      if (node.src.match(/node(p|m)(last)?\.gif$/)) {
-        node.src=node.src.replace(/nodep|nodem/,'node'+(v ? 'm' : 'p'));
-      } else if (node.src.match(/folder(open|closed)\.gif$/)) {
-        node.src=node.src.replace(/folder(open|closed)/,'folder'+(v ? 'open' : 'closed'));
-      } else if (node.src.match(/\b(m|p)\.gif$/)) {
-        node.src=node.src.replace(/(p|m)\.gif/,v ? 'm\.gif' : 'p\.gif');
-      }
-    }
-    if (!tab.TreeFetchedChildren) {
-      tab.TreeFetchedChildren=1;
-      this.loadXMLDoc(node.name);
-    }
-  }
-
-};
-
-Rico.includeLoaded('ricoTree.js');
diff --git a/ricoClient/js/ricoUI.js b/ricoClient/js/ricoUI.js
deleted file mode 100644 (file)
index 83c5691..0000000
+++ /dev/null
@@ -1,1389 +0,0 @@
-/*
- *  (c) 2005-2009 Richard Cowin (http://openrico.org)
- *  (c) 2005-2009 Matt Brown (http://dowdybrown.com)
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- *  file except in compliance with the License. You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software distributed under the
- *  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- *  either express or implied. See the License for the specific language governing permissions
- *  and limitations under the License.
- */
-Rico.applyShadow = function(elem,shadowFlag) {
-  if (typeof shadowFlag=='undefined') shadowFlag=true;
-  var tab = document.createElement("table");
-  tab.border=0;
-  tab.cellPadding=0;
-  tab.cellSpacing=0;
-  tab.style.margin='0px';
-  tab.style.width='auto';
-  var tbody=Rico.getTBody(tab);
-  var r=tbody.insertRow(-1);
-  var c0=r.insertCell(-1);
-  c0.style.padding='0px';
-  if (shadowFlag) {
-    if (Rico.isIE && Rico.ieVersion < 7) {
-      tab.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=130)";
-    } else {
-      var c=r.insertCell(-1);
-      c.style.width='8px';
-      c.style.padding='0px';
-      c.style.background="transparent url("+Rico.imgDir+"shadow_r.png) no-repeat 0px 3px";
-      r=tbody.insertRow(-1);
-      c=r.insertCell(-1);
-      c.colSpan=2;
-      c.style.padding='0px';
-      c.innerHTML="<div style='height: 8px; font-size: 1px; position: relative;'><div style='height: 8px; width: 8px; position: absolute; top: 0px; left: 5px; background: transparent url("+Rico.imgDir+"shadow_ll.png) no-repeat top right;'></div><div style='height: 8px; margin: 0px 8px 0px 13px; background: transparent url("+Rico.imgDir+"shadow_l.png) repeat-x;'></div><div style='height: 8px; width: 8px; position: absolute; top: 0px; right: 0px; background: transparent url("+Rico.imgDir+"shadow_lr.png) no-repeat top left;'></div></div>";
-    }
-  }
-  if (elem && elem.parentNode) {
-    elem.parentNode.replaceChild(tab, elem);
-    c0.appendChild(elem);
-  }
-  return tab;
-};
-
-Rico.Popup = function(containerDiv,options) {
-  this.initialize(containerDiv,options);
-};
-
-Rico.Popup.prototype = {
-/**
- * @class Class to manage pop-up div windows.
- * @constructs
- * @param options object may contain any of the following:<dl>
- *   <dt>hideOnEscape</dt><dd> hide popup when escape key is pressed? default=true</dd>
- *   <dt>hideOnClick </dt><dd> hide popup when mouse button is clicked? default=true</dd>
- *   <dt>ignoreClicks</dt><dd> if true, mouse clicks within the popup are not allowed to bubble up to parent elements</dd>
- *   <dt>position    </dt><dd> defaults to absolute, use "auto" to auto-detect</dd>
- *   <dt>shadow      </dt><dd> display shadow with popup? default=true</dd>
- *   <dt>zIndex      </dt><dd> which layer? default=1</dd>
- *   <dt>canDrag     </dt><dd> boolean value (or function that returns a boolean) indicating if it is ok to drag/reposition popup, default=false</dd>
- *   <dt>onClose     </dt><dd> function to call when the popup is closed</dd>
- *</dl>
- * @param containerDiv if supplied, then setDiv() is called at the end of initialization
- */
-  initialize: function(containerDiv,options) {
-    this.options = {
-      hideOnEscape  : true,
-      hideOnClick   : true,
-      ignoreClicks  : false,
-      position      : 'absolute',
-      shadow        : true,
-      zIndex        : 2,
-      canDrag       : false,
-      dragElement   : false,
-      closeFunc     : false
-    };
-    if (containerDiv) this.setDiv(containerDiv,options);
-  },
-  
-  createContainer: function(options) {
-    this.setDiv(document.createElement('div'), options);
-    if (options && options.parent) {
-      options.parent.appendChild(this.container);
-    } else {
-      document.getElementsByTagName("body")[0].appendChild(this.container);
-    }
-  },
-
-/**
- * Apply popup behavior to a div that already exists in the DOM
- * @param containerDiv div element (or element id) in the DOM. If null, then the div is created automatically.
- */
-  setDiv: function(containerDiv,options) {
-    Rico.extend(this.options, options || {});
-    this.container=Rico.$(containerDiv);
-    if (this.options.position == 'auto') {
-      this.position=Rico.getStyle(this.container,'position').toLowerCase();
-    } else {
-      this.position=this.container.style.position=this.options.position;
-    }
-    if (this.position != 'absolute') {
-      this.content=this.container;
-      return;
-    }
-    if (this.options.zIndex >= 0) this.container.style.zIndex=this.options.zIndex;
-    this.closeFunc=this.options.closeFunc || Rico.bind(this,'closePopup');
-    //this.container.style.overflow='hidden';
-    this.container.style.top='0px';
-    this.container.style.left='0px';
-    this.container.style.display='none';
-
-    var tab=Rico.applyShadow(null,this.options.shadow);
-    tab.style.position='relative';
-    this.contentCell=tab.rows[0].cells[0];
-
-    if (Rico.isIE && Rico.ieVersion < 7) {
-      // create iframe shim
-      this.ifr = document.createElement('iframe');
-      this.ifr.style.position="absolute";
-      this.ifr.style.top     = '0px';
-      this.ifr.style.left    = '0px';
-      this.ifr.style.width   = '2000px';
-      this.ifr.style.height  = '2000px';
-      this.ifr.style.zIndex  = -1;
-      this.ifr.frameBorder   = 0;
-      this.ifr.src="javascript:false;";
-      this.contentCell.appendChild(this.ifr);
-    }
-    this.content=this.contentCell.appendChild(document.createElement('div'));
-    this.content.className='RicoPopupContent';
-    this.content.style.position='relative';
-
-    while (this.container.firstChild) {
-      this.content.appendChild(this.container.firstChild);
-    }
-    this.container.appendChild(tab);
-
-    if (this.options.hideOnClick)
-      Rico.eventBind(document,"click", Rico.eventHandle(this,'_docClick'));
-    if (this.options.hideOnEscape)
-      Rico.eventBind(document,"keyup", Rico.eventHandle(this,'_checkKey'));
-    this.dragEnabled=false;
-    this.mousedownHandler = Rico.eventHandle(this,'_startDrag');
-    this.dragHandler = Rico.eventHandle(this,'_drag');
-    this.dropHandler = Rico.eventHandle(this,'_endDrag');
-    if (this.options.canDrag) this.enableDragging();
-    if (this.options.ignoreClicks || this.options.canDrag) this.ignoreClicks();
-  },
-  
-  clearContent: function() {
-    this.content.innerHTML="";
-  },
-  
-  setContent: function(content) {
-    this.content.innerHTML=content;
-  },
-  
-  enableDragging: function() {
-    if (!this.dragEnabled && this.options.dragElement) {
-      Rico.eventBind(this.options.dragElement, "mousedown", this.mousedownHandler);
-      this.dragEnabled=true;
-    }
-    return this.dragEnabled;
-  },
-  
-  disableDragging: function() {
-    if (!this.dragEnabled) return;
-    Rico.eventUnbind(this.options.dragElement, "mousedown", this.mousedownHandler);
-    this.dragEnabled=false;
-  },
-  
-  setZ: function(zIndex) {
-    this.container.style.zIndex=zIndex;
-  },
-
-/** @private */
-  ignoreClicks: function() {
-    Rico.eventBind(this.container,"click", Rico.eventHandle(this,'_ignoreClick'));
-  },
-
-  _ignoreClick: function(e) {
-    if (e.stopPropagation)
-      e.stopPropagation();
-    else
-      e.cancelBubble = true;
-    return true;
-  },
-
-  // event handler to process keyup events (hide menu on escape key)
-  _checkKey: function(e) {
-    if (Rico.eventKey(e)!=27 || !this.visible()) return true;
-    //alert('closing popup: '+this.container.className);
-    Rico.eventStop(e);
-    this.closeFunc();
-    return false;
-  },
-
-  _docClick: function(e) {
-    this.closeFunc();
-    return true;
-  },
-
-/**
- * Move popup to specified position
- */
-  move: function(left,top) {
-    if (typeof left=='number') this.container.style.left=left+'px';
-    if (typeof top=='number') this.container.style.top=top+'px';
-  },
-
-  _startDrag : function(event){
-    var elem=Rico.eventElement(event);
-    this.container.style.cursor='move';
-    this.lastMouse = Rico.eventClient(event);
-    Rico.eventBind(document, "mousemove", this.dragHandler);
-    Rico.eventBind(document, "mouseup", this.dropHandler);
-    Rico.eventStop(event);
-  },
-
-  _drag : function(event){
-    var newMouse = Rico.eventClient(event);
-    var newLeft = parseInt(this.container.style.left,10) + newMouse.x - this.lastMouse.x;
-    var newTop = parseInt(this.container.style.top,10) + newMouse.y - this.lastMouse.y;
-    this.move(newLeft, newTop);
-    this.lastMouse = newMouse;
-    Rico.eventStop(event);
-  },
-
-  _endDrag : function(){
-    this.container.style.cursor='';
-    Rico.eventUnbind(document, "mousemove", this.dragHandler);
-    Rico.eventUnbind(document, "mouseup", this.dropHandler);
-  },
-
-/**
- * Display popup at specified position
- */
-  openPopup: function(left,top) {
-    this.container.style.display=this.position=='absolute' ? "block" : Rico.isIE && Rico.ieVersion<8 ? "inline" : "inline-block";
-    if (typeof left=='number') this.container.style.left=left+'px';
-    if (typeof top=='number') this.container.style.top=top+'px';
-    if (this.container.id) Rico.log('openPopup '+this.container.id+' at '+left+','+top);
-  },
-
-  centerPopup: function() {
-    this.openPopup();
-    var msgWidth=this.container.offsetWidth;
-    var msgHeight=this.container.offsetHeight;
-    var divwi=this.container.parentNode.offsetWidth;
-    var divht=this.container.parentNode.offsetHeight;
-    this.move(parseInt(Math.max((divwi-msgWidth)/2,0),10), parseInt(Math.max((divht-msgHeight)/2,0),10));
-  },
-  
-  visible: function() {
-    return Rico.visible(this.container);
-  },
-
-/**
- * Hide popup
- */
-  closePopup: function() {
-    if (!Rico.visible(this.container)) return;
-    if (this.container.id) Rico.log('closePopup '+this.container.id);
-    if (this.dragEnabled) this._endDrag();
-    this.container.style.display="none";
-    if (this.options.onClose) this.options.onClose();
-  }
-
-};
-
-Rico.closeButton = function(handle) {
-  var a = document.createElement('a');
-  a.className='RicoCloseAnchor';
-  if (Rico.theme.closeAnchor) Rico.addClass(a,Rico.theme.closeAnchor);
-  var span = a.appendChild(document.createElement('span'));
-  span.title=Rico.getPhraseById('close');
-  new Rico.HoverSet([a]);
-  Rico.addClass(span,Rico.theme.close || 'RicoClose');
-  Rico.eventBind(a,"click", handle);
-  return a;
-};
-
-Rico.floatButton = function(buttonName, handle, title) {
-  var a=document.createElement("a");
-  a.className='RicoButtonAnchor'
-  Rico.addClass(a,Rico.theme.buttonAnchor || 'RicoButtonAnchorNative');
-  var span=a.appendChild(document.createElement("span"));
-  if (title) span.title=title;
-  span.className=Rico.theme[buttonName.toLowerCase()] || 'Rico'+buttonName;
-  Rico.eventBind(a,"click", handle, false);
-  new Rico.HoverSet([a]);
-  return a
-}
-
-Rico.clearButton = function(handle) {
-  var span=document.createElement("span");
-  span.title=Rico.getPhraseById('clear');
-  span.className='ricoClear';
-  Rico.addClass(span, Rico.theme.clear || 'ricoClearNative');
-  span.style.display='inline-block';
-  span.style.cursor='pointer';
-  Rico.eventBind(span,"click", handle);
-  return span;
-}
-
-Rico.Window = function(title, options, contentParam) {
-  this.initialize(title, options, contentParam);
-};
-
-Rico.Window.prototype = {
-
-/**
- * Create popup div with a title bar.
- */
-  initialize: function(title, options, contentParam) {
-    options=options || {overflow:'auto'};
-    Rico.extend(this, new Rico.Popup());
-    
-    this.titleDiv = document.createElement('div');
-    this.options.canDrag=true;
-    this.options.dragElement=this.titleDiv;
-    this.options.hideOnClick=false;
-    this.createContainer(options);
-    this.content.appendChild(this.titleDiv);
-    contentParam=Rico.$(contentParam);
-    this.contentDiv=contentParam || document.createElement('div');
-    this.content.appendChild(this.contentDiv);
-
-    // create title area
-    this.titleDiv.className='ricoTitle';
-    if (Rico.theme.dialogTitle) Rico.addClass(this.titleDiv,Rico.theme.dialogTitle);
-    this.titleDiv.style.position='relative';
-    this.titleContent = document.createElement('span');
-    this.titleContent.className='ricoTitleSpan';
-    this.titleDiv.appendChild(this.titleContent);
-    this.titleDiv.appendChild(Rico.closeButton(Rico.eventHandle(this,'closePopup')));
-    if (!title && contentParam) {
-      title=contentParam.title;
-      contentParam.title='';
-    }
-    this.setTitle(title || '&nbsp;');
-    
-    // create content area
-    this.contentDiv.className='ricoContent';
-    if (Rico.theme.dialogContent) Rico.addClass(this.contentDiv,Rico.theme.dialogContent);
-    this.contentDiv.style.position='relative';
-    if (options.height) this.contentDiv.style.height=options.height;
-    if (options.width) this.contentDiv.style.width=options.width;
-    if (options.overflow) this.contentDiv.style.overflow=options.overflow;
-    Rico.addClass(this.content,'ricoWindow');
-    if (Rico.theme.dialog) Rico.addClass(this.content,Rico.theme.dialog);
-    if (Rico.isIE) {
-      // fix float'ed content in IE
-      this.titleDiv.style.zoom=1;
-      this.contentDiv.style.zoom=1;
-    }
-
-    this.content=this.contentDiv;
-  },
-
-  setTitle: function(title) {
-    this.titleContent.innerHTML=title;
-  }
-
-}
-
-
-Rico.Menu = function(options) {
-  this.initialize(options);
-}
-
-Rico.Menu.prototype = {
-/**
- * @class Implements popup menus and submenus
- * @extends Rico.Popup
- * @constructs
- */
-  initialize: function(options) {
-    Rico.extend(this, new Rico.Popup());
-    Rico.extend(this.options, {
-      width        : "15em",
-      showDisabled : false
-    });
-    if (typeof options=='string')
-      this.options.width=options;
-    else
-      Rico.extend(this.options, options || {});
-    this.hideFunc=null;
-    this.highlightElem=null;
-    new Image().src = Rico.imgDir+'left_b.gif';
-    new Image().src = Rico.imgDir+'right_b.gif';
-  },
-  
-  createDiv: function(parentNode) {
-    if (this.container) return;
-    var options={closeFunc:Rico.bind(this,'cancelmenu')};
-    if (parentNode) options.parent=parentNode;
-    this.createContainer(options);
-    this.content.className = Rico.isWebKit ? 'ricoMenuSafari' : 'ricoMenu';
-    this.content.style.width=this.options.width;
-    this.direction=Rico.getStyle(this.container,'direction') || 'ltr';
-    this.direction=this.direction.toLowerCase();  // ltr or rtl
-    this.hidemenu();
-    this.itemCount=0;
-  },
-  
-  showmenu: function(e,hideFunc){
-    Rico.eventStop(e);
-    this.hideFunc=hideFunc;
-    if (this.content.childNodes.length==0) {
-      this.cancelmenu();
-      return false;
-    }
-    var mousePos = Rico.eventClient(e);
-    this.openmenu(mousePos.x,mousePos.y,0,0);
-  },
-  
-  openmenu: function(x,y,clickItemWi,clickItemHt,noOffset) {
-    var newLeft=x + (noOffset ? 0 : Rico.docScrollLeft());
-    this.container.style.visibility="hidden";
-    this.container.style.display="block";
-    var w=this.container.offsetWidth;
-    var cw=this.contentCell.offsetWidth;
-    //window.status='openmenu: newLeft='+newLeft+' width='+w+' clickItemWi='+clickItemWi+' windowWi='+Rico.windowWidth();
-    if (this.direction == 'rtl') {
-      if (newLeft > w+clickItemWi) newLeft-=cw+clickItemWi;
-    } else {
-      if (x+w > Rico.windowWidth()) newLeft-=cw+clickItemWi-2;
-    }
-    var scrTop=Rico.docScrollTop();
-    var newTop=y + (noOffset ? 0 : scrTop);
-    if (y+this.container.offsetHeight-scrTop > Rico.windowHeight())
-      newTop=Math.max(newTop-this.contentCell.offsetHeight+clickItemHt,0);
-    this.openPopup(newLeft,newTop);
-    this.container.style.visibility ="visible";
-    return false;
-  },
-
-  clearMenu: function() {
-    this.clearContent();
-    this.defaultAction=null;
-    this.itemCount=0;
-  },
-
-  addMenuHeading: function(hdg) {
-    var el=document.createElement('div');
-    el.innerHTML=hdg;
-    el.className='ricoMenuHeading';
-    this.content.appendChild(el);
-  },
-
-  addMenuBreak: function() {
-    var brk=document.createElement('div');
-    brk.className="ricoMenuBreak";
-    this.content.appendChild(brk);
-  },
-
-  addSubMenuItem: function(menutext, submenu, translate) {
-    var dir=this.direction=='rtl' ? 'left' : 'right';
-    var a=this.addMenuItem(menutext,null,true,null,translate);
-    a.className='ricoSubMenu';
-    a.style.backgroundImage='url('+Rico.imgDir+dir+'_b.gif)';
-    a.style.backgroundRepeat='no-repeat';
-    a.style.backgroundPosition=dir;
-    a.RicoSubmenu=submenu;
-    Rico.eventBind(a,"mouseover", Rico.eventHandle(this,'showSubMenu'));
-    Rico.eventBind(a,"mouseout", Rico.eventHandle(this,'subMenuOut'));
-  },
-  
-  showSubMenu: function(e) {
-    if (this.openSubMenu) this.hideSubMenu();
-    var a=Rico.eventElement(e);
-    this.openSubMenu=a.RicoSubmenu;
-    this.openMenuAnchor=a;
-    if (a.className=='ricoSubMenu') a.className='ricoSubMenuOpen';
-    a.RicoSubmenu.openmenu(parseInt(this.container.style.left)+a.offsetWidth, parseInt(this.container.style.top)+a.offsetTop, a.offsetWidth-2, a.offsetHeight+2,true);
-  },
-  
-  subMenuOut: function(e) {
-    if (!this.openSubMenu) return;
-    Rico.eventStop(e);
-    var elem=Rico.eventElement(e);
-    var reltg = Rico.eventRelatedTarget(e) || e.toElement;
-    try {
-      while (reltg != null && reltg != this.openSubMenu.div)
-        reltg=reltg.parentNode;
-    } catch(err) {}
-    if (reltg == this.openSubMenu.div) return;
-    this.hideSubMenu();
-  },
-  
-  hideSubMenu: function() {
-    if (this.openMenuAnchor) {
-      this.openMenuAnchor.className='ricoSubMenu';
-      this.openMenuAnchor=null;
-    }
-    if (this.openSubMenu) {
-      this.openSubMenu.hidemenu();
-      this.openSubMenu=null;
-    }
-  },
-
-  addMenuItemId: function(phraseId,action,enabled,title,target) {
-    if ( arguments.length < 3 ) enabled=true;
-    this.addMenuItem(Rico.getPhraseById(phraseId),action,enabled,title,target);
-  },
-
-// if action is a string, then it is assumed to be a URL and the target parm can be used indicate which window gets the content
-// action can also be a function (optionally wrapped using Rico.bind),
-// action can also be a Rico.eventHandle, but set target='event' in this case
-  addMenuItem: function(menutext,action,enabled,title,target) {
-    if (arguments.length >= 3 && !enabled && !this.options.showDisabled) return null;
-    this.itemCount++;
-    var a = document.createElement(typeof action=='string' ? 'a' : 'div');
-    if ( arguments.length < 3 || enabled ) {
-      if (typeof action=='string') {
-        a.href = action; 
-        if (target) a.target = target; 
-      } else if (target=='event') {
-        Rico.eventBind(a,"click", action);
-      } else {
-        a.onclick=action;
-      }
-      a.className = 'enabled';
-      if (this.defaultAction==null) this.defaultAction=action;
-    } else {
-      a.disabled = true;
-      a.className = 'disabled';
-    }
-    a.innerHTML = menutext;
-    if (typeof title=='string')
-      a.title = title;
-    a=this.content.appendChild(a);
-    Rico.eventBind(a,"mouseover", Rico.eventHandle(this,'mouseOver'));
-    Rico.eventBind(a,"mouseout", Rico.eventHandle(this,'mouseOut'));
-    return a;
-  },
-  
-  mouseOver: function(e) {
-    if (this.highlightElem && this.highlightElem.className=='enabled-hover') {
-      // required for Safari
-      this.highlightElem.className='enabled';
-      this.highlightElem=null;
-    }
-    var elem=Rico.eventElement(e);
-    if (this.openMenuAnchor && this.openMenuAnchor!=elem)
-      this.hideSubMenu();
-    if (elem.className=='enabled') {
-      elem.className='enabled-hover';
-      this.highlightElem=elem;
-    }
-  },
-
-  mouseOut: function(e) {
-    var elem=Rico.eventElement(e);
-    if (elem.className=='enabled-hover') elem.className='enabled';
-    if (this.highlightElem==elem) this.highlightElem=null;
-  },
-
-  cancelmenu: function() {
-    if (!this.visible()) return;
-    if (this.hideFunc) this.hideFunc();
-    this.hideFunc=null;
-    this.hidemenu();
-  },
-
-  hidemenu: function() {
-    if (this.openSubMenu) this.openSubMenu.hidemenu();
-    this.closePopup();
-  }
-
-}
-
-
-Rico.SelectionSet = function(selectionSet, options) {
-  this.initialize(selectionSet, options);
-}
-
-Rico.SelectionSet.prototype = {
-/**
- * @class
- * @constructs
- * @param selectionSet collection of DOM elements (or a CSS selection string)
- * @param options object may contain any of the following:<dl>
- *   <dt>selectedClass</dt><dd>class name to add when element is selected, default is "selected"</dd>
- *   <dt>selectNode   </dt><dd>optional function that returns the element to be selected</dd>
- *   <dt>onSelect     </dt><dd>optional function that gets called when element is selected</dd>
- *   <dt>onFirstSelect</dt><dd>optional function that gets called the first time element is selected</dd>
- *   <dt>noDefault    </dt><dd>when true, no element in the set is initially selected, default is false</dd>
- *   <dt>selectedIndex</dt><dd>index of the element that should be initially selected, default is 0</dd>
- *   <dt>cookieName   </dt><dd>optional name of cookie to use to remember selected element. If specified, and the cookie exists, then the cookie value overrides selectedIndex.</dd>
- *   <dt>cookieDays   </dt><dd>specifies how long cookie should persist (in days). If unspecified, then the cookie persists for the current session.</dd>
- *   <dt>cookiePath   </dt><dd>optional cookie path</dd>
- *   <dt>cookieDomain </dt><dd>optional cookie domain</dd>
- *</dl>
- */
-  initialize: function(selectionSet, options){
-    Rico.log('SelectionSet#initialize');
-    this.options = options || {};
-    if (typeof selectionSet == 'string')
-      selectionSet = Rico.select(selectionSet);
-    this.previouslySelected = [];
-    this.selectionSet = [];
-    this.selectedClassName = this.options.selectedClass || Rico.theme.selected || "selected";
-    this.selectNode = this.options.selectNode || function(e){return e;};
-    this.onSelect = this.options.onSelect;
-    this.onFirstSelect = this.options.onFirstSelect;
-    this.clickHandler = Rico.bind(this,'selectIndex');
-    this.selectedIndex=-1;
-    for (var i=0; i<selectionSet.length; i++)
-      this.add(selectionSet[i]);
-    if (!this.options.noDefault) {
-      var cookieIndex=this.options.cookieName ? this.getCookie() : 0;
-      this.selectIndex(cookieIndex || this.options.selectedIndex || 0);
-    }
-  },
-  getCookie: function() {
-    var cookie = Rico.getCookie(this.options.cookieName);
-    if (!cookie) return 0;
-    var index = parseInt(cookie);
-    return index < this.selectionSet.length ? index : 0;
-  },
-  reset: function(){
-    this.previouslySelected = [];
-    this._notifySelected(this.selectedIndex);
-  },
-  clearSelected: function() {
-    if (this.selected)
-      Rico.removeClass(this.selectNode(this.selected), this.selectedClassName);
-  },
-  getIndex: function(element) {
-    for (var i=0; i<this.selectionSet.length; i++) {
-      if (element == this.selectionSet[i]) return i;
-    }
-    return -1;
-  },
-  select: function(element){
-    if (this.selected == element) return;
-    var i=this.getIndex(element);
-    if (i >= 0) this.selectIndex(i);
-  },
-  _notifySelected: function(index){
-    if (index < 0) return;
-    var element = this.selectionSet[index];
-    if (this.options.cookieName)
-      Rico.setCookie(this.options.cookieName, index, this.options.cookieDays, this.options.cookiePath, this.options.cookieDomain);
-    if (this.onFirstSelect && !this.previouslySelected[index]){
-      this.onFirstSelect(element, index);
-      this.previouslySelected[index] = true;
-    }
-    if (this.onSelect)
-      try{
-        this.onSelect(index);
-      } catch (e) {};
-  },
-  selectIndex: function(index){
-    if (this.selectedIndex == index || index >= this.selectionSet.length) return;
-    this.clearSelected();
-    this._notifySelected(index);
-    this.selectedIndex = index;
-    this.selected=this.selectionSet[index].element;
-    Rico.addClass(this.selectNode(this.selected), this.selectedClassName);
-  },
-  nextSelectIndex: function(){
-    return (this.selectedIndex + 1) % this.selectionSet.length;
-  },
-  nextSelectItem: function(){
-    return this.selectionSet[this.nextSelectIndex()];
-  },
-  selectNext: function(){
-    this.selectIndex(this.nextSelectIndex());
-  },
-  add: function(item){
-    var index=this.selectionSet.length;
-    this.selectionSet[index] = new Rico._SelectionItem(item,index,this.clickHandler);
-  },
-  remove: function(item){
-    if (item==this.selected) this.clearSelected();
-    var i=this.getIndex(item);
-    if (i < 0) return;
-    this.selectionSet[i].remove();
-    this.selectionSet.splice(i,1);
-  },
-  removeAll: function(){
-    this.clearSelected();
-    while (this.selectionSet.length > 0) {
-      this.selectionSet.pop().remove();
-    }
-  }
-};
-
-
-Rico._SelectionItem=function(element,index,callback) {
-  this.add(element,index,callback);
-};
-
-Rico._SelectionItem.prototype = {
-  add: function(element,index,callback) {
-    this.element=element;
-    this.index=index;
-    this.callback=callback;
-    this.handle=Rico.eventHandle(this,'click');
-    Rico.eventBind(element, "click", this.handle);
-  },
-  
-  click: function(ev) {
-    this.callback(this.index);
-  },
-
-  remove: function() {
-    Rico.eventUnbind(this.element, "click", this.handle);
-  }
-};
-
-Rico.HoverSet = function(hoverSet, options) {
-  this.initialize(hoverSet, options);
-};
-
-Rico.HoverSet.prototype = {
-/**
- * @class
- * @constructs
- * @param hoverSet collection of DOM elements
- * @param options object may contain any of the following:<dl>
- *   <dt>hoverClass</dt><dd> class name to add when mouse is over element, default is "hover"</dd>
- *   <dt>hoverNodes</dt><dd> optional function to select/filter which nodes are in the set</dd>
- *</dl>
- */
-  initialize: function(hoverSet, options){
-    Rico.log('HoverSet#initialize');
-    options = options || {};
-    this.hoverClass = options.hoverClass || Rico.theme.hover || "hover";
-    this.hoverFunc = options.hoverNodes || function(e){return [e];};
-    this.hoverSet=[];
-    if (!hoverSet) return;
-    for (var i=0; i<hoverSet.length; i++)
-      this.add(hoverSet[i]);
-  },
-  add: function(item) {
-    this.hoverSet.push(new Rico._HoverItem(item,this.hoverFunc,this.hoverClass));
-  },
-  removeAll: function(){
-    while (this.hoverSet.length > 0) {
-      this.hoverSet.pop().remove();
-    }
-  }
-};
-
-
-Rico._HoverItem=function(element,selectFunc,hoverClass) {
-  this.add(element,selectFunc,hoverClass);
-};
-
-Rico._HoverItem.prototype = {
-  add: function(element,selectFunc,hoverClass) {
-    this.element=element;
-    this.selectFunc=selectFunc;
-    this.hoverClass=hoverClass;
-    this.movehandle=Rico.eventHandle(this,'move');
-    this.outhandle=Rico.eventHandle(this,'mouseout');
-    Rico.eventBind(element, "mousemove", this.movehandle);
-    Rico.eventBind(element, "mouseout", this.outhandle);
-  },
-  
-  move: function(ev) {
-    var elems=this.selectFunc(this.element);
-    for (var i=0; i<elems.length; i++)
-      Rico.addClass(elems[i],this.hoverClass);
-  },
-
-  mouseout: function(ev) {
-    var elems=this.selectFunc(this.element);
-    for (var i=0; i<elems.length; i++)
-      Rico.removeClass(elems[i],this.hoverClass);
-  },
-
-  remove: function() {
-    Rico.eventUnbind(element, "mousemove", this.movehandle);
-    Rico.eventUnbind(element, "mouseout", this.outhandle);
-  }
-};
-
-
-/** @namespace */
-Rico.Effect = {};
-Rico.Effect.easeIn = function(step){
-  return Math.sqrt(step);
-};
-Rico.Effect.easeOut = function(step){
-  return step*step;
-};
-
-
-/** @class core methods for transition effects */
-Rico.ContentTransitionBase = function() {};
-Rico.ContentTransitionBase.prototype = {
-  initBase: function(titles, contents, options) {
-    Rico.log('ContentTransitionBase#initBase');
-    if (typeof titles == 'string')
-      titles = Rico.select(titles);
-    if (typeof contents == 'string')
-      contents = Rico.select(contents);
-
-    this.options = options || {};
-    this.titles = titles;
-    this.contents = contents;
-    this.hoverSet = new Rico.HoverSet(titles, options);
-    for (var i=0; i<contents.length; i++) {
-      if (contents[i]) Rico.hide(contents[i]);
-    }
-    this.selectionSet = new Rico.SelectionSet(titles, Rico.extend(options, {onSelect: Rico.bind(this,'_finishSelect')}));
-  },
-  reset: function(){
-    this.selectionSet.reset();
-  },
-  select: function(index) {
-    this.selectionSet.selectIndex(index);
-  },
-  _finishSelect: function(index) {
-    Rico.log('ContentTransitionBase#_finishSelect');
-    var panel = this.contents[index];
-    if (!panel) {
-      alert('Internal error: no panel @index='+index);
-      return;
-    }
-    if ( this.selected == panel) return;
-    if (this.transition){
-      if (this.selected){
-        this.transition(panel);
-      } else {
-        panel.style.display='block';
-      }
-    } else {
-      if (this.selected) Rico.hide(this.selected);
-      panel.style.display='block';
-    }
-    this.selected = panel;
-  },
-  addBase: function(title, content){
-    this.titles.push(title);
-    this.contents.push(content);
-    this.hoverSet.add(title);
-    this.selectionSet.add(title);
-    Rico.hide(content);
-    //this.selectionSet.select(title);
-  },
-  removeBase: function(title){},
-  removeAll: function(){
-    this.hoverSet.removeAll();
-    this.selectionSet.removeAll();
-  }
-};
-
-
-/**
- * @class Implements accordion effect
- * @see Rico.ContentTransitionBase#initialize for construction parameters
- * @extends Rico.ContentTransitionBase
- */
-Rico.Accordion = function(element, options) {
-  this.initialize(element, options);
-};
-
-Rico.Accordion.prototype = Rico.extend(new Rico.ContentTransitionBase(), 
-/** @lends Rico.Accordion# */
-{
-  initialize: function(element, options) {
-    element=Rico.$(element);
-    element.style.overflow='hidden';
-    element.className=options.accClass || Rico.theme.accordion || "Rico_accordion";
-    if (typeof options.panelWidth=='number') options.panelWidth+="px";
-    if (options.panelWidth) element.style.width = options.panelWidth;
-    var panels=Rico.getDirectChildrenByTag(element,'div');
-    var items,titles=[], contents=[];
-    for (var i=0; i<panels.length; i++) {
-      items=Rico.getDirectChildrenByTag(panels[i],'div');
-      if (items.length>=2) {
-        items[0].className=options.titleClass || Rico.theme.accTitle || "Rico_accTitle";
-        items[1].className=options.contentClass || Rico.theme.accContent || "Rico_accContent";
-        titles.push(items[0]);
-        contents.push(items[1]);
-        var a=Rico.wrapChildren(items[0],'','','a');
-        a.href="javascript:void(0)";
-      }
-    }
-    Rico.log('creating Rico.Accordion for '+element.id+' with '+titles.length+' panels');
-    this.initBase(titles, contents, options);
-    this.selected.style.height = this.options.panelHeight + "px";
-    this.totSteps=(typeof options.duration =='number' ? options.duration : 200)/25;
-  },
-  transition: function(p){
-    if (!this.options.noAnimate) {
-      this.closing=this.selected;
-      this.opening=p;
-      this.curStep=0;
-      this.timer=setInterval(Rico.bind(this,'step'),25);
-    } else {
-      p.style.height = this.options.panelHeight + "px";
-      if (this.selected) Rico.hide(this.selected);
-      p.style.display='block';
-    }
-  },
-  step: function() {
-    this.curStep++;
-    var oheight=Math.round(this.curStep/this.totSteps*this.options.panelHeight);
-    this.opening.style.height=oheight+'px';
-    this.closing.style.height=(this.options.panelHeight - oheight)+'px';
-    if (this.curStep==1) {
-      this.opening.style.paddingTop=this.opening.style.paddingBottom='0px';
-      this.opening.style.display='block';
-    }
-    if (this.curStep==this.totSteps) {
-      clearInterval(this.timer);
-      this.opening.style.paddingTop=this.opening.style.paddingBottom='';
-      Rico.hide(this.closing);
-    }
-  },
-  setPanelHeight: function(h) {
-    this.options.panelHeight = h;
-    this.selected.style.height = this.options.panelHeight + "px";
-  }
-});
-
-
-/**
- * @class Implements tabbed panel effect
- * @see Rico.ContentTransitionBase#initialize for construction parameters
- * @extends Rico.ContentTransitionBase
- */
-Rico.TabbedPanel = function(element, options) {
-  this.initialize(element, options);
-};
-
-Rico.TabbedPanel.prototype = Rico.extend(new Rico.ContentTransitionBase(),
-{
-  initialize: function(element, options) {
-    element=Rico.$(element);
-    options=options || {};
-    if (typeof options.panelWidth=='number') options.panelWidth+="px";
-    if (typeof options.panelHeight=='number') options.panelHeight+="px";
-    element.className=options.tabClass || Rico.theme.tabPanel || "Rico_tabPanel";
-    if (options.panelWidth) element.style.width = options.panelWidth;
-    var items = [];
-    var allKids = element.childNodes;
-    for( var i = 0 ; i < allKids.length ; i++ ) {
-      if (allKids[i] && allKids[i].tagName && allKids[i].tagName.match(/^div|ul$/i))
-        items.push(allKids[i]);
-    }
-    if (items.length < 2) return;
-    var childTag=items[0].tagName.toLowerCase()=='ul' ? 'li' : 'div';
-    items[0].className=options.navContainerClass || Rico.theme.tabNavContainer || "Rico_tabNavContainer";
-    items[0].style.listStyle='none';
-    items[1].className=options.contentContainerClass || Rico.theme.tabContentContainer || "Rico_tabContentContainer";
-    var titles=Rico.getDirectChildrenByTag(items[0], childTag);
-    var contents=Rico.getDirectChildrenByTag(items[1],'div');
-    if (!options.corners) options.corners='top';
-    for (var i=0; i<titles.length; i++) {
-      titles[i].className=options.titleClass || Rico.theme.tabTitle || "Rico_tabTitle";
-      var a=Rico.wrapChildren(titles[i],'','','a');
-      a.href="javascript:void(0)";
-      contents[i].className=options.contentClass || Rico.theme.tabContent || "Rico_tabContent";
-      if (options.panelHeight) contents[i].style.overflow='auto';
-      if (options.corners!='none') {
-        if (options.panelHdrWidth) titles[i].style.width=options.panelHdrWidth;
-        Rico.Corner.round(titles[i], Rico.theme.tabCornerOptions || options);
-      }
-    }
-    options.selectedClass=Rico.theme.tabSelected || 'selected';
-    this.initBase(titles, contents, options);
-    if (this.selected) this.transition(this.selected);
-  },
-  transition: function(p){
-    Rico.log('TabbedPanel#transition '+typeof(p));
-    if (this.selected) Rico.hide(this.selected);
-    Rico.show(p);
-    if (this.options.panelHeight) p.style.height = this.options.panelHeight;
-  }
-});
-
-
-/**
- * @namespace
- */
-Rico.Corner = {
-
-   round: function(e, options) {
-      e = Rico.$(e);
-      this.options = {
-         corners : "all",
-         bgColor : "fromParent",
-         compact : false,
-         nativeCorners: false  // only use native corners
-      };
-      Rico.extend(this.options, options || {});
-      if (Rico.isGecko)
-        this._roundCornersGecko(e);
-      else if (typeof(Rico.getStyle(e,'-webkit-border-radius'))=='string')
-        this._roundCornersWebKit(e);
-      else if (!this.options.nativeCorners)
-        this._roundCornersImpl(e);
-   },
-
-   _roundCornersImpl: function(e) {
-      var bgColor = this.options.bgColor == "fromParent" ? this._background(e.parentNode) : this.options.bgColor;
-      e.style.position='relative';
-      //this.options.numSlices = this.options.compact ? 2 : 4;
-      if (this._hasString(this.options.corners, "all", "top", "tl")) this._createCorner(e,'top','left',bgColor);
-      if (this._hasString(this.options.corners, "all", "top", "tr")) this._createCorner(e,'top','right',bgColor);
-      if (this._hasString(this.options.corners, "all", "bottom", "bl")) this._createCorner(e,'bottom','left',bgColor);
-      if (this._hasString(this.options.corners, "all", "bottom", "br")) this._createCorner(e,'bottom','right',bgColor);
-   },
-
-   _roundCornersGecko: function(e) {
-      var radius=this.options.compact ? '4px' : '8px';
-      if (this._hasString(this.options.corners, "all"))
-        Rico.setStyle(e, {MozBorderRadius:radius});
-      else {
-        if (this._hasString(this.options.corners, "top", "tl")) Rico.setStyle(e, {MozBorderRadiusTopleft:radius});
-        if (this._hasString(this.options.corners, "top", "tr")) Rico.setStyle(e, {MozBorderRadiusTopright:radius});
-        if (this._hasString(this.options.corners, "bottom", "bl")) Rico.setStyle(e, {MozBorderRadiusBottomleft:radius});
-        if (this._hasString(this.options.corners, "bottom", "br")) Rico.setStyle(e, {MozBorderRadiusBottomright:radius});
-      }
-   },
-
-   _roundCornersWebKit: function(e) {
-      var radius=this.options.compact ? '4px' : '8px';
-      if (this._hasString(this.options.corners, "all"))
-        Rico.setStyle(e, {WebkitBorderRadius:radius});
-      else {
-        if (this._hasString(this.options.corners, "top", "tl")) Rico.setStyle(e, {WebkitBorderTopLeftRadius:radius});
-        if (this._hasString(this.options.corners, "top", "tr")) Rico.setStyle(e, {WebkitBorderTopRightRadius:radius});
-        if (this._hasString(this.options.corners, "bottom", "bl")) Rico.setStyle(e, {WebkitBorderBottomLeftRadius:radius});
-        if (this._hasString(this.options.corners, "bottom", "br")) Rico.setStyle(e, {WebkitBorderBottomRightRadius:radius});
-      }
-   },
-   
-  _createCorner: function(elem,tb,lr,bgColor) {
-    //alert('Corner: '+tb+' '+lr+' bgColor='+typeof(bgColor));
-    var corner = document.createElement("div");
-    corner.className='ricoCorner';
-    Rico.setStyle(corner,{width:'6px', height:'5px'});
-    var borderStyle = Rico.getStyle(elem,'border-'+tb+'-style');
-    var borderColor = borderStyle=='none' ? bgColor : Rico.getStyle(elem,'border-'+tb+'-color');
-    //alert('Corner: '+tb+' '+borderStyle+borderColor+' '+);
-    var pos=borderStyle=='none' ? '0px' : '-1px';
-    corner.style[tb]=pos;
-    corner.style[lr]=Rico.isIE && Rico.ieVersion<7 && lr=='right' && borderStyle!='none' ? '-2px' : '-1px';
-    //corner.style[lr]='-1px';
-    elem.appendChild(corner);
-    var marginSizes = [ 0, 2, 3, 4, 4 ];
-    if (tb=='bottom') marginSizes.reverse();
-    var borderVal= borderStyle=='none' ? '0px none' : '1px solid '+borderColor;
-    var d= lr=='left' ? 'Right' : 'Left';
-    for (var i=0; i<marginSizes.length; i++) {
-      var slice = document.createElement("div");
-      Rico.setStyle(slice,{backgroundColor:bgColor,height:'1px'});
-      slice.style['margin'+d]=marginSizes[i]+'px';
-      slice.style['border'+d]=borderVal;
-      corner.appendChild(slice);
-    }
-  },
-
-  _background: function(elem) {
-     try {
-       var actualColor = Rico.getStyle(elem, "backgroundColor");
-
-       // if color is tranparent, check parent
-       // Safari returns "rgba(0, 0, 0, 0)", which means transparent
-       if ( actualColor.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i) && elem.parentNode )
-          return this._background(elem.parentNode);
-
-       return actualColor == null ? "#ffffff" : actualColor;
-     } catch(err) {
-       return "#ffffff";
-     }
-   },
-
-   _hasString: function(str) {
-     for(var i=1 ; i<arguments.length ; i++) {
-       if (str.indexOf(arguments[i]) >= 0) return true;
-     }
-     return false;
-   }
-
-};
-
-Rico.toColorPart = function(c) {
-  return Rico.zFill(c, 2, 16);
-};
-
-
-Rico.Color = function(red, green, blue) {
-  this.initialize(red, green, blue);
-};
-
-Rico.Color.prototype = {
-/**
- * @class Methods to manipulate color values.
- * @constructs
- * @param red integer (0-255)
- * @param green integer (0-255)
- * @param blue integer (0-255)
- */
-   initialize: function(red, green, blue) {
-      this.rgb = { r: red, g : green, b : blue };
-   },
-
-   setRed: function(r) {
-      this.rgb.r = r;
-   },
-
-   setGreen: function(g) {
-      this.rgb.g = g;
-   },
-
-   setBlue: function(b) {
-      this.rgb.b = b;
-   },
-
-   setHue: function(h) {
-
-      // get an HSB model, and set the new hue...
-      var hsb = this.asHSB();
-      hsb.h = h;
-
-      // convert back to RGB...
-      this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
-   },
-
-   setSaturation: function(s) {
-      // get an HSB model, and set the new hue...
-      var hsb = this.asHSB();
-      hsb.s = s;
-
-      // convert back to RGB and set values...
-      this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
-   },
-
-   setBrightness: function(b) {
-      // get an HSB model, and set the new hue...
-      var hsb = this.asHSB();
-      hsb.b = b;
-
-      // convert back to RGB and set values...
-      this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
-   },
-
-   darken: function(percent) {
-      var hsb  = this.asHSB();
-      this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
-   },
-
-   brighten: function(percent) {
-      var hsb  = this.asHSB();
-      this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
-   },
-
-   blend: function(other) {
-      this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2);
-      this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2);
-      this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2);
-   },
-
-   isBright: function() {
-      var hsb = this.asHSB();
-      return this.asHSB().b > 0.5;
-   },
-
-   isDark: function() {
-      return ! this.isBright();
-   },
-
-   asRGB: function() {
-      return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")";
-   },
-
-   asHex: function() {
-      return "#" + Rico.toColorPart(this.rgb.r) + Rico.toColorPart(this.rgb.g) + Rico.toColorPart(this.rgb.b);
-   },
-
-   asHSB: function() {
-      return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
-   },
-
-   toString: function() {
-      return this.asHex();
-   }
-
-};
-
-/**
- * Factory method for creating a color from an RGB string
- * @param hexCode a 3 or 6 digit hex string, optionally preceded by a # symbol
- * @returns a Rico.Color object
- */
-Rico.Color.createFromHex = function(hexCode) {
-  if(hexCode.length==4) {
-    var shortHexCode = hexCode;
-    hexCode = '#';
-    for(var i=1;i<4;i++)
-      hexCode += (shortHexCode.charAt(i) + shortHexCode.charAt(i));
-  }
-  if ( hexCode.indexOf('#') == 0 )
-    hexCode = hexCode.substring(1);
-  if (!hexCode.match(/^[0-9A-Fa-f]{6}$/)) return null;
-  var red   = hexCode.substring(0,2);
-  var green = hexCode.substring(2,4);
-  var blue  = hexCode.substring(4,6);
-  return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
-};
-
-/**
- * Retrieves the background color of an HTML element
- * @param elem the DOM element whose background color should be retreived
- * @returns a Rico.Color object
- */
-Rico.Color.createColorFromBackground = function(elem) {
-
-   if (!elem.style) return new Rico.Color(255,255,255);
-   var actualColor = Rico.getStyle(elem, "background-color");
-
-   // if color is tranparent, check parent
-   // Safari returns "rgba(0, 0, 0, 0)", which means transparent
-   if ( actualColor.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i) && elem.parentNode )
-      return Rico.Color.createColorFromBackground(elem.parentNode);
-
-   if (actualColor == null) return new Rico.Color(255,255,255);
-
-   if ( actualColor.indexOf("rgb(") == 0 ) {
-      var colors = actualColor.substring(4, actualColor.length - 1 );
-      var colorArray = colors.split(",");
-      return new Rico.Color( parseInt( colorArray[0],10 ),
-                             parseInt( colorArray[1],10 ),
-                             parseInt( colorArray[2],10 )  );
-
-   }
-   else if ( actualColor.indexOf("#") == 0 ) {
-      return Rico.Color.createFromHex(actualColor);
-   }
-   else
-      return new Rico.Color(255,255,255);
-};
-
-/**
- * Converts hue/saturation/brightness to RGB
- * @returns a 3-element object: r=red, g=green, b=blue.
- */
-Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
-
-  var red   = 0;
-  var green = 0;
-  var blue  = 0;
-
-  if (saturation == 0) {
-     red = parseInt(brightness * 255.0 + 0.5,10);
-     green = red;
-     blue = red;
-  }
-  else {
-      var h = (hue - Math.floor(hue)) * 6.0;
-      var f = h - Math.floor(h);
-      var p = brightness * (1.0 - saturation);
-      var q = brightness * (1.0 - saturation * f);
-      var t = brightness * (1.0 - (saturation * (1.0 - f)));
-
-      switch (parseInt(h,10)) {
-         case 0:
-            red   = (brightness * 255.0 + 0.5);
-            green = (t * 255.0 + 0.5);
-            blue  = (p * 255.0 + 0.5);
-            break;
-         case 1:
-            red   = (q * 255.0 + 0.5);
-            green = (brightness * 255.0 + 0.5);
-            blue  = (p * 255.0 + 0.5);
-            break;
-         case 2:
-            red   = (p * 255.0 + 0.5);
-            green = (brightness * 255.0 + 0.5);
-            blue  = (t * 255.0 + 0.5);
-            break;
-         case 3:
-            red   = (p * 255.0 + 0.5);
-            green = (q * 255.0 + 0.5);
-            blue  = (brightness * 255.0 + 0.5);
-            break;
-         case 4:
-            red   = (t * 255.0 + 0.5);
-            green = (p * 255.0 + 0.5);
-            blue  = (brightness * 255.0 + 0.5);
-            break;
-          case 5:
-            red   = (brightness * 255.0 + 0.5);
-            green = (p * 255.0 + 0.5);
-            blue  = (q * 255.0 + 0.5);
-            break;
-      }
-  }
-
-   return { r : parseInt(red,10), g : parseInt(green,10) , b : parseInt(blue,10) };
-};
-
-/**
- * Converts RGB value to hue/saturation/brightness
- * @param r integer (0-255)
- * @param g integer (0-255)
- * @param b integer (0-255)
- * @returns a 3-element object: h=hue, s=saturation, b=brightness.
- * (unlike some HSB documentation which states hue should be a value 0-360, this routine returns hue values from 0 to 1.0)
- */
-Rico.Color.RGBtoHSB = function(r, g, b) {
-
-   var hue;
-   var saturation;
-   var brightness;
-
-   var cmax = (r > g) ? r : g;
-   if (b > cmax)
-      cmax = b;
-
-   var cmin = (r < g) ? r : g;
-   if (b < cmin)
-      cmin = b;
-
-   brightness = cmax / 255.0;
-   if (cmax != 0)
-      saturation = (cmax - cmin)/cmax;
-   else
-      saturation = 0;
-
-   if (saturation == 0)
-      hue = 0;
-   else {
-      var redc   = (cmax - r)/(cmax - cmin);
-      var greenc = (cmax - g)/(cmax - cmin);
-      var bluec  = (cmax - b)/(cmax - cmin);
-
-      if (r == cmax)
-         hue = bluec - greenc;
-      else if (g == cmax)
-         hue = 2.0 + redc - bluec;
-      else
-         hue = 4.0 + greenc - redc;
-
-      hue = hue / 6.0;
-      if (hue < 0)
-         hue = hue + 1.0;
-   }
-
-   return { h : hue, s : saturation, b : brightness };
-};
-
-/**
- * Returns a new XML document object
- */
-Rico.createXmlDocument = function() {
-  if (document.implementation && document.implementation.createDocument) {
-    var doc = document.implementation.createDocument("", "", null);
-    // some older versions of Moz did not support the readyState property
-    // and the onreadystate event so we patch it! 
-    if (doc.readyState == null) {
-      doc.readyState = 1;
-      doc.addEventListener("load", function () {
-        doc.readyState = 4;
-        if (typeof doc.onreadystatechange == "function") {
-          doc.onreadystatechange();
-        }
-      }, false);
-    }
-    return doc;
-  }
-
-  if (window.ActiveXObject)
-      return Rico.tryFunctions(
-        function() { return new ActiveXObject('MSXML2.DomDocument');   },
-        function() { return new ActiveXObject('Microsoft.DomDocument');},
-        function() { return new ActiveXObject('MSXML.DomDocument');    },
-        function() { return new ActiveXObject('MSXML3.DomDocument');   }
-      ) || false;
-  return null;
-}
-
-Rico.includeLoaded('ricoUI.js');