/**
*
*  WebToolKit URL encode / decode component
*  Compiled by Justas Vinevicius <justas.vinevicius(at)gmail.com>
*  Original code by Tyler Akins <fidian(at)rumkin.com>
*
*  Dependencies:
*  WebToolKit.utf8 (UTF-8 encode / decode) component for correct UTF-8 handling
*
*  Homepage:
*  http://www.webtoolkit.info/
*
**/

if (typeof(WebToolKit) == "undefined") {
	var WebToolKit = {};
};

WebToolKit.url = {

	encode : function (string) {
		if (typeof(String.prototype.utf8encode) != "undefined") {
			return escape(string.utf8encode());
		} else {
			return escape(string);
		}
	},

	decode : function (string) {
		if (typeof(String.prototype.utf8decode) !== "undefined") {
			return unescape(string).utf8decode();
		} else {
			return unescape(string);
		}
	}

};

if (typeof(String.prototype.urlencode) == "undefined") {
	String.prototype.urlencode = function () {
		return WebToolKit.url.encode(this);
	};
};

if (typeof(String.prototype.urldecode) == "undefined") {
	String.prototype.urldecode = function () {
		return WebToolKit.url.decode(this);
	};
};

