	// ##########################################################################
	// CLASS - OBJECTS (SINGLE ROWS)
	// ##########################################################################
	function MatrixObject (display_name, field_name, values) 
	{
		// ------------------------------------------------------------------------
		this.display_name 	= display_name;
		this.field_name 		= field_name;
		this.values 				= values;
		// ------------------------------------------------------------------------
	}
	// ##########################################################################
	// CLASS - COLLECTION OF OBJECTS IN MATRIX
	// ##########################################################################
	function Matrix ( matrixObjects ) 
	{
		// ------------------------------------------------------------------------
		this.debug 						= "false";
		this.single_error_msg = "";
		this.multi_error_msg  = "";
		
		this.matrixObjects 		= matrixObjects;
		this.es_selected 			= new Array();
		// ------------------------------------------------------------------------
		// INITIALISATION
		// ------------------------------------------------------------------------
		this.init = function()
		{
			for ( var i = 0; i < this.matrixObjects.length; i++ ) 
			{
				field = document.getElementsByName(this.matrixObjects[i].field_name)[0];
				field_value = "";
				if ( typeof (field) != "undefined" ) 
				{
					field_value = field.value;
				}
				if ( field_value != "" ) 
				{
					for ( x = 0; x < this.matrixObjects[i].values.length; x++) 
					{
						if ( field_value == this.matrixObjects[i].values[x] ) 
						{
							this.es_selected[i] = x;
						}
					}
				}
			}
			this.checkSelection();
			// this.checkCells();
		}
		// ------------------------------------------------------------------------
		// SHOW MATRIX
		// ------------------------------------------------------------------------
		this.show = function ( ) 
		{
			for ( var i = 0; i < this.matrixObjects.length; i++) 
			{
				this_class = "cell_no_active";
				if ( i % 2 == 0 ) { this_class += "_0"; }
				else 							{ this_class += "_1"; }
				
				document.write("<tr>");
				document.write("<td class='" + this_class + "'>" + this.matrixObjects[i].display_name + "&nbsp;</td>");
				
				for ( x = 0; x < this.matrixObjects[i].values.length; x++) 
				{
					document.write("<td class='" + this_class + "' id='" + (i) + "_" + (x) + "' onClick='my_matrix.changeSelection(" + (i) + "," + (x) + "); this.focus();' nowrap>&nbsp;</td>");
				}
				document.write("</tr>");
			}
		}
		// ------------------------------------------------------------------------
		// CHANGE SELECTION
		// ------------------------------------------------------------------------
		this.changeSelection = function ( row, col ) 
		{
			for ( var i = 0; i < this.matrixObjects.length; i++ ) 
			{
				if ( row == i ) 
				{
					store_field = document.getElementsByName(this.matrixObjects[i].field_name)[0];
					if ( store_field.disabled == false ) 
					{
						this.es_selected[row] = col;
						this.checkSelection();
						// this.checkCells();
					}
				}
			}
		}
		// ------------------------------------------------------------------------
		// CHECK ALL SELECTIONS
		// ------------------------------------------------------------------------
		this.checkSelection = function ( ) 
		{
			//alert("checkSelection started ...");
			for ( var i = 0; i < this.matrixObjects.length; i++ ) 
			{
				this_class = "cell_no_active";
				if ( i % 2 == 0 ) { this_class += "_0"; }
				else 							{ this_class += "_1"; }
				
				for ( var x = 0; x < this.matrixObjects[i].values.length; x++ ) 
				{
					//alert("Koordinaten: " + i + "/" + x);
					obj = document.getElementById(i + "_" + x);
					if ( typeof ( this.es_selected[i]) != "undefined" && this.es_selected[i] == x )
					{
						// change style
						if ( typeof (obj) != "undefined" ) 
						{
							obj.className = "matrix cell_active";
						}
						// set value to input field
						store_field = document.getElementsByName(this.matrixObjects[i].field_name)[0];
						if ( typeof (store_field) != "undefined" ) 
						{
							store_field.value = this.matrixObjects[i].values[x];
						}
						else
						{
							if ( this.debug == "true" ) 
							{
								alert("DEBUG: Datenfeld mit der Bezeichnung \"" + this.matrixObjects[i].field_name + "\" ist nicht vorhanden.");
							}
						}
					}
					else 
					{
						if ( typeof (obj) != "undefined" ) 
						{
							obj.className = "matrix " + this_class + "";
						}
					}
				}				
			}
		}
		// ------------------------------------------------------------------------
		// CHECK EMPTY FIELDS 
		// ------------------------------------------------------------------------
		this.checkCells = function() 
		{
			var errors = new Array();
			
			for ( var i = 0; i < this.matrixObjects.length; i++ ) 
			{	
				if ( typeof (this.es_selected[i]) == "undefined" || String(this.es_selected[i]) == "" ) 
				{
					errors[errors.length] = this.matrixObjects[i].display_name; 
				}
			}
			
			if ( errors.length == 0 ) 
			{
				fraboFormObj.changeFraboIcon('food_icon', 1);
				//document.getElementById('matrix_text').innerHTML = "&nbsp;";
				return true;
			}
			else if ( errors.length == 1 ) 
			{
				fraboFormObj.changeFraboIcon('food_icon', 0);
				//document.getElementById('matrix_text').innerHTML = String.sprintf(this.single_error_msg, errors[0]);
				return false;
			}
			else if ( errors.length > 1 ) 
			{
				errors_string = "";
				for ( var i = 0; i < errors.length; i++ )
				{
					if ( i > 0 && i != (errors.length - 1) ) { errors_string += ", "; }
					if ( i > 0 && i == (errors.length - 1) ) { errors_string += " und "; }
					errors_string += errors[i];
				}
				fraboFormObj.changeFraboIcon('food_icon', 0);
				//document.getElementById('matrix_text').innerHTML = String.sprintf(this.multi_error_msg, errors_string);
				return false;
			}
		}
		// ------------------------------------------------------------------------
	}
	// ##########################################################################
