

function SceneFaceRecogSecurityPopup(options) {
	this.options = options;
    
    this.MainView=null;
    this.MainViewBG=null;
	this.MainViewDim=null;
    
    this.PopupMsg = null;
    this.YesBtn = null;
    this.NoBtn = null;
   

}

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

SceneFaceRecogSecurityPopup.prototype.handleShow = function () {
	alert("SceneFaceRecogSecurityPopup.handleShow()");
	// this function will be called when the scene manager show this scene 
	this.MainViewDim.show();
	
    this.highlight(this.YesBtn);

	WndMgr.startPopupHideTimer(30000,this.popupTimerCallback);

    
}

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

	this.MainViewDim.hide();
	
	WndMgr.stopPopupHideTimer();
}

SceneFaceRecogSecurityPopup.prototype.handleFocus = function () {
	alert("SceneFaceRecogSecurityPopup.handleFocus()");
	// this function will be called when the scene manager focus this scene

}

SceneFaceRecogSecurityPopup.prototype.handleBlur = function () {
	alert("SceneFaceRecogSecurityPopup.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
}

SceneFaceRecogSecurityPopup.prototype.handleKeyDown = function (keyCode) {
	alert("SceneFaceRecogSecurityPopup.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:
			WndMgr.resetPopupHideTimer();
	        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:
        case sf.key.EXIT:
            this.processReturnKey();
            //2013 modify by minseok
            sf.key.preventDefault();
			break;
            
         case 147:  //infolink
         case 261:  //contents
         case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
	}
}

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

SceneFaceRecogSecurityPopup.prototype.create = function(){
    alert("SceneFaceRecogSecurityPopup.create()");
    this.MainView = new View("FaceRecogSecurityPopup");
	this.MainViewDim = new DimBg("FaceRecogSecurityPopupDim", "FaceRecogSecurityPopup");       
	this.MainViewBG = new View("FaceRecogSecurityPopupBG");
	this.MainViewBG.CreatePopupBG(1,"FaceRecogSecurityPopup_popup_BG")
	 
    this.PopupMsg = new Label(null,"face_recog_security_popup_msg");
        
    if(ResMgr.GetCurLanguage()== ENUM_TV_LANGUAGE.GRE)
    {
    	this.PopupMsg.SetTextStyle("face_recog_security_popup_msg_style_s");
    }
    else
    {
    	this.PopupMsg.SetTextStyle("face_recog_security_popup_msg_style");
    }    
    this.PopupMsg.SetText(TV_THUMBNAIL_IMAGE_OF_YOUR_FACE_WILL_BE_STORED_MSG+"</br>"+TV_LOGIN_FACE_RECOG_SECURITY_MSG+"</br></br>"+TV_I_ACCEPT_AND_WISH_TO_CONTINUE_MSG);
    
    var this_ = sf.scene.get("FaceRecogSecurityPopup");
    var clickCF =  function(obj){this_.processClickEvent(obj);};
    var overCF =  function(obj){this_.processMouseOverEvent(obj);};

    this.YesBtn = new Button();
    this.YesBtn.SetImageObjId("face_recog_security_popup_yes_btn", 20);
    this.YesBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.YesBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
    this.YesBtn.SetTextObjId("face_recog_security_popup_yes_btn_text");
    this.YesBtn.SetText(SID_YES);
    this.YesBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"cPopup_btn_text");
    this.YesBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"cPopup_btn_text_high");
	this.YesBtn.SetOnClickCallbackFunc(clickCF);
	this.YesBtn.SetOnMouseOverCallbackFunc(overCF);
    
    this.NoBtn = new Button();
    this.NoBtn.SetImageObjId("face_recog_security_popup_no_btn", 20);
    this.NoBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.NoBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
    this.NoBtn.SetTextObjId("face_recog_security_popup_no_btn_text");
    this.NoBtn.SetText(SID_NO);
    this.NoBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"cPopup_btn_text");
    this.NoBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"cPopup_btn_text_high");
	this.NoBtn.SetOnClickCallbackFunc(clickCF);
	this.NoBtn.SetOnMouseOverCallbackFunc(overCF);
}


SceneFaceRecogSecurityPopup.prototype.highlight=function(obj)
{
    this.MainView.setCurrenHighlight(obj);

}


SceneFaceRecogSecurityPopup.prototype.popupTimerCallback = function()
{
    alert("SceneFaceRecogSecurityPopup.popupTimerCallback() ");
   ProcMgr.SkipFaceRecogRegistration(); 
}

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

SceneFaceRecogSecurityPopup.prototype.processEnterKey = function(){
    alert("SceneFaceRecogSecurityPopup.processEnterKey() ");
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
    
    switch(currentHighlight)
    {
        case this.YesBtn:
			ProcMgr.RequestFaceRecogRegistration();

            break;
            
        case this.NoBtn:

		   	ProcMgr.SkipFaceRecogRegistration(); 
            break;
    }
}

SceneFaceRecogSecurityPopup.prototype.processReturnKey = function(){
    alert("SceneFaceRecogSecurityPopup.processReturnKey() ");
	
   	ProcMgr.SkipFaceRecogRegistration(); 
}

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

