
function SceneCreateAccountSuccess(options) {
	this.options = options;
    
    this.MainView=null;
    
    this.TitleLabel = null;     	
	this.MsgBgLabel = null;
	
	this.Msg1Label = null;
	this.Msg2Label = null;
	this.Msg3Label = null;
	this.Msg4Label= null;

    this.FaceRegisterBtn = null;
    this.StartSkypeBtn = null;
	
    this.DefaultHelpBar =null;
    
	this.flagWaiting = false;
 
}

SceneCreateAccountSuccess.prototype.initialize = function () {
	alert("SceneCreateAccountSuccess.initialize()");
	// this function will be called only once when the scene manager show this scene first time
	// initialize the scene controls and styles, and initialize your variables here 
	// scene HTML and CSS will be loaded before this function is called
   
    this.create();
    
}

SceneCreateAccountSuccess.prototype.handleShow = function () {
	alert("SceneCreateAccountSuccess.handleShow()");
	// this function will be called when the scene manager show this scene 
	this.enableButton();
	
	this.updateData();
}

SceneCreateAccountSuccess.prototype.handleHide = function () {
	alert("SceneCreateAccountSuccess.handleHide()");
	// this function will be called when the scene manager hide this scene      
	this.highlight(null);
}

SceneCreateAccountSuccess.prototype.handleFocus = function () {
	alert("SceneCreateAccountSuccess.handleFocus()");
	// this function will be called when the scene manager focus this scene
    var currentHighlight =  this.MainView.getCurrentHighlight();
    if(currentHighlight ==null)
    {
        this.highlight(this.StartSkypeBtn);
    }
    else
    {
         this.highlight(currentHighlight);
    }  
    
    var this_ = sf.scene.get("CreateAccountSuccess");
  	var returnCF =  function(){this_.processReturnKey();};
    WndMgr.SetReturnIconClickCallback(returnCF);
}

SceneCreateAccountSuccess.prototype.handleBlur = function () {
	alert("SceneCreateAccountSuccess.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
    if(currentHighlight !=null)
    {
    	currentHighlight.blur();
	}

	WndMgr.SetReturnIconClickCallback(null);
}
 
SceneCreateAccountSuccess.prototype.handleKeyDown = function (keyCode) {
	alert("SceneCreateAccountSuccess.handleKeyDown(" + keyCode + ")");
	// TODO : write an key event handler when this scene get focued
	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	if(this.flagWaiting ==true)
	{
		return;
	}
	
	switch (keyCode) {
		case sf.key.LEFT:
		case sf.key.RIGHT:
			
			break;
		case sf.key.UP:          
		case sf.key.DOWN:
           this.processUpDownKey(keyCode);
			break;

		case sf.key.ENTER:
            this.processEnterKey();
			break;
        
		case sf.key.TOOLS:
            
			break; 
            
        case sf.key.RETURN:
            this.processReturnKey();
            //2013 modify by minseok
            sf.key.preventDefault();
            //sf.key.block(event);	
			break;
            
        case sf.key.EXIT:
            this.processExitKey();
            //2013 modify by minseok
            sf.key.preventDefault();
            //sf.key.block(event);	
			break;
		
        case 147:  //infolink
        case 261:  //contents
        case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
			
		default:
            ProcMgr.processBlockKey(keyCode);
            break;

	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////

SceneCreateAccountSuccess.prototype.create = function(){
    alert("SceneCreateAccountSuccess.create()");
    this.MainView = new View("CreateAccountSuccess");
    // this.MainView.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BG);
    
    this.TitleLabel = new Label(null,"create_account_success_title");
    this.TitleLabel.SetTextStyle("create_account_success_title_style");
    this.TitleLabel.SetText(TV_SUCCESSFUL_ACCOUNT_CREATION);
    
   	this.MsgBgLabel= new Label("create_account_success_msg_bg", null);
    this.MsgBgLabel.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_MSG_BG);    
	
    this.Msg1Label = new Label(null,"create_account_success_msg_1");
    this.Msg1Label.SetTextStyle("create_account_success_msg_style");
    this.Msg1Label.SetText(IDWS_MOIP_WELCOM_TO_SKYPE+"<br>"+TV_YOUR_ACCOUNT_HAS_BEEN_CREATED_SUCCESSFULLY);  
	
	this.Msg2Label = new Label(null,"create_account_success_msg_2");
    this.Msg2Label.SetTextStyle("create_account_success_msg_style");

    this.Msg3Label = new Label(null,"create_account_success_msg_3");
    this.Msg3Label.SetTextStyle("create_account_success_msg_style");
    this.Msg3Label.SetText(TV_WE_RECOMMEND_YOU_MAKE_A_NOTE_OF_YOUR_SKYPE_NAME+"</br>"+TV_GIVE_TO_FRIENDS_CONNECT_SKYPE_MSG);  
    
    this.Msg4Label = new Label(null,"create_account_success_msg_4");
    this.Msg4Label.SetTextStyle("create_account_success_msg_style");
    this.Msg4Label.SetText(TV_LOG_IN_WITH_FACE_IF_REGISTER_MSG);  
	
	var this_ = sf.scene.get("CreateAccountSuccess");
	var clickCF =  function(obj){this_.processClickEvent(obj);};
	var overCF =  function(obj){this_.processMouseOverEvent(obj);};
	
	this.FaceRegisterBtn= new Button();
    this.FaceRegisterBtn.SetImageObjId("create_account_success_face_registration_btn", 30);
    this.FaceRegisterBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_NORMAL);
    this.FaceRegisterBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_NORMALFOCUS);
    this.FaceRegisterBtn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_DIM);
	this.FaceRegisterBtn.SetTextObjId("create_account_success_face_registration_btn_text");
    this.FaceRegisterBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_success_btn_normal_style");
	this.FaceRegisterBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"create_account_success_btn_select_style");
	this.FaceRegisterBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE,"create_account_success_btn_dim_style");
    this.FaceRegisterBtn.SetText(TV_REGISTER_FACE_BTTN);
    this.FaceRegisterBtn.SetOnClickCallbackFunc(clickCF); 
    this.FaceRegisterBtn.SetOnMouseOverCallbackFunc(overCF); 
	
	this.StartSkypeBtn= new Button();
    this.StartSkypeBtn.SetImageObjId("create_account_success_start_skype_btn", 30);
    this.StartSkypeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_NORMAL);
    this.StartSkypeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_NORMALFOCUS);
    this.StartSkypeBtn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_CREATE_ACCOUNT_SUCCESS_BTN_DIM);
	this.StartSkypeBtn.SetTextObjId("create_account_success_start_skype_btn_text");
    this.StartSkypeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_success_btn_normal_style");
	this.StartSkypeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"create_account_success_btn_select_style");
    this.StartSkypeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE,"create_account_success_btn_dim_style");
	this.StartSkypeBtn.SetText(TV_START_USING_SKYPE);
	this.StartSkypeBtn.SetOnClickCallbackFunc(clickCF); 
	this.StartSkypeBtn.SetOnMouseOverCallbackFunc(overCF); 
	

}

SceneCreateAccountSuccess.prototype.updateData = function(){
    alert("SceneCreateAccountSuccess.updateData() ");
    this.Msg2Label.SetText(g_Data.CombinateStrings(TV_MIX_YOUR_SKYPE_NAME_IS,"<span class='create_account_success_msg_name_style'>"+g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id+"</span>"));    
}

SceneCreateAccountSuccess.prototype.highlight=function(obj)
{
	alert("SceneCreateAccountSuccess.highlight()");
	
    this.MainView.setCurrenHighlight(obj);
	
}

SceneCreateAccountSuccess.prototype.processUpDownKey = function(keyCode){
    alert("SceneCreateAccountSuccess.processUpDownKey() ");
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
	
    switch(currentHighlight)
    {
        case this.StartSkypeBtn:
        	if(keyCode==sf.key.UP){
        		this.highlight(this.FaceRegisterBtn);		
        	}
            break;
			
	    case this.FaceRegisterBtn:
	    	if(keyCode==sf.key.DOWN){
	    		this.highlight(this.StartSkypeBtn);	
	    	}
            break;           
    }
}


SceneCreateAccountSuccess.prototype.processEnterKey = function(){
    alert("SceneCreateAccountSuccess.processEnterKey() ");
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
	
    switch(currentHighlight)
    {            
        case this.StartSkypeBtn:
			this.disableButton();
			ProcMgr.StartLoggedInState();
            break;
			
		case this.FaceRegisterBtn:			
			WndMgr.NextStepCreateAccountSuccess();
            break; 
    }
}

SceneCreateAccountSuccess.prototype.processReturnKey = function(){
    alert("SceneCreateAccountSuccess.processReturnKey() ");
   
   StateMgr.Start_Exit_State(true);
}

SceneCreateAccountSuccess.prototype.processExitKey = function(){
    alert("SceneCreateAccountSuccess.processExitKey() ");
   
   StateMgr.Start_Exit_State(false);
}

SceneCreateAccountSuccess.prototype.enableButton = function(){
    alert("SceneCreateAccountSuccess.enableButton() ");
    
    this.StartSkypeBtn.SetFlagDim(false);
    this.FaceRegisterBtn.SetFlagDim(false);
	
    this.flagWaiting = false;
}

SceneCreateAccountSuccess.prototype.disableButton = function(){
    alert("SceneCreateAccountSuccess.disableButton() ");
	
     this.flagWaiting = true;
     
    this.StartSkypeBtn.blur();
    
    this.StartSkypeBtn.SetFlagDim(true);
	this.FaceRegisterBtn.SetFlagDim(true);
}


SceneCreateAccountSuccess.prototype.processClickEvent = function(obj){
	alert("SceneCreateAccountSuccess.processClickEvent() ");
	
	
	this.processEnterKey();
}
SceneCreateAccountSuccess.prototype.processMouseOverEvent = function(obj){
	alert("SceneCreateAccountSuccess.processMouseOverEvent() ");
	
	var currentHighlight =  this.MainView.getCurrentHighlight();
    if(currentHighlight != obj)
    {
    	this.highlight(obj);
    }
	
	//this.processEnterKey();
}

