$(document).ready(function(e) {

/* ------------------------------------------ Home Sidebar boxes ------------------------------------------ */    
	
	$('#sidebar_buttons a.sidebar_button').hover(function() {
		$('span.sidebar_button_subtext',this).stop(true, true).slideDown('fast');
	}, function() {
		$('span.sidebar_button_subtext',this).stop(true, true).slideUp('fast');
	});

/* ------------------------------------------ Header search form ------------------------------------------ */

	$('#nav_search_input').focus(function() {
		if($(this).val() == this.defaultValue)
		$(this).val("");
	});

	$('#nav_search_input').blur(function() {
		if($(this).val() == "")
		$(this).val(this.defaultValue);
	});
	
	$('#searchsubmit').click(function(e) {
        if ( $('#nav_search_input').val() == 'Enter your search term...') {
			$('#nav_search_input').focus();
			return false;
		}
    });


/* ------------------------------------------ Hire Fleet images ------------------------------------------ */

	
	$('#price tbody').hover(function() {
		$('#fleet_info').stop(true, true).fadeIn(250);
	}, function() {
		$('#fleet_info').stop(true, true).fadeOut(300);
	});


	$('tr.premium').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_premium');
    });

	$('tr.tandem').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_tandem');
    });

	$('tr.twenty').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_20');
    });

	$('tr.twentyfour').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_24');
    });

	$('tr.childseat').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_cs');
    });

	$('tr.tag').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_tag');
    });

	$('tr.buggy').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_bug');
    });

	$('tr.dog').mouseover(function() {
        $('#fleet_info_scroll').attr('class','row_dog');
    });

/* ------------------------------------------ Cycle Route Desc ------------------------------------------ */

if (jQuery().accordion) {
	$('#route_descriptions').accordion({
		collapsible: true, 
		autoHeight: false, 
		active: false,
		change: function(event, ui) {
			var routeMap = ui.newHeader.attr('rel');

			if (routeMap) {
				$('#route_map_wrapper img').each(function(i) {
						$(this).removeClass("activeRoute")	
						$(this).addClass("inactiveRoute")									  
				});
				
				$('#'+routeMap).removeClass('inactiveRoute');
				$('#'+routeMap).addClass('activeRoute');
				
				$('#route_map_wrapper img').each(function(i) {
					if ( !($(this).hasClass("activeRoute")) ) {
						//$(this).fadeOut(400);
						$(this).addClass("inactiveRoute")
					}
				});
			} else {
				$('#route_map_wrapper img').each(function(i) {
						$(this).removeClass("inactiveRoute")	
						$(this).removeClass("activeRoute")									  
				});
			}
		}
 	});
	
	$('#route_map_fixed').click(function(){
		$('#route_map_wrapper img').each(function(i) {
						$(this).removeClass("inactiveRoute")	
						$(this).removeClass("activeRoute")									  
		});								 
	});
}

/* ------------------------------------------ Book Online Datepicker ------------------------------------------ */
	
if (jQuery().datepicker) {
	var myDate=new Date();
		myDate.setDate(myDate.getDate()+1);
		$.datepicker.setDefaults({
			minDate: myDate,
			dateFormat: 'd M yy',
			changeMonth: true,
			changeYear: true,
			closeText: 'Close',
			currentText: '',
			showButtonPanel: true
			});
	$('.book_datepicker').datepicker();
	$('#ui-datepicker-div').wrap('<div class="ui_datepicker"></div>');	
}

});
