function openTip(tip_obj) { 
	var posx   = 0;
	var posy   = 0;
	var ewidth = 0;
	
	posx   = (findPosX(document.getElementById(tip_obj)) + 205);
	posy   = (findPosY(document.getElementById(tip_obj)) - 10);
	
	if(!document.getElementById("autocomp")) { 
		var autocomp = document.createElement("div");
			autocomp.setAttribute("id","autocomp");
			autocomp.className = "autocomp";
			
			autocomp.style.position = "absolute";
			
			/*if(getBrowserVer().indexOf("IE") != -1) {
				posx += 8; posy += 14;
			}*/
			
			autocomp.style.left  = posx +"px";
			autocomp.style.top   = posy +"px";
			
		document.body.appendChild(autocomp);
	} else {
		document.body.removeChild(document.getElementById("autocomp"));
		openTip(tip_obj);
	}
}

$(document).ready(function(){
	$("input[name=txidsp], input[name=txidup]").keyup(function(){
		var fieldchecked = "#spn_"+ $(this).attr("name");
		
		$(fieldchecked).fadeIn("slow").html("Loading...");
		if($(this).val() != "")
		{
			$.ajax({
				type: "POST",
				data: "n="+ $(this).val() +"&m="+ (($(this).attr("name") == "txidsp") ? 's' : 'u'),
				url: "checkname.php",
				success: function(rs){$(fieldchecked).html(rs);},
				error: function(rs){$(fieldchecked).html(rs);}
			});
		} else { $(fieldchecked).fadeOut("slow") };
	});
	$(".registration").find("input, select").each(function(){
		$(this).qtip({
			content: $(this).parent().find("span.comment").html(),
			position: {corner: {target: 'rightTop', tooltip: 'leftTop'}},
			show: {when: {event: 'focus'}},
			hide: {when: {event: 'blur'}},
			style: {border: {color: '#900'}, color: '#900'}
	    });
	});
	
	$("#txnama").bind("keyup", function(){
		$("#txatasnama").val($(this).val());
	});
});