
function SceneAddAssignedPhoneLabelSeletor(options) {

	this.options = options;	
	
	this.ListView	= null;
	this.ListPopupView = null;
	this.ListViewDim = null;
	
	this.MobileBtn = null;
	this.OfficeBtn = null;
	this.HomeBtn = null;
	this.OtherBtn = null;

	this.CurIndex	= -1;
	this.ListState = null;
	//this.AssignedLabelType = null;
	
	this.Callback = null;
}

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

SceneAddAssignedPhoneLabelSeletor.prototype.handleShow = function () {
	alert("SceneAddAssignedPhoneLabelSeletor.handleShow()");

	this.ListViewDim.show();
}

SceneAddAssignedPhoneLabelSeletor.prototype.handleHide = function () {
	alert("SceneAddAssignedPhoneLabelSeletor.handleHide()");
	
	this.ListViewDim.hide();

}

SceneAddAssignedPhoneLabelSeletor.prototype.handleFocus = function () {
	alert("SceneAddAssignedPhoneLabelSeletor.handleFocus()");

	if(	!(this.ListState) ) {
			this.ListState = this.MobileBtn;
		}

	if(this.ListView.getCurrentHighlight() != this.ListState){
		this.ListView.setCurrenHighlight(this.ListState);	
	}
	else {		
		this.highlight(this.ListState);
	}
	
}

SceneAddAssignedPhoneLabelSeletor.prototype.handleBlur = function () {
	alert("SceneAddAssignedPhoneLabelSeletor.handleBlur()");
	
//	this.list.blur();
	this.highlight(null);
}

SceneAddAssignedPhoneLabelSeletor.prototype.handleKeyDown = function (keyCode) {
	
	alert("SceneAddAssignedPhoneLabelSeletor.handleKeyDown(" + keyCode + ")");
PluginAPIMgr.PlayAudio(keyCode);
if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	switch(keyCode){
    
		case sf.key.UP:
			WndMgr.resetPopupHideTimer();
			this.processUpKey();
			break;
		case sf.key.DOWN:
			WndMgr.resetPopupHideTimer();
			this.processDownKey();
			break;

		case sf.key.ENTER:
			alert("KEY_ENTER");
			this.ProcessKeyEnter();
			break;			
                   
		case sf.key.RETURN:
			alert("KEY_RETURN");
			this.ResetCallerSceneTimer();
			this.ProcessKeyReturn();
			sf.key.preventDefault();
			break;
			
		case sf.key.EXIT:
			sf.key.preventDefault();
			break;	
			
        case 147:  //infolink
        case 261:  //contents
        case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
			
		default :
			if(keyCode == sf.key.DOWN || keyCode == sf.key.UP)
			{
				this.ResetCallerSceneTimer();	
			}
			
//			this.list.KeyProcess(keyCode);	
			break;	
		                   
    }
	
}

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

SceneAddAssignedPhoneLabelSeletor.prototype.create = function(){
    alert("SceneAddAssignedPhoneLabelSeletor.create() ");

    this.ListView = new View("AddAssignedPhoneLabelSeletor");

    this.ListPopupView = new View("LabelList_popup_Bg");
    this.ListPopupView.CreatePopupBG(2,"LabelList_popup_Bg");

	this.ListViewDim = new DimBg("AddAssignedPhoneLabelSeletorDim", "AddAssignedPhoneLabelSeletor"); 

	var this_ = sf.scene.get("AddAssignedPhoneLabelSeletor");
	var clickCF = function(obj) {
		this_.processClickEvent(obj);
	};

	this.MobileBtn = new Button();
	this.MobileBtn.SetImageObjId("LabelList_mobile_btn", 30);
	this.MobileBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.MobileBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.MobileBtn.SetTextObjId("LabelList_mobile_btn_text");
	this.MobileBtn.SetText(IDWS_MOIP_MOBILE);
	this.MobileBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.MobileBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.MobileBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.MobileBtn.SetOnClickCallbackFunc(clickCF);

	this.OfficeBtn = new Button();
	this.OfficeBtn.SetImageObjId("LabelList_office_btn", 30);
	this.OfficeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.OfficeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.OfficeBtn.SetTextObjId("LabelList_office_btn_text");
	this.OfficeBtn.SetText(IDWS_MOIP_OFFICE);
	this.OfficeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.OfficeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.OfficeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.OfficeBtn.SetOnClickCallbackFunc(clickCF);

	this.HomeBtn = new Button();
	this.HomeBtn.SetImageObjId("LabelList_home_btn", 30);
	this.HomeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.HomeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.HomeBtn.SetTextObjId("LabelList_home_btn_text");
	this.HomeBtn.SetText(SID_HOME_KR_HOMEPHONE);
	this.HomeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.HomeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.HomeBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.HomeBtn.SetOnClickCallbackFunc(clickCF);

	this.OtherBtn = new Button();
	this.OtherBtn.SetImageObjId("LabelList_other_btn", 30);
	this.OtherBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.OtherBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.OtherBtn.SetTextObjId("LabelList_other_btn_text");
	this.OtherBtn.SetText(SID_COUNTRY_OTHER);
	this.OtherBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.OtherBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.OtherBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.OtherBtn.SetOnClickCallbackFunc(clickCF);
				
	this.MobileBtn.SetOnMouseOverCallbackFunc(function(obj) {this_.processMouseOver(obj);});
	this.OfficeBtn.SetOnMouseOverCallbackFunc(function(obj) {this_.processMouseOver(obj);});
	this.HomeBtn.SetOnMouseOverCallbackFunc(function(obj) {this_.processMouseOver(obj);});
	this.OtherBtn.SetOnMouseOverCallbackFunc(function(obj) {this_.processMouseOver(obj);});
}

SceneAddAssignedPhoneLabelSeletor.prototype.Init = function(LableType,CallbackFunc)
{
	alert("SceneAddAssignedPhoneLabelSeletor.Init()");
	
	this.CurIndex = LableType;
	this.Callback = CallbackFunc;
}


SceneAddAssignedPhoneLabelSeletor.prototype.highlight = function(obj) {
	this.ListView.setCurrenHighlight(obj);
}

SceneAddAssignedPhoneLabelSeletor.prototype.processUpKey = function() {
	alert("SceneOnlineStatus.processUpKey() ");

	var currentHighlight = this.ListView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.MobileBtn:
			this.ListState = this.OtherBtn;
			break;

		case this.OfficeBtn:
			this.ListState = this.MobileBtn;
			break;

		case this.HomeBtn:
			this.ListState = this.OfficeBtn;
			break;

		case this.OtherBtn:
			this.ListState = this.HomeBtn;
			break;
	}
	this.highlight(this.ListState);
}

SceneAddAssignedPhoneLabelSeletor.prototype.processDownKey = function() {
	alert("SceneOnlineStatus.processDownKey() ");

	var currentHighlight = this.ListView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.MobileBtn:
			this.ListState = this.OfficeBtn;
			break;

		case this.OfficeBtn:
			this.ListState = this.HomeBtn;
			break;

		case this.HomeBtn:
			this.ListState = this.OtherBtn;
			break;

		case this.OtherBtn:
			this.ListState = this.MobileBtn;
			break;
	}
	this.highlight(this.ListState);
}

SceneAddAssignedPhoneLabelSeletor.prototype.ProcessKeyReturn = function(){
	alert("SceneAddAssignedPhoneLabelSeletor.ProcessKeyReturn() ");
	
	sf.scene.focus('AddAssignedPhoneNumber');
	sf.scene.hide('AddAssignedPhoneLabelSeletor');
}


SceneAddAssignedPhoneLabelSeletor.prototype.ProcessKeyEnter = function(){
	alert("SceneAddAssignedPhoneLabelSeletor.ProcessKeyEnter() ");

	this.ResetCallerSceneTimer();
	if(this.MobileBtn.flagHighlight() == true)
		this.ProcessCallback(0);
	else if(this.OfficeBtn.flagHighlight() == true)
		this.ProcessCallback(1);
	else if(this.HomeBtn.flagHighlight() == true)
		this.ProcessCallback(2);
	else if(this.OtherBtn.flagHighlight() == true)
		this.ProcessCallback(3);
	else
		this.ProcessCallback(3);
}


SceneAddAssignedPhoneLabelSeletor.prototype.ResetCallerSceneTimer = function()
{
	alert("SceneAddAssignedPhoneLabelSeletor.ResetCallerSceneTimer() ");	
//	sf.scene.get("AddAssignedPhoneNumber").resetTimer(); // Test jason 
	WndMgr.resetPopupHideTimer(); // stopPopupHideTimer
}

SceneAddAssignedPhoneLabelSeletor.prototype.ProcessCallback = function(ItemIndex){

	alert("SceneAddAssignedPhoneLabelSeletor.ProcessCallback() -- " + ItemIndex);	
	
	if(this.Callback)
	{
		this.Callback(ItemIndex);
	}
	
	this.ProcessKeyReturn();

}

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

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

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

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

	this.ProcessKeyEnter();
}

SceneAddAssignedPhoneLabelSeletor.prototype.onClickEventFunc1 = function(){
	
	var This_ = sf.scene.get("AddAssignedPhoneLabelSeletor");	
	This_.ProcessCallback(0);
}

SceneAddAssignedPhoneLabelSeletor.prototype.onClickEventFunc2 = function(){

	var This_ = sf.scene.get("AddAssignedPhoneLabelSeletor");	
	This_.ProcessCallback(1);
}

SceneAddAssignedPhoneLabelSeletor.prototype.onClickEventFunc3 = function(){
	
	var This_ = sf.scene.get("AddAssignedPhoneLabelSeletor");	
	This_.ProcessCallback(2);
}

SceneAddAssignedPhoneLabelSeletor.prototype.onClickEventFunc4 = function(){
	
	var This_ = sf.scene.get("AddAssignedPhoneLabelSeletor");	
	This_.ProcessCallback(3);
}

