var UserNameTag_closedHeight = "18px";
var UserNameTag_openedHeight = "50px";
var UserNameTag_openingTime = 500;
var UserNameTag_closingTime = 500;
var UserNameTag_fastClosingTime = 250;
var UserNameTag_tooltipTime = 1000;

function MouseOverNameTag( id ) {
	o = $("#" + id );
	if (!o.data( "done" )) o.stop();
	o.data( "done" , 0 );
	o.animate(
		{ height: UserNameTag_openedHeight } ,
		UserNameTag_openingTime ,
		function() { $("#"+id).data("done",1); }
	);
}

function MouseOutNameTag( id ) {
	o = $("#" + id );
	if (o.data("done")) {
		o.data( "done" , 0 ); 
		o.delay(
			UserNameTag_tooltipTime ).animate(
				{ height: UserNameTag_closedHeight },
				UserNameTag_closingTime,
				function() { $("#"+id).data("done",1); }
		);
	} else {
		o.data( "done" , 0 ); 
		o.stop().animate(
			{ height: UserNameTag_closedHeight } ,
			UserNameTag_fastClosingTime ,
			function () { $("#"+id).data( "done" , 1 ); }
		);
	}
}

function InitUserNameTag( id , userid , sel ) {
	o = $("#"+id);
	o.data( "done" , 1 );
	o.data( "userid" , userid );
	o.data( "sel" , sel );
	/*
	o.mouseenter( function() { MouseOverNameTag( id ); } );
	o.mouseleave( function() { MouseOutNameTag( id ); } );
	*/
	if (typeof( usernametagmap )=="undefined" ) usernametagmap = new Array();
	usernametagmap[userid]=id;
}

function UserNameTagAddUser( id ) {
	c = "#" + id;
	s = "#" + id + "_plusminus";
	if (typeof SelectedTranslatorsAddTranslator == "function" ) {
		SelectedTranslatorsAddTranslator( $(c).data("userid") );
	}
	$(s).html( aJSLangDefs.usernametag_del );
	$(c).data("sel",1);
}

function UserNameTagDeleteUser( id ) {
	c = "#" + id;
	s = "#" + id + "_plusminus";
	if (typeof SelectedTranslatorsDeleteTranslator == "function" ) {
		SelectedTranslatorsDeleteTranslator( $(c).data( "userid" ) );
	}
	$(s).html( aJSLangDefs.usernametag_add );
	$(c).data("sel",0);
}

function UserNameTagToggleAddDel( id ) {
	s = "#" + id;
	if ($(s).data("sel"))
		UserNameTagDeleteUser( id );
	else
		UserNameTagAddUser( id );
}

function UserNameTagDeleteUserByMap( user_id ) {
	if (typeof( usernametagmap[user_id] )=="undefined") {
		if (typeof SelectedTranslatorsDeleteTranslator != "function" ) return;
		return;
	}
	UserNameTagDeleteUser( usernametagmap[user_id] );
}
