var tabBackgroundColor = '#4349a9'; //* tab background color var tabBackgroundColorHilighted = '#ffffff'; //* highlighted tab background color var tabTextColor = '#ffffff'; //* tab text color var tabTextColorHilighted = tabBackgroundColor; //* highlighted tab text color var slideTimes = [30000,30000,30000,30000,30000]; //* respective time to show slide, e.g. second value is time to show second slide // Correct IE6's incomplete setAttribute support var classSpec = "class"; //W3C spec, e.g. setAttribute('class','foo'); if(BrowserDetect.browser == "Explorer" && (BrowserDetect.version =="6" || BrowserDetect.version =="7")){ classSpec = "className";} //IE's setAttribute support correction, e.g. setAttribute('className','foo'); //******************************* //ROTATOR v2.1 // - v2.2 Accomidations for Safari among other discrepancies // - v2.1 displays adjustments for compatibility, refactoring // - v2.0 appeal to IE7 for "special code" // - v2.0b incomplete deployment, mostly functional new design // - v1.0 initial small-width release //******************************* //SlideShow JS Object // - slides[] ~ array of "Slide" objects // - currentSlide ~ changes with each action on SlideShow Object instantiated // * changeToSlide() ~ changes to specified slide via hide-all, show specified // * hideAll() ~ cycles through all slides, changes CSS display state, set appropriate class for bg // * show() ~ sets attributes for each tab on activated state and resets adjacent tabs' states // * toggle() ~ changes SlideShow instances between "play" and "pause" modes. Also clears triggers for next auto-play tab to-be-shown // * nextSlide() ~ advances currentSlide to next in array (with looparound) // * prevSlide() ~ decrements slide counter via setting currentSlide to previous in slide array (with looparound) function SlideShow(sIn) { var slides = []; //accessible data member for all Slide objects var currentSlide = ''; //actively displayed slide object for(var i=1; i<=sIn.length; i++){ //cycle through all slides if(i==sIn.length-1){slides[i] = new Slide(i,sIn[i],0,slideTimes[i-1]); break;} //assign "next slide" of last slide to null slides[i] = new Slide(i,sIn[i],i+1,slideTimes[i-1]); //create Slide object for each tab } this.changeToSlide = function(s,cont){ //s = slide #, cont = continue to rotate boolean this.hideAll(); //initially hide all slides this.show(s,cont); //then show the respect one passed in by index }; this.hideAll = function(){ for(var i=slides.length-1; i>0; i--){ //cycle through all slide document.getElementById('slide'+i).style.display = 'none'; //hide the indexed slide if(i==1){document.getElementById('tab'+i).setAttribute(classSpec,'tabOffLeft');} //set class to have background of left tab "off", classSpec varies between class and className for FF/IE, resep. else if(i==slides.length){ document.getElementById('tab'+i).setAttribute(classSpec,'tabOffRight');} //for the last slide, set this so that the anchor in this tab has the appropriate right-side bg else { document.getElementById('tab'+i).setAttribute(classSpec,'tabOffMid');} //other tabs have "offoff" cross-tab bg by default. This also allows the nested anchor to be offoff as well } }; this.show = function(i,cont){ // Added by MW: 10.12.07: set current slide this.currentSlide = i; i = i-0; //convert i to numerical context document.getElementById('slide'+i).style.display = 'block'; //remove slide from hidden state var currentTab = document.getElementById('tab'+i); //local variables to prevent redundant lookups var prevTab = document.getElementById('tab'+(i-1)); var nextTab = document.getElementById('tab'+(i+i)); var lastTab = document.getElementById('tab'+(slides.length-1)); if(i==1){ currentTab.setAttribute(classSpec,'activeTab leftOn'); //tab one bg for anchor, left side special bg document.getElementById('tab2').setAttribute(classSpec,'tab1On'); //tab2 must be reset for post-loop through tabs recorrection lastTab.setAttribute(classSpec,'tabOffRight');} //after cycle-through, reset last tab else if(i==slides.length-1){ currentTab.setAttribute(classSpec,'activeTab rightOn');} //set special state for last tap, for rightOn bg for a else{ if(i==2){document.getElementById('tab1').setAttribute(classSpec,'tabOffLeft'); } //reset special state for first tab else{prevTab.setAttribute(classSpec,'tabOffMid');} //otherwise, a normal "off" state suffices lastTab.setAttribute(classSpec,'tabOffRight'); //reset the state of the last tab, if applicable currentTab.setAttribute(classSpec,'activeTab midOn'); //turns this "mid tab" to active state if(i 1){ this.currentSlide = (this.currentSlide - 0) - 1;} else if(this.currentSlide == 1 || !this.currentSlide){this.currentSlide = slides.length - 1;} slideShow.changeToSlide(this.currentSlide); }; } function Slide(i,id,next,t){ this.i = i; this.id = id; this.next = i+1; this.timeVisible = t; if(next){this.next = 0;} //last slide's "next" is slide 1 (index 0) } function showNextSlide(){ //orphaned method is crucial as slideshow.nextslide functionality is lost to scope of the object if(!slideShow.currentSlide){slideShow.currentSlide = '2';} else{slideShow.currentSlide++;} if(slideShow.currentSlide == slides.length){slideShow.currentSlide = 1;} slideShow.changeToSlide(slideShow.currentSlide, true); } var slideShow, slides, t; window.onload = function() { try { slides = []; //establish variable as array for(var i=1; i<=slideTimes.length; i++){ //cycle through all slide, index 1 slides[i] = 'slide'+i;} slideShow = new SlideShow(slides); //Javascript doesn't pass variables to anonymous function properly, hence verbose initialization document.getElementById('tab1').onclick = function(){slideShow.changeToSlide(1); slideShow.toggle('stop');}; document.getElementById('tab2').onclick = function(){slideShow.changeToSlide(2); slideShow.toggle('stop');}; document.getElementById('tab3').onclick = function(){slideShow.changeToSlide(3); slideShow.toggle('stop');}; document.getElementById('tab4').onclick = function(){slideShow.changeToSlide(4); slideShow.toggle('stop');}; document.getElementById('tab5').onclick = function(){slideShow.changeToSlide(5); slideShow.toggle('stop');}; //functionality of rotation toggle document.getElementById('toggle').onclick = function(){clearTimeout(t); slideShow.toggle();}; document.getElementById('tab_back').onclick = function(){slideShow.toggle('stop'); slideShow.prevSlide();}; document.getElementById('tab_forward').onclick = function(){slideShow.toggle('stop'); slideShow.nextSlide(); }; slideShow.changeToSlide(1,false); //first to be displayed is slide 1 } catch(e) {} };