$(function(){
			
				$('#select_province').change(function(){					
					var province = $('#select_province').val();					
					$.ajax({
						url: 'handler/getLocations/'+province,
						timeout: 2000,
						success: function(data){
						$('#select_location').html(data);					
						}				
					});					
				});
	
				$('#select_location').change(function(){					
					var location = $('#select_location').val();					
					$.ajax({
						url: 'handler/getQuarters/'+location,
						timeout: 2000,
						success: function(data){
						$('#select_quarter').html(data);
						}
				
					});
				});
				
			});


function getPhotoAJAX(id, size_big, size_small, size_rel)
{	
	var photoLink = $.ajax({
		url: 'handler/getPhoto/'+id+'/'+size_big+'/'+size_small+'/'+size_rel,
		timeout: 10000,
		success: function(data){
			$("#img"+id).append(data);
		}
	});

}

function toNotes(offerId)
{
	var notes = $.cookie('notes');
	if(notes === null) notes = "";
	
	if(notes.indexOf(offerId) == -1) notes = notes+","+offerId;
	else
		{
			alert("Oferta jest już w notatniku");
			return false;
		}
	
	$.cookie('notes', notes);	
	alert("Oferta została dodana do notatnika");
	
}

function removeNote(offerId)
{
	var notes = $.cookie('notes');
	notes = notes.replace(","+offerId, "");
	
	$.cookie('notes', "");
	$.cookie('notes', notes);
		
	$("#oferta-"+offerId).slideUp(500);
	
	
	
}
