$(document).ready(function(){
	
	$('.no_points').click(function(){
		if($(this).attr('href') == '#'){
			alert('Aby aplikować na ofertę musisz wypełnić profil w przynajmniej 30%.');
		}
	});

	$(".save_offer").live('click', function(evt)
	{
		evt.preventDefault();
		var link = $(this);
		$.get($(this).attr('href'), function(data){
			var count = parseInt(link.parent().find(".offer_count").text());
			$(".offer_count").text(count + 1);
			$(".save_offer").text('Usuń z zapamiętanych').removeClass('save_offer').addClass('remove_saved_offer');
		});
	});
	
	$(".remove_saved_offer").live('click', function(evt)
	{
		evt.preventDefault();
		var link = $(this);
		$.get($(this).attr('href'), function(data){
		   	var count = parseInt($(".offer_count").text());
			$(".offer_count").text(count - 1);
			if(link.hasClass('permanent'))
			{
				link.closest('li').remove();
				$(".information").show();
				if($(".col1 li").length == 0)
				{
					$(".emptyInfo").show();
				}
			}
			else
			{
				link.text('Zapamiętaj Ofertę').removeClass('remove_saved_offer').addClass('save_offer');
			}
		});
	});

	$("#recommend_offer").click(function()
	{
		
	});
});

