jQuery(document).ready(function(){
	
	var theconf = {
						trigger:'#pagenavigation a',
						target:'#foto',
						event: 'click',
						exec: function(target, reference, index){
						
							
							$('#agenturheadline')		.fadeOut('fast', function(){ $('#agenturheadline').attr('id','agenturheadlineold') });
							$('#text')					.fadeOut('fast', function(){ $('#text').attr('id','textold'); });
							$('#agenturtext')			.fadeOut('fast', function(){ $('#agenturtext').attr('id','agenturtextold')	});
							$('#pagenavigation')		.attr('id','pagenavigationold');
							$(target)					.animate({"margin-left":"-1000px", "opacity":"0"}, 'slow', function(){ $(target).css('margin-left','1000px').attr('id','fotoold'); smartAnchorFinish(reference, index);});
							
						
						},
						ajax: {
							containerids:['#fotoold', '#agenturheadlineold','#textold', '#agenturtextold', '#pagenavigationold'],
							contentids:['#foto', '#agenturheadline','#text', '#agenturtext', '#pagenavigation'],
							success:[
								function(){
									//console.log($('#foto'));
									//console.log($('#foto img'));
									if($('#foto img')) $('#fotoold').animate({"margin-left":"0px", "opacity":"1"}, 'slow', function(){ $('#fotoold').replaceWith($('#foto')); });
									else $('#fotoold').attr('id', 'foto');
									
								},
								function(){
									if($('#agenturheadline h1')) $('#agenturheadlineold').fadeIn('fast', function(){ $('#agenturheadlineold').replaceWith($('#agenturheadline'));  });
									else $('#agenturheadlineold').attr('id','agenturheadline');
								},
								function(){
									$('#textold').fadeIn('slow', function(){ $('#textold').replaceWith($('#text')); smartAnchors(theconf); });
								},
								function(){
									if($('#agenturtext p')) $('#agenturtextold').fadeIn('fast', function(){ $('#agenturtextold').replaceWith($('#agenturtext')) });
									else $('#agenturtextold').attr('id','agenturtext')
								},
								
								function(){
									$('#pagenavigationold').replaceWith($('#pagenavigation'));   
								}
							]
						}
					}
	smartAnchors( theconf );
});
