jQuery(document).ready(function(){
	
	//Fade
	$("#navigation-cars-content-ul li a").fadeTo("fast", 1);
	
	$("#navigation-cars-content-ul li a").mouseover(function() {
		$(this).fadeTo(500, 0.7);
	});
	
	$("#navigation-cars-content-ul li a").mouseout(function() {
		$(this).fadeTo(600, 1);
	});
	
	// Lightbox
	$(function() {
		$(".lightbox").lightbox();
	});	
	
	// Moving stuff around on the page
	
	$("#navigation-cars").insertBefore("#main-and-sidebar");
				
	$('<p class="car-toggle">Show Executive Cars Quick Navigation</p>').insertBefore("#navigation-cars-content");
	
	$("#breadcrumbs").insertBefore("h1");
	
	
// Hide/Show Car Navigation
$("p.car-toggle").addClass("car-off").click(function() {
	if ($(this).is(".car-off")) {
		$(this).html("Hide Executive Cars Quick Navigation");
		$(this).next().slideDown("slow", function() { 
			$(this).prev().removeClass("car-off").addClass("car-on");
		});
	} 
	if ($(this).is(".car-on")) {		
		$(this).html("Show Executive Cars Quick Navigation");
		$(this).next().slideUp("slow", function() { 
			$(this).prev().removeClass("car-on").addClass("car-off");
		});
	}
}).next().hide();

	// Make car navigation drop down on page with class "show-cars"

	$(".show-cars p.car-toggle").next().slideDown("slow");
	$(".show-cars p.car-toggle").removeClass("car-off").addClass("car-on");
	$(".show-cars p.car-toggle").html("Hide Executive Cars Quick Navigation");
			
	// Hide/Show Chauffeur Services
	$("p.regional-services-toggle").addClass("services-off").click(function() {
		if($(this).is(".services-off")) {
			$(this).next().slideDown("slow", function() { 
				$(this).prev().removeClass("services-off").addClass("services-on");
			});
		} 
		if ($(this).is(".services-on")) {
			$(this).next().slideUp("slow", function() { 
				$(this).prev().removeClass("services-on").addClass("services-off");
			});
		}
	}).next().hide();
	
	//


});

		function slideSwitch() {
		var $active = $('#slideshow img.active');
	
		if ( $active.length == 0 ) $active = $('#slideshow img:last');
	
		var $next =  $active.next().length ? $active.next()
			: $('#slideshow img:first');
	
		$active.addClass('last-active');
	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
			});
	}
	
	$(function() {
		setInterval( "slideSwitch()", 4000 );
	});