// JavaScript Document
Array.implement({
	equalTo: function(arr){
		for(var i in this){
			if(typeof this[i] === 'object' && this[i]['name'] !== 'array'){
				if(!this[i].equalTo(arr[i])){
					return false;
				}
			} else {
				if(this[i] !== arr[i]){
					return false;
				}
			}
		}
		return true;
	}/*,
	ids:function(){
		for(i=0;i<this.length;i++){
			this[i] = this[i].rem('dbid');
		}
		return this;
	}
	*/
});

String.implement({
	rem:function(str){
		return this.replace(str,'');
	},
	nl2br:function(){
		return this.replace(new RegExp("\\n", "gi"), '<br />');
	},
	br2nl:function(){
		var str = this;
		str = str.replace(new RegExp("\\n", "gi"), '');
		str = str.replace(new RegExp("&amp;", "gi"), '&');
		str = str.replace(new RegExp("<br>", "gi"), '\n');
		str = str.replace(new RegExp("<br />", "gi"), '\n');
		return str;
	},
	stripPath:function(){
		var s = this.split('/');
		return s[s.length-1];
	},
	encodeAmp:function(){
		return this.replace(new RegExp("&", "gi"), '&amp;');
	},
	decodeAmp:function(){
		return this.replace(new RegExp("&amp;", "gi"), '&');
	},
	urlEncodeAmp:function(){
		return this.replace(new RegExp("&", "gi"), '%26');
	}
});
