$(document).ready(function() {
	$('.apply_now').click(function() {
			var offerId = parseInt(this.id.replace("apply_", ''));
			var href = this.href;
			var url = document.location.href;
			url = url.replace(/[a-z]+\/\d+?/, 'employees/logged');
			 
			$.get(url, { offer_id: offerId }, function(data){
				isLogged = parseInt(data);
				if(!isLogged) {
					$.blockUI( { message: $('#logged_box')} );
				    $('.blockOverlay').click($.unblockUI); 
				} else {
					document.location.href = href;
				}
			});
			
			return false;
	});
});