var Rico={Version:"1.1.0",prototypeVersion:parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])};
if((typeof Prototype=="undefined")||Rico.prototypeVersion<1.3){
throw ("Rico requires the Prototype JavaScript framework >= 1.3");
}
Rico.ArrayExtensions=new Array();
if(Object.prototype.extend){
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;
}else{
Object.prototype.extend=function(_1){
return Object.extend.apply(this,[this,_1]);
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;
}
if(Array.prototype.push){
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push;
}
if(!Array.prototype.remove){
Array.prototype.remove=function(dx){
if(isNaN(dx)||dx>this.length){
return false;
}
for(var i=0,n=0;i<this.length;i++){
if(i!=dx){
this[n++]=this[i];
}
}
this.length-=1;
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove;
}
if(!Array.prototype.removeItem){
Array.prototype.removeItem=function(_4){
for(var i=0;i<this.length;i++){
if(this[i]==_4){
this.remove(i);
break;
}
}
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem;
}
if(!Array.prototype.indices){
Array.prototype.indices=function(){
var _5=new Array();
for(index in this){
var _6=false;
for(var i=0;i<Rico.ArrayExtensions.length;i++){
if(this[index]==Rico.ArrayExtensions[i]){
_6=true;
break;
}
}
if(!_6){
_5[_5.length]=index;
}
}
return _5;
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices;
}
if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){
if(!Document.prototype.loadXML){
Document.prototype.loadXML=function(s){
var _8=(new DOMParser()).parseFromString(s,"text/xml");
while(this.hasChildNodes()){
this.removeChild(this.lastChild);
}
for(var i=0;i<_8.childNodes.length;i++){
this.appendChild(this.importNode(_8.childNodes[i],true));
}
};
}
Document.prototype.__defineGetter__("xml",function(){
return (new XMLSerializer()).serializeToString(this);
});
}
document.getElementsByTagAndClassName=function(_9,_10){
if(_9==null){
_9="*";
}
var _11=document.getElementsByTagName(_9)||document.all;
var _12=new Array();
if(_10==null){
return _11;
}
for(var i=0;i<_11.length;i++){
var _13=_11[i];
var _14=_13.className.split(" ");
for(var j=0;j<_14.length;j++){
if(_14[j]==_10){
_12.push(_13);
break;
}
}
}
return _12;
};
Rico.Accordion=Class.create();
Rico.Accordion.prototype={initialize:function(_16,_17){
this.container=$(_16);
this.lastExpandedTab=null;
this.accordionTabs=new Array();
this.setOptions(_17);
this._attachBehaviors();
if(!_16){
return;
}
this.container.style.borderBottom="1px solid "+this.options.borderColor;
if(this.options.onLoadShowTab>=this.accordionTabs.length){
this.options.onLoadShowTab=0;
}
for(var i=0;i<this.accordionTabs.length;i++){
if(i!=this.options.onLoadShowTab){
this.accordionTabs[i].collapse();
this.accordionTabs[i].content.style.display="none";
}
}
this.lastExpandedTab=this.accordionTabs[this.options.onLoadShowTab];
if(this.options.panelHeight=="auto"){
var _18=(this.options.onloadShowTab===0)?1:0;
var _19=parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[_18].titleBar,"height"));
if(isNaN(_19)){
_19=this.accordionTabs[_18].titleBar.offsetHeight;
}
var _20=this.accordionTabs.length*_19;
var _21=parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode,"height"));
if(isNaN(_21)){
_21=this.container.parentNode.offsetHeight;
}
this.options.panelHeight=_21-_20-2;
}
this.lastExpandedTab.content.style.height=this.options.panelHeight+"px";
this.lastExpandedTab.showExpanded();
this.lastExpandedTab.titleBar.style.fontWeight=this.options.expandedFontWeight;
},setOptions:function(_22){
this.options={expandedBg:"#63699c",hoverBg:"#63699c",collapsedBg:"#6b79a5",expandedTextColor:"#ffffff",expandedFontWeight:"bold",hoverTextColor:"#ffffff",collapsedTextColor:"#ced7ef",collapsedFontWeight:"normal",hoverTextColor:"#ffffff",borderColor:"#1f669b",panelHeight:200,onHideTab:null,onShowTab:null,onLoadShowTab:0};
Object.extend(this.options,_22||{});
},showTabByIndex:function(_23,_24){
var _25=arguments.length==1?true:_24;
this.showTab(this.accordionTabs[_23],_25);
},showTab:function(_26,_27){
var _28=arguments.length==1?true:_27;
if(this.options.onHideTab){
this.options.onHideTab(this.lastExpandedTab);
}
this.lastExpandedTab.showCollapsed();
var _29=this;
var _30=this.lastExpandedTab;
this.lastExpandedTab.content.style.height=(this.options.panelHeight-1)+"px";
_26.content.style.display="";
_26.titleBar.style.fontWeight=this.options.expandedFontWeight;
if(_28){
new Rico.Effect.AccordionSize(this.lastExpandedTab.content,_26.content,1,this.options.panelHeight,100,10,{complete:function(){
_29.showTabDone(_30);
}});
this.lastExpandedTab=_26;
}else{
this.lastExpandedTab.content.style.height="1px";
_26.content.style.height=this.options.panelHeight+"px";
this.lastExpandedTab=_26;
this.showTabDone(_30);
}
},showTabDone:function(_31){
_31.content.style.display="none";
this.lastExpandedTab.showExpanded();
if(this.options.onShowTab){
this.options.onShowTab(this.lastExpandedTab);
}
},_attachBehaviors:function(){
var _32=this._getDirectChildrenByTag(this.container,"DIV");
for(var i=0;i<_32.length;i++){
var _33=this._getDirectChildrenByTag(_32[i],"DIV");
if(_33.length!=2){
continue;
}
var _34=_33[0];
var _35=_33[1];
this.accordionTabs.push(new Rico.Accordion.Tab(this,_34,_35));
}
},_getDirectChildrenByTag:function(e,_37){
var _38=new Array();
var _39=e.childNodes;
for(var i=0;i<_39.length;i++){
if(_39[i]&&_39[i].tagName&&_39[i].tagName==_37){
_38.push(_39[i]);
}
}
return _38;
}};
Rico.Accordion.Tab=Class.create();
Rico.Accordion.Tab.prototype={initialize:function(_40,_41,_42){
this.accordion=_40;
this.titleBar=_41;
this.content=_42;
this._attachBehaviors();
},collapse:function(){
this.showCollapsed();
this.content.style.height="1px";
},showCollapsed:function(){
this.expanded=false;
this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;
this.titleBar.style.color=this.accordion.options.collapsedTextColor;
this.titleBar.style.fontWeight=this.accordion.options.collapsedFontWeight;
this.content.style.overflow="hidden";
},showExpanded:function(){
this.expanded=true;
this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;
this.titleBar.style.color=this.accordion.options.expandedTextColor;
this.content.style.overflow="visible";
},titleBarClicked:function(e){
if(this.accordion.lastExpandedTab==this){
return;
}
this.accordion.showTab(this);
},hover:function(e){
this.titleBar.style.backgroundColor=this.accordion.options.hoverBg;
this.titleBar.style.color=this.accordion.options.hoverTextColor;
},unhover:function(e){
if(this.expanded){
this.titleBar.style.backgroundColor=this.accordion.options.expandedBg;
this.titleBar.style.color=this.accordion.options.expandedTextColor;
}else{
this.titleBar.style.backgroundColor=this.accordion.options.collapsedBg;
this.titleBar.style.color=this.accordion.options.collapsedTextColor;
}
},_attachBehaviors:function(){
this.content.style.border="1px solid "+this.accordion.options.borderColor;
this.content.style.borderTopWidth="0px";
this.content.style.borderBottomWidth="0px";
this.content.style.margin="0px";
this.titleBar.onclick=this.titleBarClicked.bindAsEventListener(this);
this.titleBar.onmouseover=this.hover.bindAsEventListener(this);
this.titleBar.onmouseout=this.unhover.bindAsEventListener(this);
}};
Rico.AjaxEngine=Class.create();
Rico.AjaxEngine.prototype={initialize:function(){
this.ajaxElements=new Array();
this.ajaxObjects=new Array();
this.requestURLS=new Array();
this.options={};
},registerAjaxElement:function(_43,_44){
if(!_44){
_44=$(_43);
}
this.ajaxElements[_43]=_44;
},registerAjaxObject:function(_45,_46){
this.ajaxObjects[_45]=_46;
},registerRequest:function(_47,_48){
this.requestURLS[_47]=_48;
},sendRequest:function(_49,_50){
if(arguments.length>=2){
if(typeof arguments[1]=="string"){
_50={parameters:this._createQueryString(arguments,1)};
}
}
this.sendRequestWithData(_49,null,_50);
},sendRequestWithData:function(_51,_52,_53){
var _54=this.requestURLS[_51];
if(_54==null){
return;
}
if(arguments.length>=3){
if(typeof arguments[2]=="string"){
_53.parameters=this._createQueryString(arguments,2);
}
}
new Ajax.Request(_54,this._requestOptions(_53,_52));
},sendRequestAndUpdate:function(_55,_56,_57){
if(arguments.length>=3){
if(typeof arguments[2]=="string"){
_57.parameters=this._createQueryString(arguments,2);
}
}
this.sendRequestWithDataAndUpdate(_55,null,_56,_57);
},sendRequestWithDataAndUpdate:function(_58,_59,_60,_61){
var _62=this.requestURLS[_58];
if(_62==null){
return;
}
if(arguments.length>=4){
if(typeof arguments[3]=="string"){
_61.parameters=this._createQueryString(arguments,3);
}
}
var _63=this._requestOptions(_61,_59);
new Ajax.Updater(_60,_62,_63);
},_requestOptions:function(_64,_65){
var _66=["X-Rico-Version",Rico.Version];
var _67="post";
if(_65==null){
if(Rico.prototypeVersion<1.4){
_66.push("Content-type","text/xml");
}else{
_67="get";
}
}
(!_64)?_64={}:"";
if(!_64._RicoOptionsProcessed){
if(_64.onComplete){
_64.onRicoComplete=_64.onComplete;
}
if(_64.overrideOnComplete){
_64.onComplete=_64.overrideOnComplete;
}else{
_64.onComplete=this._onRequestComplete.bind(this);
}
_64._RicoOptionsProcessed=true;
}
this.options={requestHeaders:_66,parameters:_64.parameters,postBody:_65,method:_67,onComplete:_64.onComplete};
Object.extend(this.options,_64);
return this.options;
},_createQueryString:function(_68,_69){
var _70="";
for(var i=_69;i<_68.length;i++){
if(i!=_69){
_70+="&";
}
var _71=_68[i];
if(_71.name!=undefined&&_71.value!=undefined){
_70+=_71.name+"="+escape(_71.value);
}else{
var _72=_71.indexOf("=");
var _73=_71.substring(0,_72);
var _74=_71.substring(_72+1);
_70+=_73+"="+escape(_74);
}
}
return _70;
},_onRequestComplete:function(_75){
if(!_75){
return;
}
if(_75.status!=200){
return;
}
var _76=_75.responseXML.getElementsByTagName("ajax-response");
if(_76==null||_76.length!=1){
return;
}
this._processAjaxResponse(_76[0].childNodes);
var _77=this.options.onRicoComplete;
if(_77!=null){
_77();
}
},_processAjaxResponse:function(_78){
for(var i=0;i<_78.length;i++){
var _79=_78[i];
if(_79.nodeType!=1){
continue;
}
var _80=_79.getAttribute("type");
var _81=_79.getAttribute("id");
if(_80=="object"){
this._processAjaxObjectUpdate(this.ajaxObjects[_81],_79);
}else{
if(_80=="element"){
this._processAjaxElementUpdate(this.ajaxElements[_81],_79);
}else{
alert("unrecognized AjaxResponse type : "+_80);
}
}
}
},_processAjaxObjectUpdate:function(_82,_83){
_82.ajaxUpdate(_83);
},_processAjaxElementUpdate:function(_84,_85){
_84.innerHTML=RicoUtil.getContentAsString(_85);
}};
var ajaxEngine=new Rico.AjaxEngine();
Rico.Color=Class.create();
Rico.Color.prototype={initialize:function(red,_87,_88){
this.rgb={r:red,g:_87,b:_88};
},setRed:function(r){
this.rgb.r=r;
},setGreen:function(g){
this.rgb.g=g;
},setBlue:function(b){
this.rgb.b=b;
},setHue:function(h){
var hsb=this.asHSB();
hsb.h=h;
this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);
},setSaturation:function(s){
var hsb=this.asHSB();
hsb.s=s;
this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);
},setBrightness:function(b){
var hsb=this.asHSB();
hsb.b=b;
this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);
},darken:function(_94){
var hsb=this.asHSB();
this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.max(hsb.b-_94,0));
},brighten:function(_95){
var hsb=this.asHSB();
this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.min(hsb.b+_95,1));
},blend:function(_96){
this.rgb.r=Math.floor((this.rgb.r+_96.rgb.r)/2);
this.rgb.g=Math.floor((this.rgb.g+_96.rgb.g)/2);
this.rgb.b=Math.floor((this.rgb.b+_96.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 "#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart();
},asHSB:function(){
return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b);
},toString:function(){
return this.asHex();
}};
Rico.Color.createFromHex=function(_97){
if(_97.length==4){
var _98=_97;
var _97="#";
for(var i=1;i<4;i++){
_97+=(_98.charAt(i)+_98.charAt(i));
}
}
if(_97.indexOf("#")==0){
_97=_97.substring(1);
}
var red=_97.substring(0,2);
var _99=_97.substring(2,4);
var blue=_97.substring(4,6);
return new Rico.Color(parseInt(red,16),parseInt(_99,16),parseInt(blue,16));
};
Rico.Color.createColorFromBackground=function(elem){
var _102=RicoUtil.getElementsComputedStyle($(elem),"backgroundColor","background-color");
if(_102=="transparent"&&elem.parentNode){
return Rico.Color.createColorFromBackground(elem.parentNode);
}
if(_102==null){
return new Rico.Color(255,255,255);
}
if(_102.indexOf("rgb(")==0){
var _103=_102.substring(4,_102.length-1);
var _104=_103.split(",");
return new Rico.Color(parseInt(_104[0]),parseInt(_104[1]),parseInt(_104[2]));
}else{
if(_102.indexOf("#")==0){
return Rico.Color.createFromHex(_102);
}else{
return new Rico.Color(255,255,255);
}
}
};
Rico.Color.HSBtoRGB=function(hue,_106,_107){
var red=0;
var _108=0;
var blue=0;
if(_106==0){
red=parseInt(_107*255+0.5);
_108=red;
blue=red;
}else{
var h=(hue-Math.floor(hue))*6;
var f=h-Math.floor(h);
var p=_107*(1-_106);
var q=_107*(1-_106*f);
var t=_107*(1-(_106*(1-f)));
switch(parseInt(h)){
case 0:
red=(_107*255+0.5);
_108=(t*255+0.5);
blue=(p*255+0.5);
break;
case 1:
red=(q*255+0.5);
_108=(_107*255+0.5);
blue=(p*255+0.5);
break;
case 2:
red=(p*255+0.5);
_108=(_107*255+0.5);
blue=(t*255+0.5);
break;
case 3:
red=(p*255+0.5);
_108=(q*255+0.5);
blue=(_107*255+0.5);
break;
case 4:
red=(t*255+0.5);
_108=(p*255+0.5);
blue=(_107*255+0.5);
break;
case 5:
red=(_107*255+0.5);
_108=(p*255+0.5);
blue=(q*255+0.5);
break;
}
}
return {r:parseInt(red),g:parseInt(_108),b:parseInt(blue)};
};
Rico.Color.RGBtoHSB=function(r,g,b){
var hue;
var _113;
var _114;
var cmax=(r>g)?r:g;
if(b>cmax){
cmax=b;
}
var cmin=(r<g)?r:g;
if(b<cmin){
cmin=b;
}
_114=cmax/255;
if(cmax!=0){
_113=(cmax-cmin)/cmax;
}else{
_113=0;
}
if(_113==0){
hue=0;
}else{
var redc=(cmax-r)/(cmax-cmin);
var _118=(cmax-g)/(cmax-cmin);
var _119=(cmax-b)/(cmax-cmin);
if(r==cmax){
hue=_119-_118;
}else{
if(g==cmax){
hue=2+redc-_119;
}else{
hue=4+_118-redc;
}
}
hue=hue/6;
if(hue<0){
hue=hue+1;
}
}
return {h:hue,s:_113,b:_114};
};
Rico.Corner={round:function(e,_120){
var e=$(e);
this._setOptions(_120);
var _121=this.options.color;
if(this.options.color=="fromElement"){
_121=this._background(e);
}
var _122=this.options.bgColor;
if(this.options.bgColor=="fromParent"){
_122=this._background(e.offsetParent);
}
this._roundCornersImpl(e,_121,_122);
},_roundCornersImpl:function(e,_123,_124){
if(this.options.border){
this._renderBorder(e,_124);
}
if(this._isTopRounded()){
this._roundTopCorners(e,_123,_124);
}
if(this._isBottomRounded()){
this._roundBottomCorners(e,_123,_124);
}
},_renderBorder:function(el,_126){
var _127="1px solid "+this._borderColor(_126);
var _128="border-left: "+_127;
var _129="border-right: "+_127;
var _130="style='"+_128+";"+_129+"'";
el.innerHTML="<div "+_130+">"+el.innerHTML+"</div>";
},_roundTopCorners:function(el,_131,_132){
var _133=this._createCorner(_132);
for(var i=0;i<this.options.numSlices;i++){
_133.appendChild(this._createCornerSlice(_131,_132,i,"top"));
}
el.style.paddingTop=0;
el.insertBefore(_133,el.firstChild);
},_roundBottomCorners:function(el,_134,_135){
var _136=this._createCorner(_135);
for(var i=(this.options.numSlices-1);i>=0;i--){
_136.appendChild(this._createCornerSlice(_134,_135,i,"bottom"));
}
el.style.paddingBottom=0;
el.appendChild(_136);
},_createCorner:function(_137){
var _138=document.createElement("div");
_138.style.backgroundColor=(this._isTransparent()?"transparent":_137);
return _138;
},_createCornerSlice:function(_139,_140,n,_142){
var _143=document.createElement("span");
var _144=_143.style;
_144.backgroundColor=_139;
_144.display="block";
_144.height="1px";
_144.overflow="hidden";
_144.fontSize="1px";
var _145=this._borderColor(_139,_140);
if(this.options.border&&n==0){
_144.borderTopStyle="solid";
_144.borderTopWidth="1px";
_144.borderLeftWidth="0px";
_144.borderRightWidth="0px";
_144.borderBottomWidth="0px";
_144.height="0px";
_144.borderColor=_145;
}else{
if(_145){
_144.borderColor=_145;
_144.borderStyle="solid";
_144.borderWidth="0px 1px";
}
}
if(!this.options.compact&&(n==(this.options.numSlices-1))){
_144.height="2px";
}
this._setMargin(_143,n,_142);
this._setBorder(_143,n,_142);
return _143;
},_setOptions:function(_146){
this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};
Object.extend(this.options,_146||{});
this.options.numSlices=this.options.compact?2:4;
if(this._isTransparent()){
this.options.blend=false;
}
},_whichSideTop:function(){
if(this._hasString(this.options.corners,"all","top")){
return "";
}
if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){
return "";
}
if(this.options.corners.indexOf("tl")>=0){
return "left";
}else{
if(this.options.corners.indexOf("tr")>=0){
return "right";
}
}
return "";
},_whichSideBottom:function(){
if(this._hasString(this.options.corners,"all","bottom")){
return "";
}
if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){
return "";
}
if(this.options.corners.indexOf("bl")>=0){
return "left";
}else{
if(this.options.corners.indexOf("br")>=0){
return "right";
}
}
return "";
},_borderColor:function(_147,_148){
if(_147=="transparent"){
return _148;
}else{
if(this.options.border){
return this.options.border;
}else{
if(this.options.blend){
return this._blend(_148,_147);
}else{
return "";
}
}
}
},_setMargin:function(el,n,_149){
var _150=this._marginSize(n);
var _151=_149=="top"?this._whichSideTop():this._whichSideBottom();
if(_151=="left"){
el.style.marginLeft=_150+"px";
el.style.marginRight="0px";
}else{
if(_151=="right"){
el.style.marginRight=_150+"px";
el.style.marginLeft="0px";
}else{
el.style.marginLeft=_150+"px";
el.style.marginRight=_150+"px";
}
}
},_setBorder:function(el,n,_152){
var _153=this._borderSize(n);
var _154=_152=="top"?this._whichSideTop():this._whichSideBottom();
if(_154=="left"){
el.style.borderLeftWidth=_153+"px";
el.style.borderRightWidth="0px";
}else{
if(_154=="right"){
el.style.borderRightWidth=_153+"px";
el.style.borderLeftWidth="0px";
}else{
el.style.borderLeftWidth=_153+"px";
el.style.borderRightWidth=_153+"px";
}
}
if(this.options.border!=false){
el.style.borderLeftWidth=_153+"px";
}
el.style.borderRightWidth=_153+"px";
},_marginSize:function(n){
if(this._isTransparent()){
return 0;
}
var _155=[5,3,2,1];
var _156=[3,2,1,0];
var _157=[2,1];
var _158=[1,0];
if(this.options.compact&&this.options.blend){
return _158[n];
}else{
if(this.options.compact){
return _157[n];
}else{
if(this.options.blend){
return _156[n];
}else{
return _155[n];
}
}
}
},_borderSize:function(n){
var _159=[5,3,2,1];
var _160=[2,1,1,1];
var _161=[1,0];
var _162=[0,2,0,0];
if(this.options.compact&&(this.options.blend||this._isTransparent())){
return 1;
}else{
if(this.options.compact){
return _161[n];
}else{
if(this.options.blend){
return _160[n];
}else{
if(this.options.border){
return _162[n];
}else{
if(this._isTransparent()){
return _159[n];
}
}
}
}
}
return 0;
},_hasString:function(str){
for(var i=1;i<arguments.length;i++){
if(str.indexOf(arguments[i])>=0){
return true;
}
}
return false;
},_blend:function(c1,c2){
var cc1=Rico.Color.createFromHex(c1);
cc1.blend(Rico.Color.createFromHex(c2));
return cc1;
},_background:function(el){
try{
return Rico.Color.createColorFromBackground(el).asHex();
}
catch(err){
return "#ffffff";
}
},_isTransparent:function(){
return this.options.color=="transparent";
},_isTopRounded:function(){
return this._hasString(this.options.corners,"all","top","tl","tr");
},_isBottomRounded:function(){
return this._hasString(this.options.corners,"all","bottom","bl","br");
},_hasSingleTextChild:function(el){
return el.childNodes.length==1&&el.childNodes[0].nodeType==3;
}};
Rico.DragAndDrop=Class.create();
Rico.DragAndDrop.prototype={initialize:function(){
this.dropZones=new Array();
this.draggables=new Array();
this.currentDragObjects=new Array();
this.dragElement=null;
this.lastSelectedDraggable=null;
this.currentDragObjectVisible=false;
this.interestedInMotionEvents=false;
this._mouseDown=this._mouseDownHandler.bindAsEventListener(this);
this._mouseMove=this._mouseMoveHandler.bindAsEventListener(this);
this._mouseUp=this._mouseUpHandler.bindAsEventListener(this);
},registerDropZone:function(_167){
this.dropZones[this.dropZones.length]=_167;
},deregisterDropZone:function(_168){
var _169=new Array();
var j=0;
for(var i=0;i<this.dropZones.length;i++){
if(this.dropZones[i]!=_168){
_169[j++]=this.dropZones[i];
}
}
this.dropZones=_169;
},clearDropZones:function(){
this.dropZones=new Array();
},registerDraggable:function(_170){
this.draggables[this.draggables.length]=_170;
this._addMouseDownHandler(_170);
},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,_171){
this.origPos=RicoUtil.toDocumentPosition(_171);
this.startx=e.screenX-this.origPos.x;
this.starty=e.screenY-this.origPos.y;
this.interestedInMotionEvents=this.hasSelection();
this._terminateEvent(e);
},updateSelection:function(_172,_173){
if(!_173){
this.clearSelection();
}
if(_172.isSelected()){
this.currentDragObjects.removeItem(_172);
_172.deselect();
if(_172==this.lastSelectedDraggable){
this.lastSelectedDraggable=null;
}
}else{
this.currentDragObjects[this.currentDragObjects.length]=_172;
_172.select();
this.lastSelectedDraggable=_172;
}
},_mouseDownHandler:function(e){
if(arguments.length==0){
e=event;
}
var _174=e.which!=undefined;
if((_174&&e.which!=1)||(!_174&&e.button!=1)){
return;
}
var _175=e.target?e.target:e.srcElement;
var _176=_175.draggable;
var _177=_175;
while(_176==null&&_177.parentNode){
_177=_177.parentNode;
_176=_177.draggable;
}
if(_176==null){
return;
}
this.updateSelection(_176,e.ctrlKey);
if(this.hasSelection()){
for(var i=0;i<this.dropZones.length;i++){
this.dropZones[i].clearPositionCache();
}
}
this.setStartDragFromElement(e,_176.getMouseDownHTMLElement());
},_mouseMoveHandler:function(e){
var _178=e.which!=undefined;
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);
this._terminateEvent(e);
},_makeDraggableObjectVisible:function(e){
if(!this.hasSelection()){
return;
}
var _179;
if(this.currentDragObjects.length>1){
_179=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects);
}else{
_179=this.currentDragObjects[0].getSingleObjectDragGUI();
}
if(RicoUtil.getElementsComputedStyle(_179,"position")!="absolute"){
_179.style.position="absolute";
}
if(_179.parentNode==null||_179.parentNode.nodeType==11){
document.body.appendChild(_179);
}
this.dragElement=_179;
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 _180=this.dragElement.style;
_180.left=(e.screenX+this._leftOffset(e)-this.startx)+"px";
_180.top=(e.screenY+this._topOffset(e)-this.starty)+"px";
},_updateDropZonesHover:function(e){
var n=this.dropZones.length;
for(var i=0;i<n;i++){
if(!this._mousePointInDropZone(e,this.dropZones[i])){
this.dropZones[i].hideHover();
}
}
for(var 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;
}
var _181=e.which!=undefined;
if((_181&&e.which!=1)||(!_181&&e.button!=1)){
return;
}
this.interestedInMotionEvents=false;
if(this.dragElement==null){
this._terminateEvent(e);
return;
}
if(this._placeDraggableInDropZone(e)){
this._completeDropOperation(e);
}else{
this._terminateEvent(e);
new Rico.Effect.Position(this.dragElement,this.origPos.x,this.origPos.y,200,20,{complete:this._doCancelDragProcessing.bind(this)});
}
Event.stopObserving(document.body,"mousemove",this._mouseMove);
Event.stopObserving(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;
this._terminateEvent(e);
},_doCancelDragProcessing:function(){
this._cancelDrag();
if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()&&this.dragElement){
if(this.dragElement.parentNode!=null){
this.dragElement.parentNode.removeChild(this.dragElement);
}
}
this._deactivateRegisteredDropZones();
this.dragElement=null;
this.currentDragObjectVisible=false;
},_placeDraggableInDropZone:function(e){
var _182=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);
_182=true;
break;
}
}
}
return _182;
},_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,_183){
var _184=_183.getAbsoluteRect();
return e.clientX>_184.left+this._leftOffset(e)&&e.clientX<_184.right+this._leftOffset(e)&&e.clientY>_184.top+this._topOffset(e)&&e.clientY<_184.bottom+this._topOffset(e);
},_addMouseDownHandler:function(_185){
htmlElement=_185.getMouseDownHTMLElement();
if(htmlElement!=null){
htmlElement.draggable=_185;
Event.observe(htmlElement,"mousedown",this._onmousedown.bindAsEventListener(this));
Event.observe(htmlElement,"mousedown",this._mouseDown);
}
},_activateRegisteredDropZones:function(){
var n=this.dropZones.length;
for(var i=0;i<n;i++){
var _186=this.dropZones[i];
if(_186.canAccept(this.currentDragObjects)){
_186.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;
},_onmousedown:function(){
Event.observe(document.body,"mousemove",this._mouseMove);
Event.observe(document.body,"mouseup",this._mouseUp);
},_terminateEvent:function(e){
if(e.stopPropagation!=undefined){
e.stopPropagation();
}else{
if(e.cancelBubble!=undefined){
e.cancelBubble=true;
}
}
if(e.preventDefault!=undefined){
e.preventDefault();
}else{
e.returnValue=false;
}
},initializeEventHandlers:function(){
if(typeof document.implementation!="undefined"&&document.implementation.hasFeature("HTML","1.0")&&document.implementation.hasFeature("Events","2.0")&&document.implementation.hasFeature("CSS","2.0")){
document.addEventListener("mouseup",this._mouseUpHandler.bindAsEventListener(this),false);
document.addEventListener("mousemove",this._mouseMoveHandler.bindAsEventListener(this),false);
}else{
document.attachEvent("onmouseup",this._mouseUpHandler.bindAsEventListener(this));
document.attachEvent("onmousemove",this._mouseMoveHandler.bindAsEventListener(this));
}
}};
var dndMgr=new Rico.DragAndDrop();
dndMgr.initializeEventHandlers();
Rico.Draggable=Class.create();
Rico.Draggable.prototype={initialize:function(type,_188){
this.type=type;
this.htmlElement=$(_188);
this.selected=false;
},getMouseDownHTMLElement:function(){
return this.htmlElement;
},select:function(){
this.selected=true;
if(this.showingSelected){
return;
}
var _189=this.getMouseDownHTMLElement();
var _190=Rico.Color.createColorFromBackground(_189);
_190.isBright()?_190.darken(0.033):_190.brighten(0.033);
this.saveBackground=RicoUtil.getElementsComputedStyle(_189,"backgroundColor","background-color");
_189.style.backgroundColor=_190.asHex();
this.showingSelected=true;
},deselect:function(){
this.selected=false;
if(!this.showingSelected){
return;
}
var _191=this.getMouseDownHTMLElement();
_191.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(_192){
return this.htmlElement;
},getDroppedGUI:function(){
return this.htmlElement;
},toString:function(){
return this.type+":"+this.htmlElement+":";
}};
Rico.Dropzone=Class.create();
Rico.Dropzone.prototype={initialize:function(_193){
this.htmlElement=$(_193);
this.absoluteRect=null;
},getHTMLElement:function(){
return this.htmlElement;
},clearPositionCache:function(){
this.absoluteRect=null;
},getAbsoluteRect:function(){
if(this.absoluteRect==null){
var _194=this.getHTMLElement();
var pos=RicoUtil.toViewportPosition(_194);
this.absoluteRect={top:pos.y,left:pos.x,bottom:pos.y+_194.offsetHeight,right:pos.x+_194.offsetWidth};
}
return this.absoluteRect;
},activate:function(){
var _196=this.getHTMLElement();
if(_196==null||this.showingActive){
return;
}
this.showingActive=true;
this.saveBackgroundColor=_196.style.backgroundColor;
var _197="#ffea84";
var _198=Rico.Color.createColorFromBackground(_196);
if(_198==null){
_196.style.backgroundColor=_197;
}else{
_198.isBright()?_198.darken(0.2):_198.brighten(0.2);
_196.style.backgroundColor=_198.asHex();
}
},deactivate:function(){
var _199=this.getHTMLElement();
if(_199==null||!this.showingActive){
return;
}
_199.style.backgroundColor=this.saveBackgroundColor;
this.showingActive=false;
this.saveBackgroundColor=null;
},showHover:function(){
var _200=this.getHTMLElement();
if(_200==null||this.showingHover){
return;
}
this.saveBorderWidth=_200.style.borderWidth;
this.saveBorderStyle=_200.style.borderStyle;
this.saveBorderColor=_200.style.borderColor;
this.showingHover=true;
_200.style.borderWidth="1px";
_200.style.borderStyle="solid";
_200.style.borderColor="#ffff00";
},hideHover:function(){
var _201=this.getHTMLElement();
if(_201==null||!this.showingHover){
return;
}
_201.style.borderWidth=this.saveBorderWidth;
_201.style.borderStyle=this.saveBorderStyle;
_201.style.borderColor=this.saveBorderColor;
this.showingHover=false;
},canAccept:function(_202){
return true;
},accept:function(_203){
var _204=this.getHTMLElement();
if(_204==null){
return;
}
n=_203.length;
for(var i=0;i<n;i++){
var _205=_203[i].getDroppedGUI();
if(RicoUtil.getElementsComputedStyle(_205,"position")=="absolute"){
_205.style.position="static";
_205.style.top="";
_205.style.top="";
}
_204.appendChild(_205);
}
}};
if(window.Effect==undefined){
Rico.Effect={};
}
Rico.Effect.SizeAndPosition=Class.create();
Rico.Effect.SizeAndPosition.prototype={initialize:function(_206,x,y,w,h,_210,_211,_212){
this.element=$(_206);
this.x=x;
this.y=y;
this.w=w;
this.h=h;
this.duration=_210;
this.steps=_211;
this.options=arguments[7]||{};
this.sizeAndPosition();
},sizeAndPosition:function(){
if(this.isFinished()){
if(this.options.complete){
this.options.complete(this);
}
return;
}
if(this.timer){
clearTimeout(this.timer);
}
var _213=Math.round(this.duration/this.steps);
var _214=this.element.offsetLeft;
var _215=this.element.offsetTop;
var _216=this.element.offsetWidth;
var _217=this.element.offsetHeight;
this.x=(this.x)?this.x:_214;
this.y=(this.y)?this.y:_215;
this.w=(this.w)?this.w:_216;
this.h=(this.h)?this.h:_217;
var difX=this.steps>0?(this.x-_214)/this.steps:0;
var difY=this.steps>0?(this.y-_215)/this.steps:0;
var difW=this.steps>0?(this.w-_216)/this.steps:0;
var difH=this.steps>0?(this.h-_217)/this.steps:0;
this.moveBy(difX,difY);
this.resizeBy(difW,difH);
this.duration-=_213;
this.steps--;
this.timer=setTimeout(this.sizeAndPosition.bind(this),_213);
},isFinished:function(){
return this.steps<=0;
},moveBy:function(difX,difY){
var _222=this.element.offsetLeft;
var _223=this.element.offsetTop;
var _224=parseInt(difX);
var _225=parseInt(difY);
var _226=this.element.style;
if(_224!=0){
_226.left=(_222+_224)+"px";
}
if(_225!=0){
_226.top=(_223+_225)+"px";
}
},resizeBy:function(difW,difH){
var _227=this.element.offsetWidth;
var _228=this.element.offsetHeight;
var _229=parseInt(difW);
var _230=parseInt(difH);
var _231=this.element.style;
if(_229!=0){
_231.width=(_227+_229)+"px";
}
if(_230!=0){
_231.height=(_228+_230)+"px";
}
}};
Rico.Effect.Size=Class.create();
Rico.Effect.Size.prototype={initialize:function(_232,w,h,_233,_234,_235){
new Rico.Effect.SizeAndPosition(_232,null,null,w,h,_233,_234,_235);
}};
Rico.Effect.Position=Class.create();
Rico.Effect.Position.prototype={initialize:function(_236,x,y,_237,_238,_239){
new Rico.Effect.SizeAndPosition(_236,x,y,null,null,_237,_238,_239);
}};
Rico.Effect.Round=Class.create();
Rico.Effect.Round.prototype={initialize:function(_240,_241,_242){
var _243=document.getElementsByTagAndClassName(_240,_241);
for(var i=0;i<_243.length;i++){
Rico.Corner.round(_243[i],_242);
}
}};
Rico.Effect.FadeTo=Class.create();
Rico.Effect.FadeTo.prototype={initialize:function(_244,_245,_246,_247,_248){
this.element=$(_244);
this.opacity=_245;
this.duration=_246;
this.steps=_247;
this.options=arguments[4]||{};
this.fadeTo();
},fadeTo:function(){
if(this.isFinished()){
if(this.options.complete){
this.options.complete(this);
}
return;
}
if(this.timer){
clearTimeout(this.timer);
}
var _249=Math.round(this.duration/this.steps);
var _250=this.getElementOpacity();
var _251=this.steps>0?(this.opacity-_250)/this.steps:0;
this.changeOpacityBy(_251);
this.duration-=_249;
this.steps--;
this.timer=setTimeout(this.fadeTo.bind(this),_249);
},changeOpacityBy:function(v){
var _253=this.getElementOpacity();
var _254=Math.max(0,Math.min(_253+v,1));
this.element.ricoOpacity=_254;
this.element.style.filter="alpha(opacity:"+Math.round(_254*100)+")";
this.element.style.opacity=_254;
},isFinished:function(){
return this.steps<=0;
},getElementOpacity:function(){
if(this.element.ricoOpacity==undefined){
var _255=RicoUtil.getElementsComputedStyle(this.element,"opacity");
this.element.ricoOpacity=_255!=undefined?_255:1;
}
return parseFloat(this.element.ricoOpacity);
}};
Rico.Effect.AccordionSize=Class.create();
Rico.Effect.AccordionSize.prototype={initialize:function(e1,e2,_258,end,_260,_261,_262){
this.e1=$(e1);
this.e2=$(e2);
this.start=_258;
this.end=end;
this.duration=_260;
this.steps=_261;
this.options=arguments[6]||{};
this.accordionSize();
},accordionSize:function(){
if(this.isFinished()){
this.e1.style.height=this.start+"px";
this.e2.style.height=this.end+"px";
if(this.options.complete){
this.options.complete(this);
}
return;
}
if(this.timer){
clearTimeout(this.timer);
}
var _263=Math.round(this.duration/this.steps);
var diff=this.steps>0?(parseInt(this.e1.offsetHeight)-this.start)/this.steps:0;
this.resizeBy(diff);
this.duration-=_263;
this.steps--;
this.timer=setTimeout(this.accordionSize.bind(this),_263);
},isFinished:function(){
return this.steps<=0;
},resizeBy:function(diff){
var _265=this.e1.offsetHeight;
var _266=this.e2.offsetHeight;
var _267=parseInt(diff);
if(diff!=0){
this.e1.style.height=(_265-_267)+"px";
this.e2.style.height=(_266+_267)+"px";
}
}};
Rico.LiveGridMetaData=Class.create();
Rico.LiveGridMetaData.prototype={initialize:function(_268,_269,_270,_271){
this.pageSize=_268;
this.totalRows=_269;
this.setOptions(_271);
this.ArrowHeight=16;
this.columnCount=_270;
},setOptions:function(_272){
this.options={largeBufferSize:7,nearLimitFactor:0.2};
Object.extend(this.options,_272||{});
},getPageSize:function(){
return this.pageSize;
},getTotalRows:function(){
return this.totalRows;
},setTotalRows:function(n){
this.totalRows=n;
},getLargeBufferSize:function(){
return parseInt(this.options.largeBufferSize*this.pageSize);
},getLimitTolerance:function(){
return parseInt(this.getLargeBufferSize()*this.options.nearLimitFactor);
}};
Rico.LiveGridScroller=Class.create();
Rico.LiveGridScroller.prototype={initialize:function(_273,_274){
this.isIE=navigator.userAgent.toLowerCase().indexOf("msie")>=0;
this.liveGrid=_273;
this.metaData=_273.metaData;
this.createScrollBar();
this.scrollTimeout=null;
this.lastScrollPos=0;
this.viewPort=_274;
this.rows=new Array();
},isUnPlugged:function(){
return this.scrollerDiv.onscroll==null;
},plugin:function(){
this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);
},unplug:function(){
this.scrollerDiv.onscroll=null;
},sizeIEHeaderHack:function(){
if(!this.isIE){
return;
}
var _275=$(this.liveGrid.tableId+"_header");
if(_275){
_275.rows[0].cells[0].style.width=(_275.rows[0].cells[0].offsetWidth+1)+"px";
}
},createScrollBar:function(){
var _276=this.liveGrid.viewPort.visibleHeight();
this.scrollerDiv=document.createElement("div");
var _277=this.scrollerDiv.style;
_277.borderRight=this.liveGrid.options.scrollerBorderRight;
_277.position="relative";
_277.left=this.isIE?"-6px":"-3px";
_277.width="19px";
_277.height=_276+"px";
_277.overflow="auto";
this.heightDiv=document.createElement("div");
this.heightDiv.style.width="1px";
this.heightDiv.style.height=parseInt(_276*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";
this.scrollerDiv.appendChild(this.heightDiv);
this.scrollerDiv.onscroll=this.handleScroll.bindAsEventListener(this);
var _278=this.liveGrid.table;
_278.parentNode.parentNode.insertBefore(this.scrollerDiv,_278.parentNode.nextSibling);
var _279=this.isIE?"mousewheel":"DOMMouseScroll";
Event.observe(_278,_279,function(evt){
if(evt.wheelDelta>=0||evt.detail<0){
this.scrollerDiv.scrollTop-=(2*this.viewPort.rowHeight);
}else{
this.scrollerDiv.scrollTop+=(2*this.viewPort.rowHeight);
}
this.handleScroll(false);
}.bindAsEventListener(this),false);
},updateSize:function(){
var _281=this.liveGrid.table;
var _282=this.viewPort.visibleHeight();
this.heightDiv.style.height=parseInt(_282*this.metaData.getTotalRows()/this.metaData.getPageSize())+"px";
},rowToPixel:function(_283){
return (_283/this.metaData.getTotalRows())*this.heightDiv.offsetHeight;
},moveScroll:function(_284){
this.scrollerDiv.scrollTop=this.rowToPixel(_284);
if(this.metaData.options.onscroll){
this.metaData.options.onscroll(this.liveGrid,_284);
}
},handleScroll:function(){
if(this.scrollTimeout){
clearTimeout(this.scrollTimeout);
}
var _285=this.lastScrollPos-this.scrollerDiv.scrollTop;
if(_285!=0){
var r=this.scrollerDiv.scrollTop%this.viewPort.rowHeight;
if(r!=0){
this.unplug();
if(_285<0){
this.scrollerDiv.scrollTop+=(this.viewPort.rowHeight-r);
}else{
this.scrollerDiv.scrollTop-=r;
}
this.plugin();
}
}
var _286=parseInt(this.scrollerDiv.scrollTop/this.viewPort.rowHeight);
this.liveGrid.requestContentRefresh(_286);
this.viewPort.scrollTo(this.scrollerDiv.scrollTop);
if(this.metaData.options.onscroll){
this.metaData.options.onscroll(this.liveGrid,_286);
}
this.scrollTimeout=setTimeout(this.scrollIdle.bind(this),1200);
this.lastScrollPos=this.scrollerDiv.scrollTop;
},scrollIdle:function(){
if(this.metaData.options.onscrollidle){
this.metaData.options.onscrollidle();
}
}};
Rico.LiveGridBuffer=Class.create();
Rico.LiveGridBuffer.prototype={initialize:function(_287,_288){
this.startPos=0;
this.size=0;
this.metaData=_287;
this.rows=new Array();
this.updateInProgress=false;
this.viewPort=_288;
this.maxBufferSize=_287.getLargeBufferSize()*2;
this.maxFetchSize=_287.getLargeBufferSize();
this.lastOffset=0;
},getBlankRow:function(){
if(!this.blankRow){
this.blankRow=new Array();
for(var i=0;i<this.metaData.columnCount;i++){
this.blankRow[i]="&nbsp;";
}
}
return this.blankRow;
},loadRows:function(_289){
var _290=_289.getElementsByTagName("rows")[0];
this.updateUI=_290.getAttribute("update_ui")=="true";
var _291=new Array();
var trs=_290.getElementsByTagName("tr");
for(var i=0;i<trs.length;i++){
var row=_291[i]=new Array();
var _294=trs[i].getElementsByTagName("td");
for(var j=0;j<_294.length;j++){
var cell=_294[j];
var _296=cell.getAttribute("convert_spaces")=="true";
var _297=RicoUtil.getContentAsString(cell);
row[j]=_296?this.convertSpaces(_297):_297;
if(!row[j]){
row[j]="&nbsp;";
}
}
}
return _291;
},update:function(_298,_299){
var _300=this.loadRows(_298);
if(this.rows.length==0){
this.rows=_300;
this.size=this.rows.length;
this.startPos=_299;
return;
}
if(_299>this.startPos){
if(this.startPos+this.rows.length<_299){
this.rows=_300;
this.startPos=_299;
}else{
this.rows=this.rows.concat(_300.slice(0,_300.length));
if(this.rows.length>this.maxBufferSize){
var _301=this.rows.length;
this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length);
this.startPos=this.startPos+(_301-this.rows.length);
}
}
}else{
if(_299+_300.length<this.startPos){
this.rows=_300;
}else{
this.rows=_300.slice(0,this.startPos).concat(this.rows);
if(this.rows.length>this.maxBufferSize){
this.rows=this.rows.slice(0,this.maxBufferSize);
}
}
this.startPos=_299;
}
this.size=this.rows.length;
},clear:function(){
this.rows=new Array();
this.startPos=0;
this.size=0;
},isOverlapping:function(_302,size){
return ((_302<this.endPos())&&(this.startPos<_302+size))||(this.endPos()==0);
},isInRange:function(_304){
return (_304>=this.startPos)&&(_304+this.metaData.getPageSize()<=this.endPos());
},isNearingTopLimit:function(_305){
return _305-this.startPos<this.metaData.getLimitTolerance();
},endPos:function(){
return this.startPos+this.rows.length;
},isNearingBottomLimit:function(_306){
return this.endPos()-(_306+this.metaData.getPageSize())<this.metaData.getLimitTolerance();
},isAtTop:function(){
return this.startPos==0;
},isAtBottom:function(){
return this.endPos()==this.metaData.getTotalRows();
},isNearingLimit:function(_307){
return (!this.isAtTop()&&this.isNearingTopLimit(_307))||(!this.isAtBottom()&&this.isNearingBottomLimit(_307));
},getFetchSize:function(_308){
var _309=this.getFetchOffset(_308);
var _310=0;
if(_309>=this.startPos){
var _311=this.maxFetchSize+_309;
if(_311>this.metaData.totalRows){
_311=this.metaData.totalRows;
}
_310=_311-_309;
if(_309==0&&_310<this.maxFetchSize){
_310=this.maxFetchSize;
}
}else{
var _310=this.startPos-_309;
if(_310>this.maxFetchSize){
_310=this.maxFetchSize;
}
}
return _310;
},getFetchOffset:function(_312){
var _313=_312;
if(_312>this.startPos){
_313=(_312>this.endPos())?_312:this.endPos();
}else{
if(_312+this.maxFetchSize>=this.startPos){
var _313=this.startPos-this.maxFetchSize;
if(_313<0){
_313=0;
}
}
}
this.lastOffset=_313;
return _313;
},getRows:function(_314,_315){
var _316=_314-this.startPos;
var _317=_316+_315;
if(_317>this.size){
_317=this.size;
}
var _318=new Array();
var _319=0;
for(var i=_316;i<_317;i++){
_318[_319++]=this.rows[i];
}
return _318;
},convertSpaces:function(s){
return s.split(" ").join("&nbsp;");
}};
Rico.GridViewPort=Class.create();
Rico.GridViewPort.prototype={initialize:function(_320,_321,_322,_323,_324){
this.lastDisplayedStartPos=0;
this.div=_320.parentNode;
this.table=_320;
this.rowHeight=_321;
this.div.style.height=this.rowHeight*_322;
this.div.style.overflow="hidden";
this.buffer=_323;
this.liveGrid=_324;
this.visibleRows=_322+1;
this.lastPixelOffset=0;
this.startPos=0;
},populateRow:function(_325,row){
for(var j=0;j<row.length;j++){
_325.cells[j].innerHTML=row[j];
}
},bufferChanged:function(){
this.refreshContents(parseInt(this.lastPixelOffset/this.rowHeight));
},clearRows:function(){
if(!this.isBlank){
this.liveGrid.table.className=this.liveGrid.options.loadingClass;
for(var i=0;i<this.visibleRows;i++){
this.populateRow(this.table.rows[i],this.buffer.getBlankRow());
}
this.isBlank=true;
}
},clearContents:function(){
this.clearRows();
this.scrollTo(0);
this.startPos=0;
this.lastStartPos=-1;
},refreshContents:function(_326){
if(_326==this.lastRowPos&&!this.isPartialBlank&&!this.isBlank){
return;
}
if((_326+this.visibleRows<this.buffer.startPos)||(this.buffer.startPos+this.buffer.size<_326)||(this.buffer.size==0)){
this.clearRows();
return;
}
this.isBlank=false;
var _327=this.buffer.startPos>_326;
var _328=_327?this.buffer.startPos:_326;
var _329=(this.buffer.startPos+this.buffer.size<_326+this.visibleRows)?this.buffer.startPos+this.buffer.size:_326+this.visibleRows;
var _330=_329-_328;
var rows=this.buffer.getRows(_328,_330);
var _332=this.visibleRows-_330;
var _333=_327?0:_330;
var _334=_327?_332:0;
for(var i=0;i<rows.length;i++){
this.populateRow(this.table.rows[i+_334],rows[i]);
}
for(var i=0;i<_332;i++){
this.populateRow(this.table.rows[i+_333],this.buffer.getBlankRow());
}
this.isPartialBlank=_332>0;
this.lastRowPos=_326;
this.liveGrid.table.className=this.liveGrid.options.tableClass;
var _335=this.liveGrid.options.onRefreshComplete;
if(_335!=null){
_335();
}
},scrollTo:function(_336){
if(this.lastPixelOffset==_336){
return;
}
this.refreshContents(parseInt(_336/this.rowHeight));
this.div.scrollTop=_336%this.rowHeight;
this.lastPixelOffset=_336;
},visibleHeight:function(){
return parseInt(RicoUtil.getElementsComputedStyle(this.div,"height"));
}};
Rico.LiveGridRequest=Class.create();
Rico.LiveGridRequest.prototype={initialize:function(_337,_338){
this.requestOffset=_337;
}};
Rico.LiveGrid=Class.create();
Rico.LiveGrid.prototype={initialize:function(_339,_340,_341,url,_343,_344){
this.options={tableClass:$(_339).className,loadingClass:$(_339).className,scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true};
Object.extend(this.options,_343||{});
this.ajaxOptions={parameters:null};
Object.extend(this.ajaxOptions,_344||{});
this.tableId=_339;
this.table=$(_339);
this.addLiveGridHtml();
var _345=this.table.rows[0].cells.length;
this.metaData=new Rico.LiveGridMetaData(_340,_341,_345,_343);
this.buffer=new Rico.LiveGridBuffer(this.metaData);
var _346=this.table.rows.length;
this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/_346,_340,this.buffer,this);
this.scroller=new Rico.LiveGridScroller(this,this.viewPort);
this.options.sortHandler=this.sortHandler.bind(this);
if($(_339+"_header")){
this.sort=new Rico.LiveGridSort(_339+"_header",this.options);
}
this.processingRequest=null;
this.unprocessedRequest=null;
this.initAjax(url);
if(this.options.prefetchBuffer||this.options.prefetchOffset>0){
var _347=0;
if(this.options.offset){
_347=this.options.offset;
this.scroller.moveScroll(_347);
this.viewPort.scrollTo(this.scroller.rowToPixel(_347));
}
if(this.options.sortCol){
this.sortCol=_343.sortCol;
this.sortDir=_343.sortDir;
}
this.requestContentRefresh(_347);
}
},addLiveGridHtml:function(){
if(this.table.getElementsByTagName("thead").length>0){
var _348=this.table.cloneNode(true);
_348.setAttribute("id",this.tableId+"_header");
_348.setAttribute("class",this.table.className+"_header");
for(var i=0;i<_348.tBodies.length;i++){
_348.removeChild(_348.tBodies[i]);
}
this.table.deleteTHead();
this.table.parentNode.insertBefore(_348,this.table);
}
new Insertion.Before(this.table,"<div id='"+this.tableId+"_container'></div>");
this.table.previousSibling.appendChild(this.table);
new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>");
this.table.previousSibling.appendChild(this.table);
},resetContents:function(){
this.scroller.moveScroll(0);
this.buffer.clear();
this.viewPort.clearContents();
},sortHandler:function(_349){
if(!_349){
return;
}
this.sortCol=_349.name;
this.sortDir=_349.currentSort;
this.resetContents();
this.requestContentRefresh(0);
},adjustRowSize:function(){
},setTotalRows:function(_350){
this.resetContents();
this.metaData.setTotalRows(_350);
this.scroller.updateSize();
},initAjax:function(url){
ajaxEngine.registerRequest(this.tableId+"_request",url);
ajaxEngine.registerAjaxObject(this.tableId+"_updater",this);
},invokeAjax:function(){
},handleTimedOut:function(){
this.processingRequest=null;
this.processQueuedRequest();
},fetchBuffer:function(_351){
if(this.buffer.isInRange(_351)&&!this.buffer.isNearingLimit(_351)){
return;
}
if(this.processingRequest){
this.unprocessedRequest=new Rico.LiveGridRequest(_351);
return;
}
var _352=this.buffer.getFetchOffset(_351);
this.processingRequest=new Rico.LiveGridRequest(_351);
this.processingRequest.bufferOffset=_352;
var _353=this.buffer.getFetchSize(_351);
var _354=false;
var _355;
if(this.options.requestParameters){
_355=this._createQueryString(this.options.requestParameters,0);
}
_355=(_355==null)?"":_355+"&";
_355=_355+"id="+this.tableId+"&page_size="+_353+"&offset="+_352;
if(this.sortCol){
_355=_355+"&sort_col="+escape(this.sortCol)+"&sort_dir="+this.sortDir;
}
this.ajaxOptions.parameters=_355;
ajaxEngine.sendRequest(this.tableId+"_request",this.ajaxOptions);
this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);
},setRequestParams:function(){
this.options.requestParameters=[];
for(var i=0;i<arguments.length;i++){
this.options.requestParameters[i]=arguments[i];
}
},requestContentRefresh:function(_356){
this.fetchBuffer(_356);
},ajaxUpdate:function(_357){
try{
clearTimeout(this.timeoutHandler);
this.buffer.update(_357,this.processingRequest.bufferOffset);
this.viewPort.bufferChanged();
}
catch(err){
}
finally{
this.processingRequest=null;
}
this.processQueuedRequest();
},_createQueryString:function(_358,_359){
var _360="";
if(!_358){
return _360;
}
for(var i=_359;i<_358.length;i++){
if(i!=_359){
_360+="&";
}
var _361=_358[i];
if(_361.name!=undefined&&_361.value!=undefined){
_360+=_361.name+"="+escape(_361.value);
}else{
var ePos=_361.indexOf("=");
var _363=_361.substring(0,ePos);
var _364=_361.substring(ePos+1);
_360+=_363+"="+escape(_364);
}
}
return _360;
},processQueuedRequest:function(){
if(this.unprocessedRequest!=null){
this.requestContentRefresh(this.unprocessedRequest.requestOffset);
this.unprocessedRequest=null;
}
}};
Rico.LiveGridSort=Class.create();
Rico.LiveGridSort.prototype={initialize:function(_365,_366){
this.headerTableId=_365;
this.headerTable=$(_365);
this.options=_366;
this.setOptions();
this.applySortBehavior();
if(this.options.sortCol){
this.setSortUI(this.options.sortCol,this.options.sortDir);
}
},setSortUI:function(_367,_368){
var cols=this.options.columns;
for(var i=0;i<cols.length;i++){
if(cols[i].name==_367){
this.setColumnSort(i,_368);
break;
}
}
},setOptions:function(){
new Image().src=this.options.sortAscendImg;
new Image().src=this.options.sortDescendImg;
this.sort=this.options.sortHandler;
if(!this.options.columns){
this.options.columns=this.introspectForColumnInfo();
}else{
this.options.columns=this.convertToTableColumns(this.options.columns);
}
},applySortBehavior:function(){
var _370=this.headerTable.rows[0];
var _371=_370.cells;
for(var i=0;i<_371.length;i++){
this.addSortBehaviorToColumn(i,_371[i]);
}
},addSortBehaviorToColumn:function(n,cell){
if(this.options.columns[n].isSortable()){
cell.id=this.headerTableId+"_"+n;
cell.style.cursor="pointer";
cell.onclick=this.headerCellClicked.bindAsEventListener(this);
cell.innerHTML=cell.innerHTML+"<span id=\""+this.headerTableId+"_img_"+n+"\">"+"&nbsp;&nbsp;&nbsp;</span>";
}
},headerCellClicked:function(evt){
var _372=evt.target?evt.target:evt.srcElement;
var _373=_372.id;
var _374=parseInt(_373.substring(_373.lastIndexOf("_")+1));
var _375=this.getSortedColumnIndex();
if(_375!=-1){
if(_375!=_374){
this.removeColumnSort(_375);
this.setColumnSort(_374,Rico.TableColumn.SORT_ASC);
}else{
this.toggleColumnSort(_375);
}
}else{
this.setColumnSort(_374,Rico.TableColumn.SORT_ASC);
}
if(this.options.sortHandler){
this.options.sortHandler(this.options.columns[_374]);
}
},removeColumnSort:function(n){
this.options.columns[n].setUnsorted();
this.setSortImage(n);
},setColumnSort:function(n,_376){
if(isNaN(n)){
return;
}
this.options.columns[n].setSorted(_376);
this.setSortImage(n);
},toggleColumnSort:function(n){
this.options.columns[n].toggleSort();
this.setSortImage(n);
},setSortImage:function(n){
var _377=this.options.columns[n].getSortDirection();
var _378=$(this.headerTableId+"_img_"+n);
if(_377==Rico.TableColumn.UNSORTED){
_378.innerHTML="&nbsp;&nbsp;";
}else{
if(_377==Rico.TableColumn.SORT_ASC){
_378.innerHTML="&nbsp;&nbsp;<img width=\""+this.options.sortImageWidth+"\" "+"height=\""+this.options.sortImageHeight+"\" "+"src=\""+this.options.sortAscendImg+"\"/>";
}else{
if(_377==Rico.TableColumn.SORT_DESC){
_378.innerHTML="&nbsp;&nbsp;<img width=\""+this.options.sortImageWidth+"\" "+"height=\""+this.options.sortImageHeight+"\" "+"src=\""+this.options.sortDescendImg+"\"/>";
}
}
}
},getSortedColumnIndex:function(){
var cols=this.options.columns;
for(var i=0;i<cols.length;i++){
if(cols[i].isSorted()){
return i;
}
}
return -1;
},introspectForColumnInfo:function(){
var _379=new Array();
var _380=this.headerTable.rows[0];
var _381=_380.cells;
for(var i=0;i<_381.length;i++){
_379.push(new Rico.TableColumn(this.deriveColumnNameFromCell(_381[i],i),true));
}
return _379;
},convertToTableColumns:function(cols){
var _382=new Array();
for(var i=0;i<cols.length;i++){
_382.push(new Rico.TableColumn(cols[i][0],cols[i][1]));
}
return _382;
},deriveColumnNameFromCell:function(cell,_383){
var _384=cell.innerText!=undefined?cell.innerText:cell.textContent;
return _384?_384.toLowerCase().split(" ").join("_"):"col_"+_383;
}};
Rico.TableColumn=Class.create();
Rico.TableColumn.UNSORTED=0;
Rico.TableColumn.SORT_ASC="ASC";
Rico.TableColumn.SORT_DESC="DESC";
Rico.TableColumn.prototype={initialize:function(name,_386){
this.name=name;
this.sortable=_386;
this.currentSort=Rico.TableColumn.UNSORTED;
},isSortable:function(){
return this.sortable;
},isSorted:function(){
return this.currentSort!=Rico.TableColumn.UNSORTED;
},getSortDirection:function(){
return this.currentSort;
},toggleSort:function(){
if(this.currentSort==Rico.TableColumn.UNSORTED||this.currentSort==Rico.TableColumn.SORT_DESC){
this.currentSort=Rico.TableColumn.SORT_ASC;
}else{
if(this.currentSort==Rico.TableColumn.SORT_ASC){
this.currentSort=Rico.TableColumn.SORT_DESC;
}
}
},setUnsorted:function(_387){
this.setSorted(Rico.TableColumn.UNSORTED);
},setSorted:function(_388){
this.currentSort=_388;
}};
Rico.ArrayExtensions=new Array();
if(Object.prototype.extend){
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;
}else{
Object.prototype.extend=function(_389){
return Object.extend.apply(this,[this,_389]);
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Object.prototype.extend;
}
if(Array.prototype.push){
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.push;
}
if(!Array.prototype.remove){
Array.prototype.remove=function(dx){
if(isNaN(dx)||dx>this.length){
return false;
}
for(var i=0,n=0;i<this.length;i++){
if(i!=dx){
this[n++]=this[i];
}
}
this.length-=1;
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.remove;
}
if(!Array.prototype.removeItem){
Array.prototype.removeItem=function(item){
for(var i=0;i<this.length;i++){
if(this[i]==item){
this.remove(i);
break;
}
}
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.removeItem;
}
if(!Array.prototype.indices){
Array.prototype.indices=function(){
var _391=new Array();
for(index in this){
var _392=false;
for(var i=0;i<Rico.ArrayExtensions.length;i++){
if(this[index]==Rico.ArrayExtensions[i]){
_392=true;
break;
}
}
if(!_392){
_391[_391.length]=index;
}
}
return _391;
};
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.indices;
}
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.unique;
Rico.ArrayExtensions[Rico.ArrayExtensions.length]=Array.prototype.inArray;
if(window.DOMParser&&window.XMLSerializer&&window.Node&&Node.prototype&&Node.prototype.__defineGetter__){
if(!Document.prototype.loadXML){
Document.prototype.loadXML=function(s){
var doc2=(new DOMParser()).parseFromString(s,"text/xml");
while(this.hasChildNodes()){
this.removeChild(this.lastChild);
}
for(var i=0;i<doc2.childNodes.length;i++){
this.appendChild(this.importNode(doc2.childNodes[i],true));
}
};
}
Document.prototype.__defineGetter__("xml",function(){
return (new XMLSerializer()).serializeToString(this);
});
}
document.getElementsByTagAndClassName=function(_394,_395){
if(_394==null){
_394="*";
}
var _396=document.getElementsByTagName(_394)||document.all;
var _397=new Array();
if(_395==null){
return _396;
}
for(var i=0;i<_396.length;i++){
var _398=_396[i];
var _399=_398.className.split(" ");
for(var j=0;j<_399.length;j++){
if(_399[j]==_395){
_397.push(_398);
break;
}
}
}
return _397;
};
var RicoUtil={getElementsComputedStyle:function(_400,_401,_402){
if(arguments.length==2){
_402=_401;
}
var el=$(_400);
if(el.currentStyle){
return el.currentStyle[_401];
}else{
return document.defaultView.getComputedStyle(el,null).getPropertyValue(_402);
}
},createXmlDocument:function(){
if(document.implementation&&document.implementation.createDocument){
var doc=document.implementation.createDocument("","",null);
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 Try.these(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;
},getContentAsString:function(_404){
return _404.xml!=undefined?this._getContentAsStringIE(_404):this._getContentAsStringMozilla(_404);
},_getContentAsStringIE:function(_405){
var _406="";
for(var i=0;i<_405.childNodes.length;i++){
var n=_405.childNodes[i];
if(n.nodeType==4){
_406+=n.nodeValue;
}else{
_406+=n.xml;
}
}
return _406;
},_getContentAsStringMozilla:function(_407){
var _408=new XMLSerializer();
var _409="";
for(var i=0;i<_407.childNodes.length;i++){
var n=_407.childNodes[i];
if(n.nodeType==4){
_409+=n.nodeValue;
}else{
_409+=_408.serializeToString(n);
}
}
return _409;
},toViewportPosition:function(_410){
return this._toAbsolute(_410,true);
},toDocumentPosition:function(_411){
return this._toAbsolute(_411,false);
},_toAbsolute:function(_412,_413){
if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){
return this._toAbsoluteMozilla(_412,_413);
}
var x=0;
var y=0;
var _414=_412;
while(_414){
var _415=0;
var _416=0;
if(_414!=_412){
var _415=parseInt(this.getElementsComputedStyle(_414,"borderLeftWidth"));
var _416=parseInt(this.getElementsComputedStyle(_414,"borderTopWidth"));
_415=isNaN(_415)?0:_415;
_416=isNaN(_416)?0:_416;
}
x+=_414.offsetLeft-_414.scrollLeft+_415;
y+=_414.offsetTop-_414.scrollTop+_416;
_414=_414.offsetParent;
}
if(_413){
x-=this.docScrollLeft();
y-=this.docScrollTop();
}
return {x:x,y:y};
},_toAbsoluteMozilla:function(_417,_418){
var x=0;
var y=0;
var _419=_417;
while(_419){
x+=_419.offsetLeft;
y+=_419.offsetTop;
_419=_419.offsetParent;
}
_419=_417;
while(_419&&_419!=document.body&&_419!=document.documentElement){
if(_419.scrollLeft){
x-=_419.scrollLeft;
}
if(_419.scrollTop){
y-=_419.scrollTop;
}
_419=_419.parentNode;
}
if(_418){
x-=this.docScrollLeft();
y-=this.docScrollTop();
}
return {x:x,y:y};
},docScrollLeft:function(){
if(window.pageXOffset){
return window.pageXOffset;
}else{
if(document.documentElement&&document.documentElement.scrollLeft){
return document.documentElement.scrollLeft;
}else{
if(document.body){
return document.body.scrollLeft;
}else{
return 0;
}
}
}
},docScrollTop:function(){
if(window.pageYOffset){
return window.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
return document.documentElement.scrollTop;
}else{
if(document.body){
return document.body.scrollTop;
}else{
return 0;
}
}
}
}};

Prado.RicoLiveGrid=Class.create();
Prado.RicoLiveGrid.prototype=Object.extend(Rico.LiveGrid.prototype,{initialize:function(_1,_2){
this.options={tableClass:$(_1).className||"",loadingClass:$(_1).className||"",scrollerBorderRight:"1px solid #ababab",bufferTimeout:20000,sortAscendImg:"images/sort_asc.gif",sortDescendImg:"images/sort_desc.gif",sortImageWidth:9,sortImageHeight:5,ajaxSortURLParms:[],onRefreshComplete:null,requestParameters:null,inlineStyles:true,visibleRows:10,totalRows:0,initialOffset:0};
Object.extend(this.options,_2||{});
this.tableId=_1;
this.table=$(_1);
this.addLiveGridHtml();
var _3=this.table.rows[0].cells.length;
this.metaData=new Rico.LiveGridMetaData(this.options.visibleRows,this.options.totalRows,_3,_2);
this.buffer=new Rico.LiveGridBuffer(this.metaData);
var _4=this.table.rows.length;
this.viewPort=new Rico.GridViewPort(this.table,this.table.offsetHeight/_4,this.options.visibleRows,this.buffer,this);
this.scroller=new Rico.LiveGridScroller(this,this.viewPort);
this.options.sortHandler=this.sortHandler.bind(this);
if($(_1+"_header")){
this.sort=new Rico.LiveGridSort(_1+"_header",this.options);
}
this.processingRequest=null;
this.unprocessedRequest=null;
if(this.options.initialOffset>=0){
var _5=this.options.initialOffset;
this.scroller.moveScroll(_5);
this.viewPort.scrollTo(this.scroller.rowToPixel(_5));
if(this.options.sortCol){
this.sortCol=_2.sortCol;
this.sortDir=_2.sortDir;
}
var _6=this;
setTimeout(function(){
_6.requestContentRefresh(_5);
},100);
}
},fetchBuffer:function(_7){
if(this.buffer.isInRange(_7)&&!this.buffer.isNearingLimit(_7)){
return;
}
if(this.processingRequest){
this.unprocessedRequest=new Rico.LiveGridRequest(_7);
return;
}
var _8=this.buffer.getFetchOffset(_7);
this.processingRequest=new Rico.LiveGridRequest(_7);
this.processingRequest.bufferOffset=_8;
var _9=this.buffer.getFetchSize(_7);
var _10=false;
var _11={"page_size":_9,"offset":_8};
if(this.sortCol){
Object.extend(_11,{"sort_col":this.sortCol,"sort_dir":this.sortDir});
}
Prado.Callback(this.tableId,_11,this.ajaxUpdate.bind(this),this.options);
this.timeoutHandler=setTimeout(this.handleTimedOut.bind(this),this.options.bufferTimeout);
},ajaxUpdate:function(_12,_13){
try{
clearTimeout(this.timeoutHandler);
this.buffer.update(_12,this.processingRequest.bufferOffset);
this.viewPort.bufferChanged();
}
catch(err){
}
finally{
this.processingRequest=null;
}
this.processQueuedRequest();
}});
Object.extend(Rico.LiveGridBuffer.prototype,{update:function(_14,_15){
if(this.rows.length==0){
this.rows=_14;
this.size=this.rows.length;
this.startPos=_15;
return;
}
if(_15>this.startPos){
if(this.startPos+this.rows.length<_15){
this.rows=_14;
this.startPos=_15;
}else{
this.rows=this.rows.concat(_14.slice(0,_14.length));
if(this.rows.length>this.maxBufferSize){
var _16=this.rows.length;
this.rows=this.rows.slice(this.rows.length-this.maxBufferSize,this.rows.length);
this.startPos=this.startPos+(_16-this.rows.length);
}
}
}else{
if(_15+_14.length<this.startPos){
this.rows=_14;
}else{
this.rows=_14.slice(0,this.startPos).concat(this.rows);
if(this.rows.length>this.maxBufferSize){
this.rows=this.rows.slice(0,this.maxBufferSize);
}
}
this.startPos=_15;
}
this.size=this.rows.length;
}});
Object.extend(Rico.GridViewPort.prototype,{populateRow:function(_17,row){
if(isdef(_17)){
for(var j=0;j<row.length;j++){
_17.cells[j].innerHTML=row[j];
}
}
}});

