$(document).ready(function(){

    $("a[href*=/users/]").each(function (i) {

        var link = this.href;

        var rlink = link.replace(/\/[0-9]/, "");

        if (rlink != link){ return; }

        var user_login = "";

        user_login = link.replace(/http:\/\//, "");
        user_login = user_login.replace(window.location.host, "");
        user_login = user_login.replace(/www./, "");
        user_login = user_login.replace(/\/users\//, "");
        var pos = user_login.indexOf("/");
        var pos1 = user_login.indexOf(".");
        if (pos == -1 && pos1 == -1) { 
        	this.rel = "/plugins/p_usertip/loader.php?login="+user_login;
        	var cls = this.getAttribute('class');
        	this.setAttribute("class", cls+" utip");
        	if (this.innerHTML.indexOf('img') <= 0){
        		this.setAttribute("title", this.innerHTML);
        	}
        }
    });

    $('a[class*=utip]').cluetip({sticky: false, closePosition: 'title', closeText:'X'});

})

