function Yetii(c, d) { this.active = (d) ? d : 1, this.timeout = null, this.tabclass = 'tab', this.activeclass = 'active', this.getTabs = function() { var a = []; var b = document.getElementById(c).getElementsByTagName('*'); for (var i = 0; i < b.length; i++) { if ((new RegExp('\\b' + this.tabclass + '\\b')).test(b[i].className)) a.push(b[i]) } return a }, this.links = document.getElementById(c + '-nav').getElementsByTagName('a'), this.tabs = this.getTabs(); this.show = function(a) { for (var i = 0; i < this.tabs.length; i++) { this.tabs[i].style.display = ((i + 1) == a) ? 'block' : 'none'; this.links[i].className = ((i + 1) == a) ? this.activeclass : '' } }, this.rotate = function(a) { this.show(this.active); this.active++; if (this.active > this.tabs.length) this.active = 1; var b = this; this.timeout = setTimeout(function() { b.rotate(a) }, a * 1000) }, this.init = function(a) { this.show(this.active); var b = this; for (var i = 0; i < this.links.length; i++) { this.links[i].customindex = i + 1; this.links[i].onclick = function() { if (b.timeout) clearTimeout(b.timeout); b.show(this.customindex); return false } } if (a) this.rotate(a) } };
