
if(!this.PluginAPIMgr) {
	this.PluginAPIMgr = new Object();
}

PluginAPIMgr = {
	SPLITTER : null,

	RecognitionPluginAvailable : false
}
PluginAPIMgr.WidgetHandleIncomingCall = function(flag)
{
	alert("***** PluginAPIMgr.WidgetHandleIncomingCall()  : " + flag);
	return "";
	if(this.MoIPPlugin != null)
	{
		msg = this.MoIPPlugin.Execute("WidgetHandleIncomingCall", String(flag));
    	return msg;
	}
}
PluginAPIMgr.initPluginAPI = function() {
	alert("***** PluginAPIMgr.initPluginAPI()");

	var STX = String.fromCharCode(2);
	var ETX = String.fromCharCode(3);
	SPLITTER = ETX + STX;

}

PluginAPIMgr.closePluginAPI = function() {
	alert("***** PluginAPIMgr.closePluginAPI()");

}

///////////// <<<<< AppCommon API >>>>> ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.ShowSmartControlNumber = function() {
	alert("PluginAPIMgr.ShowSmartControlNumber");

	var result = this.AppCommonPlugin.Execute("ShowSmartControlNumber");

	return result;
}

PluginAPIMgr.HideSmartControlNumber = function() {
	alert("PluginAPIMgr.HideSmartControlNumber");

	var result = this.AppCommonPlugin.Execute("HideSmartControlNumber");

	return result;
}

PluginAPIMgr.FlagSmartControlNumber = function() {
	alert("PluginAPIMgr.FlagSmartControlNumber");

	var result = 0;//this.AppCommonPlugin.Execute("FlagSmartControlNumber");

	return parseInt(result);
}

PluginAPIMgr.SubscribeAppCommonEvent = function() {
	alert("PluginAPIMgr.SubscribeAppCommonEvent");

	var result = 0;//this.AppCommonPlugin.Execute("SubscribeEvent", "23");
	// PL_APPCOMMON_MESSAGE_INPUT_OCCUR

	return result;
}

PluginAPIMgr.UnsubscribeAppCommonEvent = function() {
	alert("PluginAPIMgr.UnsubscribeAppCommonEvent");

	var result =0;// this.AppCommonPlugin.Execute("UnsubscribeEvent", "23");
	// PL_APPCOMMON_MESSAGE_INPUT_OCCUR

	return result;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< ExternalWidgetInterface  API >>>>> ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SetMyStorageInfo = function(info) {
	alert("PluginAPIMgr.SetMyStorageInfo");

	var result =0;// this.ExWidgetInterfacePlugin.Execute("WriteWidgetData", "SkypeInfo", info, String(info.length), this.Widget_ID);

	this.MoIPPlugin.Execute("BackupWidgetData");
}

PluginAPIMgr.GetMyStorageInfo = function() {
	alert("PluginAPIMgr.GetMyStorageInfo");

	var result =0;// this.ExWidgetInterfacePlugin.Execute("ReadWidgetData", "SkypeInfo", this.Widget_ID);

	return result;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< Voice Recognition  API >>>>> ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SubscribeVoiceRecogEvent = function() {
	alert("***** PluginAPIMgr.SubscribeVoiceRecogEvent() ");

//	this.RecognitionPlugin.Execute("SubscribeEvent", "MESSAGE_RECOGNITION_VOICE", "Skype");
}

PluginAPIMgr.UnsubscribeVoiceRecogEvent = function() {
	alert("***** PluginAPIMgr.UnsubscribeVoiceRecogEvent() ");

	//this.RecognitionPlugin.Execute("UnsubscribeEvent", "MESSAGE_RECOGNITION_VOICE", "Skype");
}

PluginAPIMgr.SetVoiceHelpbarInfo = function(info) {
	alert("***** PluginAPIMgr.SetVoiceHelpbarInfo() " + info);
	//this.RecognitionPlugin.Execute("SetVoiceHelpbarInfo", info);
}

PluginAPIMgr.GetOnlineContacts = function() {
	alert("***** PluginAPIMgr.GetOnlineContacts() ");
	var msg = this.MoIPPlugin.Execute("GetOnlineContacts");

	return msg;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< FACE Recognition  API >>>>> ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PluginAPIMgr.GetVersionOfFaceRecogPlugin = function() {
	var msg = 0;//this.RecognitionPlugin.Execute("GetEngineVersion");
	alert("***** PluginAPIMgr.GetVersionOfFaceRecogPlugin() : " + msg);
	return parseFloat(msg);
}

PluginAPIMgr.ToggleFaceRecogEnable = function() {
	//if(parseInt(result)==0)
	alert("************" + PluginAPIMgr.isRecognitionEnable());
	if(PluginAPIMgr.isRecognitionEnable() != 1) {
		this.RecognitionPluginAvailable = false;
	} else {
		// if(PluginAPIMgr.GetVersionOfFaceRecogPlugin()>0)
		// {
		this.RecognitionPluginAvailable = true;
		this.InitializeFace();
		// }
		// else
		// {
		// this.RecognitionPluginAvailable = false;
		// }
	}
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< ExternalWidgetInterface  API >>>>> ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SetMyStorageInfo = function(info) {
	alert("PluginAPIMgr.SetMyStorageInfo");

}

PluginAPIMgr.GetMyStorageInfo = function() {
	alert("PluginAPIMgr.GetMyStorageInfo");

	var info = new Object();
	info.SkypeAccount = new Array();
	info.SkypeAccount[0] = new Object();
	info.SkypeAccount[0].id = "testID";
	info.SkypeAccount[0].face = "none";
	info.SkypeAccount[0].face_id = -1;
	info.SkypeAccount[0].pwd_check = false;
	info.SkypeAccount[0].pwd = "testPWD";

	var info_string = JSON.stringify(info);

	return info_string;
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< FACE Recognition  API >>>>> ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PluginAPIMgr.GetVersionOfFaceRecogPlugin = function() {
	var msg = "0";
	alert("***** PluginAPIMgr.GetVersionOfFaceRecogPlugin() : " + msg);
	return parseFloat(msg);
}

PluginAPIMgr.InitializeFace = function() {
	alert("***** PluginAPIMgr.InitializeFace() ");

	this.RecognitionPlugin.Execute("InitializeFace", "Skype");

	this.MoIPPlugin.Execute("RestoreWidgetData");
}

PluginAPIMgr.SetCallingViewRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetCallingViewRect() " );
  //  this.MoIPPlugin.Execute("SetCallingPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalRecvRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetNormalRecvRect() " );
  //  this.MoIPPlugin.Execute("SetNormalRecvRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalPreviewRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetNormalPreviewRect() " );
  //  this.MoIPPlugin.Execute("SetNormalPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetTVRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetTVRect() " );
   // this.MoIPPlugin.Execute("SetTvViewRect", String(x), String(y), String(w), String(h));    
}

PluginAPIMgr.SetTVRecvRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetTVRecvRect() " );
   // this.MoIPPlugin.Execute("SetTvRecvRect", String(x), String(y), String(w), String(h));    
}

PluginAPIMgr.SetTVPreviewRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetTVPreviewRect() " );
   // this.MoIPPlugin.Execute("SetTvPreviewRect", String(x), String(y), String(w), String(h));    
}

PluginAPIMgr.SetNormalRecvRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetDefaultRecvRect() " );
    
 //   this.MoIPPlugin.Execute("SetNormalRecvRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalPreviewRect = function(x, y, w, h)
{   
    alert("***** PluginAPIMgr.SetDefaultPreviewRect() " );
    	
  //  this.MoIPPlugin.Execute("SetNormalPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SubscribeFaceRecogEvent = function() {
	alert("***** PluginAPIMgr.SubscribeFaceRecogEvent() ");

	if(this.RecognitionPluginAvailable == true) {
		this.RecognitionPlugin.Execute("SubscribeEvent", "MESSAGE_RECOGNITION_FACE", "Skype");
		this.RecognitionPlugin.OnEvent = OnRecogEvent;
	}
}

PluginAPIMgr.UnsubscribeFaceRecogEvent = function() {
	alert("***** PluginAPIMgr.UnsubscribeFaceRecogEvent() ");

	this.RecognitionPlugin.Execute("UnsubscribeEvent", "MESSAGE_RECOGNITION_FACE", "Skype");
}

PluginAPIMgr.StartFaceRecognitionAll = function() {
	alert("***** PluginAPIMgr.StartFaceRecognitionAll() ");

	this.RecognitionPlugin.Execute("StartFaceRecognitionAll");
}

PluginAPIMgr.StopFaceRecognition = function() {
	alert("***** PluginAPIMgr.StopFaceRecognition() ");

	this.RecognitionPlugin.Execute("StopFaceRecognition");
}

PluginAPIMgr.StartFaceDetection = function() {
	alert("***** PluginAPIMgr.StartFaceDetection() ");

	this.RecognitionPlugin.Execute("StartFaceDetection");
}

PluginAPIMgr.StopFaceDetection = function() {
	alert("***** PluginAPIMgr.StopFaceDetection() ");

	this.RecognitionPlugin.Execute("StopFaceDetection");
}

PluginAPIMgr.StartFaceTraining = function(detect_info) {
	alert("***** PluginAPIMgr.StartFaceTraining() ");

	this.RecognitionPlugin.Execute("StartFaceTraining", detect_info);
}

PluginAPIMgr.StopFaceTraining = function() {
	alert("***** PluginAPIMgr.StopFaceTraining() ");

	this.RecognitionPlugin.Execute("StopFaceTraining");
}

PluginAPIMgr.EraseFace = function(id) {
	alert("***** PluginAPIMgr.EraseFace() ");

	this.RecognitionPlugin.Execute("EraseFace", String(id));
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////// <<<<< CAMERA  API >>>>> ////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SyncCameraState = function() {
	alert("***** PluginAPIMgr.SyncCameraState() -> return : " + 2);

	this.CameraState = 2;
}

PluginAPIMgr.GetCameraState = function() {
	alert("***** PluginAPIMgr.GetCameraState() -> return : " + this.CameraState);
	return this.CameraState;
}

PluginAPIMgr.SetCameraState = function(state) {

	if(state > ENUM_CAM_STATE.CAM_STATE_PLAYING) {
		alert("input state error");
		return;
	}

	this.CameraState = state;
}

PluginAPIMgr.StartRecord = function() {
	//msg = this.CameraPlugin.StartRecord();
	alert("***** PluginAPIMgr.StartRecord() ");

}

PluginAPIMgr.StartPreview = function(startX, startY, width, height) {
	alert("PluginAPIMgr.StartPreview");
}

PluginAPIMgr.StartMyVideo = function(startX, startY, width, height) {
	alert("PluginAPIMgr.StartMyVideo");
}

PluginAPIMgr.StopPreview = function() {
	alert("PluginAPIMgr.StopPreview");
}

PluginAPIMgr.Zoom = function(nlevel) {
}

PluginAPIMgr.TakeSnapShot = function() {
	alert("PluginAPIMgr.TakeSnapShot");
}

PluginAPIMgr.isAutoFocusEnable = function() {
	msg = "0";
	alert("PluginAPIMgr.isAutoFocusEnable : " + msg);
	return parseInt(msg);
};

PluginAPIMgr.StartCameraForFaceRecognition = function(startX, startY, width, height) {
	alert("PluginAPIMgr.StartCameraForFaceRecognition");
	//this.CameraPlugin.Execute("SetUsecase","0");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_SIGNAL_TYPE, "0");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_MIRROR, "0");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_LOCAL_MIRROR, "1");
	this.CameraPlugin.Execute("SetCamVideoDisplaySize", String(startX), String(startY), String(width), String(height));
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_BITRATE, "5000000");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_FRAMERATE, "30");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_DIMENSION, "1280", "720");
	this.CameraPlugin.Execute("StartCamVideo", "1", "2");
}

PluginAPIMgr.StopCameraForFaceRecognition = function() {
	alert("PluginAPIMgr.StopCameraForFaceRecognition");
	this.CameraPlugin.Execute("StopCamVideo");
	this.CameraPlugin.Execute("SetCamProperty", ENUM_CAM_PROPERTY.CAM_PROPERTY_SIGNAL_TYPE, "1");
	//this.CameraPlugin.Execute("SetUsecase","2");
}

PluginAPIMgr.isRecognitionEnable = function() {
	var msg = this.CameraPlugin.Execute("GetCamCapability", ENUM_CAM_CAPABILITY.CAM_CAPABILITY_SIGNAL_TYPE);
	alert("PluginAPIMgr.isRecognitionEnable : " + msg);
	return parseInt(msg);
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////// <<<<< PIG API >>>>>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.ChangeSource = function() {
	alert("Start ChangeSource");
	this.sefPlugin.Execute("SetPreviousSource");
	alert("End ChangeSource");
}

PluginAPIMgr.SetPIG = function(x, y, w, h) {
	alert("==== PluginAPIMgr.SetPIG(): x = " + x + ", y = " + y + ", w = " + w + ", h = " + h);
	ret = this.sefPlugin.Execute("SetScreenRect", x, y, w, h);
	alert("End SetPIG");
	return parseInt(ret);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///// AUI ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.PlayAudio = function(keyCode) {
	return;

	switch(keyCode) {
		case sf.key.UP:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_UP);
			break;
		case sf.key.DOWN:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_DOWN);
			break;
		case sf.key.LEFT:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_LEFT);
			break;
		case sf.key.RIGHT:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_RIGHT);
			break;

		case sf.key.ENTER:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_SELECT);
			break;

		case sf.key.RETURN:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_BACK);
			break;

		case sf.key.EXIT:
			this.AUIPlugin.Execute("PlayAudio", ENUM_AUDIO_TYPE.AUDIO_TYPE_BACK);
			break;
	}
}

PluginAPIMgr.PlayAudioByIndex = function(Index) {
	return;

	if(Index > 0 && Index < ENUM_AUDIO_TYPE.AUDIO_TYPE_MAX) {
		this.AUIPlugin.Execute("PlayAudio", Index);
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///// Regognition ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.IsGestureRecognitionEnabled = function() {
	if(this.RecognitionPluginAvailable == false) {
		return;
	}

	var result = this.RecognitionPlugin.Execute("IsGestureRecognitionEnabled");
	alert("***** PluginAPIMgr.IsGestureRecognitionEnabled()  : " + result);

	return parseInt(result);
}

PluginAPIMgr.EnableGestureRecognition = function() {
	if(this.RecognitionPluginAvailable == false) {
		return;
	}

	alert("***** PluginAPIMgr.EnableFaceRecognition()   ");
	this.RecognitionPlugin.Execute("EnableGestureRecognition");

	//this.IsGestureRecognitionEnabled();
}

PluginAPIMgr.DisableGestureRecognition = function() {
	if(this.RecognitionPluginAvailable == false) {
		return;
	}

	alert("***** PluginAPIMgr.DisableGestureRecognition()   ");
	this.RecognitionPlugin.Execute("DisableGestureRecognition");

	//this.IsGestureRecognitionEnabled();
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////// <<<<< SKYPE API >>>>>/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PluginAPIMgr.WidgetHandleIncomingCall = function(flag) {
	alert("***** PluginAPIMgr.WidgetHandleIncomingCall()  : " + flag);

	if(this.MoIPPlugin != null) {
		msg = this.MoIPPlugin.Execute("WidgetHandleIncomingCall", String(flag));
		return msg;
	}
}

PluginAPIMgr.IsSupportMultitasking = function() {
	if(this.MoIPPlugin != null) {
		msg = this.MoIPPlugin.Execute("IsSupportMultitasking");
		alert("***** PluginAPIMgr.IsSupportMultitasking() : " + msg);
		return parseInt(msg);
	}
}

PluginAPIMgr.IsSkypeSupportMultitasking = function() {
	if(this.MoIPPlugin != null) {
		msg = this.MoIPPlugin.Execute("IsSkypeSupportMultitasking");
		alert("***** PluginAPIMgr.IsSkypeSupportMultitasking() : " + msg);
		return parseInt(msg);
	}
}

PluginAPIMgr.IsWidgetSupportMultitasking = function() {
	if(this.MoIPPlugin != null) {
		msg = this.MoIPPlugin.Execute("IsWidgetSupportMultitasking");
		alert("***** PluginAPIMgr.IsWidgetSupportMultitasking() : " + msg);
		return parseInt(msg);
	}
}

PluginAPIMgr.RunPreviousApp = function() {
	if(this.MoIPPlugin != null) {
		msg = this.MoIPPlugin.Execute("RunPreviousApp");
		alert("***** PluginAPIMgr.RunPreviousApp() : " + msg);
		return parseInt(msg);
	}
}

PluginAPIMgr.SetSkypeWidgetState = function(state) {
	alert("***** PluginAPIMgr.SetSkypeWidgetState()  : " + state);

	return "1";
}

PluginAPIMgr.GetSkypeState = function() {
	//operating normally
	//msg = "1";

	//start begin!!
	msg = "0";
	alert("***** PluginAPIMgr.GetSkypeState() -> return : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.GetLoginState = function() {

	//login state
	msg = "0";
	//logout state
	//msg = "2";
	alert("***** PluginAPIMgr.GetLoginState() -> return : " + msg);

	return msg;
}

PluginAPIMgr.GetTVModel = function() {
	msg = "T-GAPAKUC";
	return msg;
}

PluginAPIMgr.SetRemoteInputType = function(type_enum) {
	alert("***** PluginAPIMgr.SetRemoteInputType()  : " + type_enum);
	if(type_enum) {
		this.MoIPPlugin.Execute("SetRemoteInputType", type_enum);
	} else {
		this.MoIPPlugin.Execute("SetRemoteInputType");
	}
}

PluginAPIMgr.HideConnectingWnd = function() {
	//this.MoIPPlugin.Execute("HideConnectingWnd");
}

PluginAPIMgr.IsInCall = function() {
	msg = VirtualEventMgr.IsInCall;

	alert("***** PluginAPIMgr.IsInCall() -> return : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.IsCallMemberVideoAvailable = function() {
	msg = "0";
	alert("***** PluginAPIMgr.IsCallMemberVideoAvailable() -> return : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.IsWidgetActivatedByAnswer = function() {
	msg = "0";
	alert("***** PluginAPIMgr.IsWidgetActivatedByAnswer() -> return : " + msg);

	return parseInt(msg);
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Login, Register, Logout  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SetLoginMode = function(mode) {
	alert("***** PluginAPIMgr.SetLoginMode() : " + mode);
	msg = this.MoIPPlugin.Execute("SetLoginMode", String(mode));
}

PluginAPIMgr.GetLoginMode = function() {
	msg = this.MoIPPlugin.Execute("GetLoginMode");
	return parseInt(msg);
}

PluginAPIMgr.GetLastLoginID = function(Index) {
	msg = "LastLoginID";
	return msg;
}

PluginAPIMgr.IsAutoSignInSet = function() {
	msg = "1";

	alert("***** PluginAPIMgr.IsAutoSignInSet()", msg);

	if(msg == "0") {
		return false;
	} else {
		return true;
	}
}

PluginAPIMgr.IsAutoStartSet = function() {
	msg = "0";

	alert("***** PluginAPIMgr.IsAutoSignInSet()", msg);
	if(msg == "0") {
		return false;
	} else {
		return true;
	}
}

PluginAPIMgr.SetAutoSignIn = function(b_auto_signin) {
	alert("***** PluginAPIMgr.SetAutoSignIn() : " + b_auto_signin)
	if(b_auto_signin == true) {
		msg = this.MoIPPlugin.Execute("SetAutoSignIn", "1");
	} else {
		msg = this.MoIPPlugin.Execute("SetAutoSignIn", "0");
	}
}

PluginAPIMgr.SetAutoStart = function(b_auto_start) {
	alert("***** PluginAPIMgr.SetAutoStart() : " + b_auto_start)
	if(b_auto_start==true)
    {
    	this.autostart = SID_ON;
        //msg =  this.MoIPPlugin.Execute("SetAutoStart", "1");
     }
     else
     {
     	this.autostart = SID_OFF;
        //msg =  this.MoIPPlugin.Execute("SetAutoStart", "0");
     }
}

PluginAPIMgr.IsDefaultAccountAvailable = function() {
	return 0;
	alert("***** PluginAPIMgr.IsDefaultAccountAvailable() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.AutoLogin = function() {
	alert("***** PluginAPIMgr.AutoLogin()")
	msg = this.MoIPPlugin.Execute("Login", PluginAPIMgr.GetLastLoginID(), "", "1");
	return msg;
}

PluginAPIMgr.Login = function() {
	alert("***** PluginAPIMgr.Login()" + g_Data.DATA_SIGNIN_INPUT_INFO.id + " : " + g_Data.DATA_SIGNIN_INPUT_INFO.pwd);

	VirtualEventMgr.vtLoggedInEvent();
}

PluginAPIMgr.Register = function() {
	alert("***** PluginAPIMgr.Register()" + g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id + " : " + g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.pwd);
	var flag1 = "0";
	var flag2 = "0";

	if(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.save_pwd == true) {
		flag1 = "1";
	}

	if(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.news == true) {
		flag2 = "1";
	}
	msg = this.MoIPPlugin.Execute("Register", g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id, g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.pwd, g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.email, flag1 + flag2);
}

PluginAPIMgr.Logout = function(clearPwd) {
	alert("***** PluginAPIMgr.Logout() clearPwd : " + clearPwd);
}

PluginAPIMgr.GetLogoutReason = function() {
	msg = this.MoIPPlugin.Execute("GetLogoutReason");
	alert("***** PluginAPIMgr.GetLogoutReason() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.NormalizeIdentityForNewAccount = function(s_id) {
	msg = this.MoIPPlugin.Execute("NormalizeIdentityForNewAccount", s_id);
	alert("***** PluginAPIMgr.NormalizeIdentityForNewAccount() : " + msg);
	return msg;
}

PluginAPIMgr.ValidatePasswd = function(s_id, s_pwd) {
	msg = this.MoIPPlugin.Execute("ValidatePasswd", s_id, s_pwd);
	alert("***** PluginAPIMgr.ValidatePasswd() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.ValidatePasswdWithoutID = function(s_pwd) {
	msg = this.MoIPPlugin.Execute("ValidatePasswdWithoutID", s_pwd);
	alert("***** PluginAPIMgr.ValidatePasswdWithoutID() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.IsValidEmail = function(s_email) {
	return 1;
	msg = this.MoIPPlugin.Execute("IsValidEmail", s_email);
	alert("***** PluginAPIMgr.IsValidEmail() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.GetSuggestedSkypeNameList = function() {
	return this.MoIPPlugin.Execute("GetSuggestedSkypeNameList");

}

PluginAPIMgr.SetCameraCheckDisable = function(b_auto_start) {
	alert("***** PluginAPIMgr.SetCameraCheckDisable() : " + b_auto_start)
	if(b_auto_start == true) {
		msg = this.MoIPPlugin.Execute("SetCameraCheckDisable", "1");
	} else {
		msg = this.MoIPPlugin.Execute("SetCameraCheckDisable", "0");
	}
}

PluginAPIMgr.GetCameraCheckDisable = function() {
	msg = "1";
	alert("***** PluginAPIMgr.GetCameraCheckDisable()", msg);
	if(msg == "0") {
		return false;
	} else {
		return true;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Account  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetAccountInfo = function(PROPERTY) {
	//alert("***** PluginAPIMgr.GetAccountInfo() -> property :" + PROPERTY);
	msg="";
	switch(PROPERTY) {
		case  ENUM_ACCOUNT_PROPERTY.P_SKYPENAME:
			msg = "TEST_SKYPENAME";
			break;
		case  ENUM_ACCOUNT_PROPERTY.P_FULLNAME:
			msg = "TEST_FULLNAME22222222222222222222222222";
			break;
		case  ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE:
			msg = "avatar/default_avatar_Angel.jpg";
			break;
		case  ENUM_ACCOUNT_PROPERTY.P_MOOD_TEXT:
			msg = "TEST_MOOD_TEXT";
			break;
		case  ENUM_ACCOUNT_PROPERTY.P_SKYPEOUT_BALANCE_CURRENCY:
			msg = "KRW";
			break;
		case  ENUM_ACCOUNT_PROPERTY.P_SKYPEOUT_BALANCE:
			msg = "616501";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_COUNTRY:
			msg = "kr";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_GENDER:
			if(this.genderdata)
				msg = this.genderdata;
			else
				msg = "1";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_BIRTHDAY:
			if(this.birthdate)
				msg = this.birthdate;
			else
				msg = "";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_PHONE_HOME:
			msg = "+8201062546249";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_PHONE_OFFICE:
			msg = "+8201062546241";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_PHONE_MOBILE:
			msg = "+8201062546245";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_CITY:
			msg = "where is my city";
			break;
		case ENUM_ACCOUNT_PROPERTY.P_PROVINCE:
			msg = "my province..";
			break;	
		case ENUM_ACCOUNT_PROPERTY.P_EMAILS:
			msg = "kjy023@naver.com";
			break;	
		case ENUM_ACCOUNT_PROPERTY.P_OFFLINE_CALLFORWARD:
			if(this.callforwardnumbers)
				msg = this.callforwardnumbers;
			else
				msg = "0,60,+8601062526249";
	}

	//alert("***** PluginAPIMgr.GetAccountInfo() -> return : " + msg);

	return msg;
}

PluginAPIMgr.GetMyDisplayName = function() {
	var full_name = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_FULLNAME);
	var skype_name = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_SKYPENAME);
	var display_name = "";

	if(full_name.length == 0) {
		display_name = skype_name;
	} else {
		display_name = full_name;
	}

	return display_name;

}

PluginAPIMgr.GetMySkyeName = function() {

	return PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_SKYPENAME);
}

PluginAPIMgr.GetMyMoodMsg = function() {
	var mood_msg = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_MOOD_TEXT);

	return mood_msg;
}

PluginAPIMgr.GetMyFullName = function() {
	var full_name = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_FULLNAME);

	return full_name;
}

PluginAPIMgr.GetMyEmail = function() {
	var email = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_EMAILS);

	return email;
}

PluginAPIMgr.GetMyAvataImage = function() {
	var avata_image = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE);
	if(avata_image.length == 0) {
		/*
		var gender = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_GENDER);
				if(gender == "1") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_MALE;
				} else if(gender == "2") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_FEMALE;
				} else {*/
		
			avata_image = g_Image.IMAGE_CHANGE_PICTURE_AVATAR;
	//	}
	} else {
		avata_image = avata_image + g_Data.GetImgSuffixPath();
		alert("GetMyAvataImage = " + avata_image);

	}

	return avata_image;
}

PluginAPIMgr.GetMyAvataImageForMain = function() {
	var avata_image = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE);
	if(avata_image.length == 0) {
		/*
		var gender = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_GENDER);
				if(gender == "1") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_MALE;
				} else if(gender == "2") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_FEMALE;
				} else {*/
		
			avata_image = g_Image.IMAGE_CHANGE_PICTURE_AVATAR;
	//	}
	} else {
		avata_image = avata_image + g_Data.GetImgSuffixPath();
		alert("GetMyAvataImageForMain = " + avata_image);

	}

	return avata_image;
}

PluginAPIMgr.GetMyAvataImageForCall = function() {
	var avata_image = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE);
	if(avata_image.length == 0) {
		/*
		var gender = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_GENDER);
				if(gender == "1") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_MALE;
				} else if(gender == "2") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_FEMALE;
				} else {*/
		
			avata_image = g_Image.IMAGE_CHANGE_PICTURE_AVATAR;
	//	}
	} else {
		avata_image = avata_image + g_Data.GetImgSuffixPath();
		alert("GetMyAvataImageForCall = " + avata_image);
	}

	return avata_image;
}

PluginAPIMgr.GetMyAvataImageForChat = function() {
	var avata_image = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE);
	if(avata_image.length == 0) {
		/*
		var gender = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_GENDER);
				if(gender == "1") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_MALE;
				} else if(gender == "2") {
					avata_image = g_Image.IMAGE_LIST_MAIN_ONLY_MY_DEFAULT_AVATA_FEMALE;
				} else {*/
		
			avata_image = g_Image.IMAGE_CHANGE_PICTURE_AVATAR;
	//	}
	} else {
		avata_image = avata_image + g_Data.GetImgSuffixPath();
		alert("GetMyAvataImageForChat = " + avata_image);

	}

	return avata_image;
}

PluginAPIMgr.GetMyOnlineStateImage = function() {
	var availability = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVAILABILITY);
	var availability_image = "";

	switch(parseInt(availability)) {
		case ENUM_ACCOUNT_AVAILABILITY.UNKNOWN:
		case ENUM_ACCOUNT_AVAILABILITY.OFFLINE:
		case ENUM_ACCOUNT_AVAILABILITY.NOT_AVAILABLE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_OFFLINE;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.CONNECTING:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_CONNECTING;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.INVISIBLE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_INVISIBLE;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.ONLINE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_ONLINE;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.AWAY:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_AWAY;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.DO_NOT_DISTURB:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_DO_NOT_DISTURB;
			break;

		case ENUM_ACCOUNT_AVAILABILITY.SKYPE_ME:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_AVAILABLE;
			break;

		default:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_OFFLINE;
			break;
	}

	return availability_image;
}

PluginAPIMgr.GetMyOnlineState = function() {
	var availability = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_AVAILABILITY);
	var availability_value = parseInt(availability);
	var result = availability_value;

	if(availability_value != ENUM_ACCOUNT_AVAILABILITY.INVISIBLE && availability_value != ENUM_ACCOUNT_AVAILABILITY.ONLINE && availability_value != ENUM_ACCOUNT_AVAILABILITY.AWAY && availability_value != ENUM_ACCOUNT_AVAILABILITY.DO_NOT_DISTURB) {
		result = ENUM_ACCOUNT_AVAILABILITY.OFFLINE;
	}

	return result;
}

PluginAPIMgr.GetMyCredit = function() {
	var balance = PluginAPIMgr.GetMyBalance();
	var balance_currency = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_SKYPEOUT_BALANCE_CURRENCY);

	var credit = balance + " " + balance_currency;

	return credit;
}

PluginAPIMgr.GetMyBalance = function() {
	var balance = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_SKYPEOUT_BALANCE);
	var int_balance = parseInt(balance);
	balance = (parseInt(int_balance)) / 100;

	return balance;
}

PluginAPIMgr.GetAccountCapability = function(property) {

	return this.MoIPPlugin.Execute("GetAccountCapability", String(property));
}
PluginAPIMgr.GetAccountCapabilityExpireDate = function(type) {
	msg = "Wed Jan 14 02:05:00 2032";
	alert("***** PluginAPIMgr.GetAccountCapabilityExpireDate() -> result :" + msg);
	return msg;
}

PluginAPIMgr.GetMyProvince = function() {
	var province = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_PROVINCE);

	return province;
}

PluginAPIMgr.GetMyCity = function() {
	var city = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_CITY);

	return city;
}

PluginAPIMgr.GetMyGender = function() {
	var gender = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_GENDER);

	return gender;
}

PluginAPIMgr.GetMyBirthDay = function() {
	var birth_day = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_BIRTHDAY);

	return birth_day;
}

PluginAPIMgr.GetMyVoiceMailExpireDate = function(type) {
	var vm_expire_date = PluginAPIMgr.GetAccountCapabilityExpireDate(ENUM_CONTACT_CAPABILITY.CAPABILITY_VOICEMAIL);
	return vm_expire_date;
}

PluginAPIMgr.SetProp = function(PROPERTY, set_value) {
	alert("***** PluginAPIMgr.SetProp() : " + PROPERTY + "value : " + set_value);
	if(PROPERTY == ENUM_ACCOUNT_PROPERTY.P_GENDER)
		this.genderdata = set_value;
	else if(PROPERTY == ENUM_ACCOUNT_PROPERTY.P_BIRTHDAY)
		this.birthdate = set_value;
	else
		msg = this.MoIPPlugin.Execute("SetProp", String(PROPERTY), set_value);
}

PluginAPIMgr.GetMyHomePhone = function() {
	var home_phone = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_PHONE_HOME);

	return home_phone;
}

PluginAPIMgr.GetMyOfficePhone = function() {
	var office_phone = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_PHONE_OFFICE);

	return office_phone;
}

PluginAPIMgr.GetMyMobilePhone = function() {
	var mobile_phone = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_PHONE_MOBILE);

	return mobile_phone;
}
/*

 PluginAPIMgr.SetFullName = function(full_name) {
 alert("***** PluginAPIMgr.SetFullName()  :" + full_name);
 PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_FULLNAME, full_name);
 }

 PluginAPIMgr.SetCountryCode = function(country_code) {
 alert("***** PluginAPIMgr.SetCountryCode()  :" + country_code);
 PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_COUNTRY, country_code);
 }
 */

PluginAPIMgr.SetAvailability = function(setIndex) {
	alert("***** PluginAPIMgr.SetAvailability() -> property :" + setIndex);
	this.MoIPPlugin.Execute("SetAvailability", String(setIndex));
}

PluginAPIMgr.SetMyAvatar = function(ImgPath) {
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_AVATAR_IMAGE, ImgPath);
}

PluginAPIMgr.GetMyCountryCode = function() {
	var country_code = PluginAPIMgr.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_COUNTRY);
	//alert("***** PluginAPIMgr.GetMyCountryCode() -> result :" + country_code);
	return country_code;
}

PluginAPIMgr.GetMyCountryPrefix = function() {
	var country_code = PluginAPIMgr.GetMyCountryCode();
	return PluginAPIMgr.GetISOCountryPrefix(country_code);
}

PluginAPIMgr.GetMyCountryName = function(code) {
	var country_code;
	if(code==null)
		country_code = PluginAPIMgr.GetMyCountryCode();
	else
		country_code = code;
	return PluginAPIMgr.GetISOCountryName(country_code);
}

PluginAPIMgr.GetMyCountryFlag = function() {
	var country_code = PluginAPIMgr.GetMyCountryCode();
	if(country_code.length > 0) {
		return g_Image.base_flag_image_path + country_code.toUpperCase() + ".png";
	} else {
		return "";
	}
}

PluginAPIMgr.GetISOCountryName = function(country_code) {

	var LangCode = ResMgr.GetCurSkypeLanguageCode();
	return "Korea, South";
	return this.MoIPPlugin.Execute("GetISOCountryName", country_code, LangCode);

}

PluginAPIMgr.GetISOCountryPrefix = function(country_code) {
	return "82";
	msg = this.MoIPPlugin.Execute("GetISOCountryPrefix", country_code);

	alert("***** PluginAPIMgr.GetISOCountryPrefix() : " + msg);
	return msg;
}

PluginAPIMgr.NormalizeIdentity = function(phone_number) {
	msg = "015915";//this.MoIPPlugin.Execute("NormalizeIdentity", phone_number);

	alert("***** PluginAPIMgr.NormalizeIdentity() : " + msg);
	return msg;
}

PluginAPIMgr.IsEmergencyCall = function(phone_number) {
	msg = "0";//this.MoIPPlugin.Execute("IsEmergencyCall", phone_number);

	alert("***** PluginAPIMgr.IsEmergencyCall() : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.GetLocalNumber = function(phone_number) {
	if(phone_number.length>3)
		return phone_number.substring(3);
	else
		return "";
	var local_number = this.MoIPPlugin.Execute("GetLocalNumber", phone_number);

	alert("***** PluginAPIMgr.GetLocalNumber() : " + local_number);
	return local_number;
}

PluginAPIMgr.FindCountryCodeByNumber = function(phone_number) {
	if(phone_number[2]==6){
		return "cn";
	}else
		return "kr";
	var country_code = this.MoIPPlugin.Execute("FindCountryCodeByNumber", phone_number);

	alert("***** PluginAPIMgr.FindCountryCodeByNumber() : " + country_code);
	return country_code;
}

PluginAPIMgr.GetAccountCapability = function(type) {
    msg = "1";//this.MoIPPlugin.Execute("GetAccountCapability", type);

	alert("***** PluginAPIMgr.GetAccountCapability() : " + msg);
	return msg;
}

PluginAPIMgr.SetMoodMsg = function(mood_msg) {
	alert("***** PluginAPIMgr.SetMoodMsg()  :" + mood_msg);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_MOOD_TEXT, mood_msg);
}

PluginAPIMgr.SetFullName = function(full_name) {
	alert("***** PluginAPIMgr.SetFullName()  :" + full_name);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_FULLNAME, full_name);
}

PluginAPIMgr.SetEmail = function(email) {
	alert("***** PluginAPIMgr.SetEmail()  :" + email);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_EMAILS, email);
}

PluginAPIMgr.SetCountryCode = function(country_code) {
	alert("***** PluginAPIMgr.SetCountryCode()  :" + country_code);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_COUNTRY, country_code);
}

PluginAPIMgr.SetHomePhone = function(home_phone) {
	alert("***** PluginAPIMgr.SetHomePhone()  :" + home_phone);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_PHONE_HOME, home_phone);
}

PluginAPIMgr.SetOfficePhone = function(office_phone) {
	alert("***** PluginAPIMgr.SetOfficePhone()  :" + office_phone);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_PHONE_OFFICE, office_phone);
}

PluginAPIMgr.SetMobilePhone = function(mobile_phone) {
	alert("***** PluginAPIMgr.SetMobilePhone()  :" + mobile_phone);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_PHONE_MOBILE, mobile_phone);
}

PluginAPIMgr.SetProvince = function(province) {
	alert("***** PluginAPIMgr.SetProvince()  :" + province);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_PROVINCE, province);
}

PluginAPIMgr.SetCity = function(city) {
	alert("***** PluginAPIMgr.SetCity()  :" + city);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_CITY, city);
}

PluginAPIMgr.SetGender = function(gender_code) {
	alert("***** PluginAPIMgr.SetGender()  :" + gender_code);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_GENDER, gender_code);
	//0 =null, 1=man 2=femail
}

PluginAPIMgr.SetBirthDate = function(birth_day) {
	alert("***** PluginAPIMgr.SetBirthDate()  :" + birth_day);
	PluginAPIMgr.SetProp(ENUM_ACCOUNT_PROPERTY.P_BIRTHDAY, birth_day);
}
/////////////////////////////////////////////
PluginAPIMgr.ChangePassword = function() {
	alert("***** PluginAPIMgr.ChangePassword() old : " + g_Data.DATA_CHANGE_PWD_INPUT_INFO.old_pwd + " new :  " + g_Data.DATA_CHANGE_PWD_INPUT_INFO.new_pwd);
	msg = this.MoIPPlugin.Execute("ChangePassword", g_Data.DATA_CHANGE_PWD_INPUT_INFO.old_pwd, g_Data.DATA_CHANGE_PWD_INPUT_INFO.new_pwd);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Contact List ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetContactPropWithName = function(Name, ContactProp) {
	switch(ContactProp) {
		case ENUM_CONTACT_PROPERTY.P_SKYPENAME:
			msg = "SkypeName";
			break;
		case ENUM_CONTACT_PROPERTY.P_PSTNNUMBER:
			msg = "TestNumber 123-4567";
			break;
		case ENUM_CONTACT_PROPERTY.P_TYPE:
			msg = "0";
			break;
		case ENUM_CONTACT_PROPERTY.P_FULLNAME:
			msg = "FullName";
			break;
		case ENUM_CONTACT_PROPERTY.P_AVATAR_IMAGE:
			msg = "avatar/default_avatar_Behind.jpg";
			break;
		default :
			msg = "0";
	}

	return msg;
}

PluginAPIMgr.GetAvatarPath = function(Name) {

	var Avatar = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_AVATAR_IMAGE);
	alert("GetAvatarPath = " + Avatar);

	if(Avatar) {
		return Avatar + g_Data.GetImgSuffixPath();
	} else if(PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {

		return g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_PSTN;
	} else if(Name == "echo123") {

		return g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_TEST_CALL;
	} else {

		var Gender = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_GENDER);

		if(Gender == "1") {

			return g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_MALE;
		} else if(Gender == "2") {

			return g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_FEMALE;
		} else {

			return g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_NO_GENDER;
		}
	}
}

PluginAPIMgr.GetAvatarType = function(Name) {

	var Avatar = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_AVATAR_IMAGE);

	if(Avatar) {

		return ENUM_CONTACT_AVATA_TYPE.ONES_IMAGE;
	} else if(PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {

		return ENUM_CONTACT_AVATA_TYPE.PSTN;
	} else if(Name == "echo123") {

		return ENUM_CONTACT_AVATA_TYPE.TEST_CALL;
	} else {

		var Gender = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_GENDER);

		if(Gender == "1") {

			return ENUM_CONTACT_AVATA_TYPE.MALE;
		} else if(Gender == "2") {

			return ENUM_CONTACT_AVATA_TYPE.FEMALE;
		} else {
			return ENUM_CONTACT_AVATA_TYPE.NO_GENDER;
		}
	}
}

PluginAPIMgr.GetContactPropWithIndex = function(nIndex, ContactProp) {
	switch(ContactProp) {
		case ENUM_CONTACT_PROPERTY.P_SKYPENAME:
			msg = "SkypeName";
			break;
		case ENUM_CONTACT_PROPERTY.P_PSTNNUMBER:
			msg = "TestNumber 123-4567";
			break;
		case ENUM_CONTACT_PROPERTY.P_TYPE:
			msg = "0";
			break;
		case ENUM_CONTACT_PROPERTY.P_FULLNAME:
			msg = "FullName";
			break;

		default :
			msg = "0";
	}

	return msg;

}

PluginAPIMgr.GetIndexOfContact = function(Name) {
	return " ";// this.MoIPPlugin.Execute("GetIndexOfContact", Name);	
}

PluginAPIMgr.GetContactNameWithIndex = function(nIndex) {
	var skype_name = PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_SKYPENAME);

	if(skype_name.length > 0) {
		return skype_name;
	} else {
		var pstn_number = PluginAPIMgr.GetPSTNNumberWithIndex(nIndex)
		return pstn_number;
	}
}

PluginAPIMgr.GetPSTNNumberWithIndex = function(nIndex) {
	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER);

}

PluginAPIMgr.GetNameWithIndex = function(nIndex) {
	var name = PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_DISPLAYNAME);

	if(name) {
		return name;
	}
	name = PluginAPIMgr.GetContactNameWithIndex(nIndex);

	if(name) {
		return name;
	}
	name = PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER);

	if(name) {
		return name;
	}

	return " ";

}

PluginAPIMgr.GetContactAvailabilityWithName = function(Name) {
	return PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_AVAILABILITY);
}

PluginAPIMgr.GetContactAvailabilityWithIndex = function(nIndex) {
	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_AVAILABILITY);
}

PluginAPIMgr.GetHomePhoneNumberWithIndex = function(nIndex) {
	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_PHONE_HOME);
}

PluginAPIMgr.GetOfficePhoneNumberWithIndex = function(nIndex) {
	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_PHONE_OFFICE);
}

PluginAPIMgr.GetMobilePhoneNumberWithIndex = function(nIndex) {
	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_PHONE_MOBILE);
}

PluginAPIMgr.GetHomePhoneNumberWithName = function(Name) {
	alert("PluginAPIMgr.GetHomePhoneNumberWithName");
	return PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PHONE_HOME);
}

PluginAPIMgr.GetOfficePhoneNumberWithName = function(Name) {
	return PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PHONE_OFFICE);
}

PluginAPIMgr.GetMobilePhoneNumberWithName = function(Name) {
	return PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PHONE_MOBILE);
}

PluginAPIMgr.GetAssignedPhoneNumberWithName = function(Identity, prop) {
	var property;
	switch(prop) {
		case 2:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE1_LABEL;
			break;
		case 3:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE2;
			break;
		case 4:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE2_LABEL;
			break;
		case 5:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE3;
			break;
		case 6:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE3_LABEL;
			break;
		case 1:
		default:
			property = ENUM_CONTACT_PROPERTY.P_ASSIGNED_PHONE1;
			break;

	}

	return PluginAPIMgr.GetContactPropWithName(Identity, String(property));
}

PluginAPIMgr.GetPhoneNumberCnt = function (TargetIdentity, WithUsrPhn) {

	var AssignedLabel = null;
	var Count = 0;

	if(WithUsrPhn == true) {
		AssignedLabel = PluginAPIMgr.GetHomePhoneNumberWithName(TargetIdentity);
		if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
			AssignedLabel = null;
			Count++;
		}

		AssignedLabel = PluginAPIMgr.GetOfficePhoneNumberWithName(TargetIdentity);	
		if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
			AssignedLabel = null;
			Count++;
		}

		AssignedLabel = PluginAPIMgr.GetMobilePhoneNumberWithName(TargetIdentity);
		if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
			AssignedLabel = null;
			Count++;
		}
	}
	
	for(var i=1; i<7; i++) {

		AssignedLabel = PluginAPIMgr.GetAssignedPhoneNumberWithName(TargetIdentity,++i);

		if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
			AssignedLabel = null;
			Count++;
		}
	}

	alert("PluginAPIMgr.GetPhoneNumberCnt = " + Count);
	return Count;
}

PluginAPIMgr.SetAssignedPhoneNumber = function(Identity, prop, PhoneLabel, PhoneNumber) {
	return this.MoIPPlugin.Execute("SetAssignedPhoneNumber", Identity, String(prop), PhoneLabel, PhoneNumber);
}

PluginAPIMgr.GetContactList = function(ContactName) { SPLITTER
	stContactlist = "Name1" + SPLITTER
	var contact1 = "Echo12" + SPLITTER + "PSTN 1" + SPLITTER + "echo123" + SPLITTER + "7" + SPLITTER + "0" + SPLITTER + "avatar/default_avatar_Behind.jpg" + SPLITTER + "Hey Judy, don't make ..." + SPLITTER;
	var contact2 = "Jeongyeol 2" + SPLITTER + "PSTN 2" + SPLITTER + "Jeongyeol Kim" + SPLITTER + "7" + SPLITTER + "1" + SPLITTER + "avatar/default_avatar_CallMe.jpg" + SPLITTER + "You're a girl" + SPLITTER;
	var contact3 = "qoodang 3" + SPLITTER + "PSTN 3" + SPLITTER + "qoodang" + SPLITTER + "5" + SPLITTER + "0" + SPLITTER + "avatar/default_avatar_Chic.jpg" + SPLITTER + "Lagenka Save us, Woo~~~" + SPLITTER;
	var contact4 = "Jason 4" + SPLITTER + "PSTN 4" + SPLITTER + "DongHee" + SPLITTER + "5" + SPLITTER + "1" + SPLITTER + "avatar/default_avatar_Party.jpg" + SPLITTER + "Mood message here we go" + SPLITTER;
	var contact5 = "Jerry 5" + SPLITTER + "PSTN 5" + SPLITTER + "Jason Kim Jason Kim Jason Kim" + SPLITTER + "0" + SPLITTER + "0" + SPLITTER + "" + SPLITTER + "Hey man, What the Fxxk" + SPLITTER;
	var contact6 = "Seonggyoon 6" + SPLITTER + "PSTN 6" + SPLITTER + "Jerry JJang JJang JJang JJang JJang JJang" + SPLITTER + "0" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "give and take OK??" + SPLITTER;
	var contact7 = "Kim Sang Woo 7" + SPLITTER + "PSTN 6" + SPLITTER + "GangNam Style PSY" + SPLITTER + "0" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "give and take OK??" + SPLITTER;
	var contact8 = "Kim Nam Joo 8" + SPLITTER + "PSTN 6" + SPLITTER + "echo123echo123echo123echo123echo123JJang JJang JJang" + SPLITTER + "0" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "give and take OK??" + SPLITTER;
	var contact9 = "Euny Jo 9" + SPLITTER + "PSTN 6" + SPLITTER + "Jerryecho123echo123echo123echo123echo123 JJang" + SPLITTER + "0" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "give and take OK??" + SPLITTER;
	msg = contact1 + contact2 + contact3 + contact4 + contact5;// + contact6;// + contact7 + contact8 + contact9;

	return msg;
}

PluginAPIMgr.GetLiveContactList = function(StartIndex) {
	return this.MoIPPlugin.Execute("GetContactListWithoutCallMember", StartIndex + "", "4");
}

PluginAPIMgr.GetContactListInPopupMode = function(StartIndex) {
	return this.MoIPPlugin.Execute("GetContactListWithoutUnauthorizedContacts", StartIndex + "", "5");
}

PluginAPIMgr.GetLiveContactListInPopupMode = function(StartIndex) {
	return this.MoIPPlugin.Execute("GetContactListWithoutCallMemberAndUnauthorizedContacts", StartIndex + "", "4");
}

PluginAPIMgr.GetNumberOfContacts = function() {
	return 6;
}

PluginAPIMgr.GetNumberOfContactsInPopupMode = function() {

	var NumOfContact = this.MoIPPlugin.Execute("GetNumOfContactsWithoutUnauthorizedContacts");

	if(NumOfContact == null) {
		return 0;
	} else {

		return parseInt(NumOfContact);
	}
}

PluginAPIMgr.BlockContact = function(Name, RemoveOption) {
	var option;

	if(RemoveOption) {
		option = '1';
	} else {
		option = '0';
	}

	this.MoIPPlugin.Execute("Block", Name, option);
}

PluginAPIMgr.UnblockContact = function(Name) {
	this.MoIPPlugin.Execute("Unblock", Name);
}

PluginAPIMgr.RemoveContact = function(Name) {
	this.MoIPPlugin.Execute("Remove", Name);
}

PluginAPIMgr.AuthorizeContact = function(Name) {
	msg = this.MoIPPlugin.Execute("Authorize", Name);
}

PluginAPIMgr.RejectAndBlock = function(Name, Block) {
	msg = this.MoIPPlugin.Execute("RejectAndBlock", Name, Block);
}

PluginAPIMgr.RenameContact = function(ContactName, Display) {
	this.MoIPPlugin.Execute("Rename", ContactName, Display);
}

PluginAPIMgr.GetBlockList = function() {
//	return this.MoIPPlugin.Execute("GetBlockedContactList");
}

PluginAPIMgr.IsMyBuddy = function(Identity) {
	var result = this.MoIPPlugin.Execute("IsMyBuddy", Identity);

	if(result == '1') {
		return true;
	} else {
		return false;
	}
}

PluginAPIMgr.HasVoiceMailCapability = function(Identity) {
	var result = '1';//this.MoIPPlugin.Execute("HasVoiceMailCapability",Identity);

	if(result == '1') {
		return true;
	} else {
		return false;
	}
}

PluginAPIMgr.GetContactAvataImage = function(Name) {
	var Avatar_image = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_AVATAR_IMAGE);

	if(Avatar_image.length == 0) {
		if(PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {
			Avatar_image = g_Image.IMAGE_LIST_MAIN_MY_DEFAULT_AVATA_PSTN;
		} else if(Name == "echo123") {
			Avatar_image = g_Image.IMAGE_LIST_MAIN_MY_DEFAULT_AVATA_TEST_CALL;
		} else {
			var Gender = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_GENDER);

			if(Gender == "1") {
				Avatar_image = g_Image.IMAGE_LIST_MAIN_MY_DEFAULT_AVATA_MALE;
			} else if(Gender == "2") {
				Avatar_image = g_Image.IMAGE_LIST_MAIN_MY_DEFAULT_AVATA_FEMALE;
			} else {
				Avatar_image = g_Image.IMAGE_LIST_MAIN_MY_DEFAULT_AVATA_NO_GENDER;
			}
		}
	} else {
		Avatar_image = Avatar_image + g_Data.GetImgSuffixPath();
	}

	return Avatar_image;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  History List ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetHistoryList = function(Index) {
//	return this.MoIPPlugin.Execute("GetHistoryListIncludingTimestamp", "" + Index, "6", "0");
	SPLITTER
	stContactlist = "Name1" + SPLITTER
	var contact1 = "1" + SPLITTER + "PSTN 1" + SPLITTER + "Name 1" + SPLITTER + "7" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "Mood1" + SPLITTER;
	var contact2 = "Contact 2" + SPLITTER + "PSTN 2" + SPLITTER + "Name 2" + SPLITTER + "7" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "Mood2" + SPLITTER;
	var contact3 = "Contact 3" + SPLITTER + "PSTN 3" + SPLITTER + "Name 3" + SPLITTER + "5" + SPLITTER + "0" + SPLITTER + "" + SPLITTER + "Mood3" + SPLITTER;
	var contact4 = "Contact 4" + SPLITTER + "PSTN 4" + SPLITTER + "Name 4" + SPLITTER + "5" + SPLITTER + "1" + SPLITTER + "avatar/default_avatar_Party.jpg" + SPLITTER + "Mood4" + SPLITTER;
	var contact5 = "Contact 5" + SPLITTER + "PSTN 5" + SPLITTER + "Name 5" + SPLITTER + "0" + SPLITTER + "0" + SPLITTER + "" + SPLITTER + "Mood5" + SPLITTER;
	var contact6 = "Contact 6" + SPLITTER + "PSTN 6" + SPLITTER + "Name 6" + SPLITTER + "0" + SPLITTER + "1" + SPLITTER + "" + SPLITTER + "Mood6" + SPLITTER;

	msg =  contact1 + contact2 + contact3 + contact4 + contact5;// + contact6;
		
	return msg;   	  
}

PluginAPIMgr.GetNumberOfHistorys = function() {
	return 6;//this.MoIPPlugin.Execute("GetNumOfHistories");
}

PluginAPIMgr.GetHistoryPropWithIndex = function(nIndex, HistoryProp) {
//    return this.MoIPPlugin.Execute("GetHistoryPropWithIndex",""+ nIndex ,""+HistoryProp);

	switch(HistoryProp)
	{
		case ENUM_HISTORY_PROPERTY.P_SKYPENAME: 
			msg = "SkypeName";
			break;
		case ENUM_HISTORY_PROPERTY.P_DISPNAME: 
			msg = "DISPNAME";
			break;
		case ENUM_HISTORY_PROPERTY.P_PSTNNUMBER: 
			msg = "TestNumber 123-4567";
			break;		
		case ENUM_HISTORY_PROPERTY.P_TYPE: 
			msg = "0";
			break;
		case ENUM_CONTACT_PROPERTY.P_FULLNAME: 
			msg = "FullName";
			break;			
		
		default :
			msg = "0";
}

	return msg;
}

PluginAPIMgr.GetHistoryNameWithIndex = function(nIndex) {
	return "Skype_Name";//this.MoIPPlugin.Execute("GetHistoryPropWithIndex" ,"" + nIndex ,"" + ENUM_HISTORY_PROPERTY.P_SKYPENAME);   

}

//for displayname....
PluginAPIMgr.GetHistoryParticipantsWithIndex = function(nIndex) {
	var Participants = this.MoIPPlugin.Execute("GetHistoryPropWithIndex", "" + nIndex, "" + ENUM_HISTORY_PROPERTY.P_PARTICIPANTS);

	var DisplayName = "";
	var NamesNumber = 0;

	var Array = Participants.split(',');

	for(var j = 0; j < Array.length; j++) {
		NamesNumber++;

		if(NamesNumber == Array.length) {
			DisplayName = DisplayName + PluginAPIMgr.GetChatMemberDisplayName(Array[j]);
		} else {
			DisplayName = DisplayName + PluginAPIMgr.GetChatMemberDisplayName(Array[j]) + ", ";
		}
	}

	alert("DisplayName --> " + DisplayName);

	return DisplayName;

}

PluginAPIMgr.GetHistoryPropWithTimeStamp = function(sTimeStamp, HistoryProp) {
	return this.MoIPPlugin.Execute("GetHistoryPropWithTimestamp", sTimeStamp, "" + HistoryProp);

}
PluginAPIMgr.GetIndexOfHistory = function(sTimeStamp) {
	return " "; // this.MoIPPlugin.Execute("GetHistoryIndexWithTimestamp", sTimeStamp);

}

PluginAPIMgr.PlayHistoryVoicemail = function(nIndex) {
	return this.MoIPPlugin.Execute("PlayVoicemail", "" + nIndex);
}

PluginAPIMgr.StopHistoryVoicemail = function(nIndex) {
	return this.MoIPPlugin.Execute("StopVoicemail", "" + nIndex);

}

PluginAPIMgr.RemoveHistory = function(Index) {
	this.MoIPPlugin.Execute("DeleteHistory", "" + Index);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Country List    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetCountryList = function(LangCode) {
	return "kr";
	return this.MoIPPlugin.Execute("GetCountryList", LangCode);
}

PluginAPIMgr.GetCountryWithIndex = function(nIndex) {

	return PluginAPIMgr.GetContactPropWithIndex(nIndex, ENUM_CONTACT_PROPERTY.P_COUNTRY);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///// Chat List ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetChatList = function(Index) {
	return this.MoIPPlugin.Execute("GetChatListWithIndex", "" + Index, '6', '0');
}

PluginAPIMgr.GetNumberOfChatList = function() {
	return this.MoIPPlugin.Execute("GetNumOfChatList");

}

PluginAPIMgr.GetChatPropertyWithIndex = function(Index, Prop) {
	return this.MoIPPlugin.Execute("GetChatProperty", String(Index), String(Prop));

}

PluginAPIMgr.GetTotalNumOfUnReadChats = function() {
	var NumOfMessage = "2";

	return parseInt(NumOfMessage);

}

PluginAPIMgr.GetTotalNumOfUnReadMessages = function() {
	var NumOfMessage = "7";

	return parseInt(NumOfMessage);

}

PluginAPIMgr.RemoveChat = function(ChatName) {
	return this.MoIPPlugin.Execute("LeaveChat", ChatName);

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Call   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetPreviousPhoneNumberList = function() {
	return this.MoIPPlugin.Execute("GetSkypeOutHistoryList");
}

PluginAPIMgr.AnswerWithVideo = function() {
	alert("***** PluginAPIMgr.AnswerWithVideo()");
	this.MoIPPlugin.Execute("AnswerWithVideo");
}

PluginAPIMgr.AnswerWithVoice = function() {
	alert("***** PluginAPIMgr.AnswerWithVoice()");
	this.MoIPPlugin.Execute("AnswerWithVoice");
}

PluginAPIMgr.CreateCall = function() {
	alert("***** PluginAPIMgr.CreateCall() -> callee_name :" + g_Data.DATA_CREATE_CALL_INPUT_INFO.callee_name + " call_type : " + g_Data.DATA_CREATE_CALL_INPUT_INFO.call_type);
	var result = "1";

	//VirtualEventMgr.vtInprogressEvent();

	alert("***** PluginAPIMgr.CreateCall() result -> " + result);
	return parseInt(result);
}

PluginAPIMgr.DisconnectCall = function(endType) {
	alert("***** PluginAPIMgr.DisconnectCall()");
	if(endType) {
		this.MoIPPlugin.Execute("CallEnd", "1");
	} else {
		this.MoIPPlugin.Execute("CallEnd", "0");
	}

}

PluginAPIMgr.GetCallType = function() {
	msg = "1";
	alert("***** PluginAPIMgr.GetCallType() : " + msg);

	return msg;
}

PluginAPIMgr.GetCallInfo = function() {
//	msg = this.MoIPPlugin.Execute("GetCallInfo");
msg="0";
	alert("***** PluginAPIMgr.GetCallInfo() : " + msg);

	return msg;
}

PluginAPIMgr.IsConference = function() {
	msg = "0";
	alert("***** PluginAPIMgr.IsConference() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.IsSendingVideo = function() {
	msg = "1";

	alert("***** PluginAPIMgr.IsSendingVideo() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.SetMainVideoRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetMainVideoRect() ");

	//this.MoIPPlugin.Execute("SetExtVideoDisplaySize", String(x), String(y), String(w), String(h));

	//msg =  this.CameraPlugin.Execute("SetExtVideoDisplaySize", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetSubVideoRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetSubVideoRect() ");

	//this.MoIPPlugin.Execute("SetCamVideoDisplaySize", String(x), String(y), String(w), String(h));

	//msg =  this.CameraPlugin.Execute("SetCamVideoDisplaySize", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetCameraLightMode = function() {
	alert("***** PluginAPIMgr.SetCameraLightMode() ");
//	this.MoIPPlugin.Execute("SetCameraLightMode");
}

PluginAPIMgr.SetCallingViewRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetCallingViewRect() ");
//	this.MoIPPlugin.Execute("SetCallingPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalRecvRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetNormalRecvRect() ");
//	this.MoIPPlugin.Execute("SetNormalRecvRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalPreviewRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetNormalPreviewRect() ");
//	this.MoIPPlugin.Execute("SetNormalPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetTVRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetTVRect() ");
//	this.MoIPPlugin.Execute("SetTvViewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetTVRecvRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetTVRecvRect() ");
//	this.MoIPPlugin.Execute("SetTvRecvRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetTVPreviewRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetTVPreviewRect() ");
//	this.MoIPPlugin.Execute("SetTvPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetNormalRecvRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetDefaultRecvRect() ");

}

PluginAPIMgr.SetNormalPreviewRect = function(x, y, w, h) {
	alert("***** PluginAPIMgr.SetDefaultPreviewRect() ");

	//this.MoIPPlugin.Execute("SetDefaultPreviewRect", String(x), String(y), String(w), String(h));
}

PluginAPIMgr.SetMicVolume = function(value) {
	alert("***** PluginAPIMgr.SetMicVolume() ");
}

PluginAPIMgr.SetSpeakerVolume = function(value) {
	alert("***** PluginAPIMgr.SetSpeakerVolume() ");
}

PluginAPIMgr.GetMicVolume = function() {
	msg = "90";

	alert("***** PluginAPIMgr.GetMicVolume() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.GetSpeakerVolume = function() {
	msg = this.MoIPPlugin.Execute("GetSpeakerVolume");

	alert("***** PluginAPIMgr.GetSpeakerVolume() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.SetAutoVolumeControl = function(value) {
	alert("***** PluginAPIMgr.SetAutoVolumeControl() ");
	if(value == true) {
		msg = this.MoIPPlugin.Execute("SetAutoVolumeControl", "1");
	} else {
		msg = this.MoIPPlugin.Execute("SetAutoVolumeControl", "0");
	}
}

PluginAPIMgr.GetAutoVolumeControl = function() {
	msg = this.MoIPPlugin.Execute("GetAutoVolumeControl");

	alert("***** PluginAPIMgr.GetAutoVolumeControl() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.SetCallMixVolume = function(value) {
	alert("***** PluginAPIMgr.SetCallMixVolume() ");
	msg = this.MoIPPlugin.Execute("SetCallMixVolume", String(value));
}

PluginAPIMgr.GetCallMixVolume = function() {
	msg = this.MoIPPlugin.Execute("GetCallMixVolume");

	alert("***** PluginAPIMgr.GetCallMixVolume() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.SetTVMixVolume = function(value) {
	alert("***** PluginAPIMgr.SetTVMixVolume() ");
	msg = this.MoIPPlugin.Execute("SetTVMixVolume", String(value));
}

PluginAPIMgr.GetTVMixVolume = function() {
	msg = this.MoIPPlugin.Execute("GetTVMixVolume");

	alert("***** PluginAPIMgr.GetTVMixVolume() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.MuteMic = function(flagOn) {
	alert("PluginAPIMgr.MuteMic >>" + flagOn);

	if(flagOn == true) {
		msg = this.MoIPPlugin.Execute("MuteMic", "1");
		ProcMgr.CallInfo.IsMute = true;
	} else {
		msg = this.MoIPPlugin.Execute("MuteMic", "0");
		ProcMgr.CallInfo.IsMute = false;
	}
}

PluginAPIMgr.Hold = function(b_hold) {
	alert("***** PluginAPIMgr.Hold() ");
	if(b_hold == true) {
		msg = this.MoIPPlugin.Execute("Hold", "1");
	} else {
		msg = this.MoIPPlugin.Execute("Hold", "0");
	}
}

PluginAPIMgr.StartSendVideo = function() {
	alert("***** PluginAPIMgr.StartSendVideo() ");
	this.MoIPPlugin.Execute("StartSendVideo");
	this.SetCameraLightMode();
}

PluginAPIMgr.StopSendVideo = function() {
	alert("***** PluginAPIMgr.StopSendVideo() ");
	msg = this.MoIPPlugin.Execute("StopSendVideo");
}

PluginAPIMgr.StopSendMyVideo = function() {
	alert("***** PluginAPIMgr.StopSendMyVideo() ");
	msg = this.MoIPPlugin.Execute("StopSendMyVideo");
}

PluginAPIMgr.StopCamVideo = function() {
	alert("PluginAPIMgr.StopCamVideo");
	this.CameraPlugin.Execute("StopCamVideo");
}

PluginAPIMgr.SendDTMF = function(number) {
	alert("***** PluginAPIMgr.SendDTMF() ");
	msg = this.MoIPPlugin.Execute("SendDTMF", String(number));
}

PluginAPIMgr.GetNumOfCallMembers = function() {
	msg = this.MoIPPlugin.Execute("GetNumOfCallMembers");

	alert("***** PluginAPIMgr.GetNumOfCallMembers() : " + msg);

	return parseInt(msg);
}

PluginAPIMgr.LeaveVoicemail = function() {
	alert("***** PluginAPIMgr.LeaveVoicemail() -> callee_name :" + g_Data.DATA_VOICE_MAIL_INPUT_INFO.callee_name);
	msg = this.MoIPPlugin.Execute("LeaveVoicemail", g_Data.DATA_VOICE_MAIL_INPUT_INFO.callee_name);
}

PluginAPIMgr.CancelVoicemail = function() {
	alert("***** PluginAPIMgr.CancelVoicemail() ");
	msg = this.MoIPPlugin.Execute("CancelVoicemail");
}

PluginAPIMgr.BlockIncomingCall = function() {
	alert("***** PluginAPIMgr.BlockIncomingCall() ");
	msg = this.MoIPPlugin.Execute("BlockIncomingCall");
}

PluginAPIMgr.UnblockIncomingCall = function(index) {
	alert("***** PluginAPIMgr.UnblockIncomingCall() -> " + index);
	msg = this.MoIPPlugin.Execute("UnblockIncomingCall", index);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Call Member  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetCallMemberInfo = function(call_member_index, property) {
	alert("***** PluginAPIMgr.GetCallMemberInfo() -> property :" + property);

	if(property == ENUM_CALL_MEMBER_PROPERTY.P_TYPE) {
		//msg = "1";	//INCOMING_P2P
		//msg = "2";	//OUTGOING_P2P
		//msg = "3";	//INCOMING_PSTN
		msg = "4";
		//OUTGOING_PSTN
		//msg = "5";	//OUTGOING_VOICEMAIL

	} else if(property == ENUM_CALL_MEMBER_PROPERTY.P_STATUS) {
		msg = "1";
	} else {
		msg = "0";
	}

	alert("***** PluginAPIMgr.GetCallMemberInfo() -> return  :" + msg);

	return msg;
}

PluginAPIMgr.GetCallMemberID = function(index) {
	if(index) {
		msg = "CallMemberID" + index;
	} else {
		msg = "CallMemberID";
	}

	return msg;
}

PluginAPIMgr.GetCallMemberDisplayName = function(index) {
	if(index) {
		msg = "Test CallMamber Displayname" + index;
	} else {
		msg = "Test CallMamber Displayname"
	}

	if(msg.length == 0) {
		msg = PluginAPIMgr.GetCallMemberID(index);
	}

	return msg;
}

PluginAPIMgr.GetCallMemberAvataImage = function(index) {
	if(index) {
		var Avatar_image = this.MoIPPlugin.Execute("GetCallMemberAvatarPath", String(index));
	} else {
		var Avatar_image = this.MoIPPlugin.Execute("GetCallMemberAvatarPath", "0");
	}

	if(Avatar_image.length == 0) {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(index);
		if(PluginAPIMgr.GetContactPropWithName(call_memeber_id, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {
			Avatar_image = g_Image.IMAGE_VOICE_CALL_DEFAULT_AVATA_PSTN;
		} else if(call_memeber_id == "echo123") {
			Avatar_image = g_Image.IMAGE_VOICE_CALL_DEFAULT_AVATA_TEST_CALL;
		} else {
			var Gender = PluginAPIMgr.GetContactPropWithName(call_memeber_id, ENUM_CONTACT_PROPERTY.P_GENDER);

			if(Gender == "1") {
				Avatar_image = g_Image.IMAGE_VOICE_CALL_DEFAULT_AVATA_MALE;
			} else if(Gender == "2") {
				Avatar_image = g_Image.IMAGE_VOICE_CALL_DEFAULT_AVATA_FEMALE;
			} else {
				Avatar_image = g_Image.IMAGE_VOICE_CALL_DEFAULT_AVATA_NO_GENDER;
			}
		}
	} else {
		Avatar_image = Avatar_image + g_Data.GetImgSuffixPath();
	}

	alert("***** PluginAPIMgr.GetCallMemberAvataImage() -> return  :" + Avatar_image);
	return Avatar_image;
}

PluginAPIMgr.GetConferenceCallMemberAvataImage = function(index) {
	if(index) {
		var Avatar_image = this.MoIPPlugin.Execute("GetCallMemberAvatarPath", String(index));
	} else {
		var Avatar_image = this.MoIPPlugin.Execute("GetCallMemberAvatarPath", "0");
	}

	if(Avatar_image.length == 0) {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(index);
		if(PluginAPIMgr.GetContactPropWithName(call_memeber_id, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {
			Avatar_image = g_Image.IMAGE_CALL_BLANK_AVATAR_166_PSTN;
		} else if(call_memeber_id == "echo123") {
			Avatar_image = g_Image.IMAGE_CALL_BLANK_AVATAR_166_TEST;
			//g_Image.IMAGE_CONFERENCE_CALL_DEFAULT_AVATA_TEST_CALL;
			} else {
			Avatar_image = g_Image.IMAGE_CALL_BLANK_AVATAR_166_MAN;
		}
	} else {
		Avatar_image = Avatar_image + g_Data.GetImgSuffixPath();
	}

	alert("***** PluginAPIMgr.GetConferenceCallMemberAvataImage() -> return  :" + Avatar_image);
	return Avatar_image;
}

PluginAPIMgr.GetConferenceCallMemberOnlineState = function(index) {
	var onlineState = null;
	if(index) {
		onlineState = this.MoIPPlugin.Execute("GetCallMemberOnlineState", String(index));
	} else {
		onlineState = this.MoIPPlugin.Execute("GetCallMemberOnlineState", "0");
	}

	return parseInt(onlineState);
}

PluginAPIMgr.GetCallMemberMoodMsg = function(index) {
	if(index) {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(index);
	} else {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(0);
	}

	var mood_msg = PluginAPIMgr.GetContactPropWithName(call_memeber_id, ENUM_CONTACT_PROPERTY.P_MOOD_TEXT);

	alert("***** PluginAPIMgr.GetCallMemberMoodMsg() -> return  :" + mood_msg);
	return mood_msg;
}

PluginAPIMgr.GetCallMemberType = function() {
	return parseInt(PluginAPIMgr.GetCallMemberInfo(0, ENUM_CALL_MEMBER_PROPERTY.P_TYPE));
}

PluginAPIMgr.GetCallStatus = function() {
	return PluginAPIMgr.GetCallMemberInfo(0, ENUM_CALL_MEMBER_PROPERTY.P_STATUS);
}

PluginAPIMgr.GetCallMemberOnlineStateImage = function(index) {
	if(index) {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(index);
	} else {
		var call_memeber_id = PluginAPIMgr.GetCallMemberID(0);
	}

	var availability = PluginAPIMgr.GetContactPropWithName(call_memeber_id, ENUM_CONTACT_PROPERTY.P_AVAILABILITY);
	var availability_image = "";

	switch(parseInt(availability)) {
		case ENUM_CONTACT_AVAILABILITY.ONLINE:
		case ENUM_CONTACT_AVAILABILITY.ONLINE_FROM_MOBILE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_ONLINE;
			break;

		case ENUM_CONTACT_AVAILABILITY.OFFLINE:
		case ENUM_CONTACT_AVAILABILITY.NOT_AVAILABLE_FROM_MOBILE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_OFFLINE;
			break;

		case ENUM_CONTACT_AVAILABILITY.AWAY :
		case ENUM_CONTACT_AVAILABILITY.AWAY_FROM_MOBILE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_AWAY;
			break;

		case ENUM_CONTACT_AVAILABILITY.DO_NOT_DISTURB :
		case ENUM_CONTACT_AVAILABILITY.DO_NOT_DISTURB_FROM_MOBILE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_DO_NOT_DISTURB;
			break;

		case ENUM_CONTACT_AVAILABILITY.OFFLINE_BUT_CF_ABLE :
		case ENUM_CONTACT_AVAILABILITY.OFFLINE_BUT_VM_ABLE:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_AVAILABLE;
			break;

		case ENUM_CONTACT_AVAILABILITY.PENDINGAUTH  :
		case  ENUM_CONTACT_AVAILABILITY.UNKNOWN:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_OFFLINE;
			break;

		case ENUM_CONTACT_AVAILABILITY.BLOCKED  :
		case  ENUM_CONTACT_AVAILABILITY.BLOCKED_SKYPEOUT:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_BLOCKED;
			break;

		case ENUM_CONTACT_AVAILABILITY.SKYPE_ME :
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_AVAILABLE;
			break;

		default:
			availability_image = g_Image.IMAGE_ONLINE_STATUS_PRESENCE_OFFLINE;
			break;
	}

	return availability_image;
}

PluginAPIMgr.isConferenceCallMemberFinised = function(index) {
	if(index) {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", String(index));
	} else {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", "0");
	}

	if(parseInt(msg) == ENUM_CALL_MEMBER_STATUS.FINISHED || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.CANCELLED || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.FAILED || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.MISSED || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.REFUSED || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.BUSY || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.DROPPED) {
		alert("***** PluginAPIMgr.isConferenceCallMemberFinised() --> result : true");
		return true;
	} else {
		alert("***** PluginAPIMgr.isConferenceCallMemberFinised() --> result : false");
		return false;
	}
}

PluginAPIMgr.isConferenceCallMemberCalling = function(index) {
	if(index) {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", String(index));
	} else {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", "0");
	}

	if(parseInt(msg) == ENUM_CALL_MEMBER_STATUS.ROUTING || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.EARLYMEDIA || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.RINGING_OUT || parseInt(msg) == ENUM_CALL_MEMBER_STATUS.RINGING_IN) {
		alert("***** PluginAPIMgr.isConferenceCallMemberCalling() --> result : true");
		return true;
	} else {
		alert("***** PluginAPIMgr.isConferenceCallMemberCalling() --> result : false");
		return false;
	}
}

PluginAPIMgr.ConferenceCallMemberStatus = function(index) {
	if(index) {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", String(index));
	} else {
		var msg = this.MoIPPlugin.Execute("GetCallMemberStatus", "0");
	}

	return parseInt(msg);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Add Contact  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SearchNewContact = function(contact_name) {
	alert("***** PluginAPIMgr.SearchNewContact() --> contact_name " + contact_name);
	msg = this.MoIPPlugin.Execute("SearchNewContact", contact_name);
}

PluginAPIMgr.SearchContactProfile = function(contact_name) {
	alert("***** PluginAPIMgr.SearchContactProfile() --> contact_name " + contact_name);
	msg = this.MoIPPlugin.Execute("SearchContactProfile", contact_name);
	g_Data.SetSearchedContactName(contact_name);
}

PluginAPIMgr.GetSearchList = function() {
	return this.MoIPPlugin.Execute("GetSearchedContactList");
}

PluginAPIMgr.GetProfileInfo = function(ContactName) {
	return this.MoIPPlugin.Execute("GetSearchedProfileInfo");
}

PluginAPIMgr.AddContact = function(skype_name, hello_msg) {
	msg = this.MoIPPlugin.Execute("AddContact", skype_name, hello_msg);
}

PluginAPIMgr.AddSkypeOutContact = function(phone_number, diplay_name) {
	msg = this.MoIPPlugin.Execute("AddSkypeOutContact", phone_number, diplay_name);
}

PluginAPIMgr.IsBlocked = function(skype_name) {
     msg =  "0";//this.MoIPPlugin.Execute("IsBlocked", skype_name);

	alert("***** PluginAPIMgr.IsBlocked() --> result : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.IsMyBuddy = function(skype_name) {
     msg =  "1";//this.MoIPPlugin.Execute("IsMyBuddy", skype_name);

	alert("***** PluginAPIMgr.IsMyBuddy() --> result : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.IsMyName = function(skype_name) {
	var my_skype_name = PluginAPIMgr.GetMySkyeName();
	if(my_skype_name == skype_name) {
		msg = "1";
	} else {
		msg = "0";
	}

	alert("***** PluginAPIMgr.IsMyName() --> result : " + msg);
	return parseInt(msg);
}

PluginAPIMgr.IsAutoVideoReceive = function() {
	var value = parseInt(this.MoIPPlugin.Execute("GetAutoVideoReceive"));
	var is_receive = false;

	if(value == 0) {
		is_receive = false;
	} else if(value == 2) {
		is_receive = true;
	} else if(value == 1) {
		var call_member_name = PluginAPIMgr.GetCallMemberID();
		var is_my_buddy = PluginAPIMgr.IsMyBuddy(call_member_name);
		if(is_my_buddy == 1) {
			is_receive = true;
		} else {
			is_receive = false;
		}
	}

	alert("***** PluginAPIMgr.IsAutoVideoReceive() --> result : " + is_receive);
	return is_receive;
}

PluginAPIMgr.StartReceiveVideo = function() {
	alert("***** PluginAPIMgr.StartReceiveVideo() ");
	msg = this.MoIPPlugin.Execute("StartRecvVideo");
}

PluginAPIMgr.StopReceiveVideo = function() {
	alert("***** PluginAPIMgr.StopReceiveVideo() ");
	msg = this.MoIPPlugin.Execute("StopRecvVideo");
}

PluginAPIMgr.OpenExtVideo = function() {
	alert("***** PluginAPIMgr.OpenExtVideo() ");
	msg = this.MoIPPlugin.Execute("OpenExtVideo");
}

PluginAPIMgr.CloseExtVideo = function() {
	alert("***** PluginAPIMgr.CloseExtVideo() ");
	msg = this.MoIPPlugin.Execute("CloseExtVideo");
}

PluginAPIMgr.OpenExtAudio = function() {
	alert("***** PluginAPIMgr.OpenExtAudio() ");
	msg = this.MoIPPlugin.Execute("OpenExtAudio");
}

PluginAPIMgr.CloseExtAudio = function() {
	alert("***** PluginAPIMgr.CloseExtAudio() ");
	msg = this.MoIPPlugin.Execute("CloseExtAudio");
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Chat ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.OpenChatWithContact = function(skype_name) {
	msg = this.MoIPPlugin.Execute("OpenChatWithContact", skype_name);

}

PluginAPIMgr.OpenChat = function(chat_name) {
	msg = this.MoIPPlugin.Execute("OpenChatWithChatName", chat_name);
}

PluginAPIMgr.GetNumOfMessages = function() {
	msg = this.MoIPPlugin.Execute("GetNumOfMessages");
	alert("***** PluginAPIMgr.GetNumOfMessages() --> " + msg);
	return parseInt(msg);
}

PluginAPIMgr.GetMessages = function(start_index, end_index) {
	alert("***** PluginAPIMgr.GetMessage() --> start_index : " + start_index + ", end_index : " + end_index);
	msg = this.MoIPPlugin.Execute("GetMessages", String(start_index), String(end_index));

	alert("***** PluginAPIMgr.GetMessage() --> " + msg);
	return msg
}

PluginAPIMgr.SendMessage = function(send_msg) {
	alert("***** PluginAPIMgr.SendMessage() --> " + send_msg);
	msg = this.MoIPPlugin.Execute("SendMessage", send_msg);
}

PluginAPIMgr.CloseChat = function() {
	msg = this.MoIPPlugin.Execute("CloseChat");

}

PluginAPIMgr.GetCurrentChatProperty = function(index) {
	msg = this.MoIPPlugin.Execute("GetCurrentChatProperty", String(index));

	return msg;
}

PluginAPIMgr.GetChatMemberDisplayName = function(skype_name) {
	alert("***** PluginAPIMgr.GetChatMemberDisplayName() --> " + skype_name);
	msg = PluginAPIMgr.GetContactPropWithName(skype_name, ENUM_CONTACT_PROPERTY.P_DISPLAYNAME);

	if(msg.length > 0) {
		return msg;
	} else {
		return skype_name;
	}
}

PluginAPIMgr.isMultiChat = function(index) {
	msg = PluginAPIMgr.GetCurrentChatProperty(ENUM_CHAT_PROPERTY.P_TYPE);

	if(parseInt(msg) == ENUM_CHAT_TYPE.MULTICHAT) {
		return true;
	} else {
		return false;
	}
}

PluginAPIMgr.GetChatMemberAvataImage = function(Name) {
	var Avatar_image = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_AVATAR_IMAGE);

	if(Avatar_image.length == 0) {
		if(PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_PSTNNUMBER)) {
			Avatar_image = g_Image.IMAGE_CHAT_DEFAULT_AVATA_PSTN;
		} else if(Name == "echo123") {
			Avatar_image = g_Image.IMAGE_CHAT_DEFAULT_AVATA_TEST_CALL;
		} else {
			var Gender = PluginAPIMgr.GetContactPropWithName(Name, ENUM_CONTACT_PROPERTY.P_GENDER);

			if(Gender == "1") {
				Avatar_image = g_Image.IMAGE_CHAT_DEFAULT_AVATA_MALE;
			} else if(Gender == "2") {
				Avatar_image = g_Image.IMAGE_CHAT_DEFAULT_AVATA_FEMALE;
			} else {
				Avatar_image = g_Image.IMAGE_CHAT_DEFAULT_AVATA_NO_GENDER;
			}
		}
	} else {
		Avatar_image = Avatar_image + g_Data.GetImgSuffixPath();
	}

	return Avatar_image;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Options ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PluginAPIMgr.GetAutoStart = function() {
	alert("***** PluginAPIMgr.GetAutoStart()");
	
	if(this.autostart)
		return this.autostart;
	else
		return SID_OFF;


	if(Boolean(parseInt(this.MoIPPlugin.Execute("GetAutoStart")))) {
		return SID_ON;
	} else {
		return SID_OFF;
	}
}

PluginAPIMgr.GetDisplayNoty = function() {
	alert("***** PluginAPIMgr.GetDisplayNoty()");
	if(this.displaydata)
		return this.displaydata;
	else
		return SID_OFF;
	if(Boolean(parseInt(this.MoIPPlugin.Execute("IsNotificationEnabled")))) {
		return SID_ON;
	} else {
		return SID_OFF;
	}
}

PluginAPIMgr.SetDisplayNoty = function(value) {
	alert("***** PluginAPIMgr.SetDisplayNoty()  : " + value);
	
	//this.MoIPPlugin.Execute("SetNotificationEnable", value);
}

PluginAPIMgr.SetDisplayNotyValue = function(state) {
	alert("***** PluginAPIMgr.SetDisplayNotyValue()  : " + state);
	
	if(state === SID_ON) {
		this.displaydata = SID_ON;
		this.SetDisplayNoty("1");
	} else {
		this.displaydata = SID_OFF;
		this.SetDisplayNoty("0");
	}

}

PluginAPIMgr.SetAutoVideoReceive = function(state) {
	alert("***** PluginAPIMgr.SetAutoVideoReceive()  : " + state);
	var bEnable = false;
	var bAnyone = false;
	/*
	 var iNone = 0;
	 var iAnyone = 1;
	 var iFromContactList = 2;
	 */
	if(state === IDWS_MOIP_SETTING_NONE) {
		bEnable = "0";
		bAnyone = "0";
		alert("Value: " + IDWS_MOIP_SETTING_NONE);
	} else if(state === TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY) {
		bEnable = "1";
		bAnyone = "0";
		alert("Value: " + TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY);
	} else if(state === IDWS_MOIP_SETTING_ANYONE) {
		bEnable = "1";
		bAnyone = "1";
		alert("Value: " + IDWS_MOIP_SETTING_ANYONE);
	}
	msg = this.MoIPPlugin.Execute("SetAutoVideoReceive", bEnable, bAnyone);
}

PluginAPIMgr.GetAutoVideoReceive = function() {
	var retValue = IDWS_MOIP_SETTING_NONE;

	alert("***** PluginAPIMgr.GetAutoVideoReceive()");
	//var value = parseInt(this.MoIPPlugin.Execute("GetAutoVideoReceive"));
	var value = 0;
	alert("Value: " + value);
	switch(value) {
		case 0:
			retValue = IDWS_MOIP_SETTING_NONE;
			break;
		case 1:
			retValue = TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY;
			break;

		case 2:
			retValue = IDWS_MOIP_SETTING_ANYONE;
			break;
	}
	return retValue;
}

PluginAPIMgr.SetVideoAdvert = function(state) {
	alert("***** PluginAPIMgr.SetVideoAdvert()  : " + state);
	var val = "0";

	if(state === IDWS_MOIP_SETTING_NONE) {
		val = "0";
	} else if(state === TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY) {
		val = "1";
	}
	this.MoIPPlugin.Execute("SetVideoAdvert", val);
}

PluginAPIMgr.GetVideoAdvert = function() {
	alert("***** PluginAPIMgr.GetVideoAdvert()");
	//var value = this.MoIPPlugin.Execute("GetVideoAdvert");
	var value = "1";
	if(value === "1")
		return TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY;
	else
		return IDWS_MOIP_SETTING_NONE;
}

PluginAPIMgr.SetAutoFocus = function(value) {
	alert("***** PluginAPIMgr.SetAutoFocus()  : " + value);
	//this.MoIPPlugin.Execute("SetAutoFocus", value);
}

PluginAPIMgr.SetAutoFocusValue = function(state) {
	alert("***** PluginAPIMgr.SetAutoFocusValue()  : " + state);
	if(state === SID_ON)
		this.SetAutoFocus("1");
	else
		this.SetAutoFocus("0");
}

PluginAPIMgr.GetAutoFocus = function() {
	alert("***** PluginAPIMgr.GetAutoFocus()");
	return "1";
}

PluginAPIMgr.GetAutoFocusValue = function() {
	alert("***** PluginAPIMgr.GetAutoFocusValue()");

	if(Boolean(parseInt(this.GetAutoFocus()))) {
		return SID_ON;
	} else {
		return SID_OFF;
	}
}

PluginAPIMgr.SetCallForward = function(state) {
	alert("***** PluginAPIMgr.SetCallForward()  : " + state);
	return;
	if(state === SID_ON)
		this.MoIPPlugin.Execute("SetCallForward", "1");
	else
		this.MoIPPlugin.Execute("SetCallForward", "0");
}

PluginAPIMgr.GetCallForward = function() {
	alert("***** PluginAPIMgr.GetCallForward()");
	return SID_ON;
	if(Boolean(parseInt(this.MoIPPlugin.Execute("GetCallForward"))))
		return SID_ON;
	else
		return SID_OFF;
}

PluginAPIMgr.SetCallForwardTimer = function(timeout) {
	alert("***** PluginAPIMgr.SetCallForwardTimer()  : " + timeout);
	//this.MoIPPlugin.Execute("SetCallForwardTimer", timeout);
}

PluginAPIMgr.GetCallForwardTimer = function() {
	alert("***** PluginAPIMgr.GetCallForwardTimer()");
	return 66;
	return this.MoIPPlugin.Execute("GetCallForwardTimer");
}

PluginAPIMgr.SetVoicemailForward = function(state) {
	alert("***** PluginAPIMgr.SetVoicemailForward()  : " + state);
	// if(state === SID_ON)
		// this.MoIPPlugin.Execute("SetVoicemailForward", "1");
	// else
		// this.MoIPPlugin.Execute("SetVoicemailForward", "0");
}

PluginAPIMgr.GetVoicemailForward = function() {
	alert("***** PluginAPIMgr.GetVoicemailForward()");
	return SID_ON;
	if(Boolean(parseInt(this.MoIPPlugin.Execute("GetVoicemailForward"))))
		return SID_ON;
	else
		return SID_OFF;
}

PluginAPIMgr.SetVoicemailForwardTimer = function(timeout) {
	alert("***** PluginAPIMgr.SetVoicemailForwardTimer()  : " + timeout);
	this.MoIPPlugin.Execute("SetVoicemailForwardTimer", timeout);
}

PluginAPIMgr.GetVoicemailForwardTimer = function() {
	alert("***** PluginAPIMgr.GetVoicemailForwardTimer()");
	return 10;
	return this.MoIPPlugin.Execute("GetVoicemailForwardTimer");
}

PluginAPIMgr.SetVoicemailForReject = function(state) {
	alert("***** PluginAPIMgr.SetVoicemailForReject()  : " + state);
	//if(state === SID_ON)
		// this.MoIPPlugin.Execute("SetVoicemailForReject", "1");
	// else
		// this.MoIPPlugin.Execute("SetVoicemailForReject", "0");
}

PluginAPIMgr.GetVoicemailForReject = function() {
	alert("***** PluginAPIMgr.GetVoicemailForReject()");
	return SID_OFF;
	if(Boolean(parseInt(this.MoIPPlugin.Execute("GetVoicemailForReject"))))
		return SID_ON;
	else
		return SID_OFF;
}

PluginAPIMgr.SetVoicemailInBusy = function(state) {
	alert("***** PluginAPIMgr.SetVoicemailInBusy()  : " + state);
	// if(state === SID_ON)
		// this.MoIPPlugin.Execute("SetVoicemailInBusy", "1");
	// else
	//	this.MoIPPlugin.Execute("SetVoicemailInBusy", "0");
}

PluginAPIMgr.GetVoicemailInBusy = function() {
	alert("***** PluginAPIMgr.GetVoicemailInBusy()");
	return SID_ON;
	if(Boolean(parseInt(this.MoIPPlugin.Execute("GetVoicemailInBusy"))))
		return SID_ON;
	else
		return SID_OFF;
}

PluginAPIMgr.SetCallAllowPolicy = function(state) {
	alert("***** PluginAPIMgr.SetCallAllowPolicy()  : " + state);
	// if(state === IDWS_MOIP_SETTING_ANYONE)
		// this.MoIPPlugin.Execute("SetCallAllowPolicy", "1");
	// else
	//	this.MoIPPlugin.Execute("SetCallAllowPolicy", "0");
}

PluginAPIMgr.GetCallAllowPolicy = function() {
	alert("***** PluginAPIMgr.GetCallAllowPolicy()");
	if(this.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_SKYPE_CALL_POLICY) == "1")
		return IDWS_MOIP_SETTING_ANYONE;
	else
		return TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY;
}

PluginAPIMgr.SetChatAllowPolicy = function(state) {
	alert("***** PluginAPIMgr.SetChatAllowPolicy()  : " + state);
	if(state === IDWS_MOIP_SETTING_ANYONE)
		this.MoIPPlugin.Execute("SetChatAllowPolicy", "1");
	else
		this.MoIPPlugin.Execute("SetChatAllowPolicy", "0");
}

PluginAPIMgr.GetChatAllowPolicy = function() {
	alert("***** PluginAPIMgr.GetChatAllowPolicy()");
	if(this.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_CHAT_POLICY) == "1")
		return IDWS_MOIP_SETTING_ANYONE;
	else
		return TV_SID_PEOPLE_IN_MY_CONTACT_LIST_ONLY;
}

PluginAPIMgr.SetCallForwardNumbers = function(numbers) {
	alert("***** PluginAPIMgr.SetCallForwardNumbers()  : " + numbers);
	//todo serialization of phone numbers
	this.callforwardnumbers = numbers;
	//this.MoIPPlugin.Execute("SetCallForwardNumbers", numbers);
}

PluginAPIMgr.GetCallForwardNumbers = function() {
	alert("***** PluginAPIMgr.GetCallForwardNumbers()");
	
	var rawData = this.GetAccountInfo(ENUM_ACCOUNT_PROPERTY.P_OFFLINE_CALLFORWARD);
	return rawData;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Video Snapshot ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.SaveSnapShot = function() {
	alert("PluginAPIMgr.SaveSnapShot");
	this.MoIPPlugin.Execute("SaveSnapShot");
}

PluginAPIMgr.DeleteSnapShot = function(nIndex) {
	alert("PluginAPIMgr.DeleteSnapShot");
	this.MoIPPlugin.Execute("DeleteSnapShot", "" + nIndex);
}

PluginAPIMgr.GetSnapShotPathList = function() {
	alert("PluginAPIMgr.GetSnapShotPathList");
	return this.MoIPPlugin.Execute("GetSnapShotPathList");
}

PluginAPIMgr.GetNumOfSnapShot = function() {
	alert("PluginAPIMgr.GetNumOfSnapShot");
	return 0;
	return parseInt(this.MoIPPlugin.Execute("GetNumOfSnapShot"));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  OSD Timer  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.StartOSDTimer = function(time, callBackFn, index) {
	g_Data.SetOSDTimerCallBackFn(callBackFn, index);
	//this.MoIPPlugin.Execute("StartOSDTimer", time, String(index));
}

PluginAPIMgr.RestartOSDTimer = function(time, index) {
	//this.MoIPPlugin.Execute("RestartOSDTimer", time, String(index));
}

PluginAPIMgr.StopOSDTimer = function(index) {
	g_Data.SetOSDTimerCallBackFn(null);
	//this.MoIPPlugin.Execute("StopOSDTimer" , String(index));
}

PluginAPIMgr.StopOSDTimer = function(index) {
	g_Data.SetOSDTimerCallBackFn(null);
	//this.MoIPPlugin.Execute("StopOSDTimer" , String(index));
}
////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////    TOOL /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

PluginAPIMgr.GetCameraLightMode = function() {
	alert("PluginAPIMgr.GetCameraLightMode");
	//return this.TempData;
	return parseInt(this.MoIPPlugin.Execute("GetCameraLightMode"));
}

PluginAPIMgr.SaveCameraLightMode = function(value) {
	alert("PluginAPIMgr.SaveCameraLightMode -- " + value);
	//this.TempData = value;
	this.MoIPPlugin.Execute("SaveCameraLightMode", String(value));
}

PluginAPIMgr.SetCameraLightMode = function() {
	this.MoIPPlugin.Execute("SetCameraLightMode");
}
/*
 horizontal  : size of pannel width
 vertical : size of pannel height
 frequency : support frequency
 scan : scan mode
 aspect : aspect ratio

 */

PluginAPIMgr.GetPanelResolution = function() {

	alert("horizontal : " + 1920);
	alert("vertical: " + 1080);
	alert("frequency: " + 240);
	alert("scan: " + false);
	alert("aspect: " + 0);

	WndMgr.SetResolutionInfo(1920, 1080, 240, false, 0);

}

PluginAPIMgr.SetPreviousSource = function() {
	this.sefPlugin.Execute("SetPreviousSource");
}

PluginAPIMgr.SetMediaSource = function() {
	var result = this.sefPlugin.Execute("SetSource", "43");
	alert("==== PluginAPIMgr.SetMediaSource(): result = " + result);
}

PluginAPIMgr.StartAudio = function() {
	this.MoIPPlugin.Execute("StartAudio");
}
PluginAPIMgr.SetSourceMode = function(b_sourceMode) {
	if(b_sourceMode == true) {
		msg = this.MoIPPlugin.Execute("SetSourceMode", "1");
	} else {
		msg = this.MoIPPlugin.Execute("SetSourceMode", "0");
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////  ePTZ   /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

//// zoom
PluginAPIMgr.SyncZoomState = function() {
	this.zoom_state = parseInt(this.CameraPlugin.Execute("GetCamProperty", "7"));
}

PluginAPIMgr.GetZoomState = function() {
	return this.zoom_state;
}

PluginAPIMgr.SetZoomState = function(nlevel) {
	if(nlevel < 0 || nlevel > 10) {
		return;
	}

	this.CameraPlugin.Execute("SetCamProperty", "7", String(nlevel));
}
//// pan
PluginAPIMgr.SyncPanState = function() {
	this.pan_state = parseInt(this.CameraPlugin.Execute("GetCamProperty", "8"));
}

PluginAPIMgr.GetPanState = function() {
	return this.pan_state;
}

PluginAPIMgr.SetPanState = function(nlevel) {
	this.pan_state = nlevel;
	this.CameraPlugin.Execute("SetCamProperty", "8", String(nlevel));
}
//// tilt
PluginAPIMgr.SyncTiltState = function() {
	this.tilt_state = parseInt(this.CameraPlugin.Execute("GetCamProperty", "9"));
}

PluginAPIMgr.GetTiltState = function() {
	return this.tilt_state;
}

PluginAPIMgr.SetTiltState = function(nlevel) {
	this.tilt_state = nlevel;
	this.CameraPlugin.Execute("SetCamProperty", "9", String(nlevel));
}

PluginAPIMgr.FaceTracking = function(bTurnOn) {
	var turn_flag = '0';

	if(bTurnOn == true) {
		turn_flag = '1';
	}

	this.CameraPlugin.Execute("FaceTracking", turn_flag);
}

PluginAPIMgr.GetFaceTracking = function() {
	return parseInt(this.CameraPlugin.Execute("GetFaceTracking"));
}
