// cufon Cufon.replace("h1", { fontFamily: 'Coolvetica Rg'}); Cufon.replace("h2", { fontFamily: 'Coolvetica Rg'}); Cufon.replace("h4", { fontFamily: 'Coolvetica Rg'}); $(function() { $(".nav-services > a").click(function() { return false; }); }); function slideShow() { // HOME PAGE SLIDESHOW CODE // // set first slide as selected $(".slideshow ul.slides li:first").addClass("selected"); $(".slideshow ul.nav li:first").addClass("selected"); // AUTO CHANGE SLIDE var t; var timer_is_on = 0; var getTimer; var isFirstTime = true; // starts the auto changer doTimer(); function autoChangeSlide() { if (!isFirstTime) { var slideLength = $(".slideshow ul.slides li").length; // determine the index of the selected slide $(".slideshow ul.slides li").each(function(index) { if ($(this).hasClass("selected")) { thisSlide = index; } }); if (thisSlide + 1 > slideLength - 1) goToSlide(0); else goToSlide(thisSlide + 1); } isFirstTime = false; t = setTimeout(function() { autoChangeSlide(); }, 5000); } // starts the javascript timer function doTimer() { if (!timer_is_on) { timer_is_on = 1; autoChangeSlide(); } } // stops the javascript timer function stopCount() { clearTimeout(t); timer_is_on = 0; } // EVENT HANDLERS // slide nav click $(".slideshow ul.nav li a").click(function() { stopCount(); //stop auto change slides $(".slideshow ul").stop(true, true); var slideIndex = $(this).parent("li").index(); goToSlide(slideIndex); return false; }); // HELPER FUNCTIONS // function to go to a specific slide index function goToSlide(index) { var thisSlide = 0; // determine the index of the selected slide $(".slideshow ul.slides li").each(function(index) { if ($(this).hasClass("selected")) { thisSlide = index; } }); // remove selected class from current slide. $(".slideshow ul.slides li").eq(thisSlide).removeClass("selected"); $(".slideshow ul.nav li").eq(thisSlide).removeClass("selected"); // add selected class to next slide. $(".slideshow ul.slides li").eq(index).addClass("selected"); $(".slideshow ul.nav li").eq(index).addClass("selected"); //alert("index: " + index + "\nthisSlide: " + thisSlide); var moveDistance = index * -350; $(".slideshow ul").animate({top: moveDistance}, 400); slideAnimations(index); } function slideAnimations(index) { switch(index) { case 0: $(".home .slideshow .overlay").stop(true, true).fadeOut(50); break; case 1: $(".home .slideshow .overlay").stop(true, true).fadeOut(50); $(".home .slideshow .overlay.cooling-ac").delay(400).fadeIn(200); $(".home .slideshow .overlay.cooling-ac img").delay(400).fadeTo(150, 0.5).fadeTo(150, 1); break; case 2: $(".home .slideshow .overlay").stop(true, true).fadeOut(50); $(".home .slideshow .overlay.heating-furnace").delay(400).fadeIn(200); $(".home .slideshow .overlay.heating-furnace img").delay(400).fadeTo(150, 0.5).fadeTo(150, 1); break; case 3: $(".home .slideshow .overlay").stop(true, true).fadeOut(50); $(".home .slideshow .overlay.ventilation-ventilator").delay(400).fadeIn(200); $(".home .slideshow .overlay.ventilation-ventilator img").delay(400).fadeTo(150, 0.5).fadeTo(150, 1); break; default: // do nothing } } }