function SceneCheckPassword(options) {
	this.options = options;
    
    // this.MainView=null;
    // this.MainViewBG=null;
	this.MainViewDim =null;
    
    // this.MsgLabel = null;
	// this.MsgLengthLabel = null;
//     
    // this.TextInputBox = null;
    
    this.flagPWD = true;
    this.initText ="";
    this.maxStringLenght = 20;
    this.callerObj = null;
    
    this.flagPwdShow = false;

	this.isCheckEnable= false;
	this.CloseTimer = false;
	
	//13년 테스트 ime
	this.imeBox = null;
	this.str = null;
	this.imeIsShow = false;
}

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

SceneCheckPassword.prototype.handleShow = function () {
	alert("SceneCheckPassword.handleShow()");
	// this function will be called when the scene manager show this scene 
	this.MainViewDim.show();
	this.updateIMEBox();
	
	/*this.TextInputBox.initKeySet();
	
    this.resetData();
    
   // this.startTmer();
   WndMgr.startPopupHideTimer(60000);*/
}

SceneCheckPassword.prototype.handleHide = function () {
	alert("SceneCheckPassword.handleHide()");
	// this function will be called when the scene manager hide this scene  
	this.MainViewDim.hide();	
   /* var obj = this.MainView.getCurrentHighlight();
	if(obj != null)
	{
		obj.imeHide();
	}
	
	this.flagPwdShow = false; //init

	WndMgr.stopPopupHideTimer();
	// if(this.CloseTimer==true)
	// {
		// this.stopTimer();
	// }*/
}

SceneCheckPassword.prototype.handleFocus = function () {
	alert("SceneCheckPassword.handleFocus()");
	// this function will be called when the scene manager focus this scene
    //this.highlight(this.TextInputBox);
    this.imeBox.onShow();
	this.imeIsShow = true;
}

SceneCheckPassword.prototype.handleBlur = function () {
	alert("SceneCheckPassword.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
	if(this.imeIsShow==true){
		this.imeBox.onClose();
	}	
}

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

			break;
		case sf.key.UP:

			break;
		case sf.key.DOWN:

			break;

		case sf.key.ENTER:
             // this.processEnterKey();
			break;
            
        case sf.key.RETURN:
            // this.processReturnKey();
            sf.key.preventDefault();
			break;
            
        case sf.key.EXIT:
            sf.key.preventDefault();
			break;
            
         case 147:  //infolink
         case 261:  //contents
         case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
	}
}

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

SceneCheckPassword.prototype.create = function(){
    alert("SceneCheckPassword.create()");
    // this.MainView = new View("CheckPassword");
//     
    // this.MainViewBG = new View("CheckPasswordBG");
    // this.MainViewBG.CreatePopupBG(1,"CheckPassword_popup_BG");
	// this.MainViewBG.SetTitleTextofPopupBG(SID_PASSWORD);
	
	this.MainViewDim = new DimBg("CheckPasswordDim", "CheckPassword");
    
   
    // this.MsgLabel = new Label(null,"check_password_msg");
    // this.MsgLabel.SetTextStyle("check_password_msg_style");
    // this.MsgLabel.SetText(SIGN_IN_KEYPAD_HELP_ENTER_PASSWORD);
// 	
	// this.MsgLengthLabel = new Label(null,"check_password_msg_length");
    // this.MsgLengthLabel.SetTextStyle("check_password_msg_length_style");
    // this.MsgLengthLabel.SetText("");
//     
    // this.TextInputBox= new InputBox();
	// this.TextInputBox.SetButtonObjId("check_password_input_box", 30);
    // this.TextInputBox.SetButtonTextObjId("check_password_input_box_text");
	// this.TextInputBox.SetInputBoxObjId("check_password_input_box_editor");
	// this.TextInputBox.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_INPUT_BOX_NORMAL);
	// this.TextInputBox.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_INPUT_BOX_NORMALFOCUS);	
	// // this.TextInputBox.setKeypadPos(675,100);
    // // this.TextInputBox.setWordBoxPos(236,50);
	// this.TextInputBox.setKeypadPos(704,93);
    // this.TextInputBox.setWordBoxPos(236,50);
    
}
SceneCheckPassword.prototype.onKeyCallback= function(key, str, id){
	 alert("SceneAddContactSkypeName.onKeyCallback() ===================: " + key + " ID = " + id + " STR = " + str);
	 var Scene = sf.scene.get("CheckPassword");
	 Scene.imeIsShow = false;
    switch (key) {
        case sf.key.ENTER: // Enter Key
            alert("ENTER - str is "+str);
            Scene.str = str;
            Scene.CheckInputPwd();
            break;
        case sf.key.RETURN:  //return
            alert("RETURN");
            Scene.processReturnKey();
            break;
        case sf.key.EXIT:  //exit
            alert("EXIT");
            Scene.processReturnKey();
            break;
    }
	
	
}
SceneCheckPassword.prototype.updateIMEBox= function(){
	alert("SceneAddContactSkypeName.updateIMEBox()");
	this.imeBox = new IMEShell_Common();
	//this.imeBox.inputboxID = "TextEditorImeTest";
    this.imeBox.inputTitle=SIGN_IN_KEYPAD_HELP_ENTER_PASSWORD;
    //this.imeBox.context = this;
    if(this.flagPWD)
    	this.imeBox.setPasswordMode(this.flagPWD);
    //this.imeBox.setBlockSpace(this.flagBlockSpace); 
    this.imeBox.setMaxlength(this.maxStringLenght); 
    this.imeBox.onKeyPressFunc = this.onKeyCallback; 
	this.imeBox.onCompleteFunc = this.checkEnterEnable; 

    this.imeBox.inputString = this.initText; 
}
/*
SceneCheckPassword.prototype.resetData = function()
{  
	this.isCheckEnable= false;
    this.TextInputBox.SetText("");
	this.MsgLengthLabel.SetText("");

    this.flagPwdShow = false; 	
}

SceneCheckPassword.prototype.update = function()
{  
 alert("SceneTextEditor.update() ");
  var obj = this.MainView.getCurrentHighlight();
    
   var scene = sf.scene.get("CheckPassword");
   
   var ime = new IMEShell(obj.IMEObjInfo.id, scene.imeReady, 'en' /*, 'en' ,  "2_35_259");

}

SceneCheckPassword.prototype.highlight=function(obj)
{
    this.MainView.setCurrenHighlight(obj);
  
    var scene = sf.scene.get("CheckPassword");
    if(obj == this.TextInputBox)
    {
        this.TextInputBox.initInputBox( this.flagPWD, this.initText, this.maxStringLenght,  this.callerObj );
       
        var ime = new IMEShell(obj.IMEObjInfo.id, scene.imeReady, 'en' /*, 'en' ,  "2_35_259");
    }
	else
	{
		if(obj == null)
		{
			this.TextInputBox.imeHide();	
		}
	}	 
}
*/
SceneCheckPassword.prototype.processReturnKey = function(){
    alert("SceneCheckPassword.processReturnKey() ");
	// this.highlight(null);
	
	ProcMgr.CancelCheckPwd();
	sf.key.preventDefault();
}

SceneCheckPassword.prototype.processExitKey = function(){
    alert("SceneCheckPassword.processExitKey() ");
    // this.highlight(null);
    ProcMgr.CancelCheckPwd();
    sf.key.preventDefault();
}
/*
SceneCheckPassword.prototype.imeReady = function(imeObject){
	alert("SceneCheckPassword.imeReady() ");
	
	var scene = sf.scene.get("CheckPassword");
	var obj = scene.MainView.getCurrentHighlight();
	
	obj.imeShow(imeObject);
	
	obj.setKeyFunc(88,  function(keyCode){ scene.processReturnKey();  return false;}); // return key
	obj.setKeyFunc(45,  function(keyCode){ scene.processExitKey();  return false;}); // exit key
	obj.setKeyFunc(108, function(keyCode){scene.DeleteAllText();  return false;}); // red key
	obj.setKeyFunc(222, function(keyCode){sf.key.preventDefault();  return false;}); // source
	
	obj.setKeyFunc(147, function(keyCode){sf.key.preventDefault();  return false;}); // infolink
	obj.setKeyFunc(261, function(keyCode){sf.key.preventDefault();  return false;}); // contents
	obj.setKeyFunc(115, function(keyCode){sf.key.preventDefault();  return false;}); // wiselink
	
	obj.setEnterFunc( function(keyCode){scene.CheckInputPwd() ; return false;});
	
	obj.setOnCompleteFunc(function(keyCode){scene.updateMsgLength(); scene.checkEnterEnable(); WndMgr.resetPopupHideTimer();  return false;});
	obj.setAnyKeyFunc(function(keyCode){WndMgr.resetPopupHideTimer(); return false;});
	
	obj.setKeySetFunc("qwerty");
	
	scene.updateHelpBar(); //when input mode is pwd, display show or hide pwd string on help bar
	
	obj.setReady();
	
	scene.updateMsgLength();
	scene.checkEnterEnable();
}

SceneCheckPassword.prototype.updateMsgLength = function()
{
	alert("SceneCheckPassword.updateMsgLength() ");
    var obj = this.MainView.getCurrentHighlight();
    var input_string = obj.getString();
	
	obj.SetText(input_string);
	this.MsgLengthLabel.SetText(String(input_string.length) +"/" +String(this.maxStringLenght));  	
}
*/
SceneCheckPassword.prototype.CheckInputPwd = function()
{
    alert("SceneCheckPassword.CheckInputPwd() ");
	var input_text = this.str;
	if(this.isCheckEnable == true)
	{
		//this.highlight(null);
		ProcMgr.CheckInputPwd(input_text);
	}else{
		ProcMgr.CancelCheckPwd();
	}  
}

SceneCheckPassword.prototype.GetInputText = function()
{
    var obj = this.MainView.getCurrentHighlight();
    return obj.getString();
}
/*
SceneCheckPassword.prototype.DeleteAllText = function()
{
	this.resetTimer();
	
	if(this.flagPWD == true)
    {
        this.TogglePWDShowMode();
    }
    else
    {
	    var obj = this.MainView.getCurrentHighlight();
	    obj.setString("");
		
		this.updateMsgLength();
		this.checkEnterEnable();
    }
}

SceneCheckPassword.prototype.TogglePWDShowMode = function()
{
    alert("SceneCheckPassword.TogglePWDShowMode() ");
    
	var obj = this.MainView.getCurrentHighlight();
	var curr_string = obj.GetText();
    obj.setEngOnly(true);
    
    this.TextInputBox.updateInputBox( this.flagPwdShow, curr_string, this.maxStringLenght,  this.callerObj );
    if( sf.scene.get('CheckPassword').flagPwdShow == false)
    {
        obj.setBlockSpace(true);
    }
    
    if(this.flagPwdShow == false)
    {
        this.flagPwdShow = true;
        
    }
    else
    {
        this.flagPwdShow = false;
        
    }  
    
    this.update();
}

SceneCheckPassword.prototype.updateHelpBar = function()
{
	var scene = sf.scene.get("CheckPassword");
	var obj = scene.MainView.getCurrentHighlight();
	
	if(scene.flagPWD == true) 
	{
 		if(scene.flagPwdShow == true)
		{
			alert("SceneCheckPassword.updateHelpBar() : mode 1 (hide)");
			obj.setShowHideString(SID_HIDE_PASSWORD);
		}
		else
		{
			alert("SceneCheckPassword.updateHelpBar() : mode 2 (show)");
			obj.setShowHideString(SID_SHOW_PASSWORD);
		}
	} 
	else
	{
		alert("SceneCheckPassword.updateHelpBar() : mode 3 (null)");
		obj.setShowHideString(null);
	}
}
*/
SceneCheckPassword.prototype.checkEnterEnable = function(string)
{
    var input_text = string;
    var Scene = sf.scene.get("CheckPassword");
    if(input_text.length ==0)
    {
        Scene.isCheckEnable = false;
    }
    else
    {
        Scene.isCheckEnable = true;
    }
           
    alert("SceneCheckPassword.checkEnterEnable()  :  " +Scene.isCheckEnable);
}
/*
SceneCheckPassword.prototype.startTimer = function()
{
    alert("SceneCheckPassword.startTimer() ");
	
	this.CloseTimer = true;
	PluginAPIMgr.StartOSDTimer("60000" , function() { sf.scene.get('CheckPassword').popupTimerCallback();}, ENUM_TIMER_TYPE.POPUP_WND);
}

SceneCheckPassword.prototype.resetTimer = function()
{
    alert("SceneCheckPassword.resetTimer() ");

	if(this.CloseTimer == true)
	{
		PluginAPIMgr.RestartOSDTimer("60000" ,ENUM_TIMER_TYPE.POPUP_WND);
	}
}

SceneCheckPassword.prototype.stopTimer = function()
{
    alert("SceneCheckPassword.stopTimer() ");
	
	this.CloseTimer = false;
	PluginAPIMgr.StopOSDTimer(ENUM_TIMER_TYPE.POPUP_WND);
}

SceneCheckPassword.prototype.popupTimerCallback = function()
{
   alert("SceneCheckPassword.popupTimerCallback() ");
   if(this.CloseTimer==false)
   {
   	return
   }
   this.CloseTimer = false;
   
	this.highlight(null);
	ProcMgr.CancelCheckPwd();
}
*/



