/*******************************
*   DATA theme functions
********************************/

if ('undefined' == typeof Array.prototype.inArray) {
	Array.prototype.inArray = function (value)
	{
	    var i;
	    for (i=0; i < this.length; i++) {
	        // Matches identical (===), not just similar (==).
	        if (this[i] === value) {
	            return true;
	        }
	    }
	    return false;
	};
}
if ('undefined' == typeof String.prototype.trim) {
  String.prototype.trim = function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  }
}
if ('undefined' == typeof String.prototype.ltrim) {
  String.prototype.ltrim = function() {
    return this.replace(/^\s+/, '');
  }
}
if ('undefined' == typeof String.prototype.rtrim) {
  String.prototype.rtrim = function() {
    return this.replace(/\s+$/, '');
  }
}

if ('undefined' == typeof String.prototype.nl2br) {
  String.prototype.nl2br = function() {
	return this.replace(/\n/gim, "<br />" );
  }
}
if ('undefined' == typeof String.prototype.escape_amp) {
  String.prototype.escape_amp = function() {
	return this.replace(/&/gim, "%26" );
  }
}
if ('undefined' == typeof String.prototype.escape_tags) {
  String.prototype.escape_tags = function() {
	return this.replace(/</gim, "&lt;" ).replace(/>/gim, "&gt;" );
  }
}
if ('undefined' == typeof String.prototype.escape_quotes) {
  String.prototype.escape_quotes = function() {
	return this.replace(/"/gim, "&quot;" );
  }
}

