jQuery.JSON = {
	useHasOwn : ({}.hasOwnProperty ? true : false),
	pad : function(n) {
		return n < 10 ? "0" + n : n;
	},
	m : {
		"\b": '\\b',
		"\t": '\\t',
		"\n": '\\n',
		"\f": '\\f',
		"\r": '\\r',
		'"' : '\\"',
		"\\": '\\\\'
	},
	encodeString : function(s){
		if (/["\\\x00-\x1f]/.test(s)) {
			return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
				var c = m[b];
				if(c){
					return c;
				}
				c = b.charCodeAt();
				return "\\u00" +
				Math.floor(c / 16).toString(16) +
				(c % 16).toString(16);
			}) + '"';
		}
		return '"' + s + '"';
	},
	encodeArray : function(o){
		var a = ["["], b, i, l = o.length, v;
		for (i = 0; i < l; i += 1) {
			v = o[i];
			switch (typeof v) {
				case "undefined":
				case "function":
				case "unknown":
					break;
				default:
					if (b) {
						a.push(',');
					}
					a.push(v === null ? "null" : this.encode(v));
					b = true;
			}
		}
		a.push("]");
		return a.join("");
	},
	encodeDate : function(o){
		return '"' + o.getFullYear() + "-" +
		pad(o.getMonth() + 1) + "-" +
		pad(o.getDate()) + "T" +
		pad(o.getHours()) + ":" +
		pad(o.getMinutes()) + ":" +
		pad(o.getSeconds()) + '"';
	},
	encode : function(o){
		if(typeof o == "undefined" || o === null){
			return "null";
		}else if(o instanceof Array){
			return this.encodeArray(o);
		}else if(o instanceof Date){
			return this.encodeDate(o);
		}else if(typeof o == "string"){
			return this.encodeString(o);
		}else if(typeof o == "number"){
			return isFinite(o) ? String(o) : "null";
		}else if(typeof o == "boolean"){
			return String(o);
		}else {
			var self = this;
			var a = ["{"], b, i, v;
			for (i in o) {
				if(!this.useHasOwn || o.hasOwnProperty(i)) {
					v = o[i];
					switch (typeof v) {
						case "undefined":
						case "function":
						case "unknown":
							break;
						default:
							if(b){
								a.push(',');
							}
							a.push(self.encode(i), ":",
								v === null ? "null" : self.encode(v));
							b = true;
					}
				}
			}
			a.push("}");
			return a.join("");
		}
	},
	decode : function(json){
		return eval("(" + json + ')');
	}
};

(function($) {
	if ($.browser.mozilla) {
		$.fn.disableTextSelect = function() {
			return this.each(function() {
				$(this).css({
					'MozUserSelect' : 'none'
				});
			});
		};
		$.fn.enableTextSelect = function() {
			return this.each(function() {
				$(this).css({
					'MozUserSelect' : ''
				});
			});
		};
	} else if ($.browser.msie) {
		$.fn.disableTextSelect = function() {
			return this.each(function() {
				$(this).bind('selectstart.disableTextSelect', function() {
					return false;
				});
			});
		};
		$.fn.enableTextSelect = function() {
			return this.each(function() {
				$(this).unbind('selectstart.disableTextSelect');
			});
		};
	} else {
		$.fn.disableTextSelect = function() {
			return this.each(function() {
				$(this).bind('mousedown.disableTextSelect', function() {
					return false;
				});
			});
		};
		$.fn.enableTextSelect = function() {
			return this.each(function() {
				$(this).unbind('mousedown.disableTextSelect');
			});
		};
	}
})(jQuery);

/*
window.log = function(){
	log.history = log.history || [];
	log.history.push(arguments);
	if(this.console){
		console.log( Array.prototype.slice.call(arguments) );
	}
};

(function(doc){
	var write = doc.write;
	doc.write = function(q){
		log('document.write(): ',arguments);
		if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);
	};
})(document);
*/

jQuery.extend(jQuery.easing, {
	def: 'easeInOutCubic',
	swing: function (x, t, b, c, d) {
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
});

