$(document).ready(function(){
	$('img.roll-over').hover(
		function() {
			this.src = this.src.replace("_off","_on");
		},
		function() {
			this.src = this.src.replace("_on","_off");
		}
	);


	if ($(".jcarousel").length > 0 ) {
		$(".jcarousel").jcarousel({
			vertical: true,
			scroll: 1
		});
	}


//	$('#cars-tabs > div.car').hide().filter(':first').show(); // hide all containers except first

	// Click handlers
	$('#cars-links a').click(function () {
		var tabContainers = $(this).parent().next().children();
	        tabContainers.hide(); // hide all tabs
		
		var activeTab = tabContainers.filter(this.hash); // find the tab to show
	        activeTab.show(); // show current

	        $(this).parent().children(".act").removeClass('act'); // deselect active tabs
	        $(this).addClass('act'); // select current one

		if (typeof $(this).attr('datasrc') != 'undefined' &&  $(this).attr('datasrc').length != 0) {
			$('#wrapper').css({'background' : '#f0f0f0 url(' + $(this).attr('datasrc') + ') right bottom no-repeat'});
		}
	        return false;
	}).filter(':first').click();
});