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