var FriendSystem =
{
	FunctionURL : 'http://friend.nexon.com/ajax/friend.aspx',

	GetCharacterIDList : function( n4GameCode, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendSystem.FunctionURL, 'GetCharacterIDList', callback );
		method.AppendParam( 'GC', n4GameCode );
		method.AppendStates( arguments, 2 );
		method.SendRequest();
	},

	GetFriendListByCategory : function( n4GameCode, oidCharacterSN, n4CategoryNo, n1IncludeBlocked, n1IncludeWaitConfirm, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendSystem.FunctionURL, 'GetFriendListByCategory', callback );
		method.AppendParam( 'GC', n4GameCode );
		method.AppendParam( 'VC', oidCharacterSN );
		method.AppendParam( 'CN', n4CategoryNo );
		method.AppendParam( 'IB', n1IncludeBlocked );
		method.AppendParam( 'IWC', n1IncludeWaitConfirm );
		method.AppendStates( arguments, 6 );
		method.SendRequest();
	},

	GetFriendCategoryList : function( n4GameCode, oidCharacterSN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendSystem.FunctionURL, 'GetFriendCategoryList', callback );
		method.AppendParam( 'GC', n4GameCode );
		method.AppendParam( 'OCS', oidCharacterSN );
		method.AppendStates( arguments, 3 );
		method.SendRequest();
	},

	IsMyFriend : function( n4GameCode, strCharacterID_friend, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendSystem.FunctionURL, 'IsMyFriend', callback );
		method.AppendParam( 'GC', n4GameCode );
		method.AppendParam( 'CDF', strCharacterID_friend );
		method.AppendStates( arguments, 3 );
		method.SendRequest();
	}
}

var FriendTool =
{
	FunctionURL : 'http://friend.nexon.com/ajax/friendtool.aspx',
	
	GetCharacterList : function( gameCode, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'GetCharacterList', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendStates( arguments, 2 );
		method.SendRequest();
	},

	GetCategoryList : function( gameCode, characterSN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'GetCategoryList', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendStates( arguments, 3 );
		method.SendRequest();
	},

	GetFriendList : function( gameCode, characterSN, categorySN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'GetFriendList', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'GN', categorySN );
		method.AppendStates( arguments, 4 );
		method.SendRequest();
	},

	AddCategory : function( gameCode, characterSN, categoryName, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'AddCategory', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'GN', categoryName );
		method.AppendStates( arguments, 4 );
		method.SendRequest();
	},

	RenameCategory : function( categorySN, categoryName, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'RenameCategory', callback );
		method.AppendParam( 'CN', categorySN );
		method.AppendParam( 'GN', categoryName );
		method.AppendStates( arguments, 3 );
		method.SendRequest();
	},

	DeleteCategory : function( categorySN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'DeleteCategory', callback );
		method.AppendParam( 'CN', categorySN );
		method.AppendStates( arguments, 2 );
		method.SendRequest();
	},

	AddFriend : function( gameCode, characterSN, categorySN, friendNexonSN, friendCharacterSN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'AddFriend', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'GN', categorySN );
		method.AppendParam( 'FN', friendNexonSN );
		method.AppendParam( 'FC', friendCharacterSN );
		method.AppendStates( arguments, 6 );
		method.SendRequest();
	},

	MoveFriend : function( gameCode, characterSN, fromCategorySN, toCategorySN, friendNexonSN, friendCharacterSN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'MoveFriend', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'FG', fromCategorySN );
		method.AppendParam( 'TG', toCategorySN );
		method.AppendParam( 'FN', friendNexonSN );
		method.AppendParam( 'FC', friendCharacterSN );
		method.AppendStates( arguments, 7 );
		method.SendRequest();
	},

	DeleteFriend : function( gameCode, characterSN, categorySN, friendNexonSN, friendCharacterSN, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'DeleteFriend', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'GN', categorySN );
		method.AppendParam( 'FN', friendNexonSN );
		method.AppendParam( 'FC', friendCharacterSN );
		method.AppendStates( arguments, 6 );
		method.SendRequest();
	},
	
	GetFriendRequestList : function( gameCode, pageSize, pageNo, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'GetFriendRequestList', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'PS', pageSize );
		method.AppendParam( 'PN', pageNo );
		method.AppendStates( arguments, 4 );
		method.SendRequest();
	},
	
	ConfirmCode :
	{
		OK		: 1,
		Deny	: 2
	},
	
	ConfirmFriendRequest : function( requestSN, confirmCode, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'ConfirmFriendRequest', callback );
		method.AppendParam( 'RN', requestSN );
		method.AppendParam( 'CC', confirmCode );
		method.AppendStates( arguments, 3 );
		method.SendRequest();
	},
	
	RequestNewFriend : function( gameCode, characterSN, characterName, targetCharacterName, message, callback )
	{
		var	method	= new NxamlLib.XmlHttpMethod( FriendTool.FunctionURL, 'RequestNewFriend', callback );
		method.AppendParam( 'GC', gameCode );
		method.AppendParam( 'CN', characterSN );
		method.AppendParam( 'CM', characterName );
		method.AppendParam( 'TC', targetCharacterName );
		method.AppendParam( 'MS', message );
		method.AppendStates( arguments, 6 );
		method.SendRequest();
	}
}
