function AjaxPanelGroup(_1){
if(!this.isSupported()){
return;
}
this.panels=[];
this.prevPanelIndex=-1;
this.enabled=true;
this.onLoad=!_1?function(){
}:_1;
}
AjaxPanelGroup.prototype={supported:null,add:function(_2){
if(!this.enabled){
return -1;
}
var i=this.panels.push(_2)-1;
if(_2.isLoaded()){
this.prevPanelIndex=i;
}
return i;
},canLoad:function(i){
return this.panels[i].canLoad();
},fillPanel:function(_5,i,_7){
if(!this.panelExists(i)){
return;
}
document.getElementById(this.panels[i].getId()).innerHTML=_5;
this.panels[i].setLoading(false);
this.panels[i].setLoaded(true);
this.setPanelHeight(i,-1);
if(_7){
this.panels[i].setStatus(_7.start,_7.end,_7.limit,_7.total);
}
this.panels[i].update();
this.onLoad(i);
},getEvent:function(_8){
var fn=function(){
};
var _a=this;
if(_8=="ajax_callback"){
var _b=arguments[1];
fn=function(){
_a.fillPanel(this.transport.responseText,_b,getJson(this.transport));
};
}else{
if(_8=="tab_onbeforeswitch"){
fn=function(_c,_d){
_a.savePreviousPanel(_c);
return true;
};
}else{
if(_8=="tab_onswitch"){
fn=function(i){
_a.load(i);
};
}
}
}
return fn;
},getNodeHeight:function(_f){
var _10=0;
var _11=-17;
if(typeof (_f)=="string"){
_f=document.getElementById(_f);
}
_10=_f.offsetHeight+_11;
_f=null;
return _10;
},isSupported:function(){
if(this.supported===null){
this.supported=(document.getElementById&&(Array.push||Array.prototype.push))?true:false;
}
return this.supported;
},load:function(i){
if(this.canLoad(i)){
this.panels[i].setLoading(true);
this.maintainPanelHeight(i);
ndg.fetch(this.panels[i].getUrl(),{onComplete:this.getEvent("ajax_callback",i),parameters:"ajax_hash="+fetch_hash});
}else{
this.panels[i].update();
this.onLoad(i);
}
},maintainPanelHeight:function(_13){
if(!this.panelExists(this.prevPanelIndex)){
return;
}
var _14=this.panels[this.prevPanelIndex].getHeight();
var _15=this.getNodeHeight(this.panels[_13].getId());
var _16=-1;
if(_15<_14){
_16=_14;
}else{
if(_15>_14){
_16=_15;
}
}
this.setPanelHeight(_13,_16);
},panelExists:function(i){
return (i<this.panels.length&&i>=0)?true:false;
},savePanelHeight:function(i){
var _19=this.getNodeHeight(this.panels[i].getId());
this.panels[i].setHeight(_19);
},savePreviousPanel:function(i){
this.savePanelHeight(i);
this.prevPanelIndex=i;
},setPanelHeight:function(i,_1c){
var _1d=document.getElementById(this.panels[i].getId()+"_placeholder");
if(!_1d){
return;
}
if(_1c>=0){
_1d.style.height=_1c+"px";
}else{
_1d.style.height="";
}
_1d=null;
}};
function AjaxPanel(id,url,_20){
this.id=id;
this.url=url;
this.loaded=!!_20;
this.loading=false;
this.status={end:0,id:"",limit:0,start:0,total:0};
}
AjaxPanel.prototype={height:-1,id:"",loaded:false,loading:false,statusSeparator:String.fromCharCode(8211),url:"",viewAllId:"",viewAllUrl:"",canLoad:function(){
return (!this.isLoaded()&&!this.isLoading())?true:false;
},getHeight:function(){
return this.height;
},getId:function(){
return this.id;
},getStatusText:function(){
var _21="";
if(this.hasStatus()){
_21+="(";
if(this.status.end<this.status.total){
_21+=this.status.start+" "+this.statusSeparator+" "+this.status.end+" of "+this.status.total;
}else{
_21+=this.status.end+" of "+this.status.total;
}
_21+=")";
}
return _21;
},getUrl:function(){
return this.url;
},hasStatus:function(){
return (this.status.id!=""&&this.status.total>0)?true:false;
},hasViewAll:function(){
return (this.viewAllId!=""&&this.viewAllUrl!="")?true:false;
},isLoaded:function(){
return this.loaded;
},isLoading:function(){
return this.loading;
},setHeight:function(_22){
if(typeof (_22)=="number"&&_22>=0){
this.height=_22;
}
},setLoaded:function(_23){
if(typeof (_23)=="boolean"){
this.loaded=_23;
}
},setLoading:function(_24){
if(typeof (_24)=="boolean"){
this.loading=_24;
}
},setStatus:function(_25,end,_27,_28){
this.status.start=_25;
this.status.end=end;
this.status.limit=_27;
this.status.total=_28;
},setStatusId:function(_29){
this.status.id=_29;
},setViewAll:function(id,url){
this.viewAllId=id;
this.viewAllUrl=url;
},update:function(){
this.updateStatus();
this.updateViewAll();
},updateStatus:function(){
var _2c=document.getElementById(this.status.id);
if(_2c){
_2c.innerHTML=this.getStatusText();
}
},updateViewAll:function(){
if(!this.hasViewAll()){
return;
}
document.getElementById(this.viewAllId).href=this.viewAllUrl;
}};

