
// ***
// *** Array-Funktionen
// ***

function arrayContains( theArray, theValue ) {
	for( j=0; j<theArray.length; j++ ) {
		if( theArray[j] == theValue ) return true;
	}
	return false;
}

function arrayFindPosition( theArray, theValue ) {
	for( j=0; j<theArray.length; j++ ) {
		if( theArray[j] == theValue ) return j;
	}
	// alert( "arrayFindPosition - Fehler:\nDas Array enthält den gesuchten Wert nicht." );
	return -1;
}

function arrayAdd( theArray, theValue ) {
	if( !arrayContains( theArray, theValue )) {
		theArray[theArray.length] = theValue;
	}
}

function arrayRemove( theArray, theValue ) {
	if( arrayContains( theArray, theValue )) {
		for( j=arrayFindPosition( theArray, theValue ); j<theArray.length-1; j++ ) {
			theArray[j] = theArray[j+1];
		}
		theArray.length--;
	}
}

