var ddajaxtabssettings={};
ddajaxtabssettings.bustcachevar=1;
ddajaxtabssettings.loadstatustext="<img src='V1/plugins/ajaxtabs/loading.gif' /> loading...";
function ddajaxtabs(_1,_2){
this.tabinterfaceid=_1;
this.tabs=document.getElementById(_1).getElementsByTagName("a");
this.enabletabpersistence=true;
this.hottabspositions=[];
this.currentTabIndex=0;
this.contentdivid=_2;
this.defaultHTML="";
this.defaultIframe="<iframe src=\"about:blank\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" vspace=\"0\" hspace=\"0\" class=\"tabcontentiframe\" style=\"width:100%; height:auto; min-height: 100px\"></iframe>";
this.defaultIframe=this.defaultIframe.replace(/<iframe/i,"<iframe name=\""+"_ddajaxtabsiframe-"+_2+"\" ");
this.revcontentids=[];
this.selectedClassTarget="link";
};
ddajaxtabs.connect=function(_3,_4){
var _5=false;
var _6="";
if(window.ActiveXObject){
try{
_5=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
_5=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
}else{
if(window.XMLHttpRequest){
_5=new XMLHttpRequest();
}else{
return false;
}
}
var _7=_3.replace(/^http:\/\/[^\/]+\//i,"http://"+window.location.hostname+"/");
_5.onreadystatechange=function(){
ddajaxtabs.loadpage(_5,_3,_4);
};
if(ddajaxtabssettings.bustcachevar){
_6=(_7.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime();
}
_5.open("GET",_7+_6,true);
_5.send(null);
};
ddajaxtabs.loadpage=function(_8,_9,_a){
var _b=_a.contentdivid;
document.getElementById(_b).innerHTML=ddajaxtabssettings.loadstatustext;
if(_8.readyState==4&&(_8.status==200||window.location.href.indexOf("http")==-1)){
document.getElementById(_b).innerHTML=_8.responseText;
ddajaxtabs.ajaxpageloadaction(_9,_a);
}
};
ddajaxtabs.ajaxpageloadaction=function(_c,_d){
_d.onajaxpageload(_c);
};
ddajaxtabs.getCookie=function(_e){
var re=new RegExp(_e+"=[^;]+","i");
if(document.cookie.match(re)){
return document.cookie.match(re)[0].split("=")[1];
}
return "";
};
ddajaxtabs.setCookie=function(_10,_11){
document.cookie=_10+"="+_11+";path=/";
};
ddajaxtabs.prototype={expandit:function(_12){
this.cancelautorun();
var _13="";
try{
if(typeof _12=="string"&&document.getElementById(_12).getAttribute("rel")){
_13=document.getElementById(_12);
}else{
if(parseInt(_12)!=NaN&&this.tabs[_12].getAttribute("rel")){
_13=this.tabs[_12];
}
}
}
catch(err){
alert("Invalid Tab ID or position entered!");
}
if(_13!=""){
this.expandtab(_13);
}
},cycleit:function(dir,_15){
if(dir=="next"){
var _16=(this.currentTabIndex<this.hottabspositions.length-1)?this.currentTabIndex+1:0;
}else{
if(dir=="prev"){
var _16=(this.currentTabIndex>0)?this.currentTabIndex-1:this.hottabspositions.length-1;
}
}
if(typeof _15=="undefined"){
this.cancelautorun();
}
this.expandtab(this.tabs[this.hottabspositions[_16]]);
},setpersist:function(_17){
this.enabletabpersistence=_17;
},loadajaxpage:function(_18){
ddajaxtabs.connect(_18,this);
},loadiframepage:function(_19){
this.iframedisplay(_19,this.contentdivid);
},setselectedClassTarget:function(_1a){
this.selectedClassTarget=_1a||"link";
},getselectedClassTarget:function(_1b){
return (this.selectedClassTarget==("linkparent".toLowerCase()))?_1b.parentNode:_1b;
},urlparamselect:function(_1c){
var _1d=window.location.search.match(new RegExp(_1c+"=(\\d+)","i"));
return (_1d==null)?null:parseInt(RegExp.$1);
},onajaxpageload:function(_1e){
},expandtab:function(_1f){
var _20=_1f.getAttribute("rel");
var _21=(_1f.getAttribute("rev"))?","+_1f.getAttribute("rev").replace(/\s+/,"")+",":"";
if(_20=="#default"){
document.getElementById(this.contentdivid).innerHTML=this.defaultHTML;
}else{
if(_20=="#iframe"){
this.iframedisplay(_1f.getAttribute("href"),this.contentdivid);
}else{
ddajaxtabs.connect(_1f.getAttribute("href"),this);
}
}
this.expandrevcontent(_21);
for(var i=0;i<this.tabs.length;i++){
this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("href")==_1f.getAttribute("href"))?"selected":"";
}
if(this.enabletabpersistence){
ddajaxtabs.setCookie(this.tabinterfaceid,_1f.tabposition);
}
this.setcurrenttabindex(_1f.tabposition);
},iframedisplay:function(_23,_24){
if(typeof window.frames["_ddajaxtabsiframe-"+_24]!="undefined"){
try{
delete window.frames["_ddajaxtabsiframe-"+_24];
}
catch(err){
}
}
document.getElementById(_24).innerHTML=this.defaultIframe;
window.frames["_ddajaxtabsiframe-"+_24].location.replace(_23);
},expandrevcontent:function(_25){
var _26=this.revcontentids;
for(var i=0;i<_26.length;i++){
document.getElementById(_26[i]).style.display=(_25.indexOf(","+_26[i]+",")!=-1)?"block":"none";
}
},setcurrenttabindex:function(_28){
for(var i=0;i<this.hottabspositions.length;i++){
if(_28==this.hottabspositions[i]){
this.currentTabIndex=i;
break;
}
}
},autorun:function(){
this.cycleit("next",true);
},cancelautorun:function(){
if(typeof this.autoruntimer!="undefined"){
clearInterval(this.autoruntimer);
}
},init:function(_2a){
var _2b=ddajaxtabs.getCookie(this.tabinterfaceid);
var _2c=-1;
var _2d=this.urlparamselect(this.tabinterfaceid);
this.automodeperiod=_2a||0;
this.defaultHTML=document.getElementById(this.contentdivid).innerHTML;
for(var i=0;i<this.tabs.length;i++){
this.tabs[i].tabposition=i;
if(this.tabs[i].getAttribute("rel")){
var _2f=this;
this.hottabspositions[this.hottabspositions.length]=i;
this.tabs[i].onclick=function(){
_2f.expandtab(this);
_2f.cancelautorun();
return false;
};
if(this.tabs[i].getAttribute("rev")){
this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/));
}
if(_2d==i||this.enabletabpersistence&&_2c==-1&&parseInt(_2b)==i||!this.enabletabpersistence&&_2c==-1&&this.getselectedClassTarget(this.tabs[i]).className=="selected"){
_2c=i;
}
}
}
if(_2c!=-1){
this.expandtab(this.tabs[_2c]);
}else{
this.expandtab(this.tabs[this.hottabspositions[0]]);
}
if(parseInt(this.automodeperiod)>500&&this.hottabspositions.length>1){
this.autoruntimer=setInterval(function(){
_2f.autorun();
},this.automodeperiod);
}
}};

