//** Tab Content script v2.2- Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
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){var b=new RegExp(a+"=[^;]+","i");if(document.cookie.match(b)){return document.cookie.match(b)[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!")}if(b!=""){this.expandtab(b)}},cycleit:function(b,a){if(b=="next"){var c=(this.currentTabIndex<this.hottabspositions.length-1)?this.currentTabIndex+1:0}else{if(b=="prev"){var c=(this.currentTabIndex>0)?this.currentTabIndex-1:this.hottabspositions.length-1}}if(typeof a=="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(b){var a=window.location.search.match(new RegExp(b+"=(\\d+)","i"));return(a==null)?null:parseInt(RegExp.$1)},expandtab:function(b){var c=b.getAttribute("rel");var d=(b.getAttribute("rev"))?","+b.getAttribute("rev").replace(/\s+/,"")+",":"";this.expandsubcontent(c);this.expandrevcontent(d);for(var a=0;a<this.tabs.length;a++){this.getselectedClassTarget(this.tabs[a]).className=(this.tabs[a].getAttribute("rel")==c)?"selected":""}if(this.enabletabpersistence){ddtabcontent.setCookie(this.tabinterfaceid,b.tabposition)}this.setcurrenttabindex(b.tabposition)},expandsubcontent:function(c){for(var b=0;b<this.subcontentids.length;b++){var a=document.getElementById(this.subcontentids[b]);a.style.display=(a.id==c)?"block":"none"}},expandrevcontent:function(c){var a=this.revcontentids;for(var b=0;b<a.length;b++){document.getElementById(a[b]).style.display=(c.indexOf(","+a[b]+",")!=-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(){if(typeof this.autoruntimer!="undefined"){clearInterval(this.autoruntimer)}},init:function(a){var e=ddtabcontent.getCookie(this.tabinterfaceid);var d=-1;var f=this.urlparamselect(this.tabinterfaceid);this.automodeperiod=a||0;for(var c=0;c<this.tabs.length;c++){this.tabs[c].tabposition=c;if(this.tabs[c].getAttribute("rel")){var b=this;this.hottabspositions[this.hottabspositions.length]=c;this.subcontentids[this.subcontentids.length]=this.tabs[c].getAttribute("rel");this.tabs[c].onclick=function(){b.expandtab(this);b.cancelautorun();return false};if(this.tabs[c].getAttribute("rev")){this.revcontentids=this.revcontentids.concat(this.tabs[c].getAttribute("rev").split(/\s*,\s*/))}if(f==c||this.enabletabpersistence&&d==-1&&parseInt(e)==c||!this.enabletabpersistence&&d==-1&&this.getselectedClassTarget(this.tabs[c]).className=="selected"){d=c}}}if(d!=-1){this.expandtab(this.tabs[d])}else{this.expandtab(this.tabs[this.hottabspositions[0]])}if(parseInt(this.automodeperiod)>500&&this.hottabspositions.length>1){this.autoruntimer=setInterval(function(){b.autorun()},this.automodeperiod)}}};