class GMWnd extends UICommonAPI;

// Sets Timer Value
//const TIMER_ID=777; 
//const TIMER_DELAY=1000; 


const DIALOGID_Recall = 0;
const DIALOGID_SendHome = 1;

var private Color m_WhiteColor;
var private EditBoxHandle m_hEditBox;
var private WindowHandle m_hGMwnd;
var private WindowHandle m_hGMDetailStatusWnd;
var private WindowHandle m_hGMInventoryWnd;
var private WindowHandle m_hGMMagicSkillWnd;
var private WindowHandle m_hGMQuestWnd;
var private WindowHandle m_hGMWarehouseWnd;
var private WindowHandle m_hGMClanWnd;
//diff_elsacred_s
var private WindowHandle m_hGMFindTreeWnd;
var private WindowHandle m_dialogWnd;
var private ComboBoxHandle m_hCbClassName;
var private ComboBoxHandle Race_ComboBox;
var private ComboBoxHandle Sex_ComboBox;
//diff_elsacred_e
var private int m_targetID;
var private int m_TargetClass;

private function InitHandle()
{
	m_hGMwnd = GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath);
	m_hEditBox = GetEditBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".EditBox");
	m_hGMDetailStatusWnd = GetWindowHandle("GMDetailStatusWnd");
	m_hGMInventoryWnd = GetWindowHandle("GMInventoryWnd");
	m_hGMMagicSkillWnd = GetWindowHandle("GMMagicSkillWnd");
	m_hGMQuestWnd = GetWindowHandle("GMQuestWnd");
	m_hGMWarehouseWnd = GetWindowHandle("GMWarehouseWnd");
	m_hGMClanWnd = GetWindowHandle("GMClanWnd");

//diff_elsacred_s
	m_hGMFindTreeWnd = GetWindowHandle("GMFindTreeWnd");
	m_dialogWnd = GetWindowHandle("DialogBox"); //ґЩАМѕу·О±Ч ЗЪµй №ЮѕЖїА±в
//diff_elsacred_e
	m_hCbClassName = GetComboBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".cbClassName");
	InitRaceCombobox();
	InitSexCombobox();
}

private function InitRaceCombobox()
{
	Race_ComboBox = GetComboBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".Race_ComboBox");
	Race_ComboBox.AddStringWithReserved(GetSystemString(2705) @ GetSystemString(175) @ "(0)", 0);
	Race_ComboBox.AddStringWithReserved(GetSystemString(2705) @ GetSystemString(176) @ "(10)", 10);
	Race_ComboBox.AddStringWithReserved(GetSystemString(171) @ GetSystemString(175) @ "(18)", 18);
	Race_ComboBox.AddStringWithReserved(GetSystemString(171) @ GetSystemString(176) @ "(25)", 25);
	Race_ComboBox.AddStringWithReserved(GetSystemString(172) @ GetSystemString(175) @ "(31)", 31);
	Race_ComboBox.AddStringWithReserved(GetSystemString(172) @ GetSystemString(176) @ "(38)", 38);
	Race_ComboBox.AddStringWithReserved(GetSystemString(173) @ GetSystemString(175) @ "(44)", 44);
	Race_ComboBox.AddStringWithReserved(GetSystemString(173) @ GetSystemString(176) @ "(49)", 49);
	Race_ComboBox.AddStringWithReserved(GetSystemString(174) @ "(53)", 53);
	if(getInstanceUIData().getIsClassicServer())
	{
		Race_ComboBox.AddStringWithReserved(GetSystemString(1544) @ "(192)", 192);
		Race_ComboBox.AddStringWithReserved(GetSystemString(13536) @ "(208)", 208);
		Race_ComboBox.AddStringWithReserved("- 추가 직업 ----------------------", -1);
		Race_ComboBox.AddStringWithReserved(GetSystemString(13221) @ GetSystemString(2705) @ "(196)", 196);
		Race_ComboBox.AddStringWithReserved(GetSystemString(13221) @ GetSystemString(171) @ "(200)", 200);
		Race_ComboBox.AddStringWithReserved(GetSystemString(13221) @ GetSystemString(172) @ "(204)", 204);
		Race_ComboBox.AddStringWithReserved(GetSystemString(14043) @ "(217)", 217);
		Race_ComboBox.AddStringWithReserved(GetSystemString(282) @ GetSystemString(2705) @ GetSystemString(177) @ "(221)", 221);
		Race_ComboBox.AddStringWithReserved(GetSystemString(282) @ GetSystemString(172) @ GetSystemString(178) @ "(225)", 225);		
	}
	else
	{
		Race_ComboBox.AddStringWithReserved(GetSystemString(1561) @ "(123)", 123);
		Race_ComboBox.AddStringWithReserved(GetSystemString(1562) @ "(124)", 124);
		Race_ComboBox.AddStringWithReserved(GetSystemString(3273) @ GetSystemString(175) @ "(182)", 182);
		Race_ComboBox.AddStringWithReserved(GetSystemString(3273) @ GetSystemString(176) @ "(183)", 183);
		Race_ComboBox.AddStringWithReserved("- 추가 직업 ----------------------", -1);
		Race_ComboBox.AddStringWithReserved(GetSystemString(13221) @ "(212)", 212);
	}
}

private function InitSexCombobox()
{
	Sex_ComboBox = GetComboBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".Sex_ComboBox");
	Sex_ComboBox.SYS_AddStringWithReserved(177, 0);
	Sex_ComboBox.SYS_AddStringWithReserved(178, 1);
}

event OnRegisterEvent()
{
	RegisterEvent( EV_ShowGMWnd );
	RegisterEvent( EV_DialogOK );
	RegisterEvent( EV_DialogCancel );
	RegisterEvent( EV_TargetUpdate );
}

event OnLoad()
{
	SetClosingOnESC();
	InitHandle();

	m_WhiteColor.R = 220;
	m_WhiteColor.G = 220;
	m_WhiteColor.B = 220;
	m_WhiteColor.A = 255;
	m_targetID = 0;
}

event OnTick()
{
	local UserInfo uInfo;

	if(! GetUserInfo(m_targetID, uInfo))
	{
		m_hOwnerWnd.DisableTick();
		return;
	}
	if(m_TargetClass != uInfo.nSubClass)
	{
		m_TargetClass = uInfo.nSubClass;
		SetClassTypeComboBox();
		m_hOwnerWnd.DisableTick();
	}	
}

event OnComboBoxItemSelected(string strID, int IndexID)
{
	switch(strID)
	{
		case "Race_ComboBox":
			SetRace(IndexID);
			break;
		case "Sex_ComboBox":
			SetSex(IndexID);
			break;
		case "cbClassName":
			SetClass(IndexID);
			break;
		default:
			break;
	}	
}

event OnEvent(int a_EventID, String a_Param)
{
	switch(a_EventID)
	{
		case EV_ShowGMWnd:
			HandleShowGMWnd();
			break;
		case EV_DialogOK:
			HandleDialogOK();
			break;
		case EV_DialogCancel:
			HandleDialogCancel();
			break;
		case EV_TargetUpdate:
			HandleTargetUpdate();
			break;
	}
}

event OnHide()
{
	class'ChatWnd'.static.Inst()._HandleHideDevTool();
}

event OnShow()
{
	HandleTargetUpdate();
	checkVisibleLockButton();
	class'ChatWnd'.static.Inst()._HandleShowDevTool();
}

event OnClickButton(String a_ButtonID)
{
	switch(a_ButtonID)
	{
		case "MsgSearchButton":
			onClickMsgSearchButton();
			break;

		case "TeleButton":
			OnClickTeleButton();
			break;
		case "MoveButton":
			OnClickMoveButton();
			break;
		case "RecallButton":
			OnClickRecallButton();
			break;
		case "DetailStatusButton":
			OnClickDetailStatusButton();
			break;
		case "InventoryButton":
			OnClickInventoryButton();
			break;
		case "MagicSkillButton":
			OnClickMagicSkillButton();
			break;
		case "InfoButton":
			OnClickInfoButton();
			break;
		case "StoreButton":
			OnClickStoreButton();
			break;
		case "ClanButton":
			OnClickClanButton();
			break;
		case "PetitionButton":
			OnClickPetitionButton();
			break;
		case "SendHomeButton":
			OnClickSendHomeButton();
			break;
		case "NPCListButton":
			OnClickNPCListButton();
			break;
		case "ItemListButton":
			OnClickItemListButton();
			break;
		case "SkillListButton":
			OnClickSkillListButton();
			break;
		case "ForcePetitionButton":
			OnClickForcePetitionButton();
			break;
		case "ChangeServerButton":
			OnClickChangeServerButton();
			break;
		case "UIButton":
			OnClickUIButton();
			break;
		case "QuestListButton":
			OnClickQuestListButton();
			break;
		case "TargettingButton":
			OnClickTargetButton();
			break;
		case "ClassChangeButton":
			OnClickClassChangeButton();
			break;
		case "LockBtn" :
		case "UnLockBtn" :
			OnClickLockButton();
			break;

		case "questSearchToolButton" :
			LoadWindowClick("UIQuestToolWnd");
			break;

		case "bcToolBtn":
			LoadWindowClick("UICommandWnd");
			break;
		case "debugButton":
			toggleWindow("DebugWnd", true, false);
			break;
		case "builderCmdButton":
			LoadWindowClick("BuilderCmdWnd");
			break;
		case "yebisCmdButton":
			LoadWindowClick("YebisCmdWnd");
			break;
	}
}

private function SetClassTypeComboBox()
{
	local int classNameSysString;
	local int i;
	local array<int> EnableClassIndexList;
	local int len;
	local int classIndex;
	local userinfo targetInfo;
	local int myClassIndex;

	m_hCbClassName.Clear();
	if(! GetTargetInfo(TargetInfo))
	{
		return;
	}
	if(targetInfo.bNPC)
		return;

	class'UIDataManager'.static.GetEnableClassIndexList(targetInfo.Class, EnableClassIndexList);
	len=EnableClassIndexList.Length;

	// debug("Её°ЩАМё§:"$targetInfo.Name$", Е¬·ЎЅє:"$targetInfo.Class$", °ЎґЙ±жАМ:"$len);

	for(i=0; i<len; ++i)
	{
		classIndex=EnableClassIndexList[i];
		// debug("АОµ¦Ѕє:"$classIndex);
		classNameSysString=class'UIDataManager'.static.GetClassnameSysstringIndexByClassIndex(classIndex);
		m_hCbClassName.AddStringWithReserved(GetSystemString(classNameSysString) @ "(" $ string(classIndex) $ ")", classIndex);

		// Бц±Эј±ЕГµИ ѕЦАЗ Е¬·ЎЅєё¦ ДЮєё№ЪЅєїЎ ј±ЕГЗШБЦ±в А§ЗШј­ АОµ¦Ѕєё¦ АъАе
		if(targetInfo.nSubClass==classindex)
			myClassIndex=i;
	}

	// Бц±Э ј±ЕГµИ ѕЦАЗ Е¬·ЎЅєё¦ ДЮєё№ЪЅєїЎ ј±ЕГЗШБЭґПґЩ.
	m_hCbClassName.SetSelectedNum(myClassIndex);
}

function SetRace(int IndexID)
{
	if(m_targetID < 1)
	{
		return;
	}
	switch(Race_ComboBox.GetReserved(IndexID))
	{
		case 0:
			ExecuteCommand("//setparam race 0 0");
			break;
		case 10:
			ExecuteCommand("//setparam race 0 1");
			break;
		case 18:
			ExecuteCommand("//setparam race 1 0");
			break;
		case 25:
			ExecuteCommand("//setparam race 1 1");
			break;
		case 31:
			ExecuteCommand("//setparam race 2 0");
			break;
		case 38:
			ExecuteCommand("//setparam race 2 1");
			break;
		case 44:
			ExecuteCommand("//setparam race 3 0");
			break;
		case 49:
			ExecuteCommand("//setparam race 3 1");
			break;
		case 53:
			ExecuteCommand("//setparam race 4 0");
			break;
		case 192:
			ExecuteCommand("//setparam race 5 0");
		case 123:
			ExecuteCommand("//setparam race 5 0");
			break;
		case 124:
			ExecuteCommand("//setparam race 5 1");
			break;
			break;
		case 182:
			ExecuteCommand("//setparam race 6 0");
			break;
		case 183:
			ExecuteCommand("//setparam race 6 1");
			break;
		case 208:
			ExecuteCommand("//setparam race 30 1");
			break;
		case 196:
		case 212:
			ExecuteCommand("//setparam race 0 0");
			ExecuteCommand("//setparam sex 0");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
		case 200:
			ExecuteCommand("//setparam race 1 0");
			ExecuteCommand("//setparam sex 0");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
		case 204:
			ExecuteCommand("//setparam race 2 0");
			ExecuteCommand("//setparam sex 0");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
		case 217:
			ExecuteCommand("//setparam race 3 0");
			ExecuteCommand("//setparam sex 0");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
		case 221:
			ExecuteCommand("//setparam race 0 0");
			ExecuteCommand("//setparam sex 0");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
		case 225:
			ExecuteCommand("//setparam race 2 0");
			ExecuteCommand("//setparam sex 1");
			ExecuteCommand("//setclass" @ string(Race_ComboBox.GetReserved(IndexID)));
			getInstanceL2Util().showGfxScreenMessage("재시작이 필요 합니다.");
			break;
	}
	InvalidateClass();
}

private function SetSex(int IndexID)
{
	if(m_targetID < 1)
	{
		return;
	}
	ExecuteCommand("//setparam sex" @ string(Sex_ComboBox.GetReserved(IndexID)));
	InvalidateClass();
}

private function SetClass(int IndexID)
{
	local int classIndex;

	classIndex = m_hCbClassName.GetReserved(IndexID);
	if(classIndex >= 0)
	{
		ExecuteCommand("//setclass " @ string(classIndex));
	}
}

private function SetSelectTargetRaceComboBox()
{
	local UserInfo uInfo;
	local int j;

	if(! GetTargetInfo(uInfo))
	{
		return;
	}

	for(j = 0; j < Race_ComboBox.GetNumOfItems(); j++)
	{
		if(uInfo.Class == Race_ComboBox.GetReserved(j))
		{
			Race_ComboBox.SetSelectedNum(j);
			return;
		}
	}	
}

private function SetSelectTaargetSexComboBox()
{
	local UserInfo uInfo;

	if(! GetTargetInfo(uInfo))
	{
		return;
	}
	Sex_ComboBox.SetSelectedNum(uInfo.nSex);
}

private function InvalidateClass()
{
	local UserInfo uInfo;

	m_TargetClass = -1;
	if(! GetTargetInfo(uInfo))
	{
		return;
	}
	m_TargetClass = uInfo.nSubClass;
	m_hOwnerWnd.EnableTick();
}

private function HandleDialogOK()
{
	if(!DialogIsMine())
		return;

	switch(DialogGetID())
	{
		case DIALOGID_Recall:
			Recall();
			break;
		case DIALOGID_SendHome:
			SendHome();
			break;
	}
}

private function HandleDialogCancel()
{
	if(!DialogIsMine())
		return;
}

private function Recall()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
	{
		ExecuteCommand("//recall" @ EditBoxString);
	}	
}

private function SendHome()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
		ExecuteCommand("//sendhome" @ EditBoxString);
}

//Её°Щ Б¤єё ѕчµҐАМЖ® Гіё®	-- АФ·ВГўїЎ АМё§А» іЦѕоБЦ±в
private function HandleTargetUpdate()
{
	local int m_nowTargetID;
	local UserInfo info;

	if(! m_hOwnerWnd.IsShowWindow())
	{
		return;
	}
	//Её°ЩID ѕтѕоїА±в
	m_nowTargetID = class'UIDATA_TARGET'.static.GetTargetID();

	if(m_nowTargetID == m_TargetID) 	// ЗС№ш ЅєЖ®ёµА» ѕтѕоїВ АыАМ АЦАёёй ё®ЕП.
	{
		//m_TargetID = 0;	// АМАьАЗ Её°ЩѕЖАМµрё¦ ГК±вИ­
		return;
	}
	
	if (m_nowTargetID<1)	// ѕЖАМµр°Ў ѕшАёёй ±ЧіЙ ё®ЕП.
	{
		m_TargetID = 0;	// АМАьАЗ Её°ЩѕЖАМµрё¦ ГК±вИ­

		if(m_hEditBox.IsEnableWindow())	m_hEditBox.SetString("");
		return;
	}

	GetTargetInfo(info);	// ѕЖАМµр°Ў АЦА» °жїмїЎґВ Б¤єёё¦ ѕтѕоїВґЩ. 

	if((m_nowTargetID>0 ) && (info.bNpc == false))	//NPCАП°жїмїЎґВ јВЖГЗШБЦБц ѕКґВґЩ. 
	{
		if(m_hEditBox.IsEnableWindow())
			m_hEditBox.SetString(info.Name);
	}

	m_TargetID = m_nowTargetID;	// АМАьАЗ Её°ЩѕЖАМµрё¦ АъАеЗШµРґЩ. 	
	SetSelectTargetRaceComboBox();
	SetSelectTaargetSexComboBox();
	SetClassTypeComboBox();
}

private function HandleShowGMWnd()
{
	if(m_hOwnerWnd.IsShowWindow())
		m_hOwnerWnd.HideWindow();
	else
	{
		m_hOwnerWnd.ShowWindow();
		m_hGMwnd.SetFocus(); // єёАП¶§ ЖчДїЅєё¦ GMГўїЎ ёВГдґПґЩ.
		//class'UIAPI_WINDOW'.static.SetFocus(m_hGMwnd);
	}
}

private function onClickMsgSearchButton()
{
	toggleWindow("UISysMsgToolWnd", true);
}

private function OnClickTeleButton()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
		ExecuteCommand("//teleportto" @ EditBoxString);
}

private function OnClickMoveButton()
{
	ExecuteCommand("//instant_move");
}

private function OnClickRecallButton()
{
	DialogSetID(DIALOGID_Recall);
	DialogShow(DialogModalType_Modalless, DialogType_OKCancel, GetSystemMessage(1220), string(Self) );
}

private function OnClickDetailStatusButton()
{
	local String EditBoxString;
	local GMDetailStatusWnd GMDetailStatusWndScript;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
	{
		GMDetailStatusWndScript = GMDetailStatusWnd(m_hGMDetailStatusWnd.GetScript());
		GMDetailStatusWndScript.ShowStatus(EditBoxString);
	}
	else
		AddSystemMessage(364);
}

private function OnClickInventoryButton()
{
	local String EditBoxString;
	local GMInventoryWnd GMInventoryWndScript;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
	{
		GMInventoryWndScript = GMInventoryWnd(m_hGMInventoryWnd.GetScript());
		GMInventoryWndScript.ShowInventory(EditBoxString);
	}
	else
		AddSystemMessage(364);
}

private function OnClickMagicSkillButton()
{
	local String EditBoxString;
	local GMMagicSkillWnd GMMagicSkillWndScript;

	EditBoxString = m_hEditBox.GetString();
	GMMagicSkillWndScript = GMMagicSkillWnd(m_hGMMagicSkillWnd.GetScript());
	GMMagicSkillWndScript.ShowMagicSkill(EditBoxString);	
}

private function OnClickInfoButton()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
		ExecuteCommand("//debug" @ EditBoxString);
}

private function OnClickStoreButton()
{
	local String EditBoxString;
	local GMWarehouseWnd GMWarehouseWndScript;

	//debug("GMstore");
	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
	{
		GMWarehouseWndScript = GMWarehouseWnd(m_hGMWarehouseWnd.GetScript());
		GMWarehouseWndScript.ShowWarehouse(EditBoxString);
	}
	else
		AddSystemMessage(364);
}

private function OnClickClanButton()
{
	local String EditBoxString;
	local GMClanWnd GMClanWndScript;

	EditBoxString = m_hEditBox.GetString();
	GMClanWndScript = GMClanWnd(m_hGMClanWnd.GetScript());
	GMClanWndScript.ShowClan(EditBoxString);
}

private function OnClickPetitionButton()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if(EditBoxString != "")
		ExecuteCommand("//add_peti_chat" @ EditBoxString);
}

private function OnClickSendHomeButton()
{
	DialogSetID(DIALOGID_SendHome);
	DialogShow(DialogModalType_Modalless, DialogType_OKCancel, GetSystemMessage( 1221 ), string(Self) );
}

function OnClickNPCListButton()
{
	local String EditBoxString;

//diff_elsacred_s
	local GMFindTreeWnd m_GMFindTreeWnd;
//diff_elsacred_e

	EditBoxString = m_hEditBox.GetString();
	//if( EditBoxString == "" )
	//	return;
//diff_elsacred_s
	//if( EditBoxString != "" )
	//{
		m_GMFindTreeWnd = GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript() );
		m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_NPC);
	//}
}

private function OnClickItemListButton()
{
	local String EditBoxString;
//diff_elsacred_s
	local GMFindTreeWnd m_GMFindTreeWnd;
//diff_elsacred_e
	EditBoxString = m_hEditBox.GetString();
	//if( EditBoxString == "" )
	//	return;
	
//diff_elsacred_s
	//if( EditBoxString != "" )
	//{
		m_GMFindTreeWnd= GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript());
		m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_ITEM);
		//m_GMFindTreeWnd.ShowItemList(EditBoxString);			
	//}

//diff_elsacred_e
}

private function OnClickSkillListButton()
{
	local String EditBoxString;
//diff_elsacred_s
	local GMFindTreeWnd m_GMFindTreeWnd;
//diff_elsacred_e	
	EditBoxString = m_hEditBox.GetString();
	//if( EditBoxString == "" )
	//	return;
//diff_elsacred_s
	//if( EditBoxString != "" )
	//{
	m_GMFindTreeWnd= GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript());
	m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_SKILL);
		//m_GMFindTreeWnd.ShowSkillList(EditBoxString);	
	//}
//diff_elsacred_e
}

private function OnClickForcePetitionButton()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if( EditBoxString != "" )
		ExecuteCommand( "//force_peti" @ EditBoxString @ GetSystemMessage( 1528 ) );
}

private function OnClickChangeServerButton()
{
	local String EditBoxString;
	local UserInfo PlayerInfo;

	EditBoxString = m_hEditBox.GetString();

	if( EditBoxString == "" )
		return;

	if( !GetPlayerInfo( PlayerInfo ) )
		return;

	class'GMAPI'.static.BeginGMChangeServer( int( EditBoxString ), PlayerInfo.Loc );
}

private function OnClickUIButton()
{
	local WindowHandle UIToolWnd;

	UIToolWnd = GetWindowHandle("UIToolWnd");
	if(UIToolWnd.IsShowWindow())
	{
		UIToolWnd.HideWindow();		
	}
	else
	{
		UIToolWnd.ShowWindow();
	}
	UIToolWnd.SetFocus();	
}

private function OnClickQuestListButton()
{
	local String EditBoxString;
//diff_elsacred_s
	local GMFindTreeWnd m_GMFindTreeWnd;
//diff_elsacred_e	
	EditBoxString = m_hEditBox.GetString();
	//if( EditBoxString == "" )
	//	return;
//diff_elsacred_s
	//if( EditBoxString != "" )
	//{
		m_GMFindTreeWnd = GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript());
		m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_QUEST);
		//m_GMFindTreeWnd.ShowQuestList(EditBoxString);	
	//}
//diff_elsacred_e LISTTYPE_CLASS

}

private function LoadWindowClick(string windowName)
{
	local WindowHandle NewWindow;

	NewWindow = GetWindowHandle(windowName);
	NewWindow.ShowWindow();
	NewWindow.SetFocus();
}

// ЕШЅєЖ® їЎµрЕН Аб±Э
private function OnClickLockButton()
{
	if(m_hEditBox.IsEnableWindow())
		m_hEditBox.DisableWindow();
	else 
		m_hEditBox.EnableWindow();

	checkVisibleLockButton();
}


// ЕШЅєЖ® їЎµрЕН Аб±Э
private function checkVisibleLockButton()
{	
	if(m_hEditBox.IsEnableWindow())
	{
		GetButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".UnlockBtn").ShowWindow();
		GetButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".LockBtn").HideWindow();	
	}
	else
	{
		GetButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".UnlockBtn").HideWindow();
		GetButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".LockBtn").ShowWindow();
	}
}
// Её°ЩЖГ 
private function OnClickTargetButton()
{
	local String EditBoxString;

	EditBoxString = m_hEditBox.GetString();
	if( EditBoxString != "" )
		ExecuteCommand( "/target" @ EditBoxString );
}

// Е¬·ЎЅє єЇ°ж
private function OnClickClassChangeButton()
{
	local String EditBoxString;
	local GMFindTreeWnd m_GMFindTreeWnd;
	EditBoxString = m_hEditBox.GetString();
	m_GMFindTreeWnd = GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript());
	m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_CLASS);
}

private function OnClickFindListButton()
{
	local String EditBoxString;
	local GMFindTreeWnd m_GMFindTreeWnd;	
	
	EditBoxString = m_hEditBox.GetString();	
	
	m_GMFindTreeWnd = GMFindTreeWnd ( m_hGMFindTreeWnd.GetScript());	
	m_GMFindTreeWnd = GMFindTreeWnd ( GetScript("GMFindTreeWnd"));	
	
	
	m_GMFindTreeWnd.ShowList(EditBoxString, m_GMFindTreeWnd.EListType.LISTTYPE_ITEM);
}

/**
 * А©µµїм ESC Е°·О ґЭ±в Гіё® 
 * "Esc" Key
 ***/
event OnReceivedCloseUI()
{
	PlayConsoleSound(IFST_WINDOW_CLOSE);
	GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath).HideWindow();
}
