function __LoginResult()
{
	this.kOK						= 0;
	this.kNewUser					= 1;
	this.kSwitchDomain				= 2;
	
	this.kNotMine					= -1;
	this.kWrongId					= -2;
	this.kWrongPwd					= -3;
	this.kWrongClientVersion		= -4;
	this.kWrongMsgVersion			= -5;
	this.kServiceShutdown			= -6;
	this.kLockedByAnotherProcess	= -7;
	this.kSwitchSA					= -8;
	this.kWrongOwner				= -9;
	this.kBlockByAdmin				= -10;
	this.kTempBlockByWarning		= -11;
	this.kTempBlockByLoginFail		= -12;
	this.kMabiInfoSoapFail			= -13;
	this.kWrongPassport				= -14;
	this.kBlockedIp					= -15;
	this.kTempBlockByForeigner		= -16;
	
	this.kServerFailed				= -99;
}

var LoginResult = new __LoginResult();

function _Col2Array( col )
{
	var result = new Array();
	for ( var i=0; i<col.GetSize(); ++i )
		result[i] = col.GetCopyAt(i);
		
	return result;
}

function _Col2ArrayNoCopy( col )
{
	var result = new Array();
	for ( var i=0; i<col.GetSize(); ++i )
		result[i] = col.GetAt(i);
		
	return result;
}

function _is_undefined( type )
{
	return (type == "undefined");
}


// Friend

function __Friend()
{
	// return array of CNMCateFriendInfo
	this.GetCategories = function () {
		return _Col2ArrayNoCopy( NxConn3.Friend.GetCategoryList() );
	}
	
	this.Reload = function() {
		NxConn3.Friend.Reload();
	}
	
	this.RenameCategory = function ( uCategoryCode, strNewName ) {
		return NxConn3.Friend.RenameCategory( +uCategoryCode, strNewName );
	}

	this.AddCategory = function ( strNewName, uGameCode, uVirtualIDCode ) {
		return NxConn3.Friend.AddCategory( strNewName, +uGameCode, _is_undefined(typeof(uVirtualIDCode)) ? 1 : +uVirtualIDCode );
	}
	
	this.RemoveCategory = function ( uCategoryCode ) {
		return NxConn3.Friend.RemoveCategory( +uCategoryCode );
	}
	
	this.RequestNewFriend = function ( strRequestId, strMessage, bAddToNxFriend, uGameCode, uRequesteeGameCode, uVirtualIdCode, uRequesteeVirtualIdCode ) {
		return NxConn3.Friend.RequestNewFriend( strRequestId, strMessage,
			_is_undefined(typeof(bAddToNxFriend))			? 0 : +bAddToNxFriend,
			_is_undefined(typeof(uGameCode))				? 0 : +uGameCode,
			_is_undefined(typeof(uRequesteeGameCode))		? 0 : +uRequesteeGameCode,
			_is_undefined(typeof(uVirtualIdCode))			? 0 : +uVirtualIdCode,
			_is_undefined(typeof(uRequesteeVirtualIdCode))	? 0 : +uRequesteeVirtualIdCode
			);
	}
	
	this.RemoveFriend = function ( strFriendKey, uCategoryCode ) {
		return NxConn3.Friend.RemoveFriend( strFriendKey, +uCategoryCode );
	}
	
	this.MoveFriend = function ( strFriendKey, uFromCategoryCode, uToCategoryCode ) {
		return NxConn3.Friend.MoveFriend( strFriendKey, +uFromCategoryCode, +uToCategoryCode );
	}

	this.CopyFriend = function ( strFriendKey, uFromCategoryCode, uToCategoryCode ) {
		return NxConn3.Friend.CopyFriend( strFriendKey, +uFromCategoryCode, +uToCategoryCode );
	}

	// return CNMFriendInfo
	this.FindWithID = function ( strLoginID ) {
		return NxConn3.Friend.FindWithID( strLoginID );
	}
	
	// return CNMFriendInfo
	this.FindWithNickName = function ( sNickName, uGameCode ) {
		return NxConn3.Friend.FindWithNickName( sNickName, +uGameCode );
	}
	
	// return CNMFriendInfo
	this.FindWithFriendKey = function ( strFriendKey ) {
		return NxConn3.Friend.FindWithFriendKey( strFriendKey );
	}
	
	this.Accept = function ( uSerialNo, uConfirmCode ) {
		return NxConn3.Friend.Accept( +uSerialNo, +uConfirmCode );
	}
	
	this.Find = function ( strName, uCheckOnline, uCheckAge, uAgeFrom, uAgeTo, uCheckSex, uSex ) {
		return NxConn3.Friend.Find( strName, +uCheckOnline, +uCheckAge, +uAgeFrom, +uAgeTo, +uCheckSex, +uSex );
	}
	
	this.Iterate = function ( objIter ) {
		var categories = this.GetCategories();
		for ( var i in categories )
		{
			if ( objIter.OnCategory( categories[i] ) )
			{
				var friends = _Col2ArrayNoCopy( categories[i].aFriends );
				for ( var j in friends )
				{
					objIter.OnFriend( friends[j] );
				}
			}
		}
	}
}


// MyInfo

function __MyInfo()
{
	// return array of CNMVirtualUserInfo
	this.GetVirtualUsers = function ( uGameCode ) {
		return _Col2Array( NxConn3.MyInfo.GetVirtualUserList( _is_undefined(typeof(uGameCode)) ? 0 : +uGameCode ) );
	}
	
	// return CNMRealUserInfo
	this.GetUserInfo = function () {
		return NxConn3.MyInfo.GetUserInfo();
	}
	
	this.GetPassport = function () {
		return NxConn3.MyInfo.GetPassport();
	}
	
	this.GetSessionKey = function () {
		return NxConn3.MyInfo.GetSessionKey();
	}

	this.GetEmotion = function () {
		return NxConn3.MyInfo.GetUserInfo().aiAvatarInfo.uEmotion;
	}

	this.SetEmotion = function ( uEmotion ) {
		var ui = NxConn3.MyInfo.GetUserInfo();
		ui.aiAvatarInfo.uEmotion = uEmotion;
		ui.Update();
	}
}


// Guild

function __Guild()
{
	this.Monitor = function ( strGuildKey ) {
		if ( !s_bGuildMonitor )
			return NxConn3.Guild.Monitor( strGuildKey );
		return 1;
	}
	
	// return CNMGuildOnlineInfoEx
	this.GetOnlineInfo = function ( strGuildKey ) {
		return NxConn3.Guild.GetOnlineInfo ( strGuildKey );
	}

	// return array of CNMGuildInfoEx
	this.GetMyGuilds = function () {
		return _Col2Array( NxConn3.Guild.GetMyGuilds() );
	}
	
	this.SendChat = function ( strGuildKey, strChatMsg ) {
		return NxConn3.Guild.SendChat( strGuildKey, strChatMsg );
	}
	
	// return array of CNMChatMessage
	this.GetChatHistory = function ( strGuildKey ) {
		
		var temp = NxConn3.Guild.GetChatHistory( strGuildKey );
		if ( temp == null )
			return "";
		return _Col2Array( temp );
	}
	
	this.ClearChatHistory = function ( strGuildKey ) {
		NxConn3.Guild.ClearChatHistory( strGuildKey );
	}
}


// Note

function __Note()
{
	// return NMNoteList ( collection of CNMNoteInfo )
	this.GetNoteBox = function ( uBoxType ) {
		return NxConn3.Note.GetNoteBox( +uBoxType );
	}
	
	// return NMNoteInfoList ( collection of CNMNoteInfo2 )
	this.GetNoteBox2 = function ( uBoxType ) {
		return NxConn3.Note.GetNoteBox2( +uBoxType );		
	}
	
	// return CNMNoteInfo
	this.GetNoteBySerial = function ( uBoxType, uSerial ) {
		return NxConn3.Note.GetNoteBySerial( +uBoxType, +uSerial );
	}
	
	this.DeleteBySerials = function ( strSerials ) {
		NxConn3.Note.DeleteBySerials( strSerials );
	}
	
	this.SaveToPermBoxBySerials = function ( strSerials ) {
		NxConn3.Note.SaveToPermBoxBySerials( strSerials );
	}
	
	this.SetReadFlagBySerial = function ( uSerial ) {
		return NxConn3.Note.SetReadFlagBySerial( +uSerial );
	}
	
	this.Send = function ( strLoginIDs, strMsg, nSavePerm, uGameCode, uVirtualIdCode ) {
		NxConn3.Note.Send( strLoginIDs, strMsg, +nSavePerm, +uGameCode, _is_undefined(typeof(uVirtualIdCode)) ? 1 : +uVirtualIdCode );
	}
	
	this.GetUnreadCount = function () {
		return NxConn3.Note.GetUnreadCount();
	}

	this.GetVolatileNote = function ( key ) {
		return NxConn3.Note.GetVolatileNote( +key );
	}

	this.GetVolatileNote2 = function ( key ) {
		return NxConn3.Note.GetVolatileNote2( +key );
	}
}


// RejectList

function __RejectList()
{
	// return array of CNMRejectListUserInfo
	this.GetList = function () {
		return _Col2ArrayNoCopy( NxConn3.RejectList.GetList() );
	}
	
	this.Reload = function () {
		NxConn3.RejectList.Reload();
	}
	
	this.Add = function ( uGameCode, strNickName, strLoginID, vid, strMemo ) {
		return NxConn3.RejectList.Add( +uGameCode, strNickName, strLoginID, +vid, strMemo );
	}
	
	this.Remove = function ( uGameCode, strNickName, strLoginID, vid ) {
		return NxConn3.RejectList.Remove( +uGameCode, strNickName, strLoginID, +vid );
	}

}


// Chat

function __Chat()
{
	this.RequestSession = function ( strFriendCode ) {
		NxConn3.Chat.RequestSession( strFriendCode ); 
	}

	this.RequestSessionToGuildMember = function ( strTargetId, uGameCode, uVirtualIDCode ) {
		NxConn3.Chat.RequestSessionToGuildMember( strTargetId, +uGameCode, _is_undefined(typeof(uVirtualIDCode)) ? 1 : +uVirtualIDCode ); 
	}
	
	this.RegisterSession = function ( uSerial ) {
		NxConn3.Chat.RegisterSession( +uSerial );
	}
	
	this.WantClose = function () {
		NxConn3.Chat.WantClose();
	}
	
	// return CNMSessionInfo
	this.GetSessionInfo = function () {
		return NxConn3.Chat.GetSessionInfo();
	}
	
	// return array of CNMSessionMemberInfo
	this.GetMembers = function () {
		return _Col2Array( NxConn3.Chat.GetMembers() );
	}
	
	this.InviteUser = function ( strFriendCode ) {
		return NxConn3.Chat.InviteUser( strFriendCode );
	}

	this.SetFontHeader = function ( strFontHeader ) {
		NxConn3.Chat.SetFontHeader( strFontHeader );
	}
	
	this.SendIdle = function () {
		NxConn3.Chat.SendIdle();
	}
	
	this.SendTyping = function () {
		NxConn3.Chat.SendTyping();
	}
	
	this.SendMsg = function ( strMsg, uFace ) {
		NxConn3.Chat.SendMsg( strMsg, +uFace );
	}
}


// FileUpload

function __FileUpload()
{
	this.RegisterSession = function ( uSerial ) {
		NxConn3.FileUpload.RegisterSession( +uSerial );
	}
	
	// return array of CNMSessionMemberInfo
	this.GetMembers = function () {
		return _Col2Array( NxConn3.FileUpload.GetMembers() );
	}
	
	// return array of CNMFileEvent
	this.GetFileEvents = function () {
		return _Col2Array( NxConn3.FileUpload.GetFileEvents() );
	}
	
	this.WantClose = function () {
		NxConn3.FileUpload.WantClose();
	}
	
	this.CancelFile = function ( uEventID ) {
		NxConn3.FileUpload.CancelFile( +uEventID );
	}

	this.SendFile = function ( strFriendCode ) {
		NxConn3.FileUpload.SendFile( strFriendCode );
	}

	this.SendFileAgain = function ( uEventID ) {
		NxConn3.FileUpload.SendFileAgain( +uEventID );
	}
	
	this.AddFile = function () {
		NxConn3.FileUpload.AddFile();
	}
	
	this.PickFile = function () {
		return NxConn3.FileUpload.PickFile();
	}
}


// FileDownload

function __FileDownload()
{
	this.RegisterSession = function ( uSerial ) {
		NxConn3.FileDownload.RegisterSession( +uSerial );
	}
	
	// return array of CNMSessionMemberInfo
	this.GetMembers = function () {
		return _Col2Array( NxConn3.FileDownload.GetMembers() );
	}
	
	// return array of CNMFileEvent
	this.GetFileEvents = function () {
		return _Col2Array( NxConn3.FileDownload.GetFileEvents() );
	}
	
	this.WantClose = function () {
		NxConn3.FileDownload.WantClose();
	}
	
	this.CancelFile = function ( uEventID ) {
		NxConn3.FileDownload.CancelFile( +uEventID );
	}
	
	this.GetFile = function ( uEventID ) {
		NxConn3.FileDownload.GetFile( +uEventID );
	}
	
	this.GetDownloadDir = function () {
		return NxConn3.FileDownload.GetDownloadDir();
	}
	
	this.SetDownloadDir = function () {
		return NxConn3.FileDownload.SetDownloadDir();
	}
	
	this.OpenDownloadDir = function () {
		NxConn3.FileDownload.OpenDownloadDir();
	}
}


// ChatRoom

function __ChatRoom()
{
	// return CNMChatRoomInfoEx
	this.GetRoomInfo = function () {
		return NxConn3.ChatRoom.GetRoomInfo();
	}

	// return CNMChatRoomInfoEx
	this.CreateRoomInfo = function () {
		return NxConn3.ChatRoom.CreateRoomInfo();
	}

	this.GetSerialKey = function () {
		return NxConn3.ChatRoom.GetSerialKey();
	}

	this.SetSerialKey = function ( uSerial ) {
		NxConn3.ChatRoom.SetSerialKey( +uSerial );
	}

	this.RegisterSession = function ( uSerial ) {
		NxConn3.ChatRoom.RegisterSession( +uSerial );
	}

	this.Close = function () {
		NxConn3.ChatRoom.Close();
	}

	this.InviteUser = function ( strToId, strMsg ) {
		NxConn3.ChatRoom.InviteUser( strToId, strMsg );
	}

	// return array of CNMChatRoomMemberInfo
	this.GetMembers = function () {
		return _Col2Array( NxConn3.ChatRoom.GetMembers() );
	}
	
	this.BanUserByName = function ( strName ) {
		return NxConn3.ChatRoom.BanUserByName( strName );
	}

	this.SetFontHeader = function ( strFontHeader ) {
		NxConn3.ChatRoom.SetFontHeader( strFontHeader );
	}
	
	this.SendIdle = function () {
		NxConn3.ChatRoom.SendIdle();
	}
	
	this.SendTyping = function () {
		NxConn3.ChatRoom.SendTyping();
	}
	
	this.SendMsg = function ( strMsg, uFace ) {
		NxConn3.ChatRoom.SendMsg( strMsg, +uFace );
	}
}


// Game

function __Game()
{
	this.Launch = function ( uGameCode, strParam ) {
		return NxConn3.Game.Launch( +uGameCode, strParam );
	}
	
	this.DownloadKartReplay = function ( strUrl, bOverwrite ) {
		return NxConn3.Game.DownloadKartReplay( strUrl, +bOverwrite );
	}

	this.DownloadAsKartReplay = function ( strUrl, strFileName, bOverwrite ) {
		return NxConn3.Game.DownloadAsKartReplay( strUrl, strFileName, +bOverwrite );
	}
	
	// return array
	this.GetSupportGameCodes = function () {
		var result = new Array();
		var games = NxConn3.Game.GetSupportGames();
		
		for ( var i=0; i<games.GetSize(); ++i )
			result[i] = games.GetAt(i).uGameCode;
			
		return result;
	}
	
	// return array
	this.GetGameServerCodes = function ( uGameCode ) {
		var result = new Array();
		var servers = NxConn3.Game.GetGameServers( +uGameCode );
		
		for ( var i=0; i<servers.GetSize(); ++i )
			result[i] = servers.GetAt(i).uGameServerCode;
		
		return result;
	}
	
	this.GetGameFullName = function ( uGameCode )  {
		return NxConn3.Game.GetGameFullName( +uGameCode );
	}
	
	this.GetGameShortName = function ( uGameCode )  {
		return NxConn3.Game.GetGameShortName( +uGameCode );
	}
	
	this.GetGameFriendTitle = function ( uGameCode )  {
		return NxConn3.Game.GetGameFriendTitle( +uGameCode );
	}
	
	this.GetGameServerName = function ( uGameCode, uServerCode ) {
		return NxConn3.Game.GetGameServerName( +uGameCode, +uServerCode );
	}
}


// Util

function __Util()
{
	this.StartPlug = function () {
		var strMatch = window.navigator.appVersion;

		if( !( ( strMatch.match("Windows NT 5.0") == "Windows NT 5.0" ) || ( strMatch.match("Windows NT 5.1") == "Windows NT 5.1" ) || ( strMatch.match("Windows NT 5.2") == "Windows NT 5.2" ) ) )
			alert( "³Ø½¼ÇÃ·¯±×´Â Windows 2000 ÀÌ»ó¿¡¼­¸¸ ±¸µ¿µË´Ï´Ù." );
		else	
			NxConn3.Util.StartPlug();
	}
	
	this.ReinstallPlug = function() {
		return NxConn3.Util.ReinstallPlug();
	}
	
	this.ConvertRadix = function ( sSource, nRadixFrom, nRadixTo, nLength ) {
		return NxConn3.Util.ConvertRadix( sSource, +nRadixFrom, +nRadixTo, +nLength );
	}
	
	this.MinimizeAll = function ( bMinimize ) {
		NxConn3.Util.MinimizeAll( +bMinimize );
	}
	
	this.AllowPopup = function ( strURL, uCheckSum ) {
		return NxConn3.Util.AllowPopup( strURL, +uCheckSum );
	}
	
	this.RegisterGames = function () {
		return NxConn3.Util.RegisterGames();
	}
	
	this.GenerateSmallSysInfo = function () {
		return NxConn3.Util.GenerateSmallSysInfo();
	}

	this.SaveSysInfoAs = function () {
		return NxConn3.Util.SaveSysInfoAs();
	}

	this.SaveSysInfoToDeskTop = function () {
		return NxConn3.Util.SaveSysInfoToDeskTop();
	}

	this.GetSysInfoString = function () {
		return NxConn3.Util.GetSysInfoString();
	}

	// PC»ç¾çÁ¶»ç °ü·Ã (added by manin*** 2006.09.04)
	this.GetSysInfo = function () {
		return NxConn3.Util.GetSysInfo();
	}
	
	this.InitDxDiag = function () {
		return NxConn3.Util.InitDxDiag();
	}
	
	this.GetDxDiagProperty = function () {
		return NxConn3.Util.GetDxDiagProperty();
	}
	
	this.GetDxDiagChildCount = function () {
		return NxConn3.Util.GetDxDiagChildCount();
	}
	
	this.GetSysInfoXML = function () {
		var MakeTag = function ( tag, str )
    {
        return "<" + tag + "> " + str + " </" + tag + ">\n";
    }
 
    var MakePropTag = function ( tag, prop )
    {
        return MakeTag( tag,  NxConn3.Util.GetDxDiagProperty( prop ) );
    }    
    NxConn3.Util.InitDxDiag();
 
    var result = '<?xml version="1.0"?>\n'
    result += "<SysInfo>\n";
 
    result += MakePropTag( "CPU", "DxDiag_SystemInfo.szProcessorEnglish" );
    result += MakePropTag( "RAM", "DxDiag_SystemInfo.szPhysicalMemoryEnglish" );
    result += MakePropTag( "VGA", "DxDiag_DisplayDevices.0.szChipType" );
    result += MakePropTag( "VRAM", "DxDiag_DisplayDevices.0.szDisplayMemoryEnglish" );
    result += MakePropTag( "Display", "DxDiag_DisplayDevices.0.szDisplayModeEnglish" );
    result += MakePropTag( "OS", "DxDiag_SystemInfo.szOSExLongEnglish" );
    result += MakePropTag( "Language", "DxDiag_SystemInfo.szLanguagesEnglish" );
    result += MakePropTag( "DirectX", "DxDiag_SystemInfo.szDirectXVersionLongEnglish" );
    result += MakeTag( "LocalIP", NxConn3.MyInfo.GetUserInfo().GetLocalIP() );
    result += MakeTag( "VirtualIP", NxConn3.MyInfo.GetUserInfo().GetVirtualIP() );
    result += MakeTag( "IE", NxConn3.Util.GetSysInfo().ie_version );
 
    /*var count = NxConn3.Util.GetDxDiagChildCount( "DxDiag_LogicalDisks" );
    if ( count != null )
        for ( var i=0; i<count; ++i )
            result += MakeTag( "Disk"+i, 
                NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szDriveLetter" ) + " " +
                NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szModel" ) + " : " + 
                NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szMaxSpace" ) );
	 */
	var count = NxConn3.Util.GetDxDiagChildCount( "DxDiag_LogicalDisks" );
	if ( count != null )
	{
		var strTemp = "";
		var delimiter = ", ";
        for ( var i=0; i<count; ++i )
		{
			if(i == count)
				delimiter = "";
			strTemp += 
				NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szDriveLetter" ) + " " +
				NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szModel" ) + " : " + 
				NxConn3.Util.GetDxDiagProperty( "DxDiag_LogicalDisks."+i+".szMaxSpace" )  + delimiter;

			
		}
		result += MakeTag( "Disk", strTemp);
    }

	result += "</SysInfo>";

    return result;
	}
}


// Reception

function __Reception()
{
	this.GetAllowChatType = function () {
		return NxConn3.Reception.GetAllowChatType();
	}
	
	this.SetAllowChatType = function ( uChatType ) {
		NxConn3.Reception.SetAllowChatType( +uChatType );
	}
	
	this.GetAllowNoteType = function () {
		return NxConn3.Reception.GetAllowNoteType();
	}
	
	this.SetAllowNoteType = function ( uNoteType ) {
		NxConn3.Reception.SetAllowNoteType( +uNoteType );
	}
	
	this.GetAllowRequestFriendType = function () {
		return NxConn3.Reception.GetAllowRequestFriendType();
	}
	
	this.SetAllowRequestFriendType = function ( uRequestFriendType ) {
		NxConn3.Reception.SetAllowRequestFriendType( +uRequestFriendType );
	}
	
	this.GetAllowGameInviteType = function () {
		return NxConn3.Reception.GetAllowGameInviteType();
	}
	
	this.SetAllowGameInviteType = function ( uGameInviteType ) {
		NxConn3.Reception.SetAllowGameInviteType( +uGameInviteType );
	}
}


// GuildCommunicator

function __GuildCommunicator()
{
	this.Friend			= new __Friend();
	this.MyInfo			= new __MyInfo();
	this.Guild			= new __Guild();
	this.Note			= new __Note();
	this.RejectList		= new __RejectList();
	this.Chat			= new __Chat();
	this.FileUpload		= new __FileUpload();
	this.FileDownload	= new __FileDownload();
	this.ChatRoom		= new __ChatRoom();
	this.Game			= new __Game();
	this.Util			= new __Util();
	this.Reception		= new __Reception();

	this.Login = function ( strLocalID, strPassword ) {
		return NxConn3.Login( strLocalID, strPassword );
	}
	
	this.LoginAsMabinogi = function ( strLocalID, strPassword ) {
		return NxConn3.LoginAsMabinogi( strLocalID, strPassword );
	}

	this.Logout = function () {
		NxConn3.Logout();
		location.href = location.href;
	}
	
	this.IsLogin = function () {
		return NxConn3.IsLogin();
	}
	
	this.RefreshInfo = function ( uType ) {
		return NxConn3.RefreshInfo( +uType );
	}
	
	this.CustomEvent = function ( uType, uCode, uSubCode ) {
		NxConn3.CustomEvent( +uType, +uCode, +uSubCode );
	}
	
	this.SetAXSessionValue = function ( strName, strValue ) {
		NxConn3.SetAXSessionValue( strName, strValue );
	}
	
	this.GetAXSessionValue = function ( strName ) {
		return NxConn3.GetAXSessionValue( strName );
	}

	this.GetDomainString = function () {
		return NxConn3.GetDomainString();
	}
	
	this.IsMe = function ( strUserName, nGameCode ) {
		var vuser_list = this.MyInfo.GetVirtualUsers( nGameCode );
		for ( var i in vuser_list )
		{
			if ( strUserName == vuser_list[i].szNickName )
				return true;
		}
			
		return false;
	}
	
	this.IsFriend = function ( strUserName, nGameCode ) {
		var friend_info = this.Friend.FindWithNickName( strUserName, nGameCode );
			
		return ( friend_info != null );
	}

}


// GameCode

function __GameCode()
{
	this.NxCom		= 65536;
	this.Kart		= 73985;
	this.Warrock	= 94212;	
	this.Nanaimo	= 94215;
	this.Combat		= 74247;
	this.Slapshot	= 94219;
	this.CSO		= 73737;
	this.BF			= 74255;
	this.Heroes		= 73739;
		
	this.KartGuild		= "268435458"; // Ä«Æ®±æµå
	this.WarrockGuild	= "268435459"; // ¿ö·Ï±æµå
	this.ManmaniGuild	= "268435463"; // ¸¸¸¸ÀÌ±æµå	
	this.NxcomGuild		= "268435967"; // Ä£¸ñ±æµå
	this.CombatGuild	= "268435466"; // ÄÄ¹î±æµå
	this.SlapshotGuild	= "268435468"; // ½½·¦¼¦±æµå
	this.CSOGuild		= "268435467"; // CSO±æµå
	this.BFGuild		= "268435470"; // ¹öºíÆÄÀÌÅÍ±æµå
	this.HeroesGuild	= "268435471"; // ¸¶ºñ³ë±â¿µ¿õÀü±æµå

	this.FromGuildKey = function ( strGuildKey ) {
		var nTmpGuildKey	= strGuildKey.substr( 0, ( strGuildKey.length - 8 ) );
		var nGameCode		= GuildCommunicator.Util.ConvertRadix( nTmpGuildKey, 16, 10, 0 );
		switch ( nGameCode )
		{
		case this.KartGuild :		return this.Kart;
		case this.WarrockGuild :	return this.Warrock;
		case this.ManmaniGuild :	return this.NxCom;
		case this.CombatGuild :		return this.Combat;		
		case this.SlapshotGuild :	return this.Slapshot;				
		case this.CSOGuild :		return this.CSO;						
		case this.BFGuild :			return this.BF;
		case this.HeroesGuild :		return this.Heroes;
		case this.NxcomGuild :
		default: 					return this.NxCom;
		}
	}
	
	this.ParseMaskGameCode = function ( maskGameCode ) {
		var result = new Object();

		switch( maskGameCode >> 16 )
		{
		case 0xd:	result.nGameCode = maskGameCode; break;
		default:
			result.nGameCode = maskGameCode;
			result.nServerCode = -1;
			return result;
		}

		result.nServerCode = maskGameCode & 0x0000ffff;
		
		return result;
	}
}

var GameCode = new __GameCode();
 

// NXUtil

function __NXUtil()
{
	this.Dec2Hex = function ( strDec ) {
		return GuildCommunicator.Util.ConvertRadix( strDec, 10, 16, 16 );
	}

	this.FriendKey2FriendCode = function ( strFriendKey ) {
		var	strFriendCode = '00000000000000000000000000000000';

		if ( strFriendKey.length == 48 )
			strFriendCode = strFriendKey.substr( 0, 16 ) + strFriendKey.substr( 32, 16 );
		
		return strFriendCode;
	}

	// INPUT : FriendCode ( string )
	// OUTPUT : GameCode ( number )
	this.FriendCode2GameCode = function ( strFriendCode ) {
		var	uGameCode = 0;
		if ( strFriendCode.length == 32 )
			uGameCode = parseInt( strFriendCode.substr( 16, 8 ), 16 );
		
		return uGameCode;
	}

	// INPUT : FriendCode ( string )
	// OUTPUT : IDCode ( number )
	this.FriendCode2IDCode = function ( strFriendCode ) {
		var	uIDCode = '0000000000000000';

		if ( strFriendCode.length == 32 )
			uIDCode = strFriendCode.substr( 0, 16 );
		
		uIDCode = GuildCommunicator.Util.ConvertRadix( uIDCode, 16, 10, 0 );
		return uIDCode;
	}

	this.OidUser2IDCode = function ( IDCode ) {
		var	oidUser = '0000000000000000';
		
		if ( IDCode.length == 16 )
			oidUser = IDCode.substr( 0, 8 );
		
		oidUser = GuildCommunicator.Util.ConvertRadix( oidUser, 16, 10, 0 );
		return oidUser;
	}

	// INPUT : FriendKey ( string )
	// OUTPUT : GameCode ( number )
	this.FriendKey2GameCode = function ( strFriendKey )	{
		return FriendCode2GameCode( FriendKey2FriendCode( strFriendKey ) );
	}

	// INPUT : FriendKey ( string )
	// OUTPUT : IDCode ( number )
	this.FriendKey2IDCode = function ( strFriendKey ) {
		return FriendCode2IDCode( FriendKey2FriendCode( strFriendKey ) );
	}
	
	this.GetVirtualIDCode = function ( nGameCode, strNickName )	{
		var vusers = GuildCommunicator.MyInfo.GetVirtualUsers( nGameCode );

		for ( var i in vusers )
		{
			if ( strNickName == vusers[i].szNickName )
				return vusers[i].keyVirtual.uVirtualIDCode;
		}
		
		return 0;
	}
}

var NXUtil = new __NXUtil();


// NXC_EVENT

function __NXC_EVENT()
{
	// NxConn Event Main code
	this.k_nLoginReply				= 0;
	this.k_nServerMessage			= 1;
	this.k_nUserInfoChanged			= 2;
	this.k_nFriendListChanged		= 3;
	this.k_nFriendInfoChanged		= 4;
	this.k_nConnectionClosed		= 5;
	this.k_nRefreshMessage			= 6;
	this.k_nNoteReceived			= 7;
	this.k_nChatStarted				= 8;
	this.k_nChatReceived			= 9;
	this.k_nInitialized				= 10;
	this.k_nRefreshNoteBox			= 11;
	this.k_nFindFriend				= 12;
	this.k_nAddFriendConfirm		= 13;
	this.k_nChatMemberChanged		= 14;
	this.k_nFileUploadSession		= 15;
	this.k_nFileDownloadSession		= 16;
	this.k_nFileEvent				= 17;
	this.k_nNotifyLogoutVirtual		= 18;
	this.k_nNotifyDetach			= 19;
	this.k_GuildOnlineInfoChanged	= 20;
	this.k_GuildChatMessage			= 21;
	this.k_nCustomNotifyAll			= 100;
	this.k_FirstLoad				= 70;

	
	// LoginReply	
	this.kLoginReply_OK						= 0;
	this.kLoginReply_NewUser				= 1;
	this.kLoginReply_SwitchDomain			= 2;
	
	this.kLoginReply_NotMine				= -1;
	this.kLoginReply_WrongId				= -2;
	this.kLoginReply_WrongPwd				= -3;
	this.kLoginReply_WrongClientVersion		= -4;
	this.kLoginReply_WrongMsgVersion		= -5;
	this.kLoginReply_ServiceShutdown		= -6;
	this.kLoginReply_LockedByAnotherProcess	= -7;
	this.kLoginReply_SwitchSA				= -8;
	this.kLoginReply_WrongOwner				= -9;
	this.kLoginReply_BlockByAdmin			= -10;
	this.kLoginReply_TempBlockByWarning		= -11;
	this.kLoginReply_TempBlockByLoginFail	= -12;
	this.kLoginReply_MabiInfoSoapFail		= -13;
	this.kLoginReply_WrongPassport			= -14;
	this.kLoginReply_BlockedIp				= -15;
	this.kLoginReply_ForeignerTempId		= -16;
	
	this.kLoginReply_ServerFailed			= -99;
			
	// ChatRoomCreate
	this.k_nChatRoomStarted = 50;
	this.k_nChatRoomInfoChanged = 51;
	this.k_nChatRoomMemberChanged = 52;
	this.k_nChatRoomMessageReceived	= 53;
	this.k_nChatRoomCreateFailed = 54;
	this.k_nChatRoomClosed = 55;
	this.k_nChatRoomRegistered = 56;
	this.k_nDefaultChatRoomStarted = 57;

	// ChatRoomCreateFail
	this.kType_Failed = 1;
	this.kType_Closed = 2;
	this.k_nChatRoomCreateFailed_Denied = 3;
	this.k_nChatRoomCreateFailed_DeniedByLevel = 4;
	this.k_nChatRoomCreateFailed_DeniedByLimit = 5;
	this.k_nChatRoomCreateFailed_DeniedByPassword = 6;
	
	// NxConn Event Sub Code for k_nRefreshMessage
	this.k_nRefresh_Null = 0;
	this.k_nRefresh_Avatar = 1;
	this.k_nRefresh_GameMoney = 2;
	this.k_nRefresh_NickName = 3;
	this.k_nRefresh_Config = 4;
	this.k_nRefresh_GuildInfo = 100;

	this.Handler = NXC_EVENT_Handler;
	this.isEventStart = false;
}

function NXC_EVENT_Handler( event_code, param )
{
		
	Debug.print( "event_code : " + event_code +  " param : " + param );
	switch ( event_code )
	{
		case this.k_nInitialized:
			if ( GuildCommunicator == null )
				GuildCommunicator = new __GuildCommunicator();	
			EVM.raiseEvent( EVM.k_nEventType_onInitialized, param );
			break;

		case this.k_nLoginReply:
			EVM.raiseEvent( EVM.k_nEventType_onPassportLoginReplyOK, param );
			switch ( param )
			{
			case LoginResult.kOK:
			case LoginResult.kNewUser:
			case LoginResult.kSwitchDomain:
				EVM.raiseEvent( EVM.k_nEventType_onPassportLoginReplyOK, param );
				break;

			default:
				//alert( "(!!!) [Temporary Code] Messenger Login Failed" );
				break;
			}
			break;

		case this.k_nConnectionClosed:
			//EVM.raiseEvent( EVM.k_nEventType_onConnectionClosed, param );
			break;

		case this.k_nFriendListChanged:
			//EVM.raiseEvent( EVM.k_nEventType_onFriendListChanged, param );
			break;

		case this.k_nFriendInfoChanged:
			//EVM.raiseEvent( EVM.k_nEventType_onFriendInfoChanged, param );
			break;

		case this.k_nUserInfoChanged:
			EVM.raiseEvent( EVM.k_nEventType_onUserInfoChanged, param );
			break;

		case this.k_nServerMessage:
			EVM.raiseEvent( EVM.k_nEventType_onServerMessage, param );
			break;

		case this.k_nCustomNotifyAll:
			switch ( param )
			{
			case this.k_nCustomNotifyAll_Reload:
				EVM.raiseEvent( EVM.k_nEventType_onCustomNotifyAll_Reload, param );
				break;
			default:
				Debug.print( "Unhandled param of k_nCustomNotifyAll : " + param );
				Debug.assert( false );
				break;
			}
			break;
			
		case this.k_FirstLoad:
			EVM.raiseEvent( EVM.k_nEventType_onFirstLoad, param );
			break;

		case this.k_nRefreshMessage:
			switch ( param )
			{
			case this.k_nRefresh_Avatar:
				EVM.raiseEvent( EVM.k_nEventType_onRefresh_Avatar, param );
				break;

			case this.k_nRefresh_NickName:
				EVM.raiseEvent( EVM.k_nEventType_onRefresh_Nickname, param );
				break;
				
			case this.k_nRefresh_Config:
				EVM.raiseEvent( EVM.k_nEventType_onRefresh_Config, param );
				break;
				
			default:
				Debug.print( "Unhandled param of k_nRefreshMessage : " + param );
				Debug.assert( false );
				break;
			}
			break;

		case this.k_nNoteReceived:
			EVM.raiseEvent( EVM.k_nEventType_onNoteReceived, param );
			break;

		case this.k_nChatStarted:
			EVM.raiseEvent( EVM.k_nEventType_onChatStarted, param );
			break;

		case this.k_nChatReceived:
			EVM.raiseEvent( EVM.k_nEventType_onChatReceived, param );
			break;

		case this.k_nRefreshNoteBox:
			EVM.raiseEvent( EVM.k_nEventType_onRefreshNoteBox, param );
			break;

		case this.k_nFindFriend:
			var find_result = _Col2Array( param );
			EVM.raiseEvent( EVM.k_nEventType_onFindFriend, find_result );
			break;

		case this.k_nAddFriendConfirm:
			EVM.raiseEvent( EVM.k_nEventType_onAddFriendConfirm, param );
			break;

		case this.k_nChatMemberChanged:
			EVM.raiseEvent( EVM.k_nEventType_onChatMemberChanged, param );
			break;

		case this.k_nFileUploadSession:
			EVM.raiseEvent( EVM.k_nEventType_onFileUploadSession, param );
			break;

		case this.k_nFileDownloadSession:
			EVM.raiseEvent( EVM.k_nEventType_onFileDownloadSession, param );
			break;

		case this.k_nFileEvent:
			EVM.raiseEvent( EVM.k_nEventType_onFileEvent, param );
			break;
			
		case this.k_nNotifyLogoutVirtual:
			EVM.raiseEvent( EVM.k_nEventType_NotifyLogoutVirtual, param );
			break;
			
		case this.k_nNotifyDetach:
			EVM.raiseEvent( EVM.k_nEventType_NotifyDetach, param );
			break;
			
		case this.k_GuildOnlineInfoChanged:
			EVM.raiseEvent( EVM.k_nEventType_GuildOnlineInfoChanged, param );
			break;

		case this.k_GuildChatMessage:
			EVM.raiseEvent( EVM.k_nEventType_GuildChatMessage, param );
			break;

		case this.k_nChatRoomStarted:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomStarted, param );
			break;

		case this.k_nChatRoomInfoChanged:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomInfoChanged, param );
			break;

		case this.k_nChatRoomMemberChanged:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomMemberChanged, param );
			break;

		case this.k_nChatRoomMessageReceived:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomMessageReceived, param );
			break;

		case this.k_nChatRoomCreateFailed:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomCreateFailed, param );
			break;

		case this.k_nChatRoomClosed:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomClosed, param );
			break;

		case this.k_nChatRoomRegistered:
			EVM.raiseEvent( EVM.k_nEventType_onChatRoomRegistered, param );
			break;
			
		case this.k_nDefaultChatRoomStarted:
			EVM.raiseEvent( EVM.k_nEventType_onDefaultChatRoomStarted, param );
			break;
			
		default:
			Debug.print( "Unhandled event_code : " + event_code );
			Debug.assert( false );
			break;
	}
}

var NXC_EVENT = new __NXC_EVENT();


// etc


function _GuildCommunicator_connectionClosedHandler( isConnectionClosed )
{
	if( location.href.toLowerCase().indexOf( "/localhost/" ) == -1  
	&&  location.href.toLowerCase().indexOf("?url=_comp/login_notlogin") == -1
	&&  location.href.toLowerCase().indexOf("?url=login/logout") == -1
	&&  location.href.toLowerCase().indexOf("?url=login/loginproc") == -1)
	{
		// ·Î±×¾Æ¿ô »óÅÂ¿¡´Â ¾Æ¹«°Íµµ ÇÏÁö ¾Ê´Â´Ù.
		// ·Î±×ÀÎ ÇÏ´Â ÁßÀÌ¶ó¸é ¾Æ¹«°Íµµ ÇÏÁö ¾Ê´Â´Ù.
		if( ( isConnectionClosed && getCookies( "IL" ) == "1" && !MSGER.k_isLoginning ) || ( !isConnectionClosed && getCookies( "IL" ) == "1" ) )
		{
			var isLogin = GuildCommunicator.IsLogin();
			if( !isLogin )
			{
				Logout_NXCW();
			}
		}
		
		if( MSGER.k_isLoginning )
			MSGER.k_isLoginning = false;
	}
}

function Logout_NXCW()
{
	var strRedirect  = document.location.href.toLowerCase();
	location.href ="http://login.nexon.com/nx/Page/gnx.aspx?URL=Login/Logout&redirect" + strRedirect ;
}

function _GuildCommunicator_serverMessageHandler( param )
{
	Debug.print( "GuildCommunicator.serverMessageHandler execute..." );
	var serverCode = param.nCode;
	var serverStr = param.szMessage;
	if ( serverCode == 1 )
	{
		arrMsg = serverStr.split( "," );
		var nServerCode = arrMsg[0].slice( 2, arrMsg[0].indexOf("#_") );
		var strLocalID = arrMsg[1].slice( 2, arrMsg[1].indexOf("#_") );
		var strNickName = arrMsg[2].slice( 2, arrMsg[2].indexOf("#_") );

		window.open( "http://www.nexon.com/nx/Page/Gnx.aspx?URL=MyPage/AddFriend_Send&nServerCode=" + nServerCode + "&strFriendID=" + strLocalID , "_blank" , "scrollbars=no,resizable=no,width=385,height=190" );
	}
	else
	{
		alert( serverStr );
	}
}

function _GuildCommunicator_reloadHandler()
{
	window.location.reload();
}

function _GuildCommunicator_startChatHandler( subCode )
{
	window.open( "http://guild.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/web_chatting&oidMemo=" + subCode , subCode , "scrollbars=no,resizable=no,width=380,height=500" );
}

function _GuildCommunicator_startUploadHandler( subCode )
{
	window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/file_send&n4FileTransferSessionValue=" + subCode , subCode , "scrollbars=no,resizable=no,width=450,height=300" );
}

function _GuildCommunicator_startDownloadHandler( subCode )
{
	window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/file_receive&n4FileTransferSessionValue=" + subCode , subCode , "scrollbars=no,resizable=no,width=450,height=300" );
}

function _GuildCommunicator_startDefaultChatRoomHandler( subCode )
{
	window.open( "http://guild.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/guild_chat&n4GuildChatSessionValue=" + subCode , "_blank" , "scrollbar=no,resizable=yes,width=450,height=700" );
}

function _GuildCommunicator_startChatRoomHandler( subCode )
{
	window.open( "http://guild.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/guild_general_chat&n4GuildGeneralSession=" + subCode , "_blank" , "scrollbar=no,resizable=yes,width=450,height=700" );
}

function _GuildCommunicator_addFriendConfirmHandler( param )
{
	var SerialNo = param.uSerialNo;
	var strNickName = param.szFromNickName;
	var strLocalID = param.szFromLoginID;
	var strGameCode = param.keyFromVirtual.uGameCode;
	var strMemo = param.szMessage;

	//var strQS = "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=Message/memo_friend_registration&strLocalID="+ strLocalID + "&strVirtualUserName=" + strNickName + "&strMemo=" + strMemo + "&oidMemo=" + SerialNo + "&maskGameCode=" + strGameCode;
	var strQS = "http://www.nexon.com/NX/Page/Gnx.aspx?URL=MyPage/memo_Friend_Add&strVirtualUserName=" + strNickName + "&strMemo=" + strMemo + "&oidMemo=" + SerialNo + "&maskGameCode=" + strGameCode;
	//var strQS = "http://work2.nexon.com/jjong/long/Nxcom/PresentationLayer/NX/Page/Gnx.aspx?URL=MyPage/memo_Friend_Add&strVirtualUserName=" + strNickName + "&strMemo=" + strMemo + "&oidMemo=" + SerialNo + "&maskGameCode=" + strGameCode;
	
	if( location.href.toLowerCase().indexOf( "http://kart.nexon.com" ) == 0 )
	{
		setCookie( 'RAFK', escape( strQS ) );
	}
	else
	{
		window.open( strQS, "_blank", "scrollbars=no,resizable=no,width=370,height=220" );
	}
}

function _GuildCommunicator_noteReceivedHandler( param )
{
	var nNoteType			= param.uNoteType;
	var nNoteSubType		= param.uSubType;
	var nMaskGameCode		= param.keyVirtual.uGameCode;
	var subCode				= param.uNoteSerial;
	var volatileKey			= param.GetVolatileKey();

	switch( nNoteType )
	{
		case 1 :	//ÂÊÁö
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo&maskGameCode=" + nMaskGameCode + "&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" );
			break;
		case 2 :	//°ÔÀÓÃÊ´ë
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_invite_game&maskGameCode=" + nMaskGameCode + "&oidMemo=" + volatileKey , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" );
			break;
		case 3 :	//¼±¹°
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_present&maskGameCode=" + nMaskGameCode + "&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=400,height=302" );
			break;
		case 5 :	//±æµåÃ¤ÆÃÃÊ´ë
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_guild_invite_chatting&maskGameCode=" + nMaskGameCode + "&oidMemo=" + volatileKey , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" ); // modify by you46(2005.11.16)
			break;
		case 6  :	//°æ°í
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_master_warning&maskGameCode=" + nMaskGameCode + "&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" );
			break;
		case 7  :	//±æµå
			switch( nNoteSubType )
			{
				case 1:
					window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_guild_group&maskGameCode=" + nMaskGameCode + "&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" );
					break;
				case 2:
					window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_clan_challenge&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=400,height=286" );
					break;
				case 3:
					window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_clan_challenge&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=400,height=286" );
					break;
				case 4:
					break;
				case 5:
					window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_clan_challenge&oidMemo=" + volatileKey , "_blank" , "scrollbars=no,resizable=no,width=400,height=286" );
					break;
			}
			break;
		case 8  :	//¿î¿µÀÚ
			window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=message/memo_master_notice&maskGameCode=" + nMaskGameCode + "&oidMemo=" + subCode , "_blank" , "scrollbars=no,resizable=no,width=370,height=268" );
			break;
	}
}

function _GuildCommunicator_ChangedUserInfo()
{
	if( typeof( Avatar_User ) == "object" )
	{
		Avatar_User.ChangeFace( GuildCommunicator.MyInfo.GetUserInfo().aiAvatarInfo.uEmotion );
	}
}

var s_bGuildMonitor = false;

function _GuildCommunicator_SetGuild_Monitor()
{
	if ( !s_bGuildMonitor )
		s_bGuildMonitor = true;
}

var strKartVirtuaUserName = "";
function SetKartVirtuaUserName()
{
	strKartVirtuaUserName = GuildCommunicator.MyInfo.GetVirtualUsers( 73985 );
}

function SetRefresh_VirtuaUserName()
{
	if( strKartVirtuaUserName != GuildCommunicator.MyInfo.GetVirtualUsers( 73985 ) )
		setCookie( "RefreshNickname", "1" );
}

function _GuildCommunicator_Init()
{
	document.write( "<script language='javascript' FOR='NxConn3' EVENT='onerror'>" );
	document.write( "	//alert( 'NxConn Install Error!!!' );" );
	document.write( "</script>" );

	document.write( "<script language='javascript' FOR='NxConn3' EVENT='OnNotify( event_code, param )'>" );
	document.write( "	NXC_EVENT.Handler( event_code, param );" );
	document.write( "</script>" );

	if( location.href.toLowerCase().indexOf("?url=login/loginmes") == -1 )
	{
		EVM.addHandler( EVM.k_nEventType_onServerMessage, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_serverMessageHandler ) );
		EVM.addHandler( EVM.k_nEventType_onChatStarted, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_startChatHandler ) );

		EVM.addHandler( EVM.k_nEventType_onDefaultChatRoomStarted, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_startDefaultChatRoomHandler ) );
		
		EVM.addHandler( EVM.k_nEventType_onChatRoomStarted, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_startChatRoomHandler ) );
		EVM.addHandler( EVM.k_nEventType_onUserInfoChanged, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_ChangedUserInfo ) );
		EVM.addCommand( EVM.k_nEventType_GuildOnlineInfoChanged, EVM.k_nPriority_normal, new EVMDelegator( _GuildCommunicator_SetGuild_Monitor ) );
	}
}

function _GuildCommunicator_AlarmMemoPaper()
{
	try
	{
		var n4MemoCount = GuildCommunicator.Note.GetUnreadCount();
		
		// 1) NINANADA(2004/06/03) : ·Î±×ÀÎÇßÀ» ¶§  ÀÐÁö¾ÊÀº ÂÊÁö°¡ ÀÖÀ¸¸é ÆË¾÷¶ç¿ì±â.		
		if( n4MemoCount != 0 && n4MemoCount != "" ) 
		{
			if( getCookies( "MP" ) != "1" )
			{
				window.open( "http://message.nexon.com/Nxcom/Page/Gnx.aspx?URL=Message/memo_alarm&n4Count=" + n4MemoCount, "MP", "scrollbars=no,resizable=no,width=370,height=250" );
			}
		}

		setCookie( 'MP', '1' );
	}
	catch( e )
	{}
}

var strKartVirtuaUserName = "";
function SetKartVirtuaUserName()
{
	strKartVirtuaUserName = GuildCommunicator.MyInfo.GetVirtualUsers( 73985 );
}

function SetRefresh_VirtuaUserName()
{
	if( strKartVirtuaUserName != GuildCommunicator.MyInfo.GetVirtualUsers( 73985 ) )
		setCookie( "RefreshNickname", "1" );
}

var GuildCommunicator = null;
_GuildCommunicator_Init();
