(function($) {
	$.extend({
		// Konsolen-Log
		clog: function(str) {
			if (window.console) console.log(str); else alert(str);
		},
		
		// String in UTF-8 encoden
		utf_encode: function (s) {
			for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
				s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
			);
			return s.join("");
		},
		
		// String in UTF-8 decoden
		utf_decode: function (s) {
			for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
				((a = s[i][c](0)) & 0x80) &&
				(s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
				o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
			);
			return s.join("");
		},
		
		// Alle GET-Variablen in ein Objekt speichern
		getUrlVars: function(){
			var vars = [], hash;
			var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
			for(var i = 0; i < hashes.length; i++)
			{
			  hash = hashes[i].split('=');
			  vars.push(hash[0]);
			  vars[hash[0]] = hash[1];
			}
			return vars;
		},
		
		// Bestimmte GET-Variable in ein Objekt speichern
		getUrlVar: function(name){
			return $.getUrlVars()[name];
		}
	});
})(jQuery);
