			var re_done = -1;
			var ru_done = -1;
			var t_done = -1;
			var p_done = -1;

			var current = 0;

var ALBUM = function(){
	var _P = {
		init : function( params ) {
			_P.params = params;
			_P.loadXml();
		},
		params : null,
		data : null,
		loadXml : function() {
			$.ajax({
				type : "GET",
				url : _P.params.xmlPath,
				dataType : "xml",
				success : function( data ) {
					_P.data = data;
					_P.amount = _P.params.perView;
					_P.datenow = _P.params.datenow;
// _P.datenow = 1290374460;

					_P.count = $( "photo", data ).length;
					_P.loadSlides();


// $(function() {
//     $('#slideshow').cycle();
// });
// http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&photo_id=4114400873&api_key=f3c249775517e1ab84f9eb3783d0447b


				}
			});
		},
		first : 0,
		amount : 0,
		count : 0,
		last : 0,
		images_width : 460,
		images_created : 0,







///////////////																		!!!!! WithoutThisImageIWouldHaveSeen

		WithoutThisImageIWouldHaveSeen : function() {
			// user van het laatste plaatje is...
var currentImage = $( "photo", _P.data )[current];
var current_user = $(currentImage).attr( "title" );
if (current_user == "O") {
current_user = "P";
}
			// stel je voor dat deze afbeelding er NIET zou zijn.. dan krijg je dus de VORIGE
			// afbeelding van deze user...
			// in de tijd schuiven we sowieso een stukje op, dus:
			// ?? current++;

// als datum, die van de volgende 'state':
var currentDate = $( "photo", _P.data )[current];
_P.datenow = $(currentDate).attr( "dateupload" );

////// date stukkie opschuiven
var thatImage = $( "photo", _P.data )[current+1];
_P.datenow  = $(thatImage).attr( "dateupload" );

			// of dit volgende beeld nou al geladen is of niet, das niet relevant... ZO NEE, dan wordt ie geladen...
			// ZO JA, dan schuiven we weer een stapje op....
// if (t_done === current || ru_done === current || re_done === current || p_done === current) {
	// current++;
	// MOET NATUURLIJK NIET KUNNEN... twee stappen opschuiven tooch?!
// }
			// current zal sowieso een ++ krijg0n!
			//
			// afhankelijk van de user, de juiste objecten selecteren:
var image_object = "#image_linksboven";
var user_object = "#linksboven";
var description_object = "#T_description";
var user_done = t_done;
if (current_user == "Ru") {
image_object = "#image_rechtsboven";
user_object = "#rechtsboven";
description_object = "#Ru_description";
user_done = ru_done;
} else if (current_user == "Re") {
image_object = "#image_rechtsonder";
user_object = "#rechtsonder";
description_object = "#Re_description";
user_done = re_done;
} else if (current_user == "P" || current_user == "O") {
image_object = "#image_linksonder";
user_object = "#linksonder";
description_object = "#P_description";
user_done = p_done;
}

			//
			// vorig beeld van user gevonden?!
var previous_image_found = 0;
			$( "photo", _P.data ).each(function( i ) {

				var title = $(this).attr( "title" );

if (title == "O") {
	title = "P";
}
				if(title == current_user && i>current && previous_image_found == 0 && user_done != i) {
					previous_image_found = 1;

if (current_user === "T") {
t_done = i;
} else if (current_user === "Ru") {
ru_done = i;
} else if (current_user === "Re") {
re_done = i;
} else if (current_user === "P" || current_user === "O") {
p_done = i;
}

				var farm = $(this).attr( "farm" );
				var server = $(this).attr( "server" );
				var id = $(this).attr( "id" );
				var secret = $(this).attr( "secret" );
				var description = "";
				var dateupload = $(this).attr( "dateupload" );
				var my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
				var the_src = "http://farm"+farm+".static.flickr.com/"+server+"/"+id+"_"+secret+".jpg";

					$(image_object).attr('src', the_src);
					$(user_object).css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$(description_object).empty();
	description = $( "description", data ).text();
	$(description_object).append(description);
				}
			});

				}




			});

_P.correctScale();
current++;
// ?? 
		},

// 																		correctScale!!!!
		correctScale : function() {

// scale corrigeren:

thisImage = $( "photo", _P.data )[re_done];
dateupload = $(thisImage).attr( "dateupload" );
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#rechtsonder").css({"height":my_scale+"%"});

thisImage = $( "photo", _P.data )[ru_done];
dateupload = $(thisImage).attr( "dateupload" );
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#rechtsboven").css({"height":my_scale+"%"});

thisImage = $( "photo", _P.data )[t_done];
dateupload = $(thisImage).attr( "dateupload" );
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#linksboven").css({"height":my_scale+"%"});

thisImage = $( "photo", _P.data )[p_done];
dateupload = $(thisImage).attr( "dateupload" );
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#linksonder").css({"height":my_scale+"%"});

		},

		loadNext : function() {
			while (re_done === current || ru_done === current || t_done === current || p_done === current) {
				// dit dus maar niet doen he:
				// current++;
			}
var thisImage = $( "photo", _P.data )[current];


				var farm = $(thisImage).attr( "farm" );
				var server = $(thisImage).attr( "server" );
				var id = $(thisImage).attr( "id" );
				var secret = $(thisImage).attr( "secret" );
				var the_src = "http://farm"+farm+".static.flickr.com/"+server+"/"+id+"_"+secret+".jpg";

				var title = $(thisImage).attr( "title" );
				var description = "";
				var dateupload = $(thisImage).attr( "dateupload" );

_P.datenow = dateupload;





var my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}

// alert(my_scale+" "+title);



// juiste plaatje nu even laden ait..
				if(title == "Re") {
					re_done = current;
					$('#image_rechtsonder').attr('src', the_src);
					$("#rechtsonder").css({"height":my_scale+"%"});
			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$("#Re_description").empty();
	description = $( "description", data ).text();
	$("#Re_description").append(description);
				}
			});

				}
				if(title == "Ru") {
					ru_done = current;
					$('#image_rechtsboven').attr('src', the_src);
					$("#rechtsboven").css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$("#Ru_description").empty();
	description = $( "description", data ).text();
	$("#Ru_description").append(description);
				}
			});
				}
				if(title == "T") {
					t_done = current;
					$('#image_linksboven').attr('src', the_src);
					$("#linksboven").css({"height":my_scale+"%"});
			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$("#T_description").empty();
	$("#T_description").append($( "description", data ).text());
				}
			});
				}
				if(title == "P" || title == "O") {
					p_done = current;
					$('#image_linksonder').attr('src', the_src);
					$("#linksonder").css({"height":my_scale+"%"});
			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$("#P_description").empty();
	description = $( "description", data ).text();
	$("#P_description").append(description);
				}
			});
				}		






// scale corrigeren:

thisImage = $( "photo", _P.data )[re_done];
dateupload = $(thisImage).attr( "dateupload" );
if (dateupload>_P.datenow) {
	re_done = _P.goFetchOlderEntry("Re", re_done, "#image_rechtsonder", "#rechtsonder", "#Re_description");
} else {
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#rechtsonder").css({"height":my_scale+"%"});
}

thisImage = $( "photo", _P.data )[ru_done];
dateupload = $(thisImage).attr( "dateupload" );
if (dateupload>_P.datenow) {
	ru_done = _P.goFetchOlderEntry("Ru", ru_done, "#image_rechtsboven", "#rechtsboven", "#Ru_description");
} else {
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#rechtsboven").css({"height":my_scale+"%"});
}

thisImage = $( "photo", _P.data )[t_done];
dateupload = $(thisImage).attr( "dateupload" );
if (dateupload>_P.datenow) {
	t_done = _P.goFetchOlderEntry("T", t_done, "#image_linksboven", "#linksboven", "#T_description");
} else {
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#linksboven").css({"height":my_scale+"%"});
}

thisImage = $( "photo", _P.data )[p_done];
dateupload = $(thisImage).attr( "dateupload" );
if (dateupload>_P.datenow) {
	p_done = _P.goFetchOlderEntry("P", p_done, "#image_linksonder", "#linksonder", "#P_description");
} else {
	my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
	$("#linksonder").css({"height":my_scale+"%"});
}



			current++;



		},











		goFetchOlderEntryNOWAY : function(user, current_done, image_object, user_object, description_object) {
				var done = 0;

			$( "photo", _P.data ).each(function( i ) {

				var title = $(this).attr( "title" );

				if(title == user && i>current_done && done == 0) {
					done = 1;

				var farm = $(this).attr( "farm" );
				var server = $(this).attr( "server" );
				var id = $(this).attr( "id" );
				var secret = $(this).attr( "secret" );
				var description = "";
				var dateupload = $(this).attr( "dateupload" );
				var my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}
				var the_src = "http://farm"+farm+".static.flickr.com/"+server+"/"+id+"_"+secret+".jpg";


					$(image_object).attr('src', the_src);
					$(user_object).css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
	$(description_object).empty();
	description = $( "description", data ).text();
	$(description_object).append(description);
				}
			});

				}




			});
			return current_done;

		},





		loadSlides : function(action) {



			$( "photo", _P.data ).each(function( i ) {

				var farm = $(this).attr( "farm" );
				var server = $(this).attr( "server" );
				var id = $(this).attr( "id" );
				var secret = $(this).attr( "secret" );

				var title = $(this).attr( "title" );
				var description = "";
				var dateupload = $(this).attr( "dateupload" );

var my_scale = 48-((_P.datenow-dateupload)*(44/604800)*2);
if (my_scale<1) {
	my_scale = 1;
}

				var the_src = "http://farm"+farm+".static.flickr.com/"+server+"/"+id+"_"+secret+".jpg";

				if(title == "Re" && re_done == -1) {
					re_done = i;
					// $( "#rechtsonder" ).empty();
					// $( "#rechtsonder" ).append(["<img id='image_rechtsonder' src='",the_src,"' height='100%'/>"].join( "" ));
					$('#image_rechtsonder').attr('src', the_src);
					// $('#image_rechtsonder').attr('height', 100%);
					$("#rechtsonder").css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
					// _M.data = data;
					// _M.buildMenu();
	$("#Re_description").empty();
	description = $( "description", data ).text();
	$("#Re_description").append(description);

				}
			});

				}

				if(title == "Ru" && ru_done == -1) {
					ru_done = i;
					// $( "#rechtsboven" ).empty();
					// $( "#rechtsboven" ).append(["<img id='image_rechtsboven' src='",the_src,"' height='100%'/>"].join( "" ));
					$('#image_rechtsboven').attr('src', the_src);
					// $('#image_rechtsboven').attr('height', '100%');
					$("#rechtsboven").css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
					// _M.data = data;
					// _M.buildMenu();
	$("#Ru_description").empty();
	description = $( "description", data ).text();
	$("#Ru_description").append(description);

				}
			});

				}

				if(title == "T" && t_done == -1) {
					t_done = i;
					// $( "#linksboven" ).empty();
					// $( "#linksboven" ).append(["<img id='image_linksboven' src='",the_src,"' height='100%'/>"].join( "" ));
					$('#image_linksboven').attr('src', the_src);
					// $('#image_linksboven').attr('height', '100%');
					$("#linksboven").css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
					// _M.data = data;
					// _M.buildMenu();
	$("#T_description").empty();
	$("#T_description").append($( "description", data ).text());

				}
			});

				}

				if((title == "P" || title == "O") && p_done == -1) {

					p_done = i;
					// $( "#linksonder" ).empty();
					// $( "#linksonder" ).append(["<img id='image_linksonder' src='",the_src,"' height='100%'/>"].join( "" ));
					$('#image_linksonder').attr('src', the_src);
					// $('#image_linksonder').attr('height', '100%');
					$("#linksonder").css({"height":my_scale+"%"});

			$.ajax({
				type : "GET",
				url : "proxy.php?proxy_url="+escape("http://api.flickr.com/services/rest/--method=flickr.photos.getInfo&photo_id="+id+"&api_key=f3c249775517e1ab84f9eb3783d0447b"),
				dataType : "xml",
				success : function( data ) {
					// _M.data = data;
					// _M.buildMenu();
	$("#P_description").empty();
	description = $( "description", data ).text();
	$("#P_description").append(description);

				}
			});


				}			



			});

$( "#Rudin" ).click(function() {
		_P.WithoutThisImageIWouldHaveSeen();
		return false;
		// alert('image_rechtsonder');		   
	});

	$( "#image_rechtsonder" ).click(function() {
		_P.WithoutThisImageIWouldHaveSeen();
		return false;
		// alert('image_rechtsonder');		   
	});
	$( "#image_rechtsboven" ).click(function() {
		_P.WithoutThisImageIWouldHaveSeen();
		return false;
		// alert('image_rechtsboven');		   
	});
	$( "#image_linksboven" ).click(function() {
		_P.WithoutThisImageIWouldHaveSeen();
		return false;
		// alert('image_linksboven');		   
	});
	$( "#image_linksonder" ).click(function() {
		_P.WithoutThisImageIWouldHaveSeen();
		return false;
		// alert('image_linksonder');		   
	});
	

$("#image_linksboven").hover(
   function() {
	$("#T_description").css({"visibility":"visible"});
   },
   function() {
	$("#T_description").css({"visibility":"hidden"});
   }
);
$("#T_description").hover(
   function() {
	$("#T_description").css({"visibility":"visible"});
   },
   function() {
	$("#T_description").css({"visibility":"hidden"});
   }
);

$("#image_rechtsboven").hover(
   function() {
	$("#Ru_description").css({"visibility":"visible"});
   },
   function() {
	$("#Ru_description").css({"visibility":"hidden"});
   }
);
$("#Ru_description").hover(
   function() {
	$("#Ru_description").css({"visibility":"visible"});
   },
   function() {
	$("#Ru_description").css({"visibility":"hidden"});
   }
);

$("#image_linksonder").hover(
   function() {
	$("#P_description").css({"visibility":"visible"});
   },
   function() {
	$("#P_description").css({"visibility":"hidden"});
   }
);
$("#P_description").hover(
   function() {
	$("#P_description").css({"visibility":"visible"});
   },
   function() {
	$("#P_description").css({"visibility":"hidden"});
   }
);

$("#image_rechtsonder").hover(
   function() {
	$("#Re_description").css({"visibility":"visible"});
   },
   function() {
	$("#Re_description").css({"visibility":"hidden"});
   }
);
$("#Re_description").hover(
   function() {
	$("#Re_description").css({"visibility":"visible"});
   },
   function() {
	$("#Re_description").css({"visibility":"hidden"});
   }
);


		},


		initNavigation : function() {

		},
		

	};
	return {
		init : function( params ) {
			_P.init( params );
		}
	};
}();
