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

WndMgr ={
		MouseClickEnable : false,
		
		SigninStep : "InputInfo",
		CreateAccountStep : "InputIdPwd",
		
        AddContactStep : "AddContact",
		RemoveContactStep : "RemoveContact",
        ChangePWDStep:"ChangePassword",
		ChangePictureStep:"ChangePictureWnd",
        
        CurrentPopupSceneId:"",
        
        CreateAccountSuccessStep : "Success",
        FaceRecogSigninStep : "FaceRecog",
        FaceRecogRegistrationStep : "FaceDetect",
        
        AccountManagerStep :"AccountManager",
        
        isShowFaceRecogSignin: false,
        isShowFaceRecogResult: false,
        isShowFaceRecogChooseAccount: false,

		VideoCallScreen : "Large",
        SkypeOutCallMode : "Normal",
        ViewType : null,
       
        MainSubScene: new Array(5),
             
        iCurrentSubScene :0,
        
        TextEditorCallerSceneId : "",
        TextEditorCallerObj :null,
		TextEditorCallerDimObj :null,   

        isShowMain : false,
		isCallingFail : false ,
        isShowCalling : false ,
        isShowVoiceCall : false ,
        isShowVideoCallNormal : false ,
        isShowVideoCallSD : false ,
        isShowVideoCallHD: false ,
        isShowConferenceCall: false ,
        isShowSKypeOutCall: false ,
        isShowSKypeOutCallDial : false ,
        isShowChat : false,
        isShowVoiceMail :false,
        isShowVideoSnapshot : false,
        isShowCheckConnected : false,
        isShowCheckDisconnected : false,
        isShowIncomingCall : false,
        isShowContextLoading : false,
        isShowContactPhoneNumberList : false,
		isShowCameraControl : false,
		isShowConfirmPopup : false,		//add by minseok : setting face recog delete popup
		isDebugMode : false,		//add by minseok : menutree-debugmode
		isShowAddContactSkypeName : false,		//add by minseok 
            
        isShowTextEditor:false,
        isLoadTextEditor:false,
        
        isShowRename : false,
        isShowChatMsgSend : false,
		
		isShowOneBtnPopup:false,

		isReturnAfterSave : false,
		
		isShowLoading : false,
		loadingType : 5,
		
        isShowCheckPwd:false,
        isLoadCheckPwd:false,
        
        isStartedPreview : false,
        
        ListCallerSceneId : null,
        //The flag is necessary to avoid the double event from the skype host
        
        KeypadCallerSceneId : "",
        KeypadCallerObj :null,
        KeypadStopCF :null,
        isShowKeypad:false,

///////////Pre laod Bg///////////////////////////////////////////////////////////////
		Skype_Bg : null,
		Skype_call_normal_preview_bg : null,
		
//Function Parameter
		Param_A : null,	//check...
		ToolType : null,		
		

		Horizontal : 0,
		Vertical : 0,
		Frequency: 0,
		Scan : 0,
		Aspect : 0,
		
		PopupHideTimer : false,
		PopupHideCallback : null,
		TimeOfPopup : 0,
		
		ReturnClickFunc : null,
		isShowReturnIcon : false,
		isMouseCusorShow : false,
		
		GestureZoomCounter : 0
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Init widget ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


WndMgr.init = function()
{
	this.MouseClickEnable = true;
	
	this.SigninStep = "InputInfo";
	this.CreateAccountStep = "InputIdPwd";
	
    this.AddContactStep = "AddContact";
	this.RemoveContactStep = "RemoveContact";
    this.ChangePWDStep="ChangePassword";
	this.ChangePictureStep="ChangePictureWnd";
    
    this.CurrentPopupSceneId = "";
    
    this.CreateAccountSuccessStep = "Success";
    
    this.FaceRecogRegistrationStep = "FaceDetect";
    this.FaceRecogSigninStep = "FaceRecog";
    
    this.AccountManagerStep ="AccountManager";
    
	this.VideoCallScreen = "Full";
    this.SkypeOutCallMode ="Normal";
    
     this.iCurrentSubScene =0;
    var a=0;
    for(a=0; a<this.MainSubScene.length; a++)
    {
        this.MainSubScene[a] = new Object();
        this.MainSubScene[a].flagSelect = false;
        this.MainSubScene[a].isShow = false;
        /* add 8.3 */
      //  this.MainSubScene[a].saveobj = null;
    }
    
    this.MainSubScene[0].Id = "ListMainContact";
    this.MainSubScene[1].Id = "ListMainHistory";
    this.MainSubScene[2].Id = "ListMainCall";
    this.MainSubScene[3].Id = "ListMainProfile";
    this.MainSubScene[4].Id = "ListMainSetting";

}

//2013
WndMgr.ImagePreLoad =function()
{
    alert("***** WndMgr.ImagePreLoad()");
	
	// this.Skype_Bg = new Object();
	// this.Skype_Bg.main						= new Image();
	// this.Skype_Bg.main.src 					= g_Image.IMAGE_SKYPE_BG;	
	// this.Skype_Bg.call_normal_preview		= new Image();
	// this.Skype_Bg.call_normal_preview.src = g_Image.IMAGE_SKYPE_BG_CALL_NORMAL_PREVIEW;	
	// this.Skype_Bg.call_tv_only				= new Image();
	// this.Skype_Bg.call_tv_only.src 			= g_Image.IMAGE_SKYPE_BG_CALL_TV;		
	// this.Skype_Bg.call_tv_remote 			= new Image();
	// this.Skype_Bg.call_tv_remote.src 		= g_Image.IMAGE_SKYPE_BG_CALL_TV_REMOTE;	
	// this.Skype_Bg.call_tv_preview 			= new Image();
	// this.Skype_Bg.call_tv_preview.src		= g_Image.IMAGE_SKYPE_BG_CALL_TV_PREVIEW;	
	// this.Skype_Bg.call_tv_all 				= new Image();
	// this.Skype_Bg.call_tv_all.src 			= g_Image.IMAGE_SKYPE_BG_CALL_TV_ALL;

	// this.Skype_Bg = new Image();
	// this.Skype_Bg.src = g_Image.IMAGE_SKYPE_BG;
	
	// this.Skype_call_normal_preview_bg = new Image();
	// this.Skype_call_normal_preview_bg.src = g_Image.IMAGE_SKYPE_BG_CALL_NORMAL_PREVIEW;	

}


WndMgr.ShowInit=function()
{
    alert("***** WndMgr.ShowInit()");
    
    sf.scene.show('WidgetLoading');
    sf.scene.focus('WidgetLoading');
}

WndMgr.HideInit=function()
{
    alert("***** WndMgr.HideInit()");
    
    sf.scene.hide('WidgetLoading');
	
	setTimeout("HideTimerCF()", 0);
	HideTimerCF = function(){
		if (PluginAPIMgr.IsInCall() == 0) {
				PluginAPIMgr.HideConnectingWnd();
				
				if(PluginAPIMgr.IsWidgetActivatedByAnswer()==1 && ProcMgr.start_main == "1")
				{
					 WndMgr.StartOneBottonPopup(OneBtnPopupIndex.CALL_ENDED);
				}
			}
	}
}



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Welcome ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.DestroyWelcome = function()
{
    sf.scene.get('Welcome').setDestroyFlag(true);
}

WndMgr.ShowWelcome=function()
{
    alert("***** WndMgr.ShowWelcome()");

	sf.scene.show('Welcome');
    sf.scene.focus('Welcome');
}

WndMgr.HideWelcome = function(){
	alert("***** WndMgr.HideWelcome()");
	
	sf.scene.hide('Welcome');
}

WndMgr.ReturnWelcome = function(){
	alert("***** WndMgr.ReturnWelcome()");
	
	sf.scene.focus('Welcome');
}
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SignIn ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.InitSignin = function()
{
    this.SigninStep = "InputInfo";
    var Scene = sf.scene.get('Signin');
    if(Scene.getDestroyFlag()==true){
    	Scene.setInitFlag(true);
    } 
}

WndMgr.DestroySignin = function()
{
    sf.scene.get('Signin').setDestroyFlag(true);
}

WndMgr.ShowSignin=function()
{
    alert("***** WndMgr.ShowSignin()");
   if( this.SigninStep== "InputInfo")
   {
        sf.scene.show('Signin');
        sf.scene.focus('Signin');
   }
   
   if(this.SigninStep == "Loading")
   {
        this.StartLoading(LoadingTypeIndex.SIGNIN_WITH_CANCEL);
   }
}

WndMgr.HideSignin=function()
{
    alert("***** WndMgr.HideSignin()");
   
    if(this.SigninStep == "Loading")
    {
        this.StopLoading();
    }
    
    sf.scene.hide('Signin');

    this.SigninStep = "InputInfo" //init
}


WndMgr.NextStepSignin= function()
{
   if(this.SigninStep == "InputInfo")
   {   
        this.SigninStep ="Loading";
   }
   
   this.ShowSignin();
}

WndMgr.BackStepSignin= function()
{
   if(this.SigninStep == "Loading")
   {   
        this.StopLoading();
        this.SigninStep ="InputInfo";
   }
}

WndMgr.ReturnSignin =function()
{
    alert("***** WndMgr.ReturnSignin()");

    sf.scene.focus('Signin');
}

WndMgr.UpdateSigninCameraState=function()
{
	if((StateMgr.GetCurrentState() == 'Signin') && this.SigninStep == "InputInfo"){
		
		alert("***** WndMgr.UpdateSigninCameraState()");
		sf.scene.get('Signin').ToggleFaceRecogEnable();		
	}
}

/// Forgot Pwd
WndMgr.ShowForgotPwd=function()
{
    alert("***** WndMgr.ShowForgotPwd()");

    sf.scene.show('ForgotPassword');
    sf.scene.focus('ForgotPassword');    
}

WndMgr.HideForgotPwd=function()
{
    alert("***** WndMgr.HideForgotPwd()");
   
    sf.scene.hide('ForgotPassword');
}

WndMgr.ReturnForgotPwd=function()
{
    alert("***** WndMgr.ReturnForgotPwd()");

    sf.scene.focus('ForgotPassword');    
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Create Account  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.InitCreateAccount = function()
{
    sf.scene.get('CreateAccountStep1').setInitFlag(true);
	sf.scene.get('CreateAccountStep2').setInitFlag(true);
}

WndMgr.DestroyCreateAccount = function()
{
    sf.scene.get('CreateAccountStep1').setDestroyFlag(true);
	sf.scene.get('CreateAccountStep2').setDestroyFlag(true);
}

WndMgr.UpdateCreateAccount = function(suggested_SkypeName)
{
    sf.scene.get('CreateAccountStep1').updateSkypeName(suggested_SkypeName);
}


WndMgr.ShowCreateAccount=function()
{
    alert("***** WndMgr.ShowCreateAccount()");
    alert("this.CreateAccountStep : " +this.CreateAccountStep);

	if(this.CreateAccountStep == "InputIdPwd")
	{
		sf.scene.show('CreateAccountStep1');
	    sf.scene.focus('CreateAccountStep1');
	}
	else if(this.CreateAccountStep == "InputEmail")
	{
		sf.scene.show('CreateAccountStep2');
	    sf.scene.focus('CreateAccountStep2');
	}
	else if(this.CreateAccountStep == "Confirm")
	{
		sf.scene.show('CreateAccountStep3');
	    sf.scene.focus('CreateAccountStep3');
	}
	else if(this.CreateAccountStep == "Agreement")
	{
		sf.scene.show('CreateAccountStep4');
	    sf.scene.focus('CreateAccountStep4');
	}
	else if(this.CreateAccountStep =="Suggestion")
    {   
        sf.scene.show('CreateAccountFail1');
        sf.scene.focus('CreateAccountFail1');
    }
	
	if(this.CreateAccountStep == "Loading" || this.CreateAccountStep =="SuggestionLoading")
    {
        this.StartLoading(LoadingTypeIndex.SIGNIN);
    }
}

WndMgr.HideCreateAccount=function()
{
    alert("***** WndMgr.HideCreateAccount()");
	
	if(this.CreateAccountStep == "InputIdPwd")
	{
		 sf.scene.hide('CreateAccountStep1');
	}
	
	if(this.CreateAccountStep == "InputEmail")
	{
		 sf.scene.hide('CreateAccountStep2');
	}
	
	if(this.CreateAccountStep == "Confirm")
	{
		 sf.scene.hide('CreateAccountStep3');
	}
	
	if(this.CreateAccountStep == "Agreement")
	{
		 sf.scene.hide('CreateAccountStep4');
	}
	if(this.CreateAccountStep == "Loading" )
    {
        this.StopLoading();
        sf.scene.hide('CreateAccountStep4');
    }
	if(this.CreateAccountStep == "Suggestion")
	{
		 sf.scene.hide('CreateAccountFail1');
	}	
	if(this.CreateAccountStep =="SuggestionLoading")
    {    
        this.StopLoading();
        sf.scene.hide('CreateAccountFail1');
    }
   
   this.CreateAccountStep = "InputIdPwd"; //init
}

WndMgr.NextStepCreateAccount= function()
{
	alert("***** WndMgr.NextStepCreateAccount()");
    alert("this.CreateAccountStep : " +this.CreateAccountStep);
    if(this.CreateAccountStep == "InputIdPwd")
    {
        sf.scene.hide('CreateAccountStep1');
       this.CreateAccountStep ="InputEmail";
    }
	else if(this.CreateAccountStep == "InputEmail")
    {
        sf.scene.hide('CreateAccountStep2');
       this.CreateAccountStep ="Confirm";
    }
	else if(this.CreateAccountStep == "Confirm")
    {
        sf.scene.hide('CreateAccountStep3');
       this.CreateAccountStep ="Agreement";
    }
	else if(this.CreateAccountStep == "Agreement")
    {   
        this.CreateAccountStep ="Loading";
    }
	else if( this.CreateAccountStep =="Suggestion")
	{   
	    this.CreateAccountStep ="SuggestionLoading";
	}
	   
   this.ShowCreateAccount();
}

WndMgr.BackStepCreateAccount= function()
{
    if(this.CreateAccountStep == "InputEmail")
    {
        sf.scene.hide('CreateAccountStep2');
       this.CreateAccountStep ="InputIdPwd";
    }
	else if(this.CreateAccountStep == "Confirm")
    {
        sf.scene.hide('CreateAccountStep3');
       this.CreateAccountStep ="InputEmail";
    }
	else if(this.CreateAccountStep == "Agreement")
    {
        sf.scene.hide('CreateAccountStep4');
       this.CreateAccountStep ="Confirm";
    }
	else if(this.CreateAccountStep == "Suggestion")
    {   
        sf.scene.hide('CreateAccountFail1');
        this.CreateAccountStep ="Agreement";
    } 
	else if(this.CreateAccountStep == "Loading")
    {   
        this.StopLoading();
		//sf.scene.hide('CreateAccountStep4');
        this.CreateAccountStep ="Agreement";
        return;
    }   
   	else if(this.CreateAccountStep == "SuggestionLoading")
   {   
        this.StopLoading();
        //sf.scene.hide('CreateAccountFail1');
        this.CreateAccountStep ="Suggestion";
        return;
   }
	
   this.ShowCreateAccount();
}

WndMgr.ReturnCreateAccount =function()
{
    alert("***** WndMgr.ReturnCreateAccount()");
    alert("***** this.CreateAccountStep is : "+ this.CreateAccountStep);

	if(this.CreateAccountStep == "InputIdPwd") {
		 sf.scene.focus('CreateAccountStep1');
	}
	else if(this.CreateAccountStep == "InputEmail"){
		sf.scene.focus('CreateAccountStep2');
	}
	else if(this.CreateAccountStep == "Confirm"){
		sf.scene.focus('CreateAccountStep3');
	}
	else if(this.CreateAccountStep == "Agreement"){
		sf.scene.focus('CreateAccountStep4');
	}
	else if(this.CreateAccountStep == "Suggestion"){
		sf.scene.focus('CreateAccountFail1');
	}
	else if(this.CreateAccountStep == "Loading"||this.CreateAccountStep == "SuggestionLoading"){	//Timer Expired
		WndMgr.SuggestionStepCreateAccount();
	}
}

WndMgr.SuggestionStepCreateAccount = function()
{
    if(this.CreateAccountStep == "Loading")
   {   
        this.StopLoading();
        sf.scene.hide('CreateAccountStep4');
        this.CreateAccountStep ="Suggestion";
   }
   else if(this.CreateAccountStep == "SuggestionLoading")
   {
         this.StopLoading();
         sf.scene.hide('CreateAccountFail1');
         this.CreateAccountStep ="Suggestion";
   }
   
   this.ShowCreateAccount();
}
//2013 add by minseok
WndMgr.ShowLicensePopup = function(index){
	sf.scene.show('LicensePopup');
	sf.scene.focus('LicensePopup');
	var this_ = sf.scene.get('LicensePopup');
	this_.goToReadPage(index);
}
WndMgr.CloseLicensePopup = function(){
	sf.scene.hide('LicensePopup');
	sf.scene.show('CreateAccountStep4');
	sf.scene.focus('CreateAccountStep4');
}

WndMgr.ShowGuidePage = function(type){
	alert("***** WndMgr.ShowGuidePage()"+type);
	sf.scene.get("GuidePage").setType(type);
	sf.scene.show("GuidePage");
    sf.scene.focus("GuidePage");
} 
WndMgr.HideGuidePage = function(){
	alert("***** WndMgr.HideGuidePage()");
	sf.scene.hide('GuidePage');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Camera Check  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowCameraCheckConnected =function()
{
    alert("***** WndMgr.ShowCameraCheckConnected()");

	this.isShowCheckConnected = true;

	sf.scene.show('CameraCheckConnected');
    sf.scene.focus('CameraCheckConnected');
}

WndMgr.HideCameraCheckConnected = function(){
	alert("***** WndMgr.HideCameraCheckConnected()");
	
	sf.scene.hide('CameraCheckConnected');

	this.isShowCheckConnected = false;
}

WndMgr.ReturnCameraCheckConnected =function()
{
    alert("***** WndMgr.ReturnCameraCheckConnected()");

    sf.scene.focus('CameraCheckConnected');
}

WndMgr.ShowCameraCheckDisconnected =function()
{
    alert("***** WndMgr.ShowCameraCheckDisconnected()");
	
	this.isShowCheckDisconnected = true;
	
	sf.scene.show('CameraCheckDisconnected');
    sf.scene.focus('CameraCheckDisconnected');
}

WndMgr.HideCameraCheckDisconnected = function(){
	alert("***** WndMgr.HideCameraCheckDisconnected()");
	
	sf.scene.hide('CameraCheckDisconnected');
	
	this.isShowCheckDisconnected = false;	
}

WndMgr.ReturnCameraCheckDisconnected =function()
{
    alert("***** WndMgr.ReturnCameraCheckDisconnected()");

    sf.scene.focus('CameraCheckDisconnected');
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SignOut ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowSignout=function()
{
    alert("***** WndMgr.ShowSignout()");
    
    sf.scene.show('Signout');
    sf.scene.focus('Signout');
}

WndMgr.HideSignout=function()
{
    alert("***** WndMgr.HideSignout()");
    
    sf.scene.hide('Signout');

}

WndMgr.ReturnSignout=function()
{
    alert("***** WndMgr.ReturnSignout()");
    
    sf.scene.focus('Signout');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Exit ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowExit=function(fromReturnKey)
{
    alert("***** WndMgr.ShowExit()");
    
    if(fromReturnKey)
    {
        sf.scene.get('Exit').SetFromReturnKey(fromReturnKey);
    }
    
    sf.scene.show('Exit');
    sf.scene.focus('Exit');
}

WndMgr.HideExit=function()
{
    alert("***** WndMgr.HideExit()");
    
    sf.scene.hide('Exit');

}

WndMgr.ReturnExit=function()
{
    alert("***** WndMgr.ReturnExit()");
    
    sf.scene.focus('Exit');
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Main ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowMain = function()
{
    alert("***** WndMgr.ShowMain()");
    this.isShowMain = true;
    
    sf.scene.show('ListMain');
    
    if(this.MainSubScene[this.iCurrentSubScene].flagSelect == true)
    {
        this.ShowMainSub(this.iCurrentSubScene);
        this.SelectMainSub(this.iCurrentSubScene);
    }
    else
    {
        sf.scene.focus('ListMain');
    }
}

WndMgr.ShowJumpToMain = function(category_index,item_index)
{
    alert("***** WndMgr.ShowJumpToMain()");
	var flag_MissedCall = false;

    this.isShowMain = true;
	if(g_Data.WIDGET_PARAM.mode == 'MissedCallHistory')
		flag_MissedCall = true;
    
    sf.scene.show('ListMain');    

	if(item_index != null)
	{
		sf.scene.get('ListMain').gotoAndSelectCatecory(category_index,item_index,flag_MissedCall);
	}
	else
	{
		sf.scene.get("ListMain").MoveHighlight(category_index);
	}
	
}

WndMgr.HideMain = function()
{
    alert("***** WndMgr.HideMain()");
	 this.isShowMain = false;
     sf.scene.hide('ListMain');
}

WndMgr.DestroyMain = function()
{
    this.iCurrentSubScene =0;
    sf.scene.get('ListMain').setDestroyFlag(true);
    
    this.MainSubScene[0].Id = "ListMainContact";
    this.MainSubScene[1].Id = "ListMainHistory";
    this.MainSubScene[2].Id = "ListMainCall";
    this.MainSubScene[3].Id = "ListMainProfile";
    this.MainSubScene[4].Id = "ListMainSetting";
     
    var i = 0;
    for(i = 0; i < this.MainSubScene.length; i++)
    {
        this.MainSubScene[i].flagSelect = false;
        alert("i : "+i);
        sf.scene.get(this.MainSubScene[i].Id).setDestroyFlag(true);        
    }
    sf.scene.get('ListMainLiveCall').setDestroyFlag(true);
}
/* add 8.3 */
/*
WndMgr.SetSubSceneObj = function(obj)
{
	alert("WndMgr.SetSubSceneObj : "+obj);
	this.MainSubScene[this.iCurrentSubScene].saveobj = obj;
}
WndMgr.GetSubSceneObj = function()
{
	alert("WndMgr.GetSubSceneObj : "+this.MainSubScene[this.iCurrentSubScene].saveobj);
	return this.MainSubScene[this.iCurrentSubScene].saveobj;
}*/

/***/
WndMgr.ReturnMain =function()
{
    alert("***** WndMgr.ReturnMain()");
       
    if(this.MainSubScene[this.iCurrentSubScene].flagSelect == true && WndMgr.CheckMoveSubToMain(this.iCurrentSubScene))
    {
	    if(this.iCurrentSubScene < 2 && this.isShowContactPhoneNumberList == true)
	    {
	    	this.focus('ListMainContactPhoneNumberList');
	    }
    	else if(this.iCurrentSubScene == 2 && sf.scene.get('ListMainCall').ShownFlagList == true)
    	{
    		this.focus('CountryFlagList');
    	}
    	else{
    		this.focus(this.MainSubScene[this.iCurrentSubScene].Id);
    	}        
    }else{
        this.focus('ListMain');
    }
    
    sf.scene.get('ListMain').update();
}

WndMgr.UpdateMain = function()
{

}

WndMgr.UpdateMainCameraState =function()
{
     if(this.isShowMain == true)
    {
        alert("***** WndMgr.UpdateMainCameraState() ");
        sf.scene.get('ListMain').toggleCameraOffBtnEnable();
		if(WndMgr.GetMainSubIndex() == 0)
			sf.scene.get('ListMainContact').list.FuncPopup.toggleCameraOffBtnEnable();
		else if(WndMgr.GetMainSubIndex() == 1)
			sf.scene.get('ListMainHistory').list.FuncPopup.toggleCameraOffBtnEnable();
	
    } 
}

WndMgr.UpdateCameraCheckState = function()
{        	
     if(this.isShowCheckConnected == true)
    {
        alert("***** WndMgr.UpdateCameraCheckConnected() ");
        sf.scene.get('CameraCheckConnected').refreshCheckWnd();
    }

     if(this.isShowCheckDisconnected == true)
    {
        alert("***** WndMgr.UpdateCameraCheckDisconnected() ");
        sf.scene.get('CameraCheckDisconnected').refreshCheckWnd();
    }

}

WndMgr.ShowMainSub = function(index)
{
    alert("***** WndMgr.ShowMainSub() " + index);
	if(this.MainSubScene[index].isShow ==false)
	{
		sf.scene.show(this.MainSubScene[index].Id);
	}
    
    this.iCurrentSubScene = index;
    
    this.MainSubScene[index].isShow =true;
}

WndMgr.JumpMainSub = function(category_index,item_index)
{
    alert("***** WndMgr.JumpMainSub() category:" + category_index + "_item:" + item_index);

	var category_scene = sf.scene.get(this.MainSubScene[category_index].Id);
	category_scene.SetJumpState(item_index);
    
	if(this.MainSubScene[category_index].isShow == false)
	{
		sf.scene.show(this.MainSubScene[category_index].Id);
	}
	else
	{
		category_scene.Refresh();
	}
    
    this.iCurrentSubScene = category_index;
    
    this.MainSubScene[category_index].isShow = true;
}

WndMgr.HideMainSub = function(index)
{
     alert("***** WndMgr.HideMainSub() " + index);
    sf.scene.hide(this.MainSubScene[index].Id );
    
    this.MainSubScene[index].isShow =false;
}


WndMgr.UpdateMainSub = function(){

    if(this.iCurrentSubScene  < 2)  //  update list only (by euny)
    {
        var Scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
        
		if(Scene){			
			Scene.Refresh();	
		}
        	
    }	
}

WndMgr.SelectMainSub = function(index)
{
	alert("***** WndMgr.SelectMainSub() " + index);
		
	this.MainSubScene[index].flagSelect = true;
	sf.scene.focus(this.MainSubScene[index].Id);    
}

WndMgr.ReturnSubToMain = function()
{
     alert("***** WndMgr.ReturnSubToMain() ");
     this.MainSubScene[this.iCurrentSubScene].flagSelect = false;
     sf.scene.focus('ListMain');    
}
//131104 minseok - change return scenario
WndMgr.ReturnSubToMainContact = function(){
	alert("***** WndMgr.ReturnSubToMainContact() ");
    this.MainSubScene[this.iCurrentSubScene].flagSelect = false;
    sf.scene.get('ListMain').gotoAndSelectCatecory(0,0,false);
}
WndMgr.GetMainSubIndex = function()
{
	return this.iCurrentSubScene;   
}

WndMgr.GetMainSubSceneID = function()
{
	return this.MainSubScene[this.iCurrentSubScene].Id;   
}


WndMgr.CheckMoveSubToMain = function(index)
{
	alert("***** WndMgr.CheckMoveSubToMain() ");
	
	//2013 modify by minseok
	if(index > 1){
		
		return true;
	}

	alert("Scene ID : " + this.MainSubScene[index].Id);
	
	var SubScene = sf.scene.get(this.MainSubScene[index].Id);
	return SubScene.CheckValidList();
  
}



WndMgr.UpdateMainLiveCallDuration=function(time)
{
}

WndMgr.UpdateMainLiveCallMemberInfo = function()
{

}

WndMgr.MainLiveCallLocalHold=function()
{
    if(this.MainSubScene[2].isShow == true && this.MainSubScene[2].Id == "ListMainLiveCall")
    {
        alert("***** WndMgr.MainLiveCallLocalHold()  ");
        sf.scene.get('ListMainLiveCall').LocalHold();
    } 
}

WndMgr.MainLiveCallRemoteHold=function()
{
    if(this.MainSubScene[2].isShow== true && this.MainSubScene[2].Id == "ListMainLiveCall")
    {
        alert("***** WndMgr.MainLiveCallRemoteHold()  ");
        sf.scene.get('ListMainLiveCall').RemoteHold();
    } 
}

WndMgr.MainLiveCallResume=function()
{
    if(this.MainSubScene[2].isShow == true && this.MainSubScene[2].Id == "ListMainLiveCall")
    {
        alert("***** WndMgr.MainLiveCallResume()  ");
        sf.scene.get('ListMainLiveCall').Resume();
    } 
}

WndMgr.UpdateContactListCallDuration = function(nDurationTime){

        alert("***** WndMgr.UpdateContactListCallDuration(1) : nDurationTime = " + nDurationTime);
	if(StateMgr.MainStateList[MAIN_STATE.MAIN].flagLoad == true && this.iCurrentSubScene == 0)
	{
        alert("***** WndMgr.UpdateContactListCallDuration(2) : nDurationTime = " + nDurationTime);
		if(ProcMgr.isCalling== true && this.MainSubScene[0].isShow == true)
		{
	        alert("***** WndMgr.UpdateContactListCallDuration(3) : nDurationTime = " + nDurationTime);
			var MainContactListScene = sf.scene.get("ListMainContact");
	
			if (MainContactListScene.GetState() == ENUM_SCENE_STATUS.ACTIVATED ||
				MainContactListScene.GetState() == ENUM_SCENE_STATUS.DEACTIVATED) {
		        alert("***** WndMgr.UpdateContactListCallDuration(4) : nDurationTime = " + nDurationTime);
			
				MainContactListScene.ProgressCallDuration(nDurationTime);
			}
		}
	}	
}

WndMgr.UpdateHistoryVMDuration = function(nDurationTime){
	
    if(StateMgr.MainStateList[MAIN_STATE.MAIN].flagLoad == true)
    {
		if(ProcMgr.isVoiceMailPlaying==true)
		{
			var scene = sf.scene.get("ListMainHistory");
            scene.VMProgressPlayback(nDurationTime);
		}
    }	
}


//for Voice Recognition
WndMgr.FocusToCategotyOfListMain = function(index)
{
	alert('***WndMgr.FocusToCategotyOfListMain -> index: '+index);
	sf.scene.get("ListMain").MoveHighlight(index);
}

WndMgr.FocusToItemOfContactList = function(index)
{
	alert('***WndMgr.FocusToItemOfContactList -> index: '+index);
	
	sf.scene.get("ListMain").gotoContact();
    sf.scene.get("ListMainContact").RefreshForIndex(index);
}

WndMgr.FocusToItemOfHistoryList = function(index)
{
	alert('***WndMgr.FocusToItemOfHistoryList -> index: '+index);
	
	sf.scene.get("ListMain").gotoHistory();
    sf.scene.get("ListMainHistory").RefreshForIndex(index);
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  add contact  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.InitAddContact= function()
{
	sf.scene.get('AddContact').setResetFlag(true);
}

WndMgr.ShowAddContact= function()
{
    if(this.AddContactStep =="SearchNewContact")
    {
        WndMgr.StartLoading(LoadingTypeIndex.SEARCH);
        return;
    }
    if(this.AddContactStep =="SearchContactProfile")
    {
        WndMgr.StartLoading(LoadingTypeIndex.LOADING);
        return;
    }
    
     if(this.AddContactStep !="SearchFailNoty" && this.AddContactStep !="SearchProfileFailNoty" && this.AddContactStep !="AddContactFailNoty" && this.AddContactStep !="AddPhoneNumberFailNoty")
    {
    	if(this.AddContactStep =="AddContactSkypeName"){
	    	WndMgr.isShowAddContactSkypeName = true;
    	}
        sf.scene.show(this.AddContactStep);
        this.focus(this.AddContactStep);
    }    
}

WndMgr.HideAddContact= function()
{
     if(this.AddContactStep =="SearchNewContact" || this.AddContactStep =="SearchContactProfile" )
    {
        WndMgr.StopLoading();
    }
    else
    {
        sf.scene.hide(this.AddContactStep);
    }
    
   this.AddContactStep = "AddContact"; //init
}

WndMgr.ReturnAddContact= function()
{
	alert('WndMgr.ReturnAddContact');
	
	//temp
	if(this.AddContactStep == 'AddContactPhoneNumber')
	{
		Scene = sf.scene.get("AddContactPhoneNumber");
		if(Scene.ShownFlagList == true)
		{
			this.focus('CountryFlagList');
		}
		else
		{
			this.focus('AddContactPhoneNumber');
		}
	}
	else
	{
		this.focus(this.AddContactStep);
	}
}

WndMgr.StartAddContactSkypeNameStep = function()
{ 
    if(this.AddContactStep == "AddContact" )
    {
        sf.scene.hide(this.AddContactStep);
        this.AddContactStep = "AddContactSkypeName";
         sf.scene.get('AddContactSkypeName').setResetFlag(true);
    }
    else if( this.AddContactStep =="AddContactFailNoty")
    {
        this.AddContactStep = "AddContactSkypeName";
    }
    
    this.ShowAddContact();
}

WndMgr.StartAddContactPhoneNumberStep = function()
{
     if(this.AddContactStep == "AddContact")
    {
        sf.scene.hide(this.AddContactStep);
        this.AddContactStep = "AddContactPhoneNumber";
         sf.scene.get('AddContactPhoneNumber').setResetFlag(true);
    }
    else if(this.AddContactStep =="AddPhoneNumberFailNoty")
    {
         this.AddContactStep = "AddContactPhoneNumber";
    }

    this.ShowAddContact();
}

WndMgr.NextStepAddContact = function()
{
    if(this.AddContactStep =="SearchNewContact" || this.AddContactStep =="SearchContactProfile")
    {
        WndMgr.StopLoading();
    }
    else
    {    
        sf.scene.hide(this.AddContactStep);
    }
     
	if(this.AddContactStep == "AddContactSkypeName")
	{
		WndMgr.isShowAddContactSkypeName = false;	//close ime
	    this.AddContactStep ="SearchNewContact";
	}    
	else if(this.AddContactStep =="SearchNewContact")
	{
	    this.AddContactStep ="AddContactSearchResult";
	}
	else if(this.AddContactStep =="AddContactSearchResult")
	{
	    this.AddContactStep ="SearchContactProfile";
	}
	else if(this.AddContactStep =="SearchContactProfile")
	{
	    this.AddContactStep ="AddContactRequest";
	}  
	else if(this.AddContactStep == "AddContactRequest")
	{
	    this.AddContactStep ="AddContactFailNoty";
	}
	else if(this.AddContactStep == "AddContactPhoneNumber")
	{
	    this.AddContactStep ="AddPhoneNumberFailNoty";
	}
   
   alert("***** WndMgr.NextStepAddContact() " +this.AddContactStep);
   this.ShowAddContact();
}

WndMgr.BackStepAddContact = function()
{
    if(this.AddContactStep =="SearchNewContact" || this.AddContactStep =="SearchContactProfile") 
    {
            WndMgr.StopLoading();
    }
    else
    {    
        if(this.AddContactStep !="SearchFailNoty" && this.AddContactStep !="SearchProfileFailNoty")
        {
            sf.scene.hide(this.AddContactStep);
        }
    }
    
     if(this.AddContactStep == "AddContactSkypeName")
    {
    	WndMgr.isShowAddContactSkypeName = false;	//close ime
        this.AddContactStep ="AddContact";
    }
     else if(this.AddContactStep == "AddContactPhoneNumber")
    {
        this.AddContactStep ="AddContact";
    }
    else if(this.AddContactStep =="SearchNewContact") 
    {
        this.AddContactStep ="SearchFailNoty";
    }
	else if(this.AddContactStep =="SearchContactProfile") 
    {
        this.AddContactStep ="SearchProfileFailNoty";
    }
    else if(this.AddContactStep =="SearchFailNoty") 
    {
        this.AddContactStep ="AddContactSkypeName";
    }
	else if(this.AddContactStep =="SearchProfileFailNoty") 
    {
        this.AddContactStep ="AddContactSearchResult";
    }
    else if(this.AddContactStep =="AddContactSearchResult")
    {
        this.AddContactStep ="AddContactSkypeName";
    }
  	else if(this.AddContactStep =="AddContactRequest")
    {
        this.AddContactStep ="AddContactSearchResult";
    } 
   
   alert("***** WndMgr.BackStepAddContact() " +this.AddContactStep);
   this.ShowAddContact();
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Remove Contact  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowRemoveContact = function(Identity,Display)
{
    alert("***** WndMgr.ShowRemoveContact() : Identity["+Identity+"], Display["+Display+"]");
    
	if(this.RemoveContactStep == "RemoveContact"){
		
		sf.scene.get('RemoveContact').Init(Identity,Display);
		sf.scene.show('RemoveContact');
		sf.scene.focus('RemoveContact');
		
	}
	else if(this.RemoveContactStep == "RemovingContact"){
		
	}
	else if(this.RemoveContactStep == "RemovedContact"){
		
		sf.scene.hide('RemoveContact');
		if(Display)
			this.StartOneBottonPopup(OneBtnPopupIndex.CONTACT_REMOVED, Display);	
		else
			this.StartOneBottonPopup(OneBtnPopupIndex.CONTACT_REMOVED, Identity);	
	}		
}

WndMgr.NextStepRemoveContact = function(Identity,Display){
	
	if (this.RemoveContactStep == "RemoveContact") {
		
		this.RemoveContactStep = "RemovingContact";
	}
	else if(this.RemoveContactStep == "RemovingContact"){
		
		this.RemoveContactStep = "RemovedContact";		
	}	
	
    alert("***** WndMgr.NextStepRemoveContact() : RemoveContactStep["+this.RemoveContactStep+"]");
	this.ShowRemoveContact(Identity,Display);
}

WndMgr.ReturnRemoveContact = function()
{
    alert("***** WndMgr.ReturnRemoveContact()");
    
	if(this.RemoveContactStep == "RemoveContact")
	{
		this.focus('RemoveContact');
	}
}

WndMgr.GetStepOfRemoveContact = function(){

	return this.RemoveContactStep; 
}

WndMgr.HideRemoveContact = function()
{
    alert("***** WndMgr.HideRemoveContact()");
    
	if(this.RemoveContactStep == "RemoveContact"){
		
		sf.scene.hide('RemoveContact');		
	}	
		
   this.RemoveContactStep = "RemoveContact";
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Online Status  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowOnlineStatus = function()
{
    alert("***** WndMgr.ShowOnlineStatus()");
    
    sf.scene.show('OnlineStatus');
    sf.scene.focus('OnlineStatus');
}

WndMgr.HideOnlineStatus = function()
{
    alert("***** WndMgr.HideOnlineStatus()");
    
    sf.scene.hide('OnlineStatus');

}

WndMgr.ReturnOnlineStatus = function()
{
    alert("***** WndMgr.ReturnOnlineStatus");
    
    this.focus('OnlineStatus');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Gender ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowGender = function(){
	alert("***** WndMgr.ShowGender()");
    
    sf.scene.show('Gender');
    sf.scene.focus('Gender');
}
WndMgr.HideGender = function(){
	 alert("***** WndMgr.HideGender()");
    
    sf.scene.hide('Gender');

}
WndMgr.ReturnGender = function(){
	alert("***** WndMgr.ReturnGender()");
    
    sf.scene.focus('Gender');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  BirthDate ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowBirthDate = function(){
	alert("***** WndMgr.ShowBirthDate()");
    
    sf.scene.show('BirthDate');
    sf.scene.focus('BirthDate');
}
WndMgr.HideBirthDate = function(){
	 alert("***** WndMgr.HideBirthDate()");
    
    sf.scene.hide('BirthDate');

}
WndMgr.ReturnBirthDate = function(){
	alert("***** WndMgr.ReturnBirthDate()");

    sf.scene.focus('BirthDate');
}
/* 8.17 add*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  ProfilePhoneNumberSet ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowProfilePhoneNumberSet = function(){
	alert("***** WndMgr.ShowProfilePhoneNumberSet()");
    sf.scene.show('ProfilePhoneNumberSet');
    sf.scene.focus('ProfilePhoneNumberSet');
}
WndMgr.HideProfilePhoneNumberSet = function(){
	 alert("***** WndMgr.HideProfilePhoneNumberSet()");
    
    sf.scene.hide('ProfilePhoneNumberSet');
}
WndMgr.ReturnProfilePhoneNumberSet = function(){
	alert("***** WndMgr.ReturnProfilePhoneNumberSet()");
	
	Scene = sf.scene.get("ProfilePhoneNumberSet");
	if(Scene.ShownCountryList == true)
	{
		this.focus('CountryFlagList');
	}
	else
	{
		this.focus('ProfilePhoneNumberSet');
	}
}

//8.9 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsGeneral ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsGeneral = function(){
	alert("***** WndMgr.ShowSettingsGeneral()");
    
    sf.scene.show('SettingsGeneral');
    sf.scene.focus('SettingsGeneral');
}
WndMgr.HideSettingsGeneral = function(){
	 alert("***** WndMgr.HideSettingsGeneral()");
    
    sf.scene.hide('SettingsGeneral');
}
WndMgr.ReturnSettingsGeneral = function(){
	 alert("***** WndMgr.ReturnSettingsGeneral()");
    
	Scene = sf.scene.get("SettingsGeneral");

	if(Scene.ShownOnOffSubList == true)
	{
		this.focus('SettingsOnOffSubList');
	}
	else{
    	this.focus('SettingsGeneral');
    }

}

//8.10 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  VideoSetting ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsFaceRecognition = function(){
	alert("***** WndMgr.ShowSettingsFaceRecognition()");
	if(this.isShowCheckPwd==true){
		this.HideCheckPwd();
	}
    
    sf.scene.show('SettingsFaceRecognition');
    sf.scene.focus('SettingsFaceRecognition');
}
WndMgr.HideSettingsFaceRecognition = function(){
	 alert("***** WndMgr.HideSettingsFaceRecognition()");
    
    sf.scene.hide('SettingsFaceRecognition');
}
WndMgr.ReturnSettingsFaceRecognition = function(){
	 alert("***** WndMgr.ReturnSettingsFaceRecognition()");
    
    sf.scene.focus('SettingsFaceRecognition');
}
//8.10 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///// SettingsVideo ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsVideo = function(arg){
	alert("***** WndMgr.ShowSettingsVideo()");
    
    sf.scene.show('SettingsVideo');
    if(arg)
   		sf.scene.get('SettingsVideo').backtoCameraZoom();
    sf.scene.focus('SettingsVideo');
}
WndMgr.HideSettingsVideo = function(){
	 alert("***** WndMgr.HideSettingsVideo()");
    
    sf.scene.hide('SettingsVideo');
}
WndMgr.ReturnSettingsVideo = function(){

	 alert("***** WndMgr.ReturnSettingsVideo()");
	Scene = sf.scene.get("SettingsVideo");
  	if(Scene.ShownSubList == true)
	{
		this.focus('SettingsSubList');
	}
	else if(Scene.ShownOnOffSubList == true)
	{
		this.focus('SettingsOnOffSubList');
	}
	else{
    	this.focus('SettingsVideo');
    }
}

//8.9 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsPrivacy ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsPrivacy = function(){
	alert("***** WndMgr.ShowSettingsPrivacy()");
    
    sf.scene.show('SettingsPrivacy');
    sf.scene.focus('SettingsPrivacy');
}
WndMgr.HideSettingsPrivacy = function(){
	alert("***** WndMgr.HideSettingsPrivacy()");
    sf.scene.hide('SettingsPrivacy');
}
WndMgr.ReturnSettingsPrivacy = function(){
	alert("***** WndMgr.ReturnSettingsPrivacy()");
	Scene = sf.scene.get("SettingsPrivacy");
  	if(Scene.ShownSubList == true)
	{
		this.focus('SettingsSubList');
	}else{
   		this.focus('SettingsPrivacy');
   }
}

//8.10 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsBlockedContacts ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsBlockedContacts = function(){
	alert("***** WndMgr.ShowSettingsBlockedContacts()");
    
    sf.scene.show('SettingsBlockedContacts');
    sf.scene.focus('SettingsBlockedContacts');
}
WndMgr.HideSettingsBlockedContacts = function(){
	alert("***** WndMgr.HideSettingsBlockedContacts()");
    sf.scene.hide('SettingsBlockedContacts');
}
WndMgr.ReturnSettingsBlockedContacts = function(){
	alert("***** WndMgr.ReturnSettingsBlockedContacts()");
   	this.focus('SettingsBlockedContacts');
}

//8.10 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsCallForwarding ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsCallForwarding = function(){
	alert("***** WndMgr.ShowSettingsCallForwarding()");
    
    sf.scene.show('SettingsCallForwarding');
    sf.scene.focus('SettingsCallForwarding');
}
WndMgr.HideSettingsCallForwarding = function(){
	 alert("***** WndMgr.HideSettingsCallForwarding()");
    sf.scene.hide('SettingsCallForwarding');
}
WndMgr.ReturnSettingsCallForwarding = function(){
	 alert("***** WndMgr.ReturnSettingsCallForwarding()");
	Scene = sf.scene.get("SettingsCallForwarding");
  	if(Scene.ShownOnOffSubList == true)
	{
		this.focus('ShownOnOffSubList');
	}else if(Scene.ShownCountryList == true)
	{
		this.focus('CountryFlagList');
	}
	else{
    	this.focus('SettingsCallForwarding');
    }
}

//8.9 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsVoicemail ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsVoicemail = function(){
	alert("***** WndMgr.ShowSettingsVoicemail()");
    
    sf.scene.show('SettingsVoicemail');
    sf.scene.focus('SettingsVoicemail');
}
WndMgr.HideSettingsVoicemail = function(){
	alert("***** WndMgr.HideSettingsVoicemail()");
    sf.scene.hide('SettingsVoicemail');
}
WndMgr.ReturnSettingsVoicemail = function(){
	alert("***** WndMgr.ReturnSettingsVoicemail()");
	Scene = sf.scene.get("SettingsVoicemail");
  	if(Scene.ShownOnOffSubList == true)
	{
		this.focus('ShownOnOffSubList');
	}else{
    	this.focus('SettingsVoicemail');
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsVoicemailUnable ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsVoicemailUnable = function(){
	alert("***** WndMgr.ShowSettingsVoicemailUnable()");
    
    sf.scene.show('SettingsVoicemailUnable');
    sf.scene.focus('SettingsVoicemailUnable');
}
WndMgr.HideSettingsVoicemailUnable = function(){
	alert("***** WndMgr.HideSettingsVoicemailUnable()");
    sf.scene.hide('SettingsVoicemailUnable');
}
WndMgr.ReturnSettingsVoicemailUnable = function(){
	alert("***** WndMgr.ReturnSettingsVoicemailUnable()");
    this.focus('SettingsVoicemailUnable');
}

//8.9 add
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  SettingsAboutSkype ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
WndMgr.ShowSettingsAboutSkype = function(){
	alert("***** WndMgr.ShowSettingsAboutSkype()");
    
    sf.scene.show('SettingsAboutSkype');
    sf.scene.focus('SettingsAboutSkype');
}
WndMgr.HideSettingsAboutSkype = function(){
	alert("***** WndMgr.HideSettingsAboutSkype()");
    sf.scene.hide('SettingsAboutSkype');
}
WndMgr.ReturnSettingsAboutSkype = function(){
	alert("***** WndMgr.ReturnSettingsAboutSkype()");
    this.focus('SettingsAboutSkype');
}
// Settings OnOff SubList
WndMgr.StartSettingsOnOffSubList = function(objId, sceneId,sceneObj, cbFunc, curValue)
{
 	alert("***** WndMgr.StartSettingsOnOffSubList() ");
    this.ListCallerSceneId = sceneId;
	
    sf.scene.show("SettingsOnOffSubList");
    sf.scene.get("SettingsOnOffSubList").start(objId,sceneObj,cbFunc, curValue);
    sf.scene.focus("SettingsOnOffSubList");
}

WndMgr.StopSettingsOnOffSubList = function()
{ 
    alert("***** WndMgr.StopSettingsOnOffSubList()");   
    sf.scene.hide("SettingsOnOffSubList");
    sf.scene.focus(this.ListCallerSceneId);
}
WndMgr.HideSettingsOnOffSubList = function()
{ 
    alert("***** WndMgr.HideSettingsOnOffSubList()");   
    sf.scene.hide("SettingsOnOffSubList");
}
WndMgr.ReturnSettingsOnOffSubList = function(){
	alert("***** WndMgr.ReturnSettingsOnOffSubList()");
    this.focus('SettingsOnOffSubList');
}

// Settings Video, Privacy SubList
WndMgr.StartSettingsSubList = function(objId, sceneId,sceneObj, cbFunc, curValue)
{
 	alert("***** WndMgr.StartSettingsSubList() ");
    this.ListCallerSceneId = sceneId;
	
    sf.scene.show("SettingsSubList");
    sf.scene.get("SettingsSubList").start(objId,sceneObj, cbFunc, curValue);
    sf.scene.focus("SettingsSubList");
   
}

WndMgr.StopSettingsSubList = function()
{ 
    alert("***** WndMgr.StopSettingsSubList()");   
    sf.scene.hide("SettingsSubList");
    sf.scene.focus(this.ListCallerSceneId);
}
WndMgr.HideSettingsSubList = function()
{ 
    alert("***** WndMgr.HideSettingsSubList()");   
    sf.scene.hide("SettingsSubList");
}
WndMgr.ReturnSettingsSubList = function(){
	alert("***** WndMgr.ReturnSettingsSubList()");
    this.focus('SettingsSubList');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Calling  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowCalling = function()
{
    alert("***** WndMgr.ShowCalling()");
    this.isShowCalling = true ;
        
    sf.scene.show('Calling');
    sf.scene.focus('Calling');
}

WndMgr.HideCalling = function()
{
    alert("***** WndMgr.HideCalling()");
    this.isShowCalling = false ;
    sf.scene.hide('Calling');

}

WndMgr.ReturnCalling = function()
{
    alert("***** WndMgr.ReturnCalling()");
    	
	sf.scene.focus('Calling');    
}

WndMgr.CloseCallingPreView = function()
{
	if(this.isShowCalling == true)
	{
		sf.scene.get('Calling').hiddenPreview();		
	}
}

WndMgr.UpdateCallingStatus = function(call_status)
{
    alert("***** WndMgr.UpdateCallingStatus()");
    if(this.isShowCalling == true)
    {
        sf.scene.get('Calling').updateCallingStatus(call_status);
    }
    else
    {
        if( call_status == ENUM_CALL_STATUS.FAILED && StateMgr.MainStateList[MAIN_STATE.CALLING].flagLoading == true)
        {
            this.isCallingFail =  true;
        }
    }
}

WndMgr.UpdateCallingMessage = function(call_status)
{
    alert("***** WndMgr.UpdateCallingMessage()");
    if(this.isShowCalling == true)
    {
        sf.scene.get('Calling').updateCallingMessage(call_status);
    }
}

WndMgr.updateCallingButton = function(flag_dim)
{
    alert("***** WndMgr.updateCallingButton()");
    if(this.isShowCalling == true)
    {
        sf.scene.get('Calling').updateCallingButton(flag_dim);
    }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Voice Mail  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowVoiceMail= function()
{
    alert("***** WndMgr.ShowVoiceMail()");
    this.isShowVoiceMail= true ;
    
    sf.scene.show('VoiceMail');
    sf.scene.focus('VoiceMail');
}

WndMgr.HideVoiceMail = function()
{
    alert("***** WndMgr.HideVoiceMail()");
    this.isShowVoiceMail = false ;
    sf.scene.hide('VoiceMail');

}

WndMgr.ReturnVoiceMail = function()
{
    alert("***** WndMgr.ReturnVoiceMail()");
    	
	sf.scene.focus('VoiceMail');    

}

WndMgr.UpdateVoiceMailRecordingDuration=function(time)
{
    if(this.isShowVoiceMail == true)
    {
        alert("***** WndMgr.UpdateVoiceMailRecordingDuration()  ");
        sf.scene.get('VoiceMail').updateCallDuration(time);
    } 
}

WndMgr.UpdateVoiceMailMessage = function(call_status)
{
    alert("***** WndMgr.UpdateVoiceMailMessage()");
    if(this.isShowVoiceMail == true)
    {
        sf.scene.get('VoiceMail').updateVoiceMailState(call_status);
    }
}

	

WndMgr.ShowCallCameraControl= function()
{
    alert("***** WndMgr.ShowCallCameraControl()");
    this.isShowCameraControl = true ;
    
    sf.scene.show('CallCameraControl');
    sf.scene.focus('CallCameraControl');
}

WndMgr.HideCallCameraControl = function()
{
    alert("***** WndMgr.HideCallCameraControl()");
    this.isShowCameraControl = false ;
    sf.scene.hide('CallCameraControl');

}

WndMgr.ReturnCallCameraControl = function()
{
    alert("***** WndMgr.ReturnCallCameraControl()");
    	
	sf.scene.focus('CallCameraControl');    

}	


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Call Ending  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowCallEnding = function(flagCallEndByMe)
{
    alert("***** WndMgr.ShowCallEnding()");
    if(flagCallEndByMe==true)
    {
        sf.scene.get('CallEnding').setFlagEnding(true);
    }
    else
    {
        sf.scene.get('CallEnding').setFlagEnding(false);
    }
    
    sf.scene.show('CallEnding');
    sf.scene.focus('CallEnding');
}

WndMgr.HideCallEnding = function()
{
    alert("***** WndMgr.HideCallEnding()");
    
    sf.scene.hide('CallEnding');

}

WndMgr.ReturnCallEnding = function()
{
    alert("***** WndMgr.ReturnCallEnding()");
  
    sf.scene.focus('CallEnding');
}

WndMgr.UpdateCallEndingStatus = function()
{
    alert("***** WndMgr.UpdateCallEndingStatus()");
    sf.scene.get('CallEnding').setFlagEnding(false);
    sf.scene.get('CallEnding').update();
}

WndMgr.UpdateCallDroppedStatus = function()
{
    sf.scene.get('CallEnding').setFlagDropped(true);
}

WndMgr.UpdateChangePictureCameraState=function()
{
	if(StateMgr.GetCurrentSubState() == 'ChangePicture'){
		
		sf.scene.get('ChangePicture').UpdateVideoSnapshotBtn();		
	}
}
WndMgr.UpdateCallSettingPopupState = function(){
	if(StateMgr.GetCurrentSubState() == 'CallSettingPopup'){

		sf.scene.get('CallSettingPopup').processReturnKey();		
	}
}
WndMgr.UpdateCallCameraControlState = function(){
	if((StateMgr.GetCurrentState() == 'CallCameraControl') && 
		(PluginAPIMgr.GetCameraState() != ENUM_CAM_STATE.CAM_STATE_READY)){
		
		sf.scene.get('CallCameraControl').RemovedCamera();		
	}
}
WndMgr.UpdateVideoSnapshotCameraState=function()
{
	if((StateMgr.GetCurrentState() == 'VideoSnapshot') && 
		(PluginAPIMgr.GetCameraState() != ENUM_CAM_STATE.CAM_STATE_READY)){
		
		sf.scene.get('VideoSnapshot').RemovedCamera();		
	}
}

WndMgr.UpdateVideoSettingsCameraState=function()
{
	if(StateMgr.GetCurrentSubState() == 'SettingsVideo') {
		
		sf.scene.get('SettingsVideo').updatePopup();		
	}
}
WndMgr.UpdateListMainSettingCameraState=function()
{
	if((StateMgr.GetCurrentState() == 'Main')&&this.MainSubScene[this.iCurrentSubScene].Id =='ListMainSetting'){
		
		sf.scene.get('ListMainSetting').ResetPage();		
	}
}


WndMgr.VoiceCallLocalHold=function()
{
    if(this.isShowVoiceCall == true)
    {
        alert("***** WndMgr.VoiceCallLocalHold()  ");
        sf.scene.get('VoiceCall').LocalHold();
    } 
}

WndMgr.VoiceCallRemoteHold=function()
{
    if(this.isShowVoiceCall == true)
    {
        alert("***** WndMgr.VoiceCallRemoteHold()  ");
        sf.scene.get('VoiceCall').RemoteHold();
    } 
}

WndMgr.VoiceCallResume=function()
{
    if(this.isShowVoiceCall == true)
    {
        alert("***** WndMgr.VoiceCallResume()  ");
        sf.scene.get('VoiceCall').Resume();
    } 
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Video Call  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowVideoCall=function()
{
    alert("***** WndMgr.ShowVideoCall() : "+this.VideoCallScreen);
    
    this.isShowVideoCallNormal = false ;
    this.isShowVideoCallSD = false ;

    sf.scene.show('VideoCall');
    sf.scene.focus('VideoCall');
    
	this.isShowVideoCallHD = true ;
        
    PluginAPIMgr.SetCameraLightMode(); 
    
    setTimeout("OpenTimerCF()", 0);
	OpenTimerCF = function(){
		g_Data.WIDGET_PARAM.tryHideConnectWnd = true;
		PluginAPIMgr.HideConnectingWnd();
	}
}

WndMgr.HideVideoCall=function()
{
    alert("***** WndMgr.HideVideoCall() : "+this.VideoCallScreen);

	if(this.isShowVideoCallHD==true)
	{            
	    sf.scene.hide('VideoCall');
	}
	 
	this.isShowVideoCallTV = false ;	 
    this.isShowVideoCallHD = false ;
    
	this.VideoCallScreen ="Full"; //init
}

WndMgr.ReturnVideoCall =function()
{
    alert("***** WndMgr.ReturnVideoCall()");

	if( this.isShowVideoCallHD == true)
	{
	    sf.scene.focus('VideoCall');    
	}
}

WndMgr.GetVideoCallScreen = function()
{
	return this.VideoCallScreen;
}

WndMgr.UpdateVideoCallDuration=function(time)
{    
    if(StateMgr.MainStateList[MAIN_STATE.VIDEO_CALL].flagLoad == true)
    {
       if(StateMgr.GetCurrentState() == "VideoCall" )
    	{
			sf.scene.get('VideoCall').updateCallDuration(time);
    	} 
    }     
}

WndMgr.UpdateVideoCallCameraState=function()
{
    WndMgr.UpdateVideoCallMyVideo();
}

WndMgr.UpdateVideoCallYourVideo=function()
{    
	if(StateMgr.MainStateList[MAIN_STATE.VIDEO_CALL].flagLoad == true)
	{
		if(StateMgr.GetCurrentState() == "VideoCall" )
		{
			sf.scene.get('VideoCall').toggleYourVideo();
		}
	} 
} 
    
WndMgr.UpdateVideoCallMyVideo=function()
{
	//sf.scene.get('VideoCall').toggleCameraBtnEnable();
	if(StateMgr.MainStateList[MAIN_STATE.VIDEO_CALL].flagLoad == true)
	{
		if(StateMgr.GetCurrentState() == "VideoCall" )
		{
			sf.scene.get('VideoCall').toggleMyVideo();
		} 
	}
} 

WndMgr.CloseVideoCallRect=function()
{    
	alert("***** WndMgr.CloseVideoCallRect()");
	if(this.isShowVideoCallHD == true)
	{
		sf.scene.get('VideoCall').closingProcess();
	}
}

WndMgr.VideoCallLocalHoldWait=function()
{  
	//delete by lee donghee
}

WndMgr.VideoCallLocalHold=function()
{  
	//delete by lee donghee
}

WndMgr.VideoCallRemoteHold=function()
{
	alert("***** WndMgr.VideoCallRemoteHold()");

	if(this.isShowVideoCallHD == true)
	{
		sf.scene.get('VideoCall').RemoteHold();
	}
}

WndMgr.VideoCallResume=function()
{
    alert("***** WndMgr.VideoCallResume()");

	if(this.isShowVideoCallHD == true)
	{
		sf.scene.get('VideoCall').Resume();
	}
	      
	//PluginAPIMgr.SetCameraLightMode();
}

WndMgr.UpdateVideoCallQuality=function()
{
	if(StateMgr.GetCurrentState()=="VideoCall")
    {
        alert("***** WndMgr.UpdateVideoCallQuality()");
		// sf.scene.get('VideoCall').UpdateCallQuality();
    }
}

WndMgr.UpdateVideoCallMemberInfo=function()
{
	alert("***** WndMgr.UpdateVideoCallMemberInfo() ");
}

WndMgr.UpdateVideoCallCredit=function()
{
	//check
	if(this.isShowVideoCallHD == true)
	{	
        alert("***** WndMgr.UpdateVideoCallCredit()");
        sf.scene.get('VideoCall').updateCredit();
    }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Conference Call  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowConferenceCall = function()
{
    sf.scene.show('ConferenceCall');
    sf.scene.focus('ConferenceCall');
	    
    this.isShowConferenceCall = true ;
    
   setTimeout("OpenTimerCF()", 0);
	OpenTimerCF = function(){
		PluginAPIMgr.HideConnectingWnd();
	}
}

WndMgr.HideConferenceCall = function()
{
    sf.scene.hide('ConferenceCall');
    
    this.isShowConferenceCall = false ;
}

WndMgr.ReturnConferenceCall =function()
{
    alert("***** WndMgr.ReturnConferenceCall()");

        sf.scene.focus('ConferenceCall');    
}

WndMgr.UpdateConferenceCallDuration=function(time)
{
    if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.UpdateConferenceCallDuration() ");

        sf.scene.get('ConferenceCall').updateCallDuration(time);
    } 
}

WndMgr.UpdateConferenceCallCameraState =function()
{
     if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.UpdateConferenceCallCameraState() ");
        sf.scene.get('ConferenceCall').toggleMicVolumeBtnEnable();
    } 
}

WndMgr.UpdateConferenceCallMemberInfo=function()
{
    if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.UpdateConferenceCallMemberInfo() ");
        sf.scene.get('ConferenceCall').updateCallMember();
    } 
}

WndMgr.ConferenceCallLocalHold=function()
{
    if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.ConferenceCallLocalHold()  ");
        //sf.scene.get('ConferenceCall').LocalHold();
    } 
}

WndMgr.ConferenceCallRemoteHold=function()
{
    if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.ConferenceCallRemoteHold()  ");
        sf.scene.get('ConferenceCall').updateCallMember();
    } 
}

WndMgr.ConferenceCallResume=function()
{
    if(this.isShowConferenceCall == true)
    {
        alert("***** WndMgr.ConferenceCallResume()  ");
        sf.scene.get('ConferenceCall').updateCallMember();
    } 
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Skype Out Call  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowSkypeOutCall=function()
{
    alert("***** WndMgr.ShowSkypeOutCall() :" + this.SkypeOutCallMode );
    
        sf.scene.show('SkypeOutCall');
        sf.scene.focus('SkypeOutCall');
		        
        this.isShowSKypeOutCall = true;
        
        setTimeout("OpenTimerCF()", 0);
		OpenTimerCF = function(){
		PluginAPIMgr.HideConnectingWnd();
		}
    }
    
WndMgr.HideSkypeOutCall=function()
{
    alert("***** WndMgr.HideSkypeOutCall()  ");
    
        sf.scene.hide('SkypeOutCall');
    this.isShowSKypeOutCall = false;
    
}

WndMgr.ReturnSkypeOutCall =function()
{
    alert("***** WndMgr.ReturnSkypeOutCall()");

    if( this.isShowSKypeOutCall == true)
    {
        sf.scene.focus('SkypeOutCall');    
    }
}

     

WndMgr.UpdateSkypeOutCallDuration=function(time)
{
	if(this.isShowSKypeOutCall == true)
	{
        alert("***** WndMgr.UpdateSkypeOutCallDuration() : Normal");
        sf.scene.get('SkypeOutCall').updateCallDuration(time);
    }
}
    
WndMgr.UpdateSkypeOutCallCredit=function()
{
	if(this.isShowSKypeOutCall == true)
	{	
        alert("***** WndMgr.UpdateSkypeOutCallCredit()");
        sf.scene.get('SkypeOutCall').updateCredit();
    }
}
    
WndMgr.UpdateSkypeOutCallCameraState=function()
{
	if(this.isShowSKypeOutCall == true)
	{		
        sf.scene.get('SkypeOutCall').toggleMicVolumeBtnEnable();
    }
}
    
WndMgr.SkypeOutCallLocalHold=function()
{
    
}

WndMgr.SkypeOutCallRemoteHold=function()
{  
	if(this.isShowSKypeOutCall == true)
	{	  
        alert("***** WndMgr.SkypeOutCallRemoteHold() : Normal");
        sf.scene.get('SkypeOutCall').RemoteHold();
    }
}
    
WndMgr.SkypeOutCallResume=function()
{
	if(this.isShowSKypeOutCall == true)
	{		
        alert("***** WndMgr.SkypeOutCallResume() : Normal");
        sf.scene.get('SkypeOutCall').Resume();
    }
}
    


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Call Popup  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowCallConfirmPopup = function(popupType)
{
	alert("***** WndMgr.ShowCallConfirmPopup()");
	
	sf.scene.get('CallConfirmPopup').setType(popupType);
	sf.scene.show('CallConfirmPopup');
    sf.scene.focus('CallConfirmPopup');
}

WndMgr.HideCallConfirmPopup = function()
{
	alert("***** WndMgr.HideCallConfirmPopup()");
	sf.scene.hide('CallConfirmPopup'); 
}

WndMgr.ReturnCallConfirmPopup = function()
{
	alert("***** WndMgr.ReturnCallConfirmPopup()");
	
    sf.scene.focus('CallConfirmPopup');
}

WndMgr.ShowCallSettingPopup = function()
{
	alert("***** WndMgr.ShowCallSettingPopup()");
	
	sf.scene.show('CallSettingPopup');
    sf.scene.focus('CallSettingPopup');
}

WndMgr.HideCallSettingPopup = function()
{
	alert("***** WndMgr.HideCallSettingPopup()");
	sf.scene.hide('CallSettingPopup'); 
}

WndMgr.ReturnCallSettingPopup = function()
{
	alert("***** WndMgr.ReturnCallSettingPopup()");

    sf.scene.focus('CallSettingPopup');
}

WndMgr.ShowCameraAdjustPopup = function()
{
	alert("***** WndMgr.ShowCameraAdjustPopup()");
	
	sf.scene.show('CameraLightAdjControl');
    sf.scene.focus('CameraLightAdjControl');
}

WndMgr.HideCameraAdjustPopup = function()
{
	alert("***** WndMgr.HideCameraAdjustPopup()");
	
	sf.scene.hide('CameraLightAdjControl'); 
}

WndMgr.ReturnCameraAdjustPopup = function()
{
	alert("***** WndMgr.ReturnCameraAdjustPopup()");
	
	sf.scene.focus('CameraLightAdjControl');
}

/////  Add Phone number////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowAddPhoneNumber = function(Identity)
{
	alert("***** WndMgr.ShowAddPhoneNumber()");

	sf.scene.get('AddAssignedPhoneNumber').Init(Identity);
	sf.scene.show('AddAssignedPhoneNumber');
    sf.scene.focus('AddAssignedPhoneNumber');
}

WndMgr.HideAddPhoneNumber = function()
{
	alert("***** WndMgr.HideAddPhoneNumber()");
	sf.scene.hide('AddAssignedPhoneNumber'); 
}

WndMgr.ReturnAddPhoneNumber = function()
{
	alert("***** WndMgr.ReturnAddPhoneNumber()");

	Scene = sf.scene.get("AddAssignedPhoneNumber");
	if(Scene.ShownFlagList == true)
	{
		this.focus('CountryFlagList');
	}
	else
	{
		this.focus('AddAssignedPhoneNumber');
	}       
}

/////  ListMain Phone number List////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowListMainPhoneNumber = function(SceneName,SkypeName)
{
	alert("***** WndMgr.ShowListMainPhoneNumber()");

	sf.scene.get('ListMainContactPhoneNumberList').SetInfo(SceneName,SkypeName);	
	sf.scene.show('ListMainContactPhoneNumberList');
    sf.scene.focus('ListMainContactPhoneNumberList');
}

WndMgr.HideListMainPhoneNumber = function()
{
	alert("***** WndMgr.HideListMainPhoneNumber()");
	sf.scene.hide('ListMainContactPhoneNumberList'); 
}

WndMgr.ReturnListMainPhoneNumber = function()
{
	alert("***** WndMgr.ReturnListMainPhoneNumber()");

	Scene = sf.scene.get("ListMainContactPhoneNumberList");
	if(Scene.ShownFlagList == true)
	{
		this.focus('CountryFlagList');
	}
	else
	{
		this.focus('ListMainContactPhoneNumberList');
	}       
}

/////  Change Phone number////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowChangePhoneNumber = function(Identity,prop,PhoneLabel,PhoneNumber)
{
	alert("***** WndMgr.ShowChangePhoneNumber()");

	sf.scene.get('ChangePhoneNumber').Init(Identity,prop,PhoneLabel,PhoneNumber);	
	sf.scene.show('ChangePhoneNumber');
    sf.scene.focus('ChangePhoneNumber');
}

WndMgr.HideChangePhoneNumber = function()
{
	alert("***** WndMgr.HideChangePhoneNumber()");
	sf.scene.hide('ChangePhoneNumber'); 
}

WndMgr.ReturnChangePhoneNumber = function()
{
	alert("***** WndMgr.ReturnChangePhoneNumber()");

    sf.scene.focus('ChangePhoneNumber');
}

WndMgr.ShowChangePhoneNumberSelect = function(FuncParamA,FuncParamB){

	alert("***** WndMgr.Show_ChangePhoneNumberSelect()");

	sf.scene.get("ChangePhoneNumberSelect").SetInfo(FuncParamA,FuncParamB);	
	sf.scene.show('ChangePhoneNumberSelect');
	sf.scene.focus('ChangePhoneNumberSelect');
}


WndMgr.HideChangePhoneNumberSelect = function(){

	alert("***** WndMgr.Hide_ChangePhoneNumberSelect()");
	sf.scene.hide("ChangePhoneNumberSelect");
}

WndMgr.ReturnChangePhoneNumberSelect = function()
{
	alert("***** WndMgr.ReturnChangePhoneNumberSelect()");

    sf.scene.focus('ChangePhoneNumberSelect');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Loading ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartLoading = function(type)
{
    alert("***** WndMgr.StartLoading()");

    ProcMgr.registerCallKey();

    if(type)
    {
        sf.scene.get("Loading").initLoadingType(type);
    }
    
    sf.scene.show('Loading');
    sf.scene.focus('Loading');

	this.isShowLoading = true;
	this.loadingType = type;
}

WndMgr.StopLoading = function()
{
    alert("***** WndMgr.StopLoading()");
    if(this.isShowLoading){
    ProcMgr.unregisterCallKey();
    sf.scene.hide('Loading');
    }
    //init
    this.isShowLoading = false;
	this.loadingType = 5;
	
}

WndMgr.DisableLoading = function()
{
	if(this.isShowLoading==true && this.loadingType==LoadingTypeIndex.SIGNIN_WITH_CANCEL)
	{
		sf.scene.get("Loading").disableCancel();
	}
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Text Editor  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartTextEditor = function(objId, sceneId, dimObj, textareaflag)
{
 alert("***** WndMgr.StartTextEditor()");
    
    this.TextEditorCallerObj = objId
    this.TextEditorCallerSceneId = sceneId;
	this.TextEditorCallerDimObj =dimObj;
        WndMgr.ShowTextEditor(textareaflag);
    }

WndMgr.ShowTextEditor = function(textareaflag)
{
	if(this.isShowTextEditor == true)
    	return;
    alert("***** WndMgr.ShowTextEditor()"); 
    this.isShowTextEditor = true;
	if(this.TextEditorCallerDimObj)
	{
		this.TextEditorCallerDimObj.hide();
	}
	//2013 add by minseok
	if(textareaflag){
		sf.scene.get("TextEditor").setFlagTextArea(true);
	}else{
		sf.scene.get("TextEditor").setFlagTextArea(false);
	}
	
	sf.scene.get("TextEditor").initInputBox(this.TextEditorCallerObj);
    sf.scene.show('TextEditor');
    sf.scene.focus('TextEditor');
}

WndMgr.StopTextEditor = function()
{ 
 alert("***** WndMgr.StopTextEditor()");   
    this.isShowTextEditor = false;
	if(this.TextEditorCallerDimObj)
	{
		this.TextEditorCallerDimObj.show();
	}
	
	this.TextEditorCallerObj.SetText(sf.scene.get("TextEditor").GetInputText());

    sf.scene.hide('TextEditor');
    //modify by minseok
    //sf.scene.show(this.TextEditorCallerSceneId );
    
    sf.scene.focus(this.TextEditorCallerSceneId );
    sf.scene.returnFocus();
    	/*8.6 add kjy*/
	if(this.TextEditorCallerObj.onImeTextEndFunc)
		this.TextEditorCallerObj.onImeTextEndFunc();
	//
}

WndMgr.CancelTextEditor = function()
{   
 alert("***** WndMgr.CancelTextEditor()"); 

   this.isShowTextEditor = false;
   	if(this.TextEditorCallerDimObj)
	{
		this.TextEditorCallerDimObj.show();
	}
	if(this.TextEditorCallerSceneId=="CreateAccountFail1"){
		var scene = sf.scene.get("CreateAccountFail1");
		if(scene.toggleFlag){
			scene.toggleFlag=false;
		}
	}
    sf.scene.hide('TextEditor');
    sf.scene.focus(this.TextEditorCallerSceneId );
    sf.scene.returnFocus();
    
     	/*8.6 add kjy*/
	if(this.TextEditorCallerObj.onImeTextEndFunc)
		this.TextEditorCallerObj.onImeTextEndFunc();
	//
}

WndMgr.HideTextEditor = function()
{
    alert("***** WndMgr.HideTextEditor()"); 
    
    if(this.isShowTextEditor ==true)
    {
        this.isShowTextEditor = false;
        sf.scene.hide('TextEditor');
        sf.scene.returnFocus();
    }
}

WndMgr.ReturnTextEditor = function()
{
    alert("***** WndMgr.ReturnTextEditor()"); 
    this.focus('TextEditor');
    
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Keypad ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartKeypad = function(objId, sceneId, stopCF)
{
 alert("***** WndMgr.StartKeypad()");
    
    this.KeypadCallerObj = objId
    this.KeypadCallerSceneId = sceneId;
    this.KeypadStopCF = stopCF;
  
    WndMgr.ShowKeypad();

}

WndMgr.ShowKeypad = function()
{
    alert("***** WndMgr.ShowKeypad()"); 
    this.isShowkeypad = true;
	
	sf.scene.get("Keypad").initData(this.KeypadCallerObj, this.KeypadCallerSceneId);
    sf.scene.show('Keypad');
}

WndMgr.StopKeypad = function()
{ 
 alert("***** WndMgr.StopKeypad()");   
    this.isShowkeypad = false;

    sf.scene.hide('Keypad');
    if(this.KeypadStopCF!=null)
    {
    	this.KeypadStopCF();
    }
}

WndMgr.HideKeypad = function()
{
    alert("***** WndMgr.HideKeypad()"); 
    
    if(this.isShowkeypad ==true)
    {
        this.isShowkeypad = false;
        sf.scene.hide('Keypad');
    }
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  One button Popup  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartOneBottonPopup = function(popupIndex, popupData)
{
 alert("***** WndMgr.StartOneBottonPopup() "+ popupIndex);
    
	if(this.isShowOneBtnPopup ==true)
	{
		WndMgr.HideOneBottonPopup();
		WndMgr.StartOneBottonPopup(popupIndex, popupData);
	}
	else
	{
		this.isShowOneBtnPopup =true;
	    sf.scene.get("OneButtonPopup").initPopup(popupIndex, popupData);
	    sf.scene.show('OneButtonPopup');
	    sf.scene.focus('OneButtonPopup');
	}
}

WndMgr.StopOneBottonPopup = function()
{
 alert("***** WndMgr.StopOneBottonPopup()");
    
    sf.scene.hide('OneButtonPopup');
    if(this.isDebugMode==true){
    	sf.scene.focus('Welcome');
    	this.isDebugMode=false;
    }else{
	    sf.scene.get("OneButtonPopup").callBack();
    }
	this.isShowOneBtnPopup =false;
}

WndMgr.HideOneBottonPopup = function()
{
 alert("***** WndMgr.HideOneBottonPopup()");
    
	if(this.isShowOneBtnPopup==true)
	{
		sf.scene.hide('OneButtonPopup');
		this.isShowOneBtnPopup =false;
	}

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Volume  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowVolumeSpeaker = function(volume_mode)
{
 alert("***** WndMgr.ShowVolumeSpeaker()");

	if(volume_mode)
	{
		sf.scene.get('Volume').setVolumeMode(volume_mode);
	}	
    sf.scene.show('Volume');
    sf.scene.focus('Volume');
}

WndMgr.HideVolumeSpeaker = function()
{
 alert("***** WndMgr.HideVolumeSpeaker()");
    
    sf.scene.hide('Volume');    
}

WndMgr.ReturnVolumeSpeaker= function()
{
 alert("***** WndMgr.ReturnVolumeSpeaker()");

    sf.scene.focus('Volume');
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Online Status ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowOnlineStatus = function()
{
    alert("***** WndMgr.ShowOnlineStatus()");
    
    sf.scene.show('OnlineStatus');
    sf.scene.focus('OnlineStatus');
}

WndMgr.HideOnlineStatus = function()
{
    alert("***** WndMgr.HideOnlineStatus()");
    
    sf.scene.hide('OnlineStatus');

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Confirm Popup ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartConfirmPopup = function(popupIndex)
{
 alert("***** WndMgr.StartConfirmPopup()");
    sf.scene.get("ConfirmPopup").initPopup(popupIndex);
    sf.scene.show('ConfirmPopup');
    sf.scene.focus('ConfirmPopup');
    this.isShowConfirmPopup = true;
}

WndMgr.NextConfirmPopup= function()
{
 alert("***** WndMgr.NextConfirmPopup()");
    
    sf.scene.hide('ConfirmPopup');
    sf.scene.get("ConfirmPopup").yseCallBack();
    this.isShowConfirmPopup = false;
}

WndMgr.StopConfirmPopup= function()
{
 alert("***** WndMgr.StopConfirmPopup()");
    
    sf.scene.hide('ConfirmPopup');
    sf.scene.get("ConfirmPopup").noCallBack();
    this.isShowConfirmPopup = false;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Change Picture  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowChangePicture = function()
{
	alert("***** WndMgr.ShowChangePicture()");
	
	if(this.ChangePictureStep == "ConfirmWnd"){
	
		var confirmScene = sf.scene.get("ChangePictureConfirm");				
		confirmScene.SetAvatarPath(this.Param_A);
		
		sf.scene.show('ChangePictureConfirm');
		sf.scene.focus('ChangePictureConfirm');
	}
	else if(this.ChangePictureStep == "DeleteWnd"){
		
		WndMgr.StartConfirmPopup(ConfirmPopupIndex.DELETE_PICTURE);
	}
	else if(this.ChangePictureStep == "WarningWnd"){
		
		WndMgr.StartOneBottonPopup(OneBtnPopupIndex.NO_MORE_PHOTO_AVAILABLE);
	}	
	else{

		sf.scene.show('ChangePicture');
		sf.scene.focus('ChangePicture');
	}

}

WndMgr.HideChangePicture= function(bStopState)
{
	alert("***** WndMgr.HideChangePicture()");
	
	if(this.ChangePictureStep == "ConfirmWnd"){
		
		this.Param_A = null;
		sf.scene.hide('ChangePictureConfirm');		
	}
	else if(this.ChangePictureStep == "DeleteWnd"){
		
		//TEMPCODE:
		//this.StopConfirmPopup	
					
		sf.scene.hide('ConfirmPopup');		
	}
	else if(this.ChangePictureStep == "WarningWnd"){
		
		//TEMPCODE:
		//this.StopOneBottonPopup(); 	
		// to close popup window without starting another window
    	sf.scene.hide('OneButtonPopup');    
		this.isShowOneBtnPopup = false;

	}
	else{
	
		sf.scene.hide('ChangePicture');	
	}
	
	if(bStopState){		
		this.ChangePictureStep = "ChangePictureWnd";
	}
	
}

WndMgr.ReturnChangePicture = function()
{
	alert("***** WndMgr.ReturnChangePicture()");
	
	if(this.ChangePictureStep == "ConfirmWnd")
	{
		sf.scene.focus('ChangePictureConfirm');
	}
	else if(this.ChangePictureStep == "DeleteWnd")
	{
		
	}
	else if(this.ChangePictureStep == "WarningWnd")
	{		
		
	}	
	else
	{
		sf.scene.focus('ChangePicture');
	}

}

WndMgr.StartChangePictureStep= function()
{
	//alert("***** WndMgr.StartPictureConfirmStep()");

	this.HideChangePicture(false);
	this.ChangePictureStep = "ChangePictureWnd";	
	this.ShowChangePicture();
}

WndMgr.StartPictureConfirmStep= function(ImgPath)
{
	//alert("***** WndMgr.StartPictureConfirmStep()");
	
	this.HideChangePicture(false);
	this.ChangePictureStep = "ConfirmWnd";
	this.Param_A = ImgPath;
	
	this.ShowChangePicture();
}

WndMgr.StartDeletePictureStep= function()
{
	//alert("***** WndMgr.StartDeletePictureStep()");
	
	this.HideChangePicture(false);
	this.ChangePictureStep = "DeleteWnd";	
	this.ShowChangePicture();
}

WndMgr.StartWarningWndStep= function()
{
	//alert("***** WndMgr.StartWarningWndStep()");
	
	this.HideChangePicture(false);
	this.ChangePictureStep = "WarningWnd";
	this.ShowChangePicture();	
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Video Snapshot  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowVideoSnapshot= function()
{
	alert("***** WndMgr.ShowVideoSnapshot()");
	this.isShowVideoSnapshot = true;
	
	sf.scene.show('VideoSnapshot');
	sf.scene.focus('VideoSnapshot');
}

WndMgr.HideVideoSnapshot = function()
{
	alert("***** WndMgr.HideVideoSnapshot()");
	
	sf.scene.hide('VideoSnapshot');
	this.isShowVideoSnapshot = false;
}

WndMgr.ReturnVideoSnapshot =function()
{
    alert("***** WndMgr.ReturnVideoSnapshot()");
    this.focus('VideoSnapshot');    
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Change Password  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.ShowChangePassword = function()
{
    alert("***** WndMgr.ShowChangePassword()");
    
    if(this.ChangePWDStep =="ChangingPassword")
    {
        WndMgr.StartLoading(LoadingTypeIndex.WAIT);
        return;
    }
    
    if(this.ChangePWDStep=="ChangePassword")
    {
        sf.scene.show('ChangePassword');
        sf.scene.focus('ChangePassword');
     }
}

WndMgr.HideChangePassword= function()
{
    alert("***** WndMgr.HideChangePassword()");
     if(this.ChangePWDStep =="ChangingPassword")
    {
        WndMgr.StopLoading();
    }
    
    if(this.ChangePWDStep=="ChangePassword")
    {
        sf.scene.hide('ChangePassword');
    }
         
     this.ChangePWDStep="ChangePassword"; //init
}

WndMgr.ReturnChangePassword = function()
{
    alert("***** WndMgr.ReturnChangePassword()");
    
    if(this.ChangePWDStep=="ChangePassword")
    {
        sf.scene.focus('ChangePassword');
	}
	
}


WndMgr.NextStepChangePassword= function()
{
     if(this.ChangePWDStep =="ChangingPassword")
    {
        WndMgr.StopLoading();
         this.ChangePWDStep ="Noty";
    }
    else if(this.ChangePWDStep=="ChangePassword")
    {    
        sf.scene.hide('ChangePassword');
        this.ChangePWDStep ="ChangingPassword";
    }    
   
   alert("***** WndMgr.NextStepChangePassword() " +this.ChangePWDStep);
   this.ShowChangePassword();
}

WndMgr.BackStepChangePassword= function()
{
     if(this.ChangePWDStep =="Noty")
    {
         this.ChangePWDStep ="ChangePassword";
    }
   
   alert("***** WndMgr.BackStepChangePassword() " +this.ChangePWDStep);
   this.ShowChangePassword();
}

WndMgr.InitChangePassword = function()
{
    this.ChangePWDStep = "ChangePassword";
    sf.scene.get('ChangePassword').setInitFlag(true);
}




//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Tools  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


WndMgr.ShowListTools = function(type){

    alert("**** WndMgr.ShowListTools"); 
	
	this.ToolType = type;
	var scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
	scene.Deactivation();
    sf.scene.show('ListMainToolList');
    sf.scene.focus('ListMainToolList');
}

WndMgr.HideListTools = function(){

    alert("**** WndMgr.HideListTools"); 

//	var scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
//	scene.Activation();
   
	if(this.isShowVoiceCall == true || this.isShowVideoCallNormal == true || this.isShowVideoCallSD == true || this.isShowVideoCallHD == true || this.isShowConferenceCall == true)
	{
    	sf.scene.hide('ToolList');	
	}
	else{
	
		if(this.ToolType == TOOL_MENU_LIST_TYPE.VOICE_CALL_BUTTON)
		{	
		    sf.scene.hide('VoiceCallToolList');		    	
		}
		else{
	    	sf.scene.hide('ListMainToolList');
		}	
	}   
   
	this.ToolType = TOOL_MENU_LIST_TYPE.NOTHING;
}

WndMgr.ReturnListTools = function(){

    alert("**** WndMgr.ReturnListTools"); 

	if(this.ToolType == TOOL_MENU_LIST_TYPE.VOICE_CALL_BUTTON)
	{
	    sf.scene.focus('VoiceCallToolList');	
	}
	else
	{	
	    sf.scene.focus('ListMainToolList');
	}
}

WndMgr.ShowListPlus = function(type, index){
    alert("**** WndMgr.ShowListPlus"); 

 	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());
	var skype_name	= Scene.list.GetCurIdentityName();

	alert("WndMgr.ShowListPlus : skype_name ( "+skype_name+" ),   Index ( "+index+" ),   type ( "+type+" )");
	if(type == TOOL_MENU_LIST_TYPE.CONTACT_LIST)
	{
	    if(skype_name.length >0)	//skype in
			sf.scene.get('ListMainPlusList').Init("Contact_In");
		else						//skype out
			sf.scene.get('ListMainPlusList').Init("Contact_Out");
	}
	else if(type == TOOL_MENU_LIST_TYPE.HISTORY_LIST)
	{
		if(skype_name.length >0)	//skype in
			sf.scene.get('ListMainPlusList').Init("History_In");
		else						//skype out
			sf.scene.get('ListMainPlusList').Init("History_Out");
	}
	else
	{
		sf.scene.get('ListMainPlusList').Init("");
	}

    sf.scene.show('ListMainPlusList');
    sf.scene.focus('ListMainPlusList');
}

WndMgr.HideListPlus = function(){

    alert("**** WndMgr.HideListPlus"); 
    sf.scene.hide('ListMainPlusList');

	/*
	var scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
	scene.Activation();	
	*/

}

WndMgr.ReturnListPlus = function(){

    alert("**** WndMgr.ReturnListPlus"); 

    sf.scene.focus('ListMainPlusList');
}

WndMgr.ShowViewProfile = function(IdentityName){

    alert("**** WndMgr.ShowViewProfile"); 

	sf.scene.get('ViewProfile').Init(IdentityName);
    sf.scene.show('ViewProfile');
    sf.scene.focus('ViewProfile');
}

WndMgr.HideViewProfile = function(){

    alert("**** WndMgr.HideViewProfile"); 
    sf.scene.hide('ViewProfile');

	/*
	var scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
		scene.Activation();	*/
	

}

WndMgr.ReturnViewProfile = function(){

    alert("**** WndMgr.ReturnViewProfile"); 

    this.focus('ViewProfile');
}

WndMgr.UpdateNewChatMsg = function(){

	/*
	if(StateMgr.GetCurrentState() == "Main" ){
		
		var scene = sf.scene.get("ListMain");
		scene.UpdateNewChatNum();						
		}*/
	
}

WndMgr.ShowRename = function(Identity){

    alert("**** WndMgr.ShowRename");

	this.isShowRename = true;

	sf.scene.get('Rename').Init(Identity);	 
	sf.scene.show('Rename');
    sf.scene.focus('Rename');
}

WndMgr.HideRename = function(){

    alert("**** WndMgr.HideRename"); 
    sf.scene.hide('Rename');
    
    this.isShowRename = false;

	/*
	var scene = sf.scene.get(this.MainSubScene[this.iCurrentSubScene].Id);
		scene.Activation();	    */
	
}

WndMgr.ReturnRename = function(){
    
    alert("**** WndMgr.ReturnRename");

    this.focus('Rename');
}

WndMgr.ShowBlock = function(Type,Identity,Display){

    alert("**** WndMgr.ShowBlock"); 
	
	sf.scene.get('Block').Init(Type,Identity,Display);
    sf.scene.show('Block');
    sf.scene.focus('Block');
}

WndMgr.HideBlock = function(){

    alert("**** WndMgr.HideBlock"); 
    sf.scene.hide('Block');
}

WndMgr.ReturnBlock = function(){

    alert("**** WndMgr.ReturnBlock"); 
    
    this.focus('Block');
}

WndMgr.ShowRemove = function(Index){

    alert("**** WndMgr.ShowRemove"); 
	
	sf.scene.get('Remove').Init(Index);
    sf.scene.show('Remove');
    sf.scene.focus('Remove');
}

WndMgr.HideRemove = function(){

    alert("**** WndMgr.HideRemove"); 

    sf.scene.hide('Remove');
}

WndMgr.ReturnRemove = function()
{
    alert("**** WndMgr.ReturnRemove"); 
	
    sf.scene.focus('Remove');
}

WndMgr.ChangeWndPositionFor12Key = function(){

    alert("**** WndMgr.ChangeWndPositionFor12Key"); 

	if(this.AddContactStep == "AddContactSkypeName" )
	{
		// $("#AddContactSkypeName").css("left","250px");
		//2013 modify by minseok
		$("#AddContactSkypeName").css("left","140px");
		$("#AddContactSkypeNameBG_popup").css("left","140px");
	}
	else if(this.isShowCheckPwd==true)
	{
		// $("#CheckPassword").css("left","250px");
		//2013 modify by minseok
		$("#CheckPassword").css("left","140px");
		$("#CheckPasswordBG_popup").css("left","140px");
	}
	else if(this.isShowRename == true)
	{
		//$("#Rename").css("left","250px");	
		$("#Rename").css("left","140px");
		$("#Rename_BG_popup").css("left","140px");			
	}
	else if(this.isShowChatMsgSend == true)
	{
		$("#ChatMsgSend").css("left","250px");		
	}
	else if(this.isShowTextEditor == true)
	{
		$("#TextEditor").css("left","140px");
		//2013 add by minseok
		$("#TextEditorBG_popup").css("left","140px");
		$("#TextEditorTextArea").css("left","140px");
	}
}

WndMgr.ChangeWndPositionForQwerty = function(){

    alert("**** WndMgr.ChangeWndPositionForQwerty"); 

	if(this.AddContactStep == "AddContactSkypeName")
	{
		//2013 modify by minseok
		$("#AddContactSkypeName").css("left","1px");
		$("#AddContactSkypeNameBG_popup").css("left","1px");		
	}
	else if(this.isShowCheckPwd==true)
	{
		// $("#CheckPassword").css("left","5px");
		$("#CheckPassword").css("left","1px");
		$("#CheckPasswordBG_popup").css("left","1px");
	}
	else if(this.isShowRename == true)
	{
		//$("#Rename").css("left","5px");
		$("#Rename").css("left","1px");
		$("#Rename_BG_popup").css("left","1px");			
	}
	else if(this.isShowChatMsgSend == true)
	{
		$("#ChatMsgSend").css("left","5px");		
	}
	else if(this.isShowTextEditor == true)
	{
		//2013 modify by minseok
		$("#TextEditor").css("left","1px");
		$("#TextEditorBG_popup").css("left","1px");		
		$("#TextEditorTextArea").css("left","1px");		
	}
}

WndMgr.SetResolutionInfo = function(horz,vert,freq,scan,asp){
	
	this.Horizontal = horz;
	this.Vertical = vert;
	this.Frequency = freq;
	this.Scan = scan;
	this.Aspect = asp;
}


WndMgr.Is1366x768Panel = function(){

	if(this.Horizontal == 1366 && this.Vertical == 768)
	{
		return true;
	}
	
	return false;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Face Recognition  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.InitAccountManager= function()
{
	sf.scene.get('AccountManager').setResetFlag(true);
}

WndMgr.ShowAccountManager= function(){
	alert("***** WndMgr.ShowAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
		sf.scene.show('AccountManager');
    	sf.scene.focus('AccountManager');
	}
	
	if(this.AccountManagerStep == "SecurityConfirm")
	{
		sf.scene.show('FaceRecogSecurityPopup');
    	sf.scene.focus('FaceRecogSecurityPopup');
	}
	
	if(this.AccountManagerStep =="ReRegistration")
	{
		//WndMgr.StartConfirmPopup(ConfirmPopupIndex.FACE_RE_REGISTRATION);
		WndMgr.StartOneBottonPopup(OneBtnPopupIndex.FACE_ALREADY_REGISTERED);
	}
	
	if(this.AccountManagerStep =="DeleteRegisteredFace")
	{
		WndMgr.StartConfirmPopup(ConfirmPopupIndex.FACE_DELETE);
	}
	
	if(this.AccountManagerStep == "InputPwdForInit" || this.AccountManagerStep == "InputPwdForRegister")
	{
		WndMgr.StartCheckPwd(); 
	}
	
    if(this.AccountManagerStep =="CheckPwdForInit" || this.AccountManagerStep =="CheckPwdForRegister")
    {
        WndMgr.StartLoading(LoadingTypeIndex.WAIT);
    }
    

}

WndMgr.HideAccountManager= function(){
	alert("***** WndMgr.ShowAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
		sf.scene.hide('AccountManager');
	}
	
	if(this.AccountManagerStep =="InputPwdForInit")
	{
		WndMgr.HideCheckPwd(); 
	}
	
	if(this.AccountManagerStep =="CheckPwdForInit" || this.AccountManagerStep =="CheckPwdForRegister")
    {
        WndMgr.StopLoading();
    }
	
	this.AccountManagerStep = "AccountManager"; // init
}

WndMgr.ReturnAccountManager= function(){
	alert("***** WndMgr.ReturnAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
    	sf.scene.focus('AccountManager');
	}
	
	if(this.AccountManagerStep == "SecurityConfirm")
	{
    	sf.scene.focus('FaceRecogSecurityPopup');
	}
}

WndMgr.NextStepAccountManager = function(){
	alert("***** WndMgr.NextStepAccountManager()");
	
	if(this.AccountManagerStep =="ReRegistration")
	{
		//this.AccountManagerStep = "InputPwdForRegister";
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep =="InputPwdForInit")
	{
		WndMgr.StopCheckPwd(); 
		this.AccountManagerStep = "CheckPwdForInit";
	}
	else if(this.AccountManagerStep =="CheckPwdForInit")
	{
		WndMgr.StopLoading();
		this.AccountManagerStep = "DeleteRegisteredFace";
	}
	else if(this.AccountManagerStep =="CheckPwdForInitFailNoty")
	{
		this.AccountManagerStep = "InputPwdForInit";
	}
	else if(this.AccountManagerStep =="DeleteRegisteredFace")
	{
		this.AccountManagerStep = "DeleteCompleteNoty";
	}
	else if(this.AccountManagerStep == "DeleteCompleteNoty")
	{
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogSecurityPopup');
		this.AccountManagerStep = "InputPwdForRegister";
	}
	else if(this.AccountManagerStep =="InputPwdForRegister")
	{
		WndMgr.StopCheckPwd(); 
		this.AccountManagerStep = "CheckPwdForRegister";
	}
	else if(this.AccountManagerStep == "CheckPwdForRegisterFailNoty")
	{
		this.AccountManagerStep = "InputPwdForRegister";
	}
	
	WndMgr.ShowAccountManager();
}

WndMgr.BackStepAccountManager = function(){
	alert("***** WndMgr.BackStepAccountManager()");
	
	if(this.AccountManagerStep =="ReRegistration")
	{
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep =="InputPwdForInit")
	{
		WndMgr.StopCheckPwd();
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep =="CheckPwdForInit")
	{
		this.AccountManagerStep = "CheckPwdForInitFailNoty";
	}	
	else if(this.AccountManagerStep =="DeleteRegisteredFace")
	{
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogSecurityPopup');
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep =="InputPwdForRegister")
	{
		WndMgr.StopCheckPwd(); 
		this.AccountManagerStep = "AccountManager";
	}
	else if(this.AccountManagerStep =="CheckPwdForRegister")
	{
		this.AccountManagerStep = "CheckPwdForRegisterFailNoty";
	}	
	
	WndMgr.ShowAccountManager();
}

WndMgr.SecurityConfirmStepAccountManager= function(){
	
	alert("***** WndMgr.SecurityConfirmStepAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
		sf.scene.hide('AccountManager');
		this.AccountManagerStep = "SecurityConfirm";
	}
	
	WndMgr.ShowAccountManager();
}

WndMgr.ReRegistrationStepAccountManager= function(){
	
	alert("***** WndMgr.ReRegistrationStepAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
		sf.scene.hide('AccountManager');
		this.AccountManagerStep = "ReRegistration";
	}
	
	WndMgr.ShowAccountManager();
}

WndMgr.inputPwdForInitAccountManager= function(){
	
	alert("***** WndMgr.inputPwdForInitAccountManager()");
	
	if(this.AccountManagerStep =="AccountManager")
	{
		sf.scene.hide('AccountManager');
		this.AccountManagerStep = "InputPwdForInit";
	}
	
	WndMgr.ShowAccountManager();
}






WndMgr.ShowCreateAccountSuccess = function(){
	alert("***** WndMgr.ShowCreateAccountSuccess()");
	if(this.CreateAccountSuccessStep == "Success")
	{
		sf.scene.show('CreateAccountSuccess');
    	sf.scene.focus('CreateAccountSuccess');
	}
	
	if(this.CreateAccountSuccessStep == "SecurityConfirm")
	{
		sf.scene.show('FaceRecogSecurityPopup');
    	sf.scene.focus('FaceRecogSecurityPopup');
	}
}

WndMgr.HideCreateAccountSuccess = function(){
	alert("***** WndMgr.HideCreateAccountSuccess()");
	
	if(this.CreateAccountSuccessStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogSecurityPopup');
	}
	
	sf.scene.hide('CreateAccountSuccess');
	
	this.CreateAccountSuccessStep = "Success"; //init
}

WndMgr.NextStepCreateAccountSuccess = function(){
	alert("***** WndMgr.HideCreateAccountSuccess()");
	
	if(this.CreateAccountSuccessStep == "Success")
	{
		this.CreateAccountSuccessStep = "SecurityConfirm";
	}	

	WndMgr.ShowCreateAccountSuccess();
}

WndMgr.BackStepCreateAccountSuccess = function(){
	alert("***** WndMgr.BackStepCreateAccountSuccess()");
	
	if(this.CreateAccountSuccessStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogSecurityPopup');
		
		this.CreateAccountSuccessStep = "Success";		
		WndMgr.ReturnCreateAccountSuccess();
	}	
}


WndMgr.ReturnCreateAccountSuccess = function(){
	alert("***** WndMgr.ReturnCreateAccountSuccess()");
	
	sf.scene.focus('CreateAccountSuccess');
}

WndMgr.InitFaceRecogSignin = function(){
	sf.scene.get('AccountConnection').setInitFlag(true);
}

WndMgr.ShowFaceRecogSignin = function(){
	alert("***** WndMgr.ShowFaceRecogSignin() : " + this.FaceRecogSigninStep);
	
	if(this.FaceRecogSigninStep == "FaceRecog")
	{
		this.isShowFaceRecogSignin=true;
		sf.scene.show('FaceRecogSignin');
    	sf.scene.focus('FaceRecogSignin');
	}
	
	if(this.FaceRecogSigninStep == "Result")
	{
		this.isShowFaceRecogResult=true;
		sf.scene.show('FaceRecogResult');
    	sf.scene.focus('FaceRecogResult');
	}
	
   	if(this.FaceRecogSigninStep == "NotRegistered")
   	{
		sf.scene.show('FaceRecogNotRegisteredPopup');
    	sf.scene.focus('FaceRecogNotRegisteredPopup');
   	}
   	
	if(this.FaceRecogSigninStep == "SecurityConfirm")
	{
		sf.scene.show('FaceRecogSecurityPopup');
    	sf.scene.focus('FaceRecogSecurityPopup');
	}
	if(this.FaceRecogSigninStep == "ChooseAccount")
	{
		this.isShowFaceRecogChooseAccount=true;
		sf.scene.show('FaceRecogChooseAccount');
    	sf.scene.focus('FaceRecogChooseAccount');
	}
   	
   	if(this.FaceRecogSigninStep == "InputInfo")
   	{
		sf.scene.show('AccountConnection');
    	sf.scene.focus('AccountConnection');
   	}
   	if(this.FaceRecogSigninStep == "GuidePage"){
   		sf.scene.get('GuidePage').setType(GUIDEPAGE_TYPE.SIGNIN_WITH_EMAIL);
		sf.scene.show('GuidePage');
		sf.scene.focus('GuidePage');
   	}
	if(this.FaceRecogSigninStep == "InputPwd")
	{
		WndMgr.StartCheckPwd(); 
	}
	
    if(this.FaceRecogSigninStep =="CheckPwd")
    {
        WndMgr.StartLoading(LoadingTypeIndex.WAIT);
    }    
   
    if(this.FaceRecogSigninStep == "Loading")
    {
        this.StartLoading(LoadingTypeIndex.SIGNIN_WITH_CANCEL);
    }
}

WndMgr.HideFaceRecogSignin = function(){
	alert("***** WndMgr.HideFaceRecogSignin() : " +this.FaceRecogSigninStep);
			
	if(this.FaceRecogSigninStep == "Loading" || this.FaceRecogSigninStep =="CheckPwd")
    {
        this.StopLoading();
    }
    
	if(this.FaceRecogSigninStep == "NotRegistered")
	{
		sf.scene.hide('FaceRecogNotRegisteredPopup');
	}
	
   	if(this.FaceRecogSigninStep == "InputInfo")
   	{
		sf.scene.hide('AccountConnection');
	}
	
	if(this.FaceRecogSigninStep =="InputPwd")
	{
		WndMgr.HideCheckPwd(); 
	}	
	
	if(this.isShowFaceRecogSignin==true)
	{
		this.FaceRecogSigninStep = "FaceRecog";
	}
	
	if(this.isShowFaceRecogResult==true)
	{
		this.FaceRecogSigninStep = "Result";
	}
	if(this.isShowFaceRecogChooseAccount==true)
	{
		this.FaceRecogSigninStep = "ChooseAccount";
	}

	if(this.FaceRecogSigninStep == "FaceRecog")
	{		
		sf.scene.hide('FaceRecogSignin');
		this.isShowFaceRecogSignin=false;
	}
	
	if(this.FaceRecogSigninStep == "Result")
	{
		sf.scene.hide('FaceRecogResult');
		this.isShowFaceRecogResult=false;
	}
	if(this.FaceRecogSigninStep == "ChooseAccount")
	{
		sf.scene.hide('FaceRecogChooseAccount');
		this.isShowFaceRecogChooseAccount=false;
	}
	
	this.FaceRecogSigninStep = "FaceRecog"; //init
}

WndMgr.NextStepFaceRecogSignin= function(){
	alert("***** WndMgr.NextStepFaceRecogSignin() : " + this.FaceRecogSigninStep);
	
	if(this.FaceRecogSigninStep == "FaceRecog" || this.FaceRecogSigninStep == "Result")
	{
		this.FaceRecogSigninStep = "Loading";
	}
	else if(this.FaceRecogSigninStep == "Loading")
	{
		this.StopLoading();
		this.FaceRecogSigninStep = "LoggedInNoty";
		
		return;
	}
	else if(this.FaceRecogSigninStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogResult');		
		sf.scene.hide('FaceRecogSecurityPopup');		
		this.isShowFaceRecogResult=false;	
		// this.FaceRecogSigninStep = "InputInfo";
		this.FaceRecogSigninStep = "ChooseAccount";
	}	
	else if(this.FaceRecogSigninStep == "ChooseAccount")
	{
		WndMgr.StopCheckPwd(); 
		this.FaceRecogSigninStep = "Loading";
	}	
	else if(this.FaceRecogSigninStep == "LinkAccount")
	{
		this.FaceRecogSigninStep = "InputInfo";
	}	
	else if(this.FaceRecogSigninStep == "NotRegistered")
	{
		sf.scene.hide('FaceRecogNotRegisteredPopup');
		// this.FaceRecogSigninStep = "SecurityConfirm";
	}
	else if(this.FaceRecogSigninStep == "InputInfo")
   	{
		sf.scene.hide('AccountConnection');
		this.FaceRecogSigninStep = "Loading";
   	}
	else if(this.FaceRecogSigninStep =="InputPwd")
	{
		WndMgr.StopCheckPwd(); 
		// this.FaceRecogSigninStep = "CheckPwd";
		this.FaceRecogSigninStep = "Loading";
	}
    else if(this.FaceRecogSigninStep =="CheckPwd")
	{
		WndMgr.StopLoading();
		this.FaceRecogSigninStep = "Loading";
	}	
	else if(this.FaceRecogSigninStep == "CheckPwdFailNoty")
	{
		this.FaceRecogSigninStep = "InputPwd";
	}
	
	WndMgr.ShowFaceRecogSignin();
}

WndMgr.BackStepFaceRecogSignin= function(){
	alert("***** WndMgr.BackStepFaceRecogSignin() : " + this.FaceRecogSigninStep);
	
	if(this.FaceRecogSigninStep == "Result")
	{
		sf.scene.hide('FaceRecogResult');
		this.isShowFaceRecogResult=false;
		this.FaceRecogSigninStep = "FaceRecog";
	}	
	else if(this.FaceRecogSigninStep == "NotRegistered")
	{
		sf.scene.hide('FaceRecogNotRegisteredPopup');
		this.FaceRecogSigninStep = "FaceRecog"
		
		WndMgr.ReturnFaceRecogSignin();
		return;
	}
	else if(this.FaceRecogSigninStep == "SecurityConfirm")
	{
		sf.scene.hide('FaceRecogSecurityPopup');		
		this.FaceRecogSigninStep = "Result";
		
		WndMgr.ReturnFaceRecogSignin();
		return;
	}
	else if(this.FaceRecogSigninStep == "ChooseAccount")
	{
		sf.scene.hide('FaceRecogChooseAccount');		
		this.isShowFaceRecogChooseAccount=false;
		this.FaceRecogSigninStep = "Result";
		
		WndMgr.ShowFaceRecogSignin();
		return;
	}
	else if(this.FaceRecogSigninStep == "InputInfo")
   	{
		sf.scene.hide('AccountConnection');
		this.FaceRecogSigninStep = "ChooseAccount"
		
		WndMgr.ReturnFaceRecogSignin();
		return;

   	}
   	else if(this.FaceRecogSigninStep =="GuidePage")
   	{
   		sf.scene.hide('GuidePage');
   		this.FaceRecogSigninStep = "ChooseAccount";
   	}
	else if(this.FaceRecogSigninStep =="InputPwd")
	{
		WndMgr.StopCheckPwd();
		
		if(this.isShowFaceRecogSignin==true)
		{
			this.FaceRecogSigninStep = "FaceRecog";
		}
		if(this.isShowFaceRecogResult==true)
		{
			this.FaceRecogSigninStep = "Result";
		} 
		
		WndMgr.ReturnFaceRecogSignin();
		
		return;
	}
	else if(this.FaceRecogSigninStep =="CheckPwd")
	{
		this.FaceRecogSigninStep = "CheckPwdFailNoty";
	}
	else if(this.FaceRecogSigninStep == "Loading")
	{
		this.StopLoading();
		if(this.isShowFaceRecogSignin==true)
		{
			this.FaceRecogSigninStep = "FaceRecog";
		}
		if(this.isShowFaceRecogResult==true)
		{
			this.FaceRecogSigninStep = "Result";
		}
		if(this.isShowFaceRecogChooseAccount==true)
		{
			this.FaceRecogSigninStep = "ChooseAccount";
		}
		
		// return;
	}
	
	
	
	WndMgr.ShowFaceRecogSignin();
}

WndMgr.ResultStepFaceRecogSignin= function(){
	alert("***** WndMgr.ResultStepFaceRecogSignin()");
	
	if(this.FaceRecogSigninStep == "FaceRecog")
	{
		sf.scene.hide('FaceRecogSignin');
		this.isShowFaceRecogSignin=false;
		this.FaceRecogSigninStep = "Result";
	}
	
	WndMgr.ShowFaceRecogSignin();
}

WndMgr.NotRegisteredStepFaceRecogSignin = function(){
	alert("***** WndMgr.NotRegisteredStepFaceRecogSignin()");
	if(this.FaceRecogSigninStep == "Result")
	{
		// this.FaceRecogSigninStep = "NotRegistered";
		this.FaceRecogSigninStep = "SecurityConfirm";
	}else if(this.FaceRecogSigninStep == "FaceRecog"){
		this.FaceRecogSigninStep = "NotRegistered";
	}
	
	WndMgr.ShowFaceRecogSignin();
}

WndMgr.InputInfoStepFaceRecogSignin = function(){
	alert("***** WndMgr.InputInfoStepFaceRecogSignin()");
	this.FaceRecogSigninStep = "InputInfo";
	
	WndMgr.ShowFaceRecogSignin();
}

WndMgr.InputPwdStepFaceRecogSignin = function(){
	alert("***** WndMgr.InputPwdStepFaceRecogSignin()");
	this.FaceRecogSigninStep = "InputPwd";
	
	WndMgr.ShowFaceRecogSignin();
}
WndMgr.ShowGuidePageFaceRecogSignin = function(){
	alert("***** WndMgr.GuidePageFaceRecogSignin()");
	if(this.FaceRecogSigninStep == "InputInfo"){
		this.BackStepFaceRecogSignin();		//back to the chooseaccount step
		sf.scene.hide('FaceRecogChooseAccount');	//hide chooseaccount scene
		this.isShowFaceRecogChooseAccount=false;
	}
	this.FaceRecogSigninStep = "GuidePage";
	this.ShowFaceRecogSignin();	

}
WndMgr.HideGuidePageFaceRecogSignin = function(){
	alert("***** WndMgr.GuidePageFaceRecogSignin()");
	this.BackStepFaceRecogSignin();
	ProcMgr.LinkAccount();
}

WndMgr.ReturnFaceRecogSignin = function(){
	alert("***** WndMgr.ReturnFaceRecogSignin() : "+this.FaceRecogSigninStep);
	if(this.FaceRecogSigninStep == "FaceRecog")
	{
		sf.scene.focus('FaceRecogSignin');
	}
	
	if(this.FaceRecogSigninStep == "Result")
	{
		sf.scene.focus('FaceRecogResult');
	}		
	if(this.FaceRecogSigninStep == "ChooseAccount")
	{
		sf.scene.focus('FaceRecogChooseAccount');
	}
			
}

WndMgr.InitFaceRecogArea = function()
{
	alert("***** WndMgr.InitFaceRecogArea()");
	if(this.isShowFaceRecogSignin)
	{
		sf.scene.get('FaceRecogSignin').initRecogArea();
	}	
}

WndMgr.UpdateFaceRecogArea = function()
{
	alert("***** WndMgr.UpdateFaceRecogArea()");
	if(this.isShowFaceRecogSignin)
	{
		sf.scene.get('FaceRecogSignin').updateRecogArea();
	}	
}



WndMgr.ShowFaceRecogRegistration = function(){
	alert("***** WndMgr.ShowFaceRecogRegistration()");
	
	if(this.FaceRecogRegistrationStep == "FaceDetect")		//face registration
	{
		sf.scene.show('FaceRecogRegistration');
    	sf.scene.focus('FaceRecogRegistration');
	}
	else if(this.FaceRecogRegistrationStep == "Complete")		//face regist -> save
	{
		//sf.scene.show('FaceRecogComplete');
    	//sf.scene.focus('FaceRecogComplete');
		sf.scene.show('FaceRecogSecureComplete');
    	sf.scene.focus('FaceRecogSecureComplete');
	}
	else if(this.FaceRecogRegistrationStep == "Duplicate")
	{
		sf.scene.show('FaceRecogDuplicate');
    	sf.scene.focus('FaceRecogDuplicate');
	}
	else if(this.FaceRecogRegistrationStep == "RetryNoty")
	{
		sf.scene.show('FaceRecogRetryPopup');
    	sf.scene.focus('FaceRecogRetryPopup');
	}
}

WndMgr.HideFaceRecogRegistration = function(){
	alert("***** WndMgr.HideFaceRecogRegistration()");
	if(this.FaceRecogRegistrationStep == "FaceDetect")
	{
		//sf.scene.hide('FaceRecogComplete');
		sf.scene.hide('FaceRecogRegistration');
	}
	if(this.FaceRecogRegistrationStep == "Complete")
	{
		//sf.scene.hide('FaceRecogComplete');
		sf.scene.hide('FaceRecogSecureComplete');
	}
	
	if(this.FaceRecogRegistrationStep == "Duplicate")
	{
		sf.scene.hide('FaceRecogDuplicate');
	}
	
	if(this.FaceRecogRegistrationStep == "RetryNoty")
	{
		sf.scene.hide('FaceRecogRegistration');
		sf.scene.hide('FaceRecogRetryPopup');
	}
	
	// sf.scene.hide('FaceRecogRegistration');
	
	this.FaceRecogRegistrationStep = "FaceDetect"; // init
}

WndMgr.NextStepFaceRecogRegistration = function(){
	alert("***** WndMgr.NextStepFaceRecogRegistration()");
	
	if(this.FaceRecogRegistrationStep == "FaceDetect")
	{
		// this.HideFaceRecogRegistration();
		sf.scene.hide('FaceRecogRegistration');
		this.FaceRecogRegistrationStep = "Complete";
	}
	
	this.ShowFaceRecogRegistration(); 
}	

WndMgr.BackStepFaceRecogRegistration = function(){
	alert("***** WndMgr.BackStepFaceRecogRegistration()");
	
	if(this.FaceRecogRegistrationStep == "RetryNoty")
	{
		sf.scene.hide('FaceRecogRetryPopup');
		this.FaceRecogRegistrationStep = "FaceDetect";
		
		WndMgr.ReturnFaceRecogRegistration();
	}
	
	if(this.FaceRecogRegistrationStep == "Complete")
	{
		//sf.scene.hide('FaceRecogComplete');
		sf.scene.hide('FaceRecogSecureComplete');
		this.FaceRecogRegistrationStep = "FaceDetect";
		
		WndMgr.ReturnFaceRecogRegistration();
	}
	//add -> this is popup state, we should close only popup window(140120)
	 if(this.FaceRecogRegistrationStep == "Duplicate")
	{
		sf.scene.hide('FaceRecogDuplicate');
		this.FaceRecogRegistrationStep = "FaceDetect";
		
		WndMgr.ReturnFaceRecogRegistration();
	}

}	


WndMgr.DuplicateStepFaceRecogRegistration = function(){
	
	if(this.FaceRecogRegistrationStep == "FaceDetect")
	{
		this.FaceRecogRegistrationStep = "Duplicate";
	}
	
	this.ShowFaceRecogRegistration(); 
}

WndMgr.RetryNotyStepFaceRecogRegistration = function(){
	
	if(this.FaceRecogRegistrationStep == "FaceDetect")
	{
		this.FaceRecogRegistrationStep = "RetryNoty";
	}
	
	this.ShowFaceRecogRegistration(); 
}

WndMgr.ReturnFaceRecogRegistration = function(){
	alert("***** WndMgr.ReturnFaceRecogRegistration()");
	
	sf.scene.show('FaceRecogRegistration');
	sf.scene.focus('FaceRecogRegistration');
}

WndMgr.UpdateFaceRecogBoxColor = function(image)
{
	alert("***** WndMgr.UpdateFaceRecogBoxColor()");
	sf.scene.get('FaceRecogRegistration').updateBoxColor(image);
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////  Check pwd   ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

WndMgr.StartCheckPwd = function()
{
 	alert("***** WndMgr.StartCheckPwd()");
 
    WndMgr.ShowCheckPwd();
}

WndMgr.ShowCheckPwd = function()
{
    alert("***** WndMgr.ShowCheckPwd() : " + this.isShowCheckPwd); 
    if(this.isShowCheckPwd ==false)
    {
	    this.isShowCheckPwd= true;

    	sf.scene.show('CheckPassword');
    	sf.scene.focus('CheckPassword');
    }
}

WndMgr.StopCheckPwd= function()
{ 
 	alert("***** WndMgr.StopCheckPwd()");  
 	 
	WndMgr.HideCheckPwd();
}

WndMgr.HideCheckPwd = function()
{
    alert("***** WndMgr.HideCheckPwd()"); 
    
    if(this.isShowCheckPwd ==true)
    {
        this.isShowCheckPwd = false;
        sf.scene.hide('CheckPassword');
        sf.scene.returnFocus();
    }
}


WndMgr.ShowPreview = function(ViewType)
{
    alert("***** WndMgr.ShowPreview()"); 

    if(this.isStartedPreview == false)
    {	    	   
	    if(ViewType == "calling")
	    {
	    	if(g_Data.DATA_CREATE_CALL_INPUT_INFO.call_type == 0)
	    	{
	    		alert("call type is voice call");
	    		return 
	    	}	
	    	//544,430,192,108
	    	//PluginAPIMgr.StartMyVideo(816,600,288,288); //816,645,288,162
	    }
	    else if(ViewType == "videoCall_full")
	    {
		   //PluginAPIMgr.StartMyVideo(1450,809,288,288);

	    }
	    else if(ViewType == "videoCall_tv")
	    {
	    	//check position
		   //PluginAPIMgr.StartMyVideo(1458,808,432,243);	  
	    }
	    //check
	    // else if(ViewType == "VideoSnapshot")
	    // {
	    	// PluginAPIMgr.StartPreview(43,24,1280,720);
	    // }
	    else
	    {
	    	alert("error!!!!!");
	    	return;
	    }
	    
    	this.isStartedPreview = true;
    }
    else{

		if(ViewType == this.PreviewType)
		{
			alert('Same type');
			return;
		}

	    if(ViewType == "videoCall_full")
	    {			
			//PluginAPIMgr.SetSubVideoRect(1450,809,288,288);
	    }
	    else if(ViewType == "videoCall_tv")
	    {			
			//PluginAPIMgr.SetSubVideoRect(1437, 633, 324, 243);  	
	    }	
    }
   	this.PreviewType = ViewType;
   	
}


WndMgr.HidePreview = function()
{
    alert("***** WndMgr.HidePreview()"); 
    
    if(this.isStartedPreview == true)
    {
	    PluginAPIMgr.StopPreview();	
		this.PreviewMode = null;
	    this.isStartedPreview = false;		
	}
}
    
WndMgr.ShowIncomingCall = function()
{
    alert("***** WndMgr.ShowIncomingCall() "); 
    
    if(this.isShowIncomingCall == false)
    {
	    this.isShowIncomingCall = true;

    	sf.scene.show('IncomingCall');
    	sf.scene.focus('IncomingCall');
    }
}


WndMgr.HideIncomingCall = function()
{
    alert("***** WndMgr.HideIncomingCall()"); 
    
    if(this.isShowIncomingCall == true)
    {
        this.isShowIncomingCall = false;
        sf.scene.hide('IncomingCall');
    }
}

WndMgr.ShowContextLoading = function()
{
    alert("***** WndMgr.ShowContextLoading() "); 
    
    if(this.isShowContextLoading == false)
    {
	    this.isShowContextLoading = true;

    	sf.scene.show('ContextLoading');
    	sf.scene.focus('ContextLoading');
    }
}


WndMgr.HideContextLoading = function()
{
    alert("***** WndMgr.HideContextLoading()"); 
    
    if(this.isShowContextLoading == true)
    {
        this.isShowContextLoading = false;
        
        sf.scene.hide('ContextLoading');
    }
}


WndMgr.Show_ContactPhoneNumberList = function(FuncParamA,FuncParamB){
	
    if(this.isShowContactPhoneNumberList == false)
    {
	    this.isShowContactPhoneNumberList = true;
		
		sf.scene.get("ListMainContactPhoneNumberList").SetInfo(FuncParamA,FuncParamB);	
    	sf.scene.show('ListMainContactPhoneNumberList');
    	sf.scene.focus('ListMainContactPhoneNumberList');
    }
	
}


WndMgr.Hide_ContactPhoneNumberList = function(){

    if(this.isShowContactPhoneNumberList == true)
    {
        this.isShowContactPhoneNumberList = false;
        sf.scene.hide('ListMainContactPhoneNumberList');
        
    }
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// startHideTimer
WndMgr.startPopupHideTimer = function(time,callback)
{
    alert("***** WndMgr.startPopupHideTimer()"+time); 
    
    if(this.PopupHideTimer == true)
    {
    	alert("PopupHideTimer is true...."); 
    	return;
    }
    
	this.PopupHideTimer = true;
	this.TimeOfPopup = time;
	this.PopupHideCallback = callback;
	
	PluginAPIMgr.StartOSDTimer(time , function() {WndMgr.hidePopup();}, ENUM_TIMER_TYPE.POPUP_WND);
	
}

WndMgr.hidePopup = function()
{
	alert('WndMgr.hidePopup');
	
	if(this.PopupHideTimer == false)
	{
		alert('PopupHideTimer is false');
		return;
	}
	this.PopupHideTimer = false;

	if(this.PopupHideCallback)
	{
		this.PopupHideCallback();
	}
	else
	{
		StateMgr.ReturnToMainState();
	}
	//2013 modify by minseok.. : why????????????? T.T
	// this.TimeOfPopup = 1;
	this.PopupHideCallback = null;
}

WndMgr.restartPopupHideTimer = function()
{
	alert("WndMgr.restartPopupHideTimer time is : "+this.TimeOfPopup);
	if(this.PopupHideTimer == false)
	{
		PluginAPIMgr.RestartOSDTimer(this.TimeOfPopup ,ENUM_TIMER_TYPE.POPUP_WND);
		this.PopupHideTimer = true;
	}

}
//resetHideTimer
WndMgr.resetPopupHideTimer = function()
{
	alert("WndMgr.resetPopupHideTimer time is : "+this.TimeOfPopup);
	if(this.PopupHideTimer == true)
	{
		PluginAPIMgr.RestartOSDTimer(this.TimeOfPopup ,ENUM_TIMER_TYPE.POPUP_WND);
	}

}
//stopHideTimer
WndMgr.stopPopupHideTimer = function()
{
    alert("WndMgr.stopPopupHideTimer() ");

	if(this.PopupHideTimer == true)
	{
		PluginAPIMgr.StopOSDTimer(ENUM_TIMER_TYPE.POPUP_WND);
		this.PopupHideTimer = false;
	}

}
WndMgr.holdPopupHideTimer = function()
{
	if(this.PopupHideTimer == true)
	{
		alert("WndMgr.holdPopupHideTimer () ");
		PluginAPIMgr.HoldOSDTimer(ENUM_TIMER_TYPE.POPUP_WND);
	}
}

WndMgr.focus = function(sceneName)
{
    alert("***** WndMgr.focus()"); 
    
    if(this.isShowIncomingCall == false)
    {
    	sf.scene.focus(sceneName);
    }
}
WndMgr.SetCurrentPopupSceneId = function(sceneId){
	alert("***** WndMgr.SetCurrentPopupSceneId() ="+sceneId);
	this.CurrentPopupSceneId = sceneId;
}
WndMgr.SettingsFailCallBack = function()
{
	alert("***** WndMgr.CallBackSettings()");
	switch(this.CurrentPopupSceneId){
		case "SettingsGeneral":
			WndMgr.StopLoading();
			WndMgr.ShowSettingsGeneral();
			break;
		case "SettingsVideo":
			WndMgr.StopLoading();
			WndMgr.ShowSettingsVideo();
			break;
		case "SettingsPrivacy": // event commit
			WndMgr.ShowSettingsPrivacy();
			break;
		case "SettingsBlockedContacts":
			WndMgr.StopLoading();
			WndMgr.ShowSettingsBlockedContacts();

			break;
		case "SettingsCallForwarding": // event commit
			WndMgr.ShowSettingsCallForwarding();
			break;
		case "SettingsVoicemail": //  Callback
			WndMgr.StopLoading();
			WndMgr.ShowSettingsVoicemail();
			break;
	}
	this.CurrentPopupSceneId = null;
}
WndMgr.SettingsSuccessCallBack = function()
{
	alert("***** WndMgr.SettingsSuccessCallBack()");
	switch(this.CurrentPopupSceneId){
		case "SettingsGeneral":
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
		case "SettingsVideo":
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
		case "SettingsPrivacy": // event commit
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
		case "SettingsBlockedContacts":
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
		case "SettingsCallForwarding": // event commit
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
		case "SettingsVoicemail":
			sf.scene.get(this.CurrentPopupSceneId).SaveSuccess();
			break;
	}
	this.CurrentPopupSceneId = null;
}


WndMgr.ShowReturnIcon = function()
{
	alert("***** WndMgr.ShowReturnIcon()");
	if(this.ReturnClickFunc==null || this.isShowReturnIcon == true)
	{
		return;
	}
	
	this.isShowReturnIcon = true;
	sf.scene.show('ReturnIcon');
}
//////////////////////////////////////////////////////etc///////////////////////////////////////////
WndMgr.HideReturnIcon = function()
{
	alert("***** WndMgr.HideReturnIcon()");
	if(this.isShowReturnIcon == false)
	{
		return;	
	}
	
	this.isShowReturnIcon = false;
	sf.scene.hide('ReturnIcon');
}

WndMgr.SetReturnIconClickCallback = function(func)
{
	alert("***** WndMgr.SetReturnIconClickCallback()");
	
	this.ReturnClickFunc = func;
	
	if(this.ReturnClickFunc==null)
	{
		if(this.isShowReturnIcon)
		{
			WndMgr.HideReturnIcon();
		}
	}
	else
	{
		if(this.isMouseCusorShow)
		{
			if(this.isShowReturnIcon != true)
			{
				WndMgr.ShowReturnIcon();
			}
		}
	}	
}

WndMgr.ProcessRerutnIconClick = function()
{
	alert("***** WndMgr.ProcessRerutnIconClick()");
	if(this.ReturnClickFunc)
	{
		this.ReturnClickFunc();
	}
}

WndMgr.SetFlagMouseCusorShow = function(flag)
{
	alert("***** WndMgr.SetFlagMouseCusorShow() : " + flag);
	this.isMouseCusorShow = flag;
}
WndMgr.ShowWidgetDimBG = function(){
	alert("***** WndMgr.ShowWidgetDimBG()");
	var HTMLString = "<div id='widgetdimbg'></div>";
	$('body').append(HTMLString);
	$("#widgetdimbg").css({
		'position' : 'absolute',
		'left' : '0px',
		'top' : '0px',
		'width' : '1280px',
		'height' : '720px',
		'z-index' : '101',
	});
	if(WndMgr.Bg_Dim != null)
	{
		$("#widgetdimbg").css('background-image', 'url('+WndMgr.Bg_Dim.src+')');
	}
	else
	{		
		$("#widgetdimbg").css('background-image', 'url('+g_Image.IMAGE_POPUP_DIM_BG+')');
	}
}
WndMgr.HideWidgetDimBG = function(){
	alert("***** WndMgr.HideWidgetDimBG() : remove div");
	$("#widgetdimbg").remove();
}

WndMgr.HideMouseArrow = function(){
	alert("***** WndMgr.HideMouseArrow()");
	if(StateMgr.MainStateList[MAIN_STATE.MAIN].flagLoad == true){
		if(WndMgr.GetMainSubIndex() == 3){	
			sf.scene.get("ListMainProfile").HideArrow();
		}else if(WndMgr.GetMainSubIndex() == 4){	
			if(StateMgr.currentSubState=="SettingsBlockedContacts"){
				sf.scene.get("SettingsBlockedContacts").HideArrow();
			}
		}
	}
}
WndMgr.HideTabOverImage = function(){
	alert('WndMgr.HideTabOverImage');
	var state = StateMgr.GetCurrentState();
	if(state=="Signin"){
		var Scene = sf.scene.get("Signin");
		Scene.hideTabOverImage();
	}else if(state=="FaceRecogSignin"){
		alert("step : "+this.FaceRecogSigninStep);
		if(this.FaceRecogSigninStep=="FaceRecog"){
			var Scene = sf.scene.get("FaceRecogSignin");
			Scene.hideTabOverImage();
		}else if(this.FaceRecogSigninStep=="Result"){
			var Scene = sf.scene.get("FaceRecogResult");
			Scene.hideTabOverImage();
		}
	}
}

WndMgr.GestureZoomInOut = function(zoomValue)
{
	if(this.isShowCameraControl == true)
	{
		//only counter is 2
		if(this.GestureZoomCounter < 3)
		{
			this.GestureZoomCounter++;
			return;
		}
				
		if(zoomValue > 0)
		{
			sf.scene.get("CallCameraControl").ZoomIn();
		}
		else
		{
			sf.scene.get("CallCameraControl").ZoomOut();
		}

		this.GestureZoomCounter = 0;
	}
}

WndMgr.StartGestureZoom = function()
{
	alert('start 2 hand gesture');
	if(this.isShowCameraControl == true)
	{
		sf.scene.get("CallCameraControl").ChangeGestureMode(true);
	}
}

WndMgr.StopGestureZoom = function()
{
	alert('stop 2 hand gesture');	
	if(this.isShowCameraControl == true)
	{
		sf.scene.get("CallCameraControl").ChangeGestureMode(false);
	}
	this.GestureZoomCounter = 0;
}
