
function SceneCreateAccountStep3(options) {
	this.options = options;
	
	this.InitFlag = true;
	this.destroyFlag = true;
	
	this.MainView=null;
	
	this.TitleLabel = null;
	
	this.MsgLabel = null;
	this.BoxLabel = null;
//2013 add by minseok 
	this.Nevi_icon1 = null;
	this.Nevi_icon2 = null;
	this.Nevi_icon3 = null;
	this.Nevi_icon4 = null;
	
	this.SkypeNameLabel = null;
	this.PasswordLabel = null;
	this.FullNameLabel = null;
	this.EmailLabel = null;
	
	this.SkypeNameBtn = null;
	this.PasswordBtn = null;
	this.FullNameBtn = null;
	this.EmailBtn = null;

	this.PreviousBtn = null;
	this.NextBtn = null;
	
	this.DefaultHelpBar =null;
}

SceneCreateAccountStep3.prototype.initialize = function () {
	alert("SceneCreateAccountStep3.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();
}

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

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

}

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

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

	WndMgr.SetReturnIconClickCallback(null);
}

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

		case sf.key.ENTER:
            this.processEnterKey();
			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;

	}
}

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

SceneCreateAccountStep3.prototype.create = function(){
    alert("SceneCreateAccountStep3.create()");
	
    this.MainView = new View("CreateAccountStep3");
    // this.MainView.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_BG);
   	this.Nevi_icon1 = new Label("create_account_step3_nevi1",null);
	this.Nevi_icon1.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_NEVI_NORMAL);
	this.Nevi_icon2 = new Label("create_account_step3_nevi2",null);
	this.Nevi_icon2.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_NEVI_NORMAL);
	this.Nevi_icon3 = new Label("create_account_step3_nevi3",null);
	this.Nevi_icon3.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_NEVI_HIGHLIGHT);
	this.Nevi_icon4 = new Label("create_account_step3_nevi4",null);
	this.Nevi_icon4.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_NEVI_NORMAL);
   
    this.TitleLabel = new Label(null,"create_account_step3_title");
    this.TitleLabel.SetTextStyle("create_account_title_style");
    this.TitleLabel.SetText(TV_SID_CREATE_AN_ACCOUNT);
	
	this.MsgLabel = new Label(null,"create_account_step3_msg");
    this.MsgLabel.SetTextStyle("create_account_step3_msg_text_style");
    this.MsgLabel.SetText(TV_CHECK_DETAILS_BEFORE_CREATING_ACCOUNT_MSG);
    
    var CurLangID = ResMgr.GetCurLanguage();
    if(CurLangID == ENUM_TV_LANGUAGE.ZUL)
    {
    	$("#create_account_step3_msg").css('top',"125px")
    }
	
	this.BoxLabel= new Label("create_account_step3_box", null);
    this.BoxLabel.SetBgImage(g_Image.IMAGE_CREATE_ACCOUNT_BOX_BG );
	
	this.SkypeNameLabel = new Label(null,"create_account_step3_skype_name");
    this.SkypeNameLabel.SetTextStyle("create_account_text_style");
    this.SkypeNameLabel.SetText(IDWS_MOIP_SKYPE_NAME);

    this.PasswordLabel = new Label(null,"create_account_step3_password");
    this.PasswordLabel.SetTextStyle("create_account_text_style");
    this.PasswordLabel.SetText(SID_PASSWORD);

    this.FullNameLabel = new Label(null,"create_account_step3_full_name");
    this.FullNameLabel.SetTextStyle("create_account_text_style");
    this.FullNameLabel.SetText(IDWS_MOIP_FULL_NAME);

    this.EmailLabel = new Label(null,"create_account_step3_email");
    this.EmailLabel.SetTextStyle("create_account_text_style");
    this.EmailLabel.SetText(IDWS_MOIP_E_MAIL);
	
	this.SkypeNameBtn= new Button();
    this.SkypeNameBtn.SetImageObjId("create_account_step3_skype_name_btn", 30);
    this.SkypeNameBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_BTN_NORMAL);
    this.SkypeNameBtn.SetTextObjId("create_account_step3_skype_name_btn_text");
    this.SkypeNameBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_input_btn_style");
    this.SkypeNameBtn.SetIsPlainText(true);
	this.SkypeNameBtn.SetText("");

    this.PasswordBtn= new Button();
    this.PasswordBtn.SetImageObjId("create_account_step3_password_btn", 30);
    this.PasswordBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_BTN_NORMAL);
    this.PasswordBtn.SetTextObjId("create_account_step3_password_btn_text");
    this.PasswordBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_input_btn_style");
    this.PasswordBtn.SetIsPlainText(true);
	this.PasswordBtn.SetText("");
	
    this.FullNameBtn= new Button();
    this.FullNameBtn.SetImageObjId("create_account_step3_full_name_btn", 30);
    this.FullNameBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_BTN_NORMAL);
    this.FullNameBtn.SetTextObjId("create_account_step3_full_name_btn_text");
    this.FullNameBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_input_btn_style");
    this.FullNameBtn.SetIsPlainText(true);
	this.FullNameBtn.SetText("");
	
    this.EmailBtn= new Button();
    this.EmailBtn.SetImageObjId("create_account_step3_email_btn", 30);
    this.EmailBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_BTN_NORMAL);
    this.EmailBtn.SetTextObjId("create_account_step3_email_btn_text");
    this.EmailBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_input_btn_style");
    this.EmailBtn.SetIsPlainText(true);
	this.EmailBtn.SetText("");
	
	var this_ = sf.scene.get("CreateAccountStep3");
	var clickCF =  function(obj){this_.processClickEvent(obj);};
	var overCF =  function(obj){this_.processMouseOverEvent(obj);};

    this.PreviousBtn= new Button();
    this.PreviousBtn.SetImageObjId("create_account_step3_previous_btn", 30);
    this.PreviousBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_PREVIOUS_BTN_NORMAL);
    this.PreviousBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_CREATE_ACCOUNT_PREVIOUS_BTN_NORMALFOCUS);
    //this.PreviousBtn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_CREATE_ACCOUNT_PREVIOUS_BTN_NORMAL);
    this.PreviousBtn.SetTextObjId("create_account_step3_previous_btn_text");
    this.PreviousBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_btn_normal_style");
	this.PreviousBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"create_account_btn_select_style");
   // this.PreviousBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE,"create_account_btn_dim_style");
    this.PreviousBtn.SetText(SID_BACK_KR_PREV);
    this.PreviousBtn.SetOnClickCallbackFunc(clickCF);
    this.PreviousBtn.SetOnMouseOverCallbackFunc(overCF);
	
	this.NextBtn= new Button();
    this.NextBtn.SetImageObjId("create_account_step3_next_btn", 30);
    this.NextBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_CREATE_ACCOUNT_NEXT_BTN_NORMAL);
    this.NextBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_CREATE_ACCOUNT_NEXT_BTN_NORMALFOCUS);
    //this.NextBtn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_CREATE_ACCOUNT_NEXT_BTN_NORMAL);
    this.NextBtn.SetTextObjId("create_account_step3_next_btn_text");
    this.NextBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"create_account_btn_normal_style");
	this.NextBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"create_account_btn_select_style");
    //this.NextBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE,"create_account_btn_dim_style");
    this.NextBtn.SetText(SID_NEXT);
    this.NextBtn.SetOnClickCallbackFunc(clickCF);
    this.NextBtn.SetOnMouseOverCallbackFunc(overCF);
}

SceneCreateAccountStep3.prototype.setInitFlag= function(init_flag){
     this.InitFlag = init_flag;
}

SceneCreateAccountStep3.prototype.setDestroyFlag= function(destroy_flag){
     this.destroyFlag = destroy_flag;
}


SceneCreateAccountStep3.prototype.initCreateAccount = function()
{   
    this.SkypeNameBtn.SetText(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id);
    this.PasswordBtn.SetText(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.pwd);
	this.FullNameBtn.SetText(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.full_name);
    this.EmailBtn.SetText(g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.email);
   
     this.highlight(this.NextBtn);
}


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



SceneCreateAccountStep3.prototype.processLeftRightKey = function(keyCode){
    alert("SceneCreateAccountStep3.processLeftRightKey() ");
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
    
	switch(currentHighlight)
	{		
		case this.PreviousBtn:
			if(keyCode==sf.key.RIGHT){	
			 this.highlight(this.NextBtn);
			}
			break;
			
		case this.NextBtn:
			if (keyCode==sf.key.LEFT) {
				this.highlight(this.PreviousBtn);
			};
			 
			break;
	}
}

SceneCreateAccountStep3.prototype.processEnterKey = function(){
    alert("SceneCreateAccountStep3.processEnterKey() ");
    
    var currentHighlight = this.MainView.getCurrentHighlight();
    
    //this.select(currentHighlight);
	
	switch(currentHighlight)
	{
		case this.PreviousBtn:	
			 this.processReturnKey();
			break;
			
		case this.NextBtn:
			WndMgr.NextStepCreateAccount();
			break;
	}
	
}

SceneCreateAccountStep3.prototype.processReturnKey = function(){
    alert("SceneCreateAccountStep3.processReturnKey() ");
    var currentHighlight = this.MainView.getCurrentHighlight();
    if(currentHighlight==this.PreviousBtn){
    	WndMgr.BackStepCreateAccount();	
    }else{
    	StateMgr.Start_Welcome_State();
    }
}

SceneCreateAccountStep3.prototype.processExitKey = function(){
    alert("SceneCreateAccountStep3.processExitKey() ");
   
   ProcMgr.ExitWithSignIn();
}

///////// Processing Click evnet  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

	var currentHighlight =  this.MainView.getCurrentHighlight();
    if(currentHighlight != obj)
    {
    	this.highlight(obj);
    }
	
	//this.processEnterKey();
}
