/*
 * JQLink show external links like Wikipedia
 * @author SeViR
 * @param u required is the own url for detect external links
 * @param o no-required bool, if is true, all external links open in other window, else none
 * @usage  $(object).jqlink("http://www.mydomain.com/miurl"); or $(object).jqlink("http://www.mydomain.com/miurl",true);
 */
 
$.fn.jqlink = function(u,o){
	return this.each(function(){
		new $.jqlink(this, u, o);
	});
}

$.jqlink = function(obj,u,o){
	externalimg = "images/external.png"
	if (typeof(o) == "boolean"){
		if (o){
			$("a",obj).each(function(){
				if (this.href.indexOf(u) < 0){
					this.setAttribute("target","_blank");
				}
			});
		}
	}
	$("a",obj).each(function(){
		if (this.href.indexOf(u) < 0){
			$(this).css({"background":"url("+externalimg+") center right no-repeat","padding-right":"13px"});
		}
	});
}