$.extend($.expr[':'], {
	extLink: function(a) {
		a = $(a);
		if(a.is('A:not(.a_notExtLink)')) {
			var href = a.attr('href');
			var localHost = document.location.host;
			
			var reg = eval('/^' + document.location.protocol + '\\/\\/' + (document.location.host.replace(/\./gi,'\\.')) + '/');
			
			return /^\w+:\/\//.test(href) && !reg.test(href);
		}
		else {
			return false;
		}
	}
});

$.extend($.expr[':'], {
	linked: function(a) {
		if((/.*:linked\([^\s]+\)(\s.*|$)/).test(a.className)) {
			return true;
		}
		return false;
	}
});

$.extend($.expr[':'], {
	formFields : function(DOMObject) {
		if( (/textarea|select/i.test(DOMObject.nodeName))
			|| (/input/i.test(DOMObject.nodeName)
					&& /text|checkbox|radio/i.test(DOMObject.type)
				)
			) {
			return true;
		}
		else {
			return false;
		}
	}
});

$.fn.getLinkedArgs = function() {
	var $this = $(this);
	var args= '';
	
	if($this.length != 1 || !$this.is(':linked')) {
		return false;
	}
	
	$this.each(function(){
		$this = $this;
		args = this.className.replace(/.*:linked\(([^\s]+)\)(\s.*|$)/,'$1');
		args = args.split('|');
	});
	
	return args;
};

$.fn.setLinked = function(args) {
	var $this = $(this);
	
	if(args.constructor == Array) {
		args = args.join('|');
	}
	
	if(args.constructor == String) {
		$this.each(function(){
			var $o = $(this);
			if(!$o.is(':linked')) {
				$o.addClass(':linked(' + args + ')');
			}
		});
	}
	
	return $this;
};

$.fn.getLinked = function() {
	var $this = $(this);
	var $linked = [];
	
	if($this.length != 1 || !$this.is(':linked')) {
		return false;
	}
	
	$this.each(function(){
		$this = $this;
		$linked = $($this.getLinkedArgs()[0]);
	});
	
	return $linked;
};