
	/********* ALF ***********/
	
		function alf_json_form( url, form, button, onSuccess ) {
		
			alf_json( url, $( form ).serialize( true ), button, onSuccess );
				
		}
		
		///////////// Clear json
		
		function alf_json( url, parameters, button, onSuccess ) {
		
			var trans = '';
			
			if( button != null )  {
				button.disabled = true;
				parameters[ 'button' ] = button.id;
			}
				
			new Ajax.Request( url, {
					method: 'post',
					parameters: parameters,
					requestHeaders: { Accept: 'application/json' },
					onSuccess: function( transport ) {
						var json = transport.responseText.evalJSON( true );
						
						if( json[ 'signal' ] == 'ERROR' ) {
							
							if( json[ 'link' ] && $( json[ 'link' ] ) ) {
								$( json[ 'link' ] ).style.color = '#CC0000';
								
								window.scrollTo( 0, $( json[ 'link' ] ).offsetTop + 150 );
								
							}
							
							alf_msg( json[ 'msg' ] );
							
						} else if( json[ 'signal' ] == 'OK' ) {
							
							if( onSuccess != null ) {
								onSuccess( json );	
							}
								
						} else if( json[ 'signal' ] == 'LOGIN FAIL' ) {
						
							alf_msg( 'Bitte loggen Sie sich neu ein. Die SESSION ist abgelaufen.' );
							if( login_url != undefined ) {
								location = login_url;
							}
						
						} else {
							
							alf_msg( 'Interner Fehler: JSON liefert keine verwertbare Antwort' );
							
						}
						
						if( json[ 'button' ] != null && $( json[ 'button' ] ) != undefined ) 
							$( json[ 'button' ] ).disabled = false;
								
					}
				} );
				
		}
		
		//////// Roundabout
		
		/////// MSG BOX
		
		function alf_msg( msg ) {
			$( 'alf_msg' ).innerHTML = msg;
			$( 'alf_blackbox' ).style.display = '';
			$( 'alf_msg_box' ).style.display = '';
		}
		
		function alf_msg_hide() {
			$( 'alf_blackbox' ).style.display = 'none';
			$( 'alf_msg_box' ).style.display = 'none';
		}
		
	////////// new

	function alf_display_image( url ) {
	
		var img = new Image();
		alf_loading();
		
			$('light_content').innerHTML = '<img onClick="alf_light_close()" style="cursor:pointer;  border:1px solid #000000;" src="' + url + '" id="light_image" onLoad="alf_light()" onError="alf_loading_hide(); alert(\'Bild nicht verf&uuml;gbar\')" />';
		/*img.src = url;
		
		img.onload = function() {
			alf_loading_stop();
			$('light_content').innerHTML = '<img onClick="alf_light_close()" style="cursor:pointer;  border:1px solid #000000;" src="' + url + '" id="light_image" />';
			alf_light();
		}
		
		img.onerror = function() {
			alf_loading_stop();
			alert('Bild nicht verf&uuml;gbar.');
		}*/
		
	}
	
	function alf_loading() {
		alf_blackbox();
		$('alf_loading').style.display='';
	}
	
	function alf_loading_hide() {
		alf_blackbox_hide();
		$('alf_loading').style.display='none';
	}
	
	function alf_blackbox() {
		$('alf_blackbox').style.opacity = '0.5';
		$('alf_blackbox').style.filter = 'alpha(opacity=50)';
		$('alf_blackbox').style.display = '';
	}
	
	function alf_blackbox_hide() {
		$('alf_blackbox').style.display = 'none';
	}

	function alf_light() {
	
		alf_loading_hide();
		alf_blackbox();
		$('light_center').style.display = '';
		
		$('alf_lightbox').style.display = 'none';
		$('alf_lightbox').style.opacity = '1';
		$('alf_lightbox').style.filter = 'alpha(opacity=100)';
		
		$('alf_lightbox').style.left = '-' + ( $('alf_lightbox').getWidth() / 2 ) + 'px';
		$('alf_lightbox').style.top = '-' + ( $('alf_lightbox').getHeight() / 2 ) + 'px';
		//$('light_header').style.height = '0px';
		
		Effect.Grow('alf_lightbox');
		setTimeout( 'alf_show_light_header()', 1000 );
		setTimeout( 'alf_show_light_content()', 2000 );

	}
	
	function alf_show_light_content() {
		new Effect.Opacity('light_content', { from: 0, to: 1 });
	}
	
	function alf_show_light_header() {
		new Effect.Opacity('light_header', { from: 0, to: 1 });
	}
	
	function alf_light_close() {
	
		new Effect.Opacity('light_header', { from: 1, to: 0 });
		new Effect.Opacity('light_content', { from: 1, to: 0 });
		new Effect.Opacity('alf_lightbox', { from: 1, to: 0 });
		new Effect.Opacity('alf_blackbox', { from: 0.5, to: 0 });
		setTimeout( "$('alf_blackbox').style.display='none'", 1000 );
		setTimeout( "$('light_center').style.display='none'", 1000 );
	
	}
