
function picasaLinks() {
	 if (editmode!='content') {
	    $('#content a').each(function(){
			var a = this;
			var matches = this.href.match(/picasaweb\.google\.com\/(.*)\/(.*)/);
			if (matches && matches[1]) {
				var title = $(this).text();
				$(this).before('<div id="album_'+matches[1]+'"/>');
				$(this).remove();
				
				
				var album = matches[2];
				if (album) {
					var albumid;
					$.getJSON('http://picasaweb.google.com/data/feed/api/user/' 
	                    + matches[1] + '?kind=album&access=visible&alt=json-in-script&thumbsize=' + 72 + 'c&callback=?',
	                    function(data){
							$(data).each(function(i, item){
								$(item.feed.entry).each(function(){
									if (album == this.gphoto$name.$t) {
										albumid = this.gphoto$id.$t;
										$('div#album_'+matches[1]).EmbedPicasaGallery(matches[1],{	
											loading_animation: 'css/loading.gif',
											albumid : albumid,
											size: 72,
											msg_loading_list: '',
											msg_back: 'Terug naar het overzicht'
									    	});
									}
								});
							});
						}
	               );
					
				}
				else {
				$('div#album_'+matches[1]).EmbedPicasaGallery(matches[1],{	
					loading_animation: 'css/loading.gif',
				
					size: 72,
					msg_loading_list: 'Albums laden',
					msg_back: 'Terug naar het overzicht'
			    });	
			    
				}
			}
		});
		
		}
	
}

$(document).ready(function(){
picasaLinks();
	   
});
