var spxHome;

$(document).ready(function(){
	spxGalleryConfig();
	jsCss();
	spxHome = true;
	$(".spxViewMapLink a").click(function(){
		spxPaneSwitch(this);
		return false;
	});
});

function jsCss() {
	$("body").addClass("js");	
}

function spxGalleryConfig()	{
	$('#gallery li').after('<li><img src="images/gallery/taxi2.jpg" width="450" height="340" alt="LTI TXII Taxi - front angled view" title="" /></li><li><img src="images/gallery/taxi3.jpg" width="450" height="340" alt="LTI TX4 Taxi - view of front grill" title="" /></li><li><img src="images/gallery/taxi4.jpg" width="450" height="340" alt="LTI TX4 Taxi - interior view of driver cabin" title="" /></li><li><img src="images/gallery/taxi5.jpg" width="450" height="340"  alt="LTI TX4 Taxi - rear view" title="" /></li>');
	$('#gallery').galleryView({
		panel_width: 450,
		panel_height: 340,
		frame_width: 80,
		frame_height: 50,
		overlay_width: 300,
		transition_speed: 800,
		easing: 'easeInOutQuad',
		overlay_opacity: 0,
		nav_theme: 'light',
		transition_interval: 8000
	});
}

function spxPaneSwitch(spxLink) {
	var dir = (spxLink.href + " #spxBodySwitch > *");

	$("#spxBodySwitch").load(dir, function() {
		spxGalleryConfig();
	});
	if (spxHome)	{
		spxHome = false;
		$(".spxViewMap img").attr({ 
			  src: "images/spxViewHome.gif",
			  title: "Home",
			  alt: "Home"
			});
		$(".spxViewMap p a").text("Home");
		$(".spxViewMap a").attr({ 
			  href: "/"
			});
		//$(".spxLTINotice").css("display", "none");
	} else {
		spxHome = true;
		$(".spxViewMap img").attr({ 
			  src: "images/spxViewMap.gif",
			  title: "View Map",
			  alt: "View Map"
			});
		$(".spxViewMap p a").text("View Map");
		$(".spxViewMap a").attr({ 
			  href: "map.html"
			});
		//$(".spxLTINotice").css("display", "block");
	}
}
