var kuehne = {};

String.prototype.translate = function (params) {
    if (kuehne.l18n && kuehne.l18n[this]) {
		var str = kuehne.l18n[this], re;
		if (params) {
			for (param in params) {
                re = new RegExp('%' + param + '%', 'g');
                str = str.replace(re, params[param]);
            }
        }
        return str;
    }
    else {
        return this;
    }
};

String.prototype.escapeHTML = function () {
	return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g, '&quot;');
};

String.prototype.unescapeHTML = function () {
	return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
};

if (typeof Array.indexOf == 'undefined') {
	Array.prototype.indexOf = function (v) {
		var idx = -1;
		jQuery(this).each (
            function (i, n) {
                if (n == val && idx == -1) {
                    idx = i;
                }
            }
        );
        return idx;
	};
}