jQuery(document).ready(function(){
	
	$('#contactform').submit(function(){
	
		var action = $(this).attr('action');
		
		$("#message").slideUp(750,function() {
		$('#message').hide();
		
 		$('#submit')
			.after('<img src="assets/ajax-loader.gif" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			hear: $('#hear').val(),
			timely: $('input[name=timely]:checked').val(),
			comm: $('input[name=comm]:checked').val(),
			satisfied_with_install: $('input[name=satisfied_with_install]:checked').val(),
			not_satisfied_with_install: $('#not_satisfied_with_install').val(),
			satisfied_with_overall: $('input[name=satisfied_with_overall]:checked').val(),
			overall_experience: $('input[name=overall_experience]:checked').val(),
			using_in_future: $('input[name=using_in_future]:checked').val(),
			refer_cambridge_floors: $('input[name=refer_cambridge_floors]:checked').val(),
			comments: $('#comments').val(),
			testimonial: $('#testimonial').val()
		},
			function(data){
				document.getElementById('message').innerHTML = data;
				$('#message').slideDown('slow');
				$('#contactform img.loader').fadeOut('slow',function(){$(this).remove()});
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
				window.scrollTo(0, $('#message').position().top);
			}
		);
		
		});
		
		return false; 
	
	});
	
});
