function ddtabcontent(a){this.tabinterfaceid=a;this.tabs=document.getElementById(a).getElementsByTagName("a");this.enabletabpersistence=true;this.hottabspositions=[];this.currentTabIndex=0;this.subcontentids=[];this.revcontentids=[];this.selectedClassTarget="link"}ddtabcontent.getCookie=function(a){a=new RegExp(a+"=[^;]+","i");if(document.cookie.match(a))return document.cookie.match(a)[0].split("=")[1];return""};ddtabcontent.setCookie=function(a,b){document.cookie=a+"="+b+";path=/"};
ddtabcontent.prototype={expandit:function(a){this.cancelautorun();var b="";try{if(typeof a=="string"&&document.getElementById(a).getAttribute("rel"))b=document.getElementById(a);else if(parseInt(a)!=NaN&&this.tabs[a].getAttribute("rel"))b=this.tabs[a]}catch(c){alert("Invalid Tab ID or position entered!")}b!=""&&this.expandtab(b)},cycleit:function(a,b){if(a=="next")var c=this.currentTabIndex<this.hottabspositions.length-1?this.currentTabIndex+1:0;else if(a=="prev")c=this.currentTabIndex>0?this.currentTabIndex-
1:this.hottabspositions.length-1;typeof b=="undefined"&&this.cancelautorun();this.expandtab(this.tabs[this.hottabspositions[c]])},setpersist:function(a){this.enabletabpersistence=a},setselectedClassTarget:function(a){this.selectedClassTarget=a||"link"},getselectedClassTarget:function(a){return this.selectedClassTarget=="linkparent".toLowerCase()?a.parentNode:a},urlparamselect:function(a){a=window.location.search.match(new RegExp(a+"=(\\d+)","i"));return a==null?null:parseInt(RegExp.$1)},expandtab:function(a){var b=
a.getAttribute("rel"),c=a.getAttribute("rev")?","+a.getAttribute("rev").replace(/\s+/,"")+",":"";this.expandsubcontent(b);this.expandrevcontent(c);for(c=0;c<this.tabs.length;c++)this.getselectedClassTarget(this.tabs[c]).className=this.tabs[c].getAttribute("rel")==b?"selected":"";this.enabletabpersistence&&ddtabcontent.setCookie(this.tabinterfaceid,a.tabposition);this.setcurrenttabindex(a.tabposition)},expandsubcontent:function(a){for(var b=0;b<this.subcontentids.length;b++){var c=document.getElementById(this.subcontentids[b]);
c.style.display=c.id==a?"block":"none"}},expandrevcontent:function(a){for(var b=this.revcontentids,c=0;c<b.length;c++)document.getElementById(b[c]).style.display=a.indexOf(","+b[c]+",")!=-1?"block":"none"},setcurrenttabindex:function(a){for(var b=0;b<this.hottabspositions.length;b++)if(a==this.hottabspositions[b]){this.currentTabIndex=b;break}},autorun:function(){this.cycleit("next",true)},cancelautorun:function(){typeof this.autoruntimer!="undefined"&&clearInterval(this.autoruntimer)},init:function(a){var b=
ddtabcontent.getCookie(this.tabinterfaceid),c=-1,e=this.urlparamselect(this.tabinterfaceid);this.automodeperiod=a||0;for(a=0;a<this.tabs.length;a++){this.tabs[a].tabposition=a;if(this.tabs[a].getAttribute("rel")){var d=this;this.hottabspositions[this.hottabspositions.length]=a;this.subcontentids[this.subcontentids.length]=this.tabs[a].getAttribute("rel");this.tabs[a].onclick=function(){d.expandtab(this);d.cancelautorun();return false};if(this.tabs[a].getAttribute("rev"))this.revcontentids=this.revcontentids.concat(this.tabs[a].getAttribute("rev").split(/\s*,\s*/));
if(e==a||this.enabletabpersistence&&c==-1&&parseInt(b)==a||!this.enabletabpersistence&&c==-1&&this.getselectedClassTarget(this.tabs[a]).className=="selected")c=a}}c!=-1?this.expandtab(this.tabs[c]):this.expandtab(this.tabs[this.hottabspositions[0]]);if(parseInt(this.automodeperiod)>500&&this.hottabspositions.length>1)this.autoruntimer=setInterval(function(){d.autorun()},this.automodeperiod)}};
