// check if a value is inside an array
// andr3a [ 25 / 03 / 2004 ]
// returns position of value or -1 if not found
Array.prototype.in_array = function( what )
{
	for( var a = 0; a < this.length; a++ )
	{
		if( this[a] == what )
		{
			return a;
		}
		else if( this[a] instanceof Array )
		{
			return this[a].in_array( what );
		}
	}

	return -1;
}


/**
 * String.prototype.removeCharsFromSide = function( strCharsToRemove, strSide )
 *
 * @author      mdi(at)silversolutions(dot)de
 * @version     1.0
 *
 * removes a string (if existing) from either left or right (default) side of
 * the string the method is applied to
 *
 * example:
 * var myString = "Test this!!!";
 * myString.removeCharsFromSide( '!!', 'right' );
 * > myString is now "Test this!"
 */
String.prototype.removeCharsFromSide = function( strCharsToRemove, strSide )
{
	var strResult;

	if ( strSide == "left" )
	{
		if ( this.substr( 0, strCharsToRemove.length ) == strCharsToRemove )
		{
			strResult = this.substr( strCharsToRemove.length - 1, this.length - strCharsToRemove.length );
		}
		else
		{
			strResult = this;
		}
	}
	else
	{
		if ( this.substr( this.length - strCharsToRemove.length, strCharsToRemove.length ) == strCharsToRemove )
		{
			strResult = this.substr( 0, this.length - strCharsToRemove.length );
		}
		else
		{
			strResult = this;
		}
	}

	return strResult;
}