/* Some additional Javascript functions */

/* ******************************************************************************
The below just extends the native String object to add some much needed trim 
capability.
****************************************************************************** */
String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};

/* ******************************************************************************
An in_array() equivalent for PHP is nice!
Giving credit where credit is due, I got this function at 
http://blog.klimpong.de/archives/2005/06/phps_in_array_f.html
I wish his name was up there..... :-( ...... Oh well....
****************************************************************************** */
function js_in_array(the_needle, the_haystack)
	{
        var the_hay = the_haystack.toString();
        if(the_hay == '')
		{ return false; }
        var the_pattern = new RegExp(the_needle, 'g');
        var matched = the_pattern.test(the_haystack);
        return matched;
    	}
/* **************************************************************************** */
