jQuery.fn.extend({
	serialize: function() {
		return arguments[0]?this.formObject():jQuery.param(this.serializeArray());
	},
	formObject: function () {
		var rs = {};
		this.map(function(){
			return this.elements ? jQuery.makeArray(this.elements) : this;
		})
		.filter(function(){
			return this.name && !this.disabled &&
				(this.checked || /select|textarea/i.test(this.nodeName) ||
					/text|hidden|password|search/i.test(this.type));
		})
		.each(function(i, elem){
			eval("var obj = {'"+elem.name+"':jQuery(this).val()};");
			rs = $.extend(rs, obj);
		});
		return rs;
	},
	anchor: function () {
		var a = [], h;
		if(this.length === 1){
			this.find('a').each(function(i,e){
				h = $(e).attr('href');
				if(h){
					a.push(h.substring((h.indexOf('#')+1), h.length));
				}
			});
		}
		return a;
	},
	ghostTo: function() {
		var dest = arguments[0];
		var callback = arguments[1];
		var pos = {
			width:$(this).width(),
			height:$(this).height()
		};
		var offset = $(this).offset();
		$(dest).each(function(i, elem){
			var posD = {
				width:$(elem).width(),
				height:$(elem).height()
			};
			var offsetD = $(elem).offset();
			$('<div></div>').addClass('ghostTo').css({
				position:'absolute',
				width:pos.width+'px',
				height:pos.height+'px',
				top:Math.round(offset.top)+'px',
				left:Math.round(offset.left)+'px'
			}).animate({
				width:posD.width+'px',
				height:posD.height+'px',
				top:Math.round(offsetD.top)+'px',
				left:Math.round(offsetD.left)+'px',
				opacity:0.1
			}, 1500, function(){
				$(this).remove();
				if(jQuery.isFunction(callback)){
					callback.apply(null);
				}
			}).appendTo('body');
		});
		return this;
	}
});
