

function SceneRemoveContact(options) {
	
	this.options = options;
	
	this.RemoveIdentityName = null;
	this.RemoveDisplayName = null;

			
	this.RemoveContactView = null;
	this.RemoveContactPopupView = null;
	this.RemoveContactDim=null;
	
	this.BodyMsg	= null;
	
	this.OkBtn 		= null;
	this.CancelBtn = null;
	
}

SceneRemoveContact.prototype.initialize = function () {
	alert("SceneRemoveContact.initialize()");
	this.create();

}

SceneRemoveContact.prototype.handleShow = function () {
	alert("SceneRemoveContact.handleShow()");
	this.RemoveContactDim.show();			
	this.ResetPopup();

	WndMgr.startPopupHideTimer(30000); 
}

SceneRemoveContact.prototype.handleHide = function () {
	alert("SceneRemoveContact.handleHide()");
	this.RemoveContactDim.hide();
	this.highlight(null);
	
	WndMgr.stopPopupHideTimer();
}

SceneRemoveContact.prototype.handleFocus = function () {
	alert("SceneRemoveContact.handleFocus()");
	
    var currentHighlight =  this.RemoveContactView.getCurrentHighlight();

    if(currentHighlight == null)
    {
        this.highlight(this.CancelBtn);
    }
    else
    {
         this.highlight(currentHighlight);
    }
	
}

SceneRemoveContact.prototype.handleBlur = function () {
	alert("SceneRemoveContact.handleBlur()");

    var currentHighlight =  this.RemoveContactView.getCurrentHighlight();

    if(currentHighlight)
    {
        currentHighlight.blur();
    }
	
}

SceneRemoveContact.prototype.handleKeyDown = function (keyCode) {
	alert("SceneRemoveContact.handleKeyDown(" + keyCode + ")");
	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	
	switch (keyCode) {
		case sf.key.LEFT:
		case sf.key.RIGHT:
			WndMgr.resetPopupHideTimer();
			this.processLEFTKey();
			break;
					
		case sf.key.ENTER:
			this.processEnterKey();
			break;
		
		case sf.key.RETURN:
		case sf.key.EXIT:
			sf.key.preventDefault();
			StateMgr.Stop_Remove_Contact_State(true);
			break;

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

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

SceneRemoveContact.prototype.create = function(){
    alert("SceneRemoveContact.create()");
	
    this.RemoveContactView = new View("RemoveContact");

    this.RemoveContactPopupView = new View("RemoveContactBg");
    this.RemoveContactPopupView.CreatePopupBG(1,"RemoveContactBg");
	
	this.RemoveContactDim = new DimBg("RemoveContactDim", "RemoveContact");      

    this.BodyMsg = new Label(null,"RemoveContact_Msg");	
    this.BodyMsg.SetIsPlainText(true);

	var This_ = sf.scene.get('RemoveContact');
	var clickCF = function(obj) {
		This_.processClickEvent(obj);
	};

    this.OkBtn = new ButtonBase();
    this.OkBtn.Create("RemoveContact_OkButton",BUTTON_BASE_TYPE.BG_TEXT, 20);
    this.OkBtn.SetBgImage(BUTTON_BASE_STATE.NORMAL, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.OkBtn.SetBgImage(BUTTON_BASE_STATE.HIGHLIGHT, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
 	this.OkBtn.SetTextStyle(BUTTON_BASE_STATE.NORMAL,"cPopup_btn_text_high");
    this.OkBtn.SetText(SID_YES);
    this.OkBtn.SetOnClickCallbackFunc(clickCF);    
 
	this.CancelBtn = new ButtonBase();
    this.CancelBtn.Create("RemoveContact_CancelButton",BUTTON_BASE_TYPE.BG_TEXT, 20);
    this.CancelBtn.SetBgImage(BUTTON_BASE_STATE.NORMAL, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.CancelBtn.SetBgImage(BUTTON_BASE_STATE.HIGHLIGHT, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
	this.CancelBtn.SetTextStyle(BUTTON_BASE_STATE.NORMAL,"cPopup_btn_text_high");
    this.CancelBtn.SetText(SID_NO);
	this.CancelBtn.SetOnClickCallbackFunc(clickCF);
 
	this.OkBtn.SetOnMouseOverCallbackFunc(function(obj) {This_.processMouseOver(obj);});
	this.CancelBtn.SetOnMouseOverCallbackFunc(function(obj) {This_.processMouseOver(obj);});
 
}

SceneRemoveContact.prototype.highlight=function(obj)
{
	alert("SceneRemoveContact.highlight()");
	
    this.RemoveContactView.setCurrenHighlight(obj);
	
}

SceneRemoveContact.prototype.ResetPopup = function(){
	alert("SceneRemoveContact.ResetPopup() ");
	
	//TEMPCODE
	var finalName;
	
	if(this.RemoveDisplayName.length > 15){
		
		finalName = this.RemoveDisplayName.slice(0,14) + '...';
	}
	else{
		finalName = this.RemoveDisplayName;
	}
	
	var BodyText = g_Data.CombinateStrings(TV_SID_MIX_REMOVE_FROM_CONTACTS,finalName);
		
	this.BodyMsg.SetText(BodyText);	
	
}


SceneRemoveContact.prototype.processEnterKey = function(){
    alert("SceneRemoveContact.processEnterKey() ");

    var currentHighlight =  this.RemoveContactView.getCurrentHighlight();
    
    switch(currentHighlight)
    {
        case this.OkBtn:
			this.ClickOkBtn();
            break;
            
        case this.CancelBtn:
			this.ClickCancelBtn();
            break;		
    }

}

SceneRemoveContact.prototype.processLEFTKey = function(){
    alert("SceneRemoveContact.processLEFTKey() ");

    var currentHighlight =  this.RemoveContactView.getCurrentHighlight();
    
    switch(currentHighlight)
    {
        case this.OkBtn:
            this.highlight(this.CancelBtn);
            break;
            
        case this.CancelBtn:
            this.highlight(this.OkBtn);
            break;
    }
    
}

SceneRemoveContact.prototype.Init = function(Identity,Display){
    
	this.RemoveIdentityName = Identity;
	this.RemoveDisplayName = Display;

}

SceneRemoveContact.prototype.processClickEvent = function(obj) {
	alert("SceneRemoveContact.processClickEvent() ");

	var currentHighlight = this.RemoveContactView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}

	this.processEnterKey();
}

SceneRemoveContact.prototype.processMouseOver = function(obj) {
    alert("SceneRemoveContact.processMouseOver() " + obj);

	var currentHighlight = this.RemoveContactView.getCurrentHighlight();
	if(currentHighlight != obj) {
		WndMgr.resetPopupHideTimer();
		this.highlight(obj);
	}
}

SceneRemoveContact.prototype.ClickOkBtn = function(){

	var This_ = sf.scene.get('RemoveContact');
	
	WndMgr.NextStepRemoveContact(This_.RemoveIdentityName, This_.RemoveDisplayName);	
	PluginAPIMgr.RemoveContact(This_.RemoveIdentityName);
}

SceneRemoveContact.prototype.ClickCancelBtn = function(){

	StateMgr.Stop_Remove_Contact_State(true);
}
