
function getProjectDetails(list_id) {
	$("#project_desc").fadeOut("slow", function () {
		$("#content2").addClass("content2_height");
		$("#loading").addClass("circle");
		$.ajax({
			type: "POST",
			url: "ajax.php",
			data: "a=getProjectInfo&projects_id=" + list_id,
			success: function(msg) {
				if (msg!="") {
					$("#project_desc").html(msg);
					$("#loading").removeClass("circle");
					$("#project_desc").fadeIn("slow", function(){
						$("#content2").removeClass("content2_height");

						mapBaseActions();
					});
				}
			}
		});
	});
}

function mapBaseActions() {
	$("a.newwindow").attr("target","_blank");
	$('a.lightbox').lightBox();
	$('a.lightbox2').lightBox();
	
	$(".project_navigate").click(function() {
		getProjectDetails($(this).html());
	});
}

function updateLastProject(curr_move) {
	//alert('1');
	$("#realizacje_img").fadeOut("slow",function() {
		$.ajax({
			type: "POST",
			url: "ajax.php",
			data: "a=getProjectIco&move=" + curr_move,
			success: function(msg) {
				if (msg!="") {
					$("#realizacje_img").fadeIn("slow");
					$("#realizacje_img").html(msg);
				}
			}
		});
	});
}

var move = 0;

$(document).ready(function() {
	mapBaseActions();

	move = parseInt($("#move").val());
	
	$("#arrow_left").click(function () {
		move = move - 1;
		$("#move").val(move);
		updateLastProject(move);
	});
	
	$("#arrow_right").click(function() {
		move = move + 1;
		$("#move").val(move);
		updateLastProject(move);
	});
	//alert('2');
});