function SceneFaceRecogDuplicate(options) {
	this.options = options;
    
	this.MainView=null;
	this.MainViewBG=null;
	this.MainViewDim=null;
	
	this.MsgLabel = null;
	this.SkypeNameLabel = null;
	
	this.OkBtn = null;

	this.flagWaiting = false;
	
	// this.CloseTimer = false;
}

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

SceneFaceRecogDuplicate.prototype.handleShow = function () {
	alert("SceneFaceRecogDuplicate.handleShow()");
	// this function will be called when the scene manager show this scene 
	this.MainViewDim.show();
	this.updateData();
    this.highlight(this.OkBtn);
    
    WndMgr.startPopupHideTimer(10000, function(){sf.scene.get('FaceRecogDuplicate').popupTimerCallback();});

    // this.startTimer();
}

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

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

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

}

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

SceneFaceRecogDuplicate.prototype.handleKeyDown = function (keyCode) {
	alert("SceneFaceRecogDuplicate.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:
			break;
		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:
        case sf.key.EXIT:
            this.processReturnKey();
            sf.key.preventDefault();
			break;

        case 147:  //infolink
        case 261:  //contents
        case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
	}
}

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

SceneFaceRecogDuplicate.prototype.create = function(){
    alert("SceneFaceRecogDuplicate.create()");
    this.MainView = new View("FaceRecogDuplicate");
    // this.MainView.SetBgImage(g_Image.IMAGE_FACE_RECOG_DUPLICATE_BG);
	
	this.MainViewBG = new View("FaceRecogDuplicateBG");
	this.MainViewBG.CreatePopupBG(1,"FaceRecogDuplicate_popup_BG");
	
	this.MainViewDim = new DimBg("FaceRecogDuplicateDim", "FaceRecogDuplicate");
    
    this.MsgLabel = new Label(null,"face_recog_duplicate_msg");
    this.MsgLabel.SetTextStyle("face_recog_duplicate_msg_style");
    this.MsgLabel.SetText(TV_THIS_FACE_IS_ALREADY_USED_BY_ANOTHER_ACCOUNT+"</br>"+TV_TRANSFER_YOUR_FACE_TO_THIS_ACCOUNT_AND_RETRY);
    
    /*var CurLangID = ResMgr.GetCurLanguage();  
    if(CurLangID == ENUM_TV_LANGUAGE.PER)
    {
    	$("#face_recog_duplicate_msg").css('left', "40px");
    	$("#face_recog_duplicate_msg").css('width', "440px");
    }*/
    
    this.SkypeNameLabel = new Label(null,"face_recog_duplicate_skype_name");
    this.SkypeNameLabel.SetTextStyle("face_recog_duplicate_msg_style");
    //this.SkypeNameLabel.SetReverseDisable(true);
    
    var this_ = sf.scene.get("FaceRecogDuplicate");
    var clickCF =  function(obj){this_.processClickEvent(obj);};
    
    this.OkBtn = new Button();
    this.OkBtn.SetImageObjId("face_recog_duplicate_ok_btn", 20);
    this.OkBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.OkBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);		
    this.OkBtn.SetTextObjId("face_recog_duplicate_ok_btn_text");
    this.OkBtn.SetText(SID_OK);
    this.OkBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"cPopup_btn_text");
    this.OkBtn.SetOnClickCallbackFunc(clickCF);     
}

SceneFaceRecogDuplicate.prototype.updateData = function(){
    alert("SceneFaceRecogDuplicate.updateData() ");
    
    this.SkypeNameLabel.SetText(g_Data.CombinateStrings(TV_MIX_REGISTERED_ACCOUNT_COLON , g_Data.GetFaceRecogDupliceteSkypeName()));

}

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

SceneFaceRecogDuplicate.prototype.processEnterKey = function(){
    alert("SceneFaceRecogDuplicate.processEnterKey() ");
    if(this.flagWaiting ==true)
    {
        return;
    }
    
    var currentHighlight =  this.MainView.getCurrentHighlight();
  
    switch(currentHighlight)
    {
        case this.OkBtn:
        	this.disableButton();
	//DF140119-00100
        	ProcMgr.RetryFaceRecogRegistration();
			// ProcMgr.ReturnToFaceRecogRegistrationCaller();
            break;

    }
}

SceneFaceRecogDuplicate.prototype.enableButton = function(){
    alert("SceneFaceRecogDuplicate.enableButton() ");
	
    this.OkBtn.SetFlagDim(false);

    this.flagWaiting = false;
}

SceneFaceRecogDuplicate.prototype.disableButton = function(){
    alert("SceneFaceRecogDuplicate.disableButton() ");
	/*if(this.CloseTimer == true)
	{
		this.stopTimer();
	}*/
	
    this.flagWaiting = true;

    var currentHighlight =  this.MainView.getCurrentHighlight();
    currentHighlight.blur();
    
    this.OkBtn.SetFlagDim(true); 
}

SceneFaceRecogDuplicate.prototype.processReturnKey = function(){
    alert("SceneFaceRecogDuplicate.processReturnKey() ");
 	if(this.flagWaiting ==true)
    {
        return;
    }
  
     //DF140119-00100
        	ProcMgr.RetryFaceRecogRegistration();
			// ProcMgr.ReturnToFaceRecogRegistrationCaller();
}

SceneFaceRecogDuplicate.prototype.popupTimerCallback = function()
{
    alert("SceneFaceRecogDuplicate.popupTimerCallback() ");
	
	/*if (this.CloseTimer == false)
	{
		return;
	}
	this.CloseTimer = false;	*/
		
//DF140119-00100
        	ProcMgr.RetryFaceRecogRegistration();
			// ProcMgr.ReturnToFaceRecogRegistrationCaller();
}

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

