function SelectedTranslatorsRefreshAjax( mode , uid ) {
	$.ajax(
		{
			type: "POST",
			cache: false,
			data: (
				{
					inajax : 1,
					ajaxevent : mode,
					user_id : uid
				}
			),
			success: function(ret) {
				data = eval( ret );
				SelectedTranslatorsRefreshTable( data );
			}
		}
	);
}

function SelectedTranslatorGroupNameFocus( id ) {
	if ($("#"+id).val()==aJSLangDefs.Translator_group_name) {
		$("#"+id).val( "" );
		$("#"+id).css( "color" , "black" );
	}
}

function SelectedTranslatorGroupNameBlur( id ) {
	if ($("#"+id).val()=="") {
		$("#"+id).val( aJSLangDefs.Translator_group_name );
		$("#"+id).css( "color" , "#808080" );
	}
}

function SelectedTranslatorsAddTranslator( id ) {
	SelectedTranslatorsRefreshAjax( "add_selected_user" , id );
}

function SelectedTranslatorsDeleteTranslator( id ) {
	SelectedTranslatorsRefreshAjax( "del_selected_user" , id );
}

function SelectedTranslatorsRefreshTable( data ) {
	if (typeof RefreshJobRecipients == "function") {
		RefreshJobRecipients( "offer_recipients" );
	}
}

function SelectedTranslatorsClickDeleteTranslator( id ) {
	// delete user from selection if exists
	if (typeof UserNameTagDeleteUserByMap == "function") {
		UserNameTagDeleteUserByMap( id );
	}
	SelectedTranslatorsDeleteTranslator( id );
}

function SelectedTranslatorsChanged( ) {
	// TODO szurkiteni a torles es egyeb gombokat
}

function STLoad() {
	var t = $("#translator_groups").val()[0];
	$("#translator_group_name").val( $("#translator_groups :selected").text() );
	$.ajax(
		{
			type: "POST",
			cache: false,
			data: (
				{
					inajax : 1,
					ajaxevent : "load_translators",
					template_id : t
				}
			),
			success: function(ret) {
				data = eval( ret );
			}
		}
	);
}

function STDelete() {
	if (!window.confirm( aJSLangDefs.confirm_Delete_translator_group )) return;
	var t = $("#translator_groups").val()[0];
	$("#translator_group_name").val( $("#translator_groups :selected").text() );
	$.ajax(
		{
			type: "POST",
			cache: false,
			data: (
				{
					inajax : 1,
					ajaxevent : "del_translators",
					template_id : t
				}
			),
			success: function(ret) {
				data = eval( ret );
			}
		}
	);
}

function STSave() {
	if ( $("#translator_group_name").val().length == 0 ) {
		alert( aJSLangDefs.No_group_name_given );
		return;
	}
	$.ajax(
		{
			type: "POST",
			cache: false,
			data: (
				{
					inajax : 1,
					ajaxevent : "save_translators",
					template_name : $("#translator_group_name").val()
				}
			),
			success: function(ret) {
				data = eval( ret );
			}
		}
	);
}
