// JavaScript Document

//Number of Images to Rotate On Header
var imageNum=5;
//number of seconds between image change 
var time=8;
//  image to start on
var currentImage=1;
//number of seconds between specials box image change
var time2=7;



jQuery(document).ready(function(){
    //set lightbox 
    $(".fleetThumbs .hummer").lightBox({fixedNavigation:true});
    $(".fleetThumbs .sedan").lightBox({fixedNavigation:true});
    $(".fleetThumbs .bus").lightBox({fixedNavigation:true});

    //set rounded corners for divs labled with .rounded
    DD_roundies.addRule('.rounded', 5, true);

    //on rollover add a white background and change rollover image
    $(".menuText").hover(function() {
        $($(this).css('background-color','white').fadeTo(500,.50));
        $("#"+this.id+" .rollOver").show();
        $("#"+this.id+" .rollOut").hide();
    },
    function(){
        $($(this).fadeTo(0,1).css('background','none'));
        $("#"+this.id+" .rollOver").hide();
        $("#"+this.id+" .rollOut").show();
    });

    //every 5 seconds change the image
    setInterval("changeBackground()",(time*500));

    if($("specialsBox")){
        setInterval("changeSpecial()",(time2*1000));
    }

    //accordion for faq page
    $("#accordion").accordion({header: "h3",alwaysOpen: false,active:'false',autoHeight:'falso',clearStyle:'true'});

});

//function for changing header background
function changeBackground(){
    if (currentImage!=imageNum){
        $("#BG"+currentImage).fadeOut("slow");
        currentImage++;
        $("#BG"+currentImage).fadeIn("slow");}
    else {
        $("#BG"+currentImage).fadeOut("slow");
        currentImage=1;
        $("#BG"+currentImage).fadeIn("slow");
    }
}

//function for changing specials background
function changeSpecial(){
    $("#specialImage1").toggle();	
    $("#specialImage2").toggle();
}
