/* Enquiry Form Activate button */
$(document).ready(function(){	    
	$(".fleet-enquiry").click(function(){
		$("#contactFormArea").slideToggle("slow");	
		$(this).toggleClass("active"); return false;
	});
	

});
/* Tabed Navigation*/
var onMenu = false;
var onImg = false;
$(function() {
$('.navbar-toyota').hover(
function(){
onImg = true;
$('#menu').fadeIn('slow');
},
function(){
onImg = false;
setTimeout(function(){
if (!onMenu) $('#menu').fadeOut('slow');
},50);
}
);
$('#menu').hover(
function(){
onMenu = true;
},
function(){
onMenu = false;
setTimeout(function(){
if (!onImg) $('#menu').fadeOut('slow');
},50);
}
);
});

/* Tab New Car Data*/
$(document).ready(function(){
	$('ul.tabNav a').click(function() {
		var curChildIndex = $(this).parent().prevAll().length + 1;
		$(this).parent().parent().children('.current').removeClass('current');
		$(this).parent().addClass('current');
		$("#panel4").hide("slow");
		$(this).parent().parent().next('.tabContainer').children('.current').slideUp('slow',function() {
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child('+curChildIndex+')').slideDown('slow',function() {
				$(this).addClass('current');
			});
		});
		return false;								
	});
});

/* Scroll*/
$(document).ready(function(){
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();
		
		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;
		
		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];
		
		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;
		
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});

if ($.browser.msie == true) { document.execCommand('BackgroundImageCache', false, true); } 
