<script>
//Contact Form Validation
if($('#email-form').length){
	$('#submit').click(function(){
 
		var o = new Object();
		var form = '#email-form';
		
		var name = $('#email-form .name').val();
		var email = $('#email-form .email').val();
		var phone = $('#email-form .phone').val();
		var address = $('#email-form .address').val();
		
		var message = $('#email-form .message').val();
		if(name == '' || last_name == '' || email == '')
		{ 
			$('#email-form .response').html('<div class="failed">Please fill the required fields.</div>');
			return true;
		}
		
		$.ajax({
			url: "<?=base_url('Career_form/send_application')?>",
			method: "POST",
			data: $(form).serialize(),
			beforeSend:function(){
				$('#email-form .response').html('<div class="text-info"><img src="images/icons/preloader.gif"> Loading...</div>');
			},
			success:function(data){
				$('form').trigger("reset");
				$('#email-form .response').fadeIn().html(data);
				setTimeout(function(){
					$('#email-form .response').fadeOut("slow");
				}, 5000);
			},
			error:function(){
				$('#email-form .response').fadeIn().html(data);
			}
		});
	});
}
</script>