// based on http://visitmix.com/labs/glimmer/samples/sequence.html

jQuery(function ($) {
    var timer;
    function button1_click(event) {
        $(".slide").css("visibility", "hidden");
        $("#image1").css("visibility", "visible");
        $("#image1").css("opacity", "0");
        $("#image1").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("ul.buttons li").removeClass("active");
        $("#image1").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("#button1").addClass("active");
        clearTimeout(timer);
        timer = setTimeout(eval("button2_click"), "5000");
        $("#image1").animate({
            "opacity": 1
        },
        300, "linear", null);
                document.getElementById("slideshow-text-title").innerHTML = "Take a Discovery Flight!";
		document.getElementById("slideshow-text").innerHTML = 'For just $59 plus tax you can take a ride with one of our Certified Flight Instructors to see what Air America is all about!';
    }

    function button2_click(event) {
        $(".slide").css("visibility", "hidden");
        $("#image2").css("visibility", "visible");
        $("#image2").css("opacity", "0");
        $("#image2").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("ul.buttons li").removeClass("active");
        $("#image2").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("#button2").addClass("active");
        clearTimeout(timer);
        timer = setTimeout(eval("button3_click"), "5000");
        $("#image2").animate({
            "opacity": 1
        },
        300, "linear", null);
                document.getElementById("slideshow-text-title").innerHTML = "Build Your Multi Time!";
		document.getElementById("slideshow-text").innerHTML = 'For just $195/hr you can rent one of our Beechcraft Duchess twins and fly solo anywhere in the US.  For more information, <a href="fleet.php#be76">please click here</a>.';
    }

    function button3_click(event) {
        $(".slide").css("visibility", "hidden");
        $("#image3").css("visibility", "visible");
        $("#image3").css("opacity", "0");
        $("#image3").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("ul.buttons li").removeClass("active");
        $("#image3").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("#button3").addClass("active");
        clearTimeout(timer);
        timer = setTimeout(eval("button4_click"), "5000");
        $("#image3").animate({
            "opacity": 1
        },
        300, "linear", null);
                document.getElementById("slideshow-text-title").innerHTML = "We Train Foreign Pilots!";
		document.getElementById("slideshow-text").innerHTML = 'We offer foreign pilot flight training, time building and license conversions.<br>For more information, <a href="foreign-pilots.php">please click here</a>.';
    }
	
    function button4_click(event) {
        $(".slide").css("visibility", "hidden");
        $("#image4").css("visibility", "visible");
        $("#image4").css("opacity", "0");
        $("#image4").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("ul.buttons li").removeClass("active");
        $("#image4").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("#button4").addClass("active");
        clearTimeout(timer);
        timer = setTimeout(eval("button5_click"), "5000");
        $("#image4").animate({
            "opacity": 1
        },
        300, "linear", null);
                document.getElementById("slideshow-text-title").innerHTML = "<font style=\"font-size: 14px;\">Fly a High-Performance Airplane!</font>";
                document.getElementById("slideshow-text").innerHTML = 'For just $164/hr you can get your high-performance endorsement and rent our Cessna 182T G1000. For more information, <a href="fleet.php#182g1000">please click here</a>.';
    }

    function button5_click(event) {
        $(".slide").css("visibility", "hidden");
        $("#image5").css("visibility", "visible");
        $("#image5").css("opacity", "0");
        $("#image5").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("ul.buttons li").removeClass("active");
        $("#image5").animate({
            "opacity": 1
        },
        300, "linear", null);
        $("#button5").addClass("active");
        clearTimeout(timer);
        timer = setTimeout(eval("button1_click"), "5000");
        $("#image5").animate({
            "opacity": 1
        },
        300, "linear", null);
                document.getElementById("slideshow-text-title").innerHTML = "Fly to the Bahamas!";
		document.getElementById("slideshow-text").innerHTML = 'For as little as $119/hr you can rent one of our Cessna 172SPs or Cessna 182T and fly solo to the Bahamas.';
    }

    function OnLoad(event) {
        clearTimeout(timer);
        timer = setTimeout(eval("button2_click"), "5000");
    }

    $('#button1').bind('click', button1_click);

    $('#button2').bind('click', button2_click);

    $('#button3').bind('click', button3_click);
	
    $('#button4').bind('click', button4_click);

    $('#button5').bind('click', button5_click);

    OnLoad();

});
