jQuery.extend(String.prototype, {
	normalize:function() {
		var string = this;
		var source = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ";
		var target = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn";
		var letter = "";
		var result = "";
		var niddle = -1;
		var counter = 0;

		for (counter=0; counter<string.length; counter++) {
			letter = string.substring(counter, counter+1);
			niddle = source.indexOf(letter);
			result += (niddle == -1) ? letter : target.substring(niddle, niddle+1);
		}
		return result;
	},
	hiphenize:function() {
		return this.replace(/\s\s+/g, "-").replace(/\s+/g, "-");
	},
	onlywords:function() {
		return this.replace(/[^\s\w]/g, "");
	},
	ceouri:function() {
		return this.normalize().onlywords().hiphenize().toLowerCase();
	},
	strpad:function(len,pad,dir) {
		var o = this.toString();
		if (!pad) { pad = '0'; }
		if (!dir) { dir = 'LEFT'; }
		if (dir.toUpperCase() == 'LEFT') { while (o.length < len) { o = pad + o; } }
		if (dir.toUpperCase() == 'RIGHT') { while (o.length < len) { o = o + pad; } }
		return o;
	},
	strpos:function(needle, offset) {
		var i = this.indexOf(needle, (offset || 0));
		return i === -1 ? false : i;
	},
	strsplit:function(len) {
		if (len === null) { len = 1; }
		var o = this.toString();
		var chunks = [], pos = 0;
		while (pos < o.length) { chunks.push(o.slice(pos, pos+=len)); }
		return chunks;
	},
	strrev:function() {
		return this.split('').reverse().join('');
	},
	monefy:function(lendec, code, strdec, strtho) {
		/* Separate decimal part from integer */
		var couple = this.split('.');
		var integer = couple[0];
		var decimal = (couple.length == 2) ? couple[1] : '';
		/* Separate the thousand */
		var T = integer.strrev().strsplit(3), i;
		for (i=0; i<T.length; i++) { T[i] = T[i].strrev(); }
		/* Join all togheter*/
		lendec = !lendec ? 0 : lendec;
		code = !code ? '' : code.toUpperCase()+" ";
		strdec = !strdec ? '.' : strdec;
		strtho = !strtho ? ',' : strtho;
		decimals = (lendec == 0 && decimal == '') ? '' : '.'+decimal.substr(0,2).strpad(lendec,'0','RIGHT');
		/* Return the value */
		return code+T.reverse().join(strtho)+decimals;
	},
	extract:function(separator) {
		return (this.length == 0) ? [] : this.substr(1, this.length-2).split(separator);
	}
});
