// Testimonials

$('#testimonials').cycle({ 
    fx:     'fade', 
    prev:   '#prev', 
    next:   '#next',
	pause:  true
});

// Pretty Photo

$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'facebook'});

// Car animation

$('#car').click(function() {
	$('.inner').empty();
	animate_in();
});

var init = function() {
	animate_in();
};

var animate_in = function() {
	$('#car .inner').append('<img src="img/car.png" width="517" height="141" alt="Car" id="wbt-car" />');
	do_car();
};

var do_car = function() {
	$('#car .inner').css('left', '-300px', 1000).show().animate({
		left: 400
	}, {
		easing: 'swing'
	})
};

animate_in();

$('.bar2').mosaic({
	animation	:	'slide'	,	//fade or slide
	hover_y 	:	'-30px',
	opacity		:	0.4
});

var navDuration = 150; //time in miliseconds
var navJumpHeight = "5px";
	
// Navigation Jump
	
$('#sub-nav li').hover(function() {
  $(this).animate({ top : "-="+navJumpHeight }, navDuration);            
}, function() {
  $(this).animate({ top : "0px" }, navDuration);
});

//  clickable box ------------------------------------------------------	
$("#sub-nav li").click(function(){
	window.location=$(this).find("a").attr("href");return false;
});


$('#contactform').submit(function(){

	var action = $(this).attr('action');
	
	$('#submit').attr('disabled','disabled').after('<img src="img/ajax-loader.gif" class="loader" />');
	
	$("#message").slideUp(750,function() {
	$('#message').hide();			
	
	$.post(action, { 
		name: $('#name').val(),
		email: $('#email').val(),
		phone: $('#phone').val(),
		subject: $('#subject').val(),
		comments: $('#comments').val(),
		verify: $('#verify').val()
	},
		function(data){
			document.getElementById('message').innerHTML = data;
			$('#message').slideDown('slow');
			$('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
			$('#submit').removeAttr('disabled'); 
			if(data.match('success') != null) $('#contactform').slideUp('slow');
			
		}
	);
	
	});
	
	return false; 

});


