/**
 * wriiten by minseok.ko
 */
function SceneListMainCall(options) {
	this.options = options;

	this.ListMainCallView = null;

	this.CountryCodeBtn = null;
	this.CountryPrefixLabel = null;
	this.CountryNameLabel = null;
	this.CountryCode = "";
	this.CountryPrefix = "";

	this.PhoneNumberInputBox = null;

	this.CallBtn = null;
	this.ArrowLabel = null;

	this.Number1Btn = null;
	this.Number2Btn = null;
	this.Number3Btn = null;
	this.Number4Btn = null;
	this.Number5Btn = null;
	this.Number6Btn = null;
	this.Number7Btn = null;
	this.Number8Btn = null;
	this.Number9Btn = null;
	this.Number0Btn = null;
	this.StarBtn = null;
	this.SharpBtn = null;

	//2013 add by minseok
	this.KeypadFlag = false;
	this.CurrentKeypadInx = 0;
	this.HilightTimer = null;
	this.HelpBarData = null;

	this.NumBtnList = new Array(12);
	this.SelectTimer = null;

	this.ShownPhoneNumberList = false;
	this.ShownFlagList = false;

	// this.DefaultHelpBar = null;
	// this.InputHelpBar = null;
	// this.InputPlusHelpBar = null;
	// this.ListHelpBar = null;
	// this.CountryListHelpBar = null;

	this.destroyFlag = true;

	this.flagCallBtnEnable = true;
	this.flagPlusBtnEnable = true;

	this.isEmergencyCall = false;

	this.FlagFocus = false;

	this.isCountryHelpBarInsertClickEvent = false;

	//2013 add by minseok
	this.selectObj = null;
	this.IsShownObj = false;
	this.timeId = null;
}

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

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

	this.initListMainCall();
	
	var ThisScene = sf.scene.get("ListMainCall");
	sf.scene.get("CountryFlagList").Init(FLAG_LIST_TYPE.LIST_MAIN_CALL, 'ListMainCall', ThisScene.SetCountryFlag, ThisScene.ShowCountryBtn);
	this.IsShownObj = true;

}

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

	if(this.ShownPhoneNumberList == true) {

		sf.scene.hide('ListMainCallPhoneNumberList');
		// this.ListHelpBar.hiddenObj();
		this.ShownPhoneNumberList = false;
	}

	if(this.ShownFlagList == true) {

		sf.scene.hide('CountryFlagList');
		// this.CountryListHelpBar.hiddenObj();
		this.ShownFlagList = false;
	}
	this.IsShownObj = false;
	this.resetKeyPadIndex();
	this.setKeypadFlag(false);
}

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

	this.FlagFocus = true;
	

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight == null) {
		this.highlight(this.PhoneNumberInputBox);
	} else {
		this.highlight(currentHighlight);
	}
	HelpBar.changeHelpBarItems(this.HelpBarData);
	//TEMPCODE:
	this.ShownFlagList = false;
}

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

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight != null) {
		currentHighlight.blur();
	}
}

SceneListMainCall.prototype.handleKeyDown = function(keyCode) {
	alert("SceneListMainCall.handleKeyDown(" + keyCode + ")");
	// TODO : write an key event handler when this scene get focued
	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	if(this.timerId!=null){
		clearTimeout(this.timerId);
	}

	switch (keyCode) {
		case sf.key.N1:
	    case sf.key.N2:
	    case sf.key.N3:
	    case sf.key.N4:
	    case sf.key.N5:
	    case sf.key.N6:
	    case sf.key.N7:
	    case sf.key.N8:
	    case sf.key.N9:
	    case sf.key.N0:
		case 35:
		//plus100
		case 650:
		//TTXMIX
		case 259:
			//prech
			if(this.getKeypadFlag()) {
				// this.highlightKeypad(keyCode);
				this.processNumberKey(keyCode);
			}
			// this.PhoneNumberInputBox.keydown();
	    	break;
		case sf.key.STOP:
			if(event instanceof KeyboardEvent){	//if press remote controller
				ProcMgr.processBlockKey(keyCode);
			}else{			//mouse event
				if(this.getKeypadFlag()) {
					// this.highlightKeypad(keyCode);
					this.processNumberKey(650);
				}
			}
			break;
		case sf.key.PLAY:
			if(event instanceof KeyboardEvent){	//if press remote controller
				ProcMgr.processBlockKey(keyCode);
			}else{
				if(this.getKeypadFlag()) {
					// this.highlightKeypad(keyCode);
					this.processNumberKey(259);
				}
			}
			break;
		case sf.key.LEFT:
			this.processLeftKey();
			break;
		case sf.key.RIGHT:
			this.processRightKey();
			break;
		case sf.key.UP:
			this.processUpKey();
			break;
		case sf.key.DOWN:
			this.processDownKey();
			break;

		case sf.key.ENTER:
			this.processEnterKey();
			break;

		case sf.key.RETURN:
			this.processReturnKey();
			//2013 modify by minseok
			sf.key.preventDefault();
			// sf.key.block(event);
			break;

		case sf.key.RED:
			this.processRedKey();
			break;

		case sf.key.EXIT:
			this.processExitKey();
			//2013 modify by minseok
			sf.key.preventDefault();
			// sf.key.block(event);
			break;

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

SceneListMainCall.prototype.create = function() {
	alert("SceneListMainCall.create()");
	this.ListMainCallView = new View("ListMainCall");

	var this_ = sf.scene.get('ListMainCall');
	var clickCF = function(obj) {
		this_.processClickEvent(obj);
	};
	var overCF =  function(obj){this_.processMouseOverEvent(obj);};
	this.CountryCodeBtn = new Button();
	this.CountryCodeBtn.SetImageObjId("list_main_call_country_code_btn", 24);
	this.CountryCodeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_LIST_MAIN_CALL_COUNTRY_CODE_BTN_NORMAL);
	this.CountryCodeBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_MAIN_CALL_COUNTRY_CODE_BTN_NORMALFOCUS);
	this.CountryCodeBtn.AppendFgImage("list_main_call_country_code_btn_icon", "-8px", "8px", "42px", "26px");
	this.CountryCodeBtn.SetOnClickCallbackFunc(clickCF);
	this.CountryCodeBtn.SetOnMouseOverCallbackFunc(overCF);

	this.ArrowLabel = new Label("list_main_call_country_code_btn_down_arrow",null);
	this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);
	
	this.CountryPrefixLabel = new Label(null, "list_main_call_country_prefix");
	this.CountryPrefixLabel.SetTextStyle("list_main_call_country_prefix_style");
	this.CountryPrefixLabel.SetReverseDisable(true);

	this.CountryNameLabel = new Label(null, "list_main_call_country_name");
	this.CountryNameLabel.SetTextStyle("list_main_call_country_name_style");

	this.PhoneNumberInputBox = new NumberInputBox();
	this.PhoneNumberInputBox.SetButtonObjId("list_main_call_phone_number_input_box", 30);
	this.PhoneNumberInputBox.SetButtonTextObjId("list_main_call_phone_number_input_text");
	this.PhoneNumberInputBox.SetInputBoxObjId("list_main_call_phone_number_input_text_editor");
	this.PhoneNumberInputBox.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_LIST_MAIN_CALL_INPUTBOX_NORMAL);
	this.PhoneNumberInputBox.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_MAIN_CALL_INPUTBOX_NORMALFOCUS);
	var scene = sf.scene.get("ListMainCall");
	this.PhoneNumberInputBox.setPrevEventOnLeftFunc(function() {
		sf.key.preventDefault();
		scene.moveToCountryCodeBtn()
	});
	this.PhoneNumberInputBox.setPrevEventOnRightFunc(function() {
		if(scene.flagCallBtnEnable == true) {
			scene.moveToCallBtn()
		}
	});
	this.PhoneNumberInputBox.setPrevEventOnDownFunc(function() {/*scene.moveToPhoneNumberList()*/
		scene.moveToKeypad();
		sf.key.preventDefault();
	});
	this.PhoneNumberInputBox.setPrevEventOnReturnFunc(function() {
		sf.key.preventDefault();
		scene.processReturnKey();
	});
	this.PhoneNumberInputBox.setPrevEventOnExitFunc(function() {
		sf.key.preventDefault();
		/*$.sf.returnFocus();*/
		scene.processExitKey();
	});
	this.PhoneNumberInputBox.setAnyKeyFunc(function(keyCode) {
		scene.callbackPhoneNumberInput(keyCode)
	});
	this.PhoneNumberInputBox.setEnterFunc(function() {
		scene.processEnterKey()
	});
	this.PhoneNumberInputBox.setPrevEventOnInfolinkFunc(function() {
		ProcMgr.processInfolinkKey();
	});
	this.PhoneNumberInputBox.setPrevEventOnBlockFunc(function(keyCode) {
		ProcMgr.processBlockKey(keyCode);
	});
	this.PhoneNumberInputBox.setPrevEventOnRedFunc(function() {
		scene.processRedKey();
		/*$.sf.returnFocus();*/
	});
/*
	this.PhoneNumberInputBox.setPrevEventOnBlueFunc(function(keyCode) {
		ProcMgr.processBlockKey(keyCode);
	});*/

	this.PhoneNumberInputBox.SetOnClickCallbackFunc(clickCF);
	this.PhoneNumberInputBox.SetOnMouseOverCallbackFunc(overCF);
	this.PhoneNumberInputBox.SetReverseDisable(true);
	this.PhoneNumberInputBox.setCommonKeyPadMode(false);

	this.CallBtn = new Button();
	this.CallBtn.SetImageObjId("list_main_call_start_call_btn", 24);
	this.CallBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_LIST_MAIN_CALL_START_CALL_BTN_NORMAL);
	this.CallBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_MAIN_CALL_START_CALL_BTN_NORMALFOCUS);
	this.CallBtn.SetBgImage(BtnImgIndex.BTN_DIM_IMG, g_Image.IMAGE_LIST_MAIN_CALL_START_CALL_BTN_DIM);
	this.CallBtn.SetTextObjId("list_main_call_start_call_btn_text");
	this.CallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_main_call_btn_text_style");
	this.CallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_main_call_btn_text_focus_style");
	this.CallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_main_call_btn_text_dim_style");
	this.CallBtn.SetText(SID_CALL);
	this.CallBtn.SetOnClickCallbackFunc(clickCF);
	this.CallBtn.SetOnMouseOverCallbackFunc(overCF);

	///// number key pad //////////////////////////////////////////////////////////////////////////////////////////////////////

	//2013 modify by minseok

	// this.Number1Btn = new Label("list_main_call_number_1_btn", "list_main_call_number_1_btn_text");
	this.Number1Btn = new Button();
	this.Number1Btn.SetImageObjId("list_main_call_number_1_btn");
	this.Number1Btn.SetTextObjId("list_main_call_number_1_btn_text");
	this.Number1Btn.SetText("1");

	// this.Number2Btn = new Label("list_main_call_number_2_btn", "list_main_call_number_2_btn_text");
	this.Number2Btn = new Button();
	this.Number2Btn.SetImageObjId("list_main_call_number_2_btn");
	this.Number2Btn.SetTextObjId("list_main_call_number_2_btn_text");
	this.Number2Btn.SetText("2");

	// this.Number3Btn = new Label("list_main_call_number_3_btn", "list_main_call_number_3_btn_text");
	this.Number3Btn = new Button();
	this.Number3Btn.SetImageObjId("list_main_call_number_3_btn");
	this.Number3Btn.SetTextObjId("list_main_call_number_3_btn_text");
	this.Number3Btn.SetText("3");

	// this.Number4Btn = new Label("list_main_call_number_4_btn", "list_main_call_number_4_btn_text");
	this.Number4Btn = new Button();
	this.Number4Btn.SetImageObjId("list_main_call_number_4_btn");
	this.Number4Btn.SetTextObjId("list_main_call_number_4_btn_text");
	this.Number4Btn.SetText("4");

	// this.Number5Btn = new Label("list_main_call_number_5_btn", "list_main_call_number_5_btn_text");
	this.Number5Btn = new Button();
	this.Number5Btn.SetImageObjId("list_main_call_number_5_btn");
	this.Number5Btn.SetTextObjId("list_main_call_number_5_btn_text");
	this.Number5Btn.SetText("5");

	// this.Number6Btn = new Label("list_main_call_number_6_btn", "list_main_call_number_6_btn_text");
	this.Number6Btn = new Button();
	this.Number6Btn.SetImageObjId("list_main_call_number_6_btn");
	this.Number6Btn.SetTextObjId("list_main_call_number_6_btn_text");
	this.Number6Btn.SetText("6");

	// this.Number7Btn = new Label("list_main_call_number_7_btn", "list_main_call_number_7_btn_text");
	this.Number7Btn = new Button();
	this.Number7Btn.SetImageObjId("list_main_call_number_7_btn");
	this.Number7Btn.SetTextObjId("list_main_call_number_7_btn_text");
	this.Number7Btn.SetText("7");

	// this.Number8Btn = new Label("list_main_call_number_8_btn", "list_main_call_number_8_btn_text");
	this.Number8Btn = new Button();
	this.Number8Btn.SetImageObjId("list_main_call_number_8_btn");
	this.Number8Btn.SetTextObjId("list_main_call_number_8_btn_text");
	this.Number8Btn.SetText("8");

	// this.Number9Btn = new Label("list_main_call_number_9_btn", "list_main_call_number_9_btn_text");
	this.Number9Btn = new Button();
	this.Number9Btn.SetImageObjId("list_main_call_number_9_btn");
	this.Number9Btn.SetTextObjId("list_main_call_number_9_btn_text");
	this.Number9Btn.SetText("9");

	// this.StarBtn = new Label("list_main_call_star_btn", "list_main_call_star_btn_text");
	this.StarBtn = new Button();
	this.StarBtn.SetImageObjId("list_main_call_star_btn");
	this.StarBtn.SetTextObjId("list_main_call_star_btn_text");
	this.StarBtn.SetText("+");

	// this.Number0Btn = new Label("list_main_call_number_0_btn", "list_main_call_number_0_btn_text");
	this.Number0Btn = new Button();
	this.Number0Btn.SetImageObjId("list_main_call_number_0_btn");
	this.Number0Btn.SetTextObjId("list_main_call_number_0_btn_text");
	this.Number0Btn.SetText("0");

	// this.SharpBtn = new Label("list_main_call_sharp_btn", "list_main_call_sharp_btn_text");
	this.SharpBtn = new Button();
	this.SharpBtn.SetImageObjId("list_main_call_sharp_btn");
	this.SharpBtn.SetTextObjId("list_main_call_sharp_btn_text");
	this.SharpBtn.SetText("Del");

	var a = 0;
	for( a = 0; a < this.NumBtnList.length; a++) {
		this.NumBtnList[a] = new Object();
	}

	this.NumBtnList[0].obj = this.Number1Btn;
	this.NumBtnList[1].obj = this.Number2Btn;
	this.NumBtnList[2].obj = this.Number3Btn;
	this.NumBtnList[3].obj = this.Number4Btn;
	this.NumBtnList[4].obj = this.Number5Btn;
	this.NumBtnList[5].obj = this.Number6Btn;
	this.NumBtnList[6].obj = this.Number7Btn;
	this.NumBtnList[7].obj = this.Number8Btn;
	this.NumBtnList[8].obj = this.Number9Btn;
	this.NumBtnList[9].obj = this.StarBtn;
	this.NumBtnList[10].obj = this.Number0Btn;
	this.NumBtnList[11].obj = this.SharpBtn;

	for( a = 0; a < this.NumBtnList.length; a++) {
		// this.NumBtnList[a].obj.SetBgImage( g_Image.IMAGE_LIST_MAIN_CALL_NUMBER_KEY_PAD_NORMAL);
		// this.NumBtnList[a].obj.SetTextStyle("list_main_call_number_btn_text_style");
		// this.NumBtnList[a].obj.isSelected = false;

		this.NumBtnList[a].obj.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_LIST_MAIN_CALL_NUMBER_KEY_PAD_NORMAL);
		this.NumBtnList[a].obj.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_MAIN_CALL_NUMBER_KEY_PAD_SELECTED);
		this.NumBtnList[a].obj.SetBgImage(BtnImgIndex.BTN_SELECTED_IMG, g_Image.IMAGE_LIST_MAIN_CALL_NUMBER_KEY_PAD_PRESS);
		this.NumBtnList[a].obj.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_main_call_number_btn_text_style");
		this.NumBtnList[a].obj.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_main_call_number_btn_text_select_style");
		this.NumBtnList[a].obj.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_SELECTED_STYLE, "list_main_call_number_btn_text_style");
		this.NumBtnList[a].obj.isSelected = false;

	}

	//helpbar
	this.HelpBarData = {
		'red': IDWS_MOIP_POPUP_EXIT_SIGN_OUT,
		'return' : SID_RETURN
	};

	// for processing mouse click event
	this.NumBtnList[0].key = sf.key.N1;
	this.NumBtnList[1].key = sf.key.N2;
	this.NumBtnList[2].key = sf.key.N3;
	this.NumBtnList[3].key = sf.key.N4;
	this.NumBtnList[4].key = sf.key.N5;
	this.NumBtnList[5].key = sf.key.N6;
	this.NumBtnList[6].key = sf.key.N7;
	this.NumBtnList[7].key = sf.key.N8;
	this.NumBtnList[8].key = sf.key.N9;
	if(ProcMgr.isTTXMIX == false) {
		this.NumBtnList[9].key = 35;
		//plus100
	} else {
		this.NumBtnList[9].key = 650;
		// TTXMIX
	}
	this.NumBtnList[10].key = sf.key.N0;
	this.NumBtnList[11].key = 259;
	//sf.key.PRECH:

	var keypadClickCF = function(obj) {
		this_.processKeyPadClickEvent(obj);
	};
	var keypadMouseOverCF = function(obj) {
		this_.processKeyPadMouseOverEvent(obj);
	};
	for( a = 0; a < this.NumBtnList.length; a++) {
		this.NumBtnList[a].obj.SetOnClickCallbackFunc(keypadClickCF);
		this.NumBtnList[a].obj.SetOnMouseOverCallbackFunc(keypadMouseOverCF);
	}

}

SceneListMainCall.prototype.initListMainCall = function() {
	alert("SceneListMainCall.initListMainCall()");

	this.CountryCodeBtn.SetFgImage(PluginAPIMgr.GetMyCountryFlag());
	/************************for testing on sdk*****************************/
	// var path = g_Image.base_flag_image_path + "kr.png";
	// this.CountryCodeBtn.SetFgImage(path);
	// var CountryName = "Korea, South";
	// this.CountryPrefix ="82";
	/*********************************************************************/	
	this.CountryNameLabel.SetText(PluginAPIMgr.GetMyCountryName());
	var CountryName =PluginAPIMgr.GetMyCountryName();
	this.CountryCode =PluginAPIMgr.GetMyCountryCode() ;
	this.CountryPrefix =PluginAPIMgr.GetMyCountryPrefix();
	
	
	//this.CountryNameLabel.SetText("Korea, South");
//	this.CountryPrefix ="82";
	if(this.CountryPrefix.length > 0 && this.CountryPrefix != "0") {
		// this.CountryPrefixLabel.SetText("+" + this.CountryPrefix);
		this.CountryNameLabel.SetText("+"+this.CountryPrefix + "<br>" + CountryName);
	} else {
		this.CountryNameLabel.SetText(CountryName);
		this.CountryPrefixLabel.SetText("");
	}

	this.PhoneNumberInputBox.setInitString("");
	this.ShownPhoneNumberList = false;
	this.highlight(null);

	this.setCallBtnEnable(false);
	this.isEmergencyCall = false;

}
SceneListMainCall.prototype.ChangeHelpbar = function(type, str){
	if(str){
		this.HelpBarData = str;
	}else{
	if(type=="numberbox_plus"){
		this.HelpBarData = {
			'ff' : SID_NUMBER,
			'stop' : "+",
			'red': IDWS_MOIP_POPUP_EXIT_SIGN_OUT,		
			'return' : SID_RETURN
		}
	}else if(type=="numberbox_delete"){
		this.HelpBarData = {
			'ff' : SID_NUMBER,
			'play' : SID_DELETE,		
			'red': IDWS_MOIP_POPUP_EXIT_SIGN_OUT,		
			'return' : SID_RETURN
		}
	}else{
		this.HelpBarData = {
			'red': IDWS_MOIP_POPUP_EXIT_SIGN_OUT,		
			'return' : SID_RETURN
		}
	}
	}
	
	HelpBar.changeHelpBarItems(this.HelpBarData);
	
}
SceneListMainCall.prototype.checkHelpbarForInputBox = function(){
	alert("SceneListMainCall.checkHelpbarForInputBox()");
	var posOfCaret = this.PhoneNumberInputBox.GetPosOfCaret();
	var bufferText = this.PhoneNumberInputBox.m_BufferText;
	if(posOfCaret==0){		//no string '+' : show, delete : hide
		if(bufferText.indexOf("+")!=-1){
			this.ChangeHelpbar("");
			return false;
		}else{
		this.ChangeHelpbar("numberbox_plus");
		}
	}else{						//exist string -> '+' : hide, delete : show						
		this.ChangeHelpbar("numberbox_delete");
	}
	return true;
}


SceneListMainCall.prototype.setDestroyFlag = function(destroy_flag) {
	this.destroyFlag = destroy_flag;
}
SceneListMainCall.prototype.select = function(obj){
	var preHighlight = this.ListMainCallView.getCurrentHighlight();
	// var preSelect = this.ListMainCallView.getCurrentSelected();
	if(preHighlight != null){
		preHighlight.blur();
	}

	this.ListMainCallView.setCurrenHighlightObj(obj);
	if(this.selectObj != null){
		this.selectObj.blur();
	}
	this.selectObj = obj
	if(obj==null){
		return;		
	}
	obj.select();
	
}
SceneListMainCall.prototype.highlight = function(obj) {
	if(this.selectObj != null){
		this.selectObj.blur();
	}
	var preHighlight = this.ListMainCallView.getCurrentHighlight();
	if(obj==this.CountryCodeBtn){
		this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON_HIGHLIGHT);
	}else if(preHighlight==this.CountryCodeBtn){
		this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);
	}
	if(this.getKeypadFlag()) {
		for( a = 0; a < this.NumBtnList.length; a++) {
			this.NumBtnList[a].obj.blur();
		}
	}
	this.ListMainCallView.setCurrenHighlight(obj);

	if(obj != null && preHighlight != null) {
		if(preHighlight.objType == "NUMBERINPUTBOX" && obj.objType != "NUMBERINPUTBOX") {
			this.leaveInputBox();
		}
	}

	if(obj == this.PhoneNumberInputBox) {
		// this.changeHelpbar("numberbox");
		this.checkHelpbarForInputBox();
		// if(this.ShownPhoneNumberList == false) {
			var curString = this.PhoneNumberInputBox.getString();
			sf.scene.get('ListMainCallPhoneNumberList').SetSearchNumber(curString);
			sf.scene.show('ListMainCallPhoneNumberList');
			this.ShownPhoneNumberList = true;
		// }

		this.checkPlusBtnEnable();
	} else {
		if(this.ShownPhoneNumberList == true) {

			var Scene = sf.scene.get('ListMainCallPhoneNumberList');
			if(Scene) {
				var curString = this.PhoneNumberInputBox.getString();
				Scene.ResetListforSearch(curString);
			}

			// sf.scene.hide('ListMainCallPhoneNumberList');
			// this.ShownPhoneNumberList = false;
		}
	}

}

SceneListMainCall.prototype.leaveInputBox = function() {
	alert("SceneListMainCall.leaveInputBox() ");
	this.ChangeHelpbar("");
	sf.scene.focus('ListMainCall');
	sf.scene.returnFocus();
	//$.sf.returnFocus();
}

SceneListMainCall.prototype.processLeftKey = function() {
	alert("SceneListMainCall.processLeftKey() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(this.getKeypadFlag()) {
		alert("moving on keypad... currentbtnindex: " + this.CurrentKeypadInx);
		switch(currentHighlight) {
			case this.Number1Btn:
			case this.Number4Btn:
			case this.Number7Btn:
			case this.StarBtn:
				this.backToMain();		//131014 add
				break;
			default:
				this.CurrentKeypadInx--;
				this.highlight(this.NumBtnList[this.CurrentKeypadInx].obj);
				// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
				break;
		}
	}
	switch(currentHighlight) {
		case this.CountryCodeBtn:
			//change arrow image
			// this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);
			this.backToMain();		//2013 modify by minseok : because keypad flag initialize
			break;

		case this.PhoneNumberInputBox:
			this.moveToCountryCodeBtn();
			break;

		case this.CallBtn:
			this.highlight(this.PhoneNumberInputBox);
			break;
	}
}

SceneListMainCall.prototype.processRightKey = function() {
	alert("SceneListMainCall.processRightKey() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(this.getKeypadFlag()) {
		alert("moving on keypad... currentbtnindex: " + this.CurrentKeypadInx);
		switch(currentHighlight) {
			case this.Number3Btn:
			case this.Number6Btn:
			case this.Number9Btn:
			case this.SharpBtn:
				if(this.flagCallBtnEnable == true) {
					this.moveToCallBtn();
				}else{
				if(sf.scene.get('ListMainCallPhoneNumberList').hasItems()){
					sf.scene.focus('ListMainCallPhoneNumberList');
				}
				}
				break;
			default:
				this.CurrentKeypadInx++;
				this.highlight(this.NumBtnList[this.CurrentKeypadInx].obj);
				// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
				break;
		}
	}

	switch(currentHighlight) {
		case this.CountryCodeBtn:
			//change arrow image
			// this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);
			this.highlight(this.PhoneNumberInputBox);
			break;

		case this.PhoneNumberInputBox:
			if(this.flagCallBtnEnable == true) {
				this.moveToCallBtn();
			}
			// else
			// {
			// this.moveToCountryCodeBtn();
			// }
			break;

	}
}
SceneListMainCall.prototype.processUpKey = function() {
	alert("SceneListMainCall.processUpKey() ");
	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(this.getKeypadFlag()) {
		alert("moving on keypad... currentbtnindex: " + this.CurrentKeypadInx);
		switch(currentHighlight) {
			case this.Number1Btn:
			case this.Number2Btn:
			case this.Number3Btn:
				this.setKeypadFlag(false);
				this.highlight(this.PhoneNumberInputBox);
				break;
			default:
				this.CurrentKeypadInx -= 3;
				this.highlight(this.NumBtnList[this.CurrentKeypadInx].obj);
				// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
				break;
		}
	}
}
SceneListMainCall.prototype.processDownKey = function() {
	alert("SceneListMainCall.processDownKey() ");
	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(this.getKeypadFlag()) {
		alert("moving on keypad... currentbtnindex: " + this.CurrentKeypadInx);
		switch(currentHighlight) {
			case this.StarBtn:
			case this.Number0Btn:
			case this.SharpBtn:
				break;
			case this.PhoneNumberInputBox:
				this.highlight(this.NumBtnList[this.CurrentKeypadInx].obj);
				// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
				break;
			default:
				this.CurrentKeypadInx += 3;
				this.highlight(this.NumBtnList[this.CurrentKeypadInx].obj);
				// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
				break;
		}
	}
}
SceneListMainCall.prototype.processEnterKey = function() {
	alert("SceneListMainCall.processEnterKey() ");
	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	
	switch(currentHighlight) {
		case this.Number1Btn:
		case this.Number2Btn:
		case this.Number3Btn:
		case this.Number4Btn:
		case this.Number5Btn:
		case this.Number6Btn:
		case this.Number7Btn:
		case this.Number8Btn:
		case this.Number9Btn:
		case this.Number0Btn:
		case this.StarBtn:
		case this.SharpBtn:
			this.enterKeypad();
			break;
		case this.CountryCodeBtn:
			this.showFlagList();
			break;

		case this.PhoneNumberInputBox:
			if(this.flagCallBtnEnable == true) {
				this.moveToCallBtn();
			}

			break;

		case this.CallBtn:
			//2013 add by minseok : for multitasking app.
			if(PluginAPIMgr.IsInCall()==1){  // calling
				alert("calling......");
				WndMgr.StartOneBottonPopup(OneBtnPopupIndex.NOT_AVAILABLE_DURING_CALL);
			}else{
				alert("Not calling....");
				var input_phone_number = this.PhoneNumberInputBox.GetText();
			if(input_phone_number.length > 0) {
				if(this.isEmergencyCall == true) {
					WndMgr.StartOneBottonPopup(OneBtnPopupIndex.EMERGENCY_CALL);
					return;
				}

				var add_prefix_phone_number = this.addCountryPrefix(input_phone_number);
				alert("add_prefix_phone_number : " + add_prefix_phone_number);
				var normalized_phone_number = PluginAPIMgr.NormalizeIdentity(add_prefix_phone_number);
				if(normalized_phone_number.length > 0) {
					ProcMgr.CreateCall(normalized_phone_number, 0);
				}
				}
			}
			break;

	}
}

SceneListMainCall.prototype.processReturnKey = function() {
	alert("SceneListMainCall.processReturnKey() ");
	if(this.getKeypadFlag()==false){
		var currentHighlight = this.ListMainCallView.getCurrentHighlight();
		if(currentHighlight==this.CountryCodeBtn){	//back to main from country btn
			this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);	//blur countrybtn -> blur down arrow
		}
	}
	WndMgr.ReturnSubToMainContact();
	
}

SceneListMainCall.prototype.processRedKey = function() {
	alert("SceneListMainCall.processRedKey() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight == this.PhoneNumberInputBox) {
		this.highlight(null);
	}

	StateMgr.Start_Signout_State();

}

SceneListMainCall.prototype.processExitKey = function() {
	alert("SceneListMainCall.processExitKey() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight == this.PhoneNumberInputBox) {
		this.highlight(null);
	}

	StateMgr.Start_Exit_State(false);
}

SceneListMainCall.prototype.ReturnToMain = function(){
    this.backToMain();
}
SceneListMainCall.prototype.backToMain = function(){
	alert("SceneListMainCall.backToMain() ");
	if(this.getKeypadFlag()==false){
		var currentHighlight = this.ListMainCallView.getCurrentHighlight();
		if(currentHighlight==this.CountryCodeBtn){	//back to main from country btn
			this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON);	//blur countrybtn -> blur down arrow
		}
	}
	WndMgr.ReturnSubToMain();
}


SceneListMainCall.prototype.callbackPhoneNumberInput = function(keyCode) {
	alert("SceneListMainCall.callbackPhoneNumberInput() ");

	for( a = 0; a < this.NumBtnList.length; a++) {
		if(this.NumBtnList[a].obj.isSelected == true) {
			this.NumBtnList[a].obj.blur();
			this.NumBtnList[a].obj.isSelected = false;
		}
	}
	if(this.checkHelpbarForInputBox()==false){
		return;
	}

	switch(keyCode) {
		case sf.key.N1:
			alert(" KEY_1");
			this.NumBtnList[0].obj.select();
			this.NumBtnList[0].obj.isSelected = true;
			break;

		case sf.key.N2:
			alert(" KEY_2");
			this.NumBtnList[1].obj.select();
			this.NumBtnList[1].obj.isSelected = true;
			break;

		case sf.key.N3:
			alert(" KEY_3");
			this.NumBtnList[2].obj.select();
			this.NumBtnList[2].obj.isSelected = true;
			break;

		case sf.key.N4:
			alert(" KEY_4");
			this.NumBtnList[3].obj.select();
			this.NumBtnList[3].obj.isSelected = true;
			break;

		case sf.key.N5:
			alert(" KEY_5");
			this.NumBtnList[4].obj.select();
			this.NumBtnList[4].obj.isSelected = true;
			break;

		case sf.key.N6:
			alert(" KEY_6");
			this.NumBtnList[5].obj.select();
			this.NumBtnList[5].obj.isSelected = true;
			break;

		case sf.key.N7:
			alert(" KEY_7");
			this.NumBtnList[6].obj.select();
			this.NumBtnList[6].obj.isSelected = true;
			break;

		case sf.key.N8:
			alert(" KEY_8");
			this.NumBtnList[7].obj.select();
			this.NumBtnList[7].obj.isSelected = true;
			break;

		case sf.key.N9:
			alert(" KEY_9");
			this.NumBtnList[8].obj.select();
			this.NumBtnList[8].obj.isSelected = true;
			break;
		case 650:	//TTXMIX
		case 35:	// plus100
			alert(" KEY_plus100");
			this.NumBtnList[9].obj.select();
			this.NumBtnList[9].obj.isSelected = true;
			break;

		case sf.key.N0:
			alert(" KEY_0");
			this.NumBtnList[10].obj.select();
			this.NumBtnList[10].obj.isSelected = true;
			break;

		case 259:
			//sf.key.PRECH:
			alert(" KEY_PRECH");
			this.NumBtnList[11].obj.select();
			this.NumBtnList[11].obj.isSelected = true;
			break;
	}
	this.highlightKeypad(keyCode);

	var searchString = this.PhoneNumberInputBox.getString();
	alert("searchString = " + searchString);

	var Scene = sf.scene.get('ListMainCallPhoneNumberList');
	if(Scene) {
		Scene.ResetListforSearch(searchString);
	}

	this.checkCallBtnEnable();
	this.checkPlusBtnEnable();

}

SceneListMainCall.prototype.checkCallBtnEnable = function() {
	alert("SceneListMainCall.checkCallBtnEnable() ");
	var input_phone_number = this.PhoneNumberInputBox.GetText();
	if(input_phone_number.length > 0) {
		var add_prefix_phone_number = this.addCountryPrefix(input_phone_number);
		var normalized_phone_number = PluginAPIMgr.NormalizeIdentity(add_prefix_phone_number);

		if(normalized_phone_number.length > 0) {
			var is_emergency_call = PluginAPIMgr.IsEmergencyCall(normalized_phone_number);
			if(is_emergency_call == 1) {
				this.isEmergencyCall = true;
			} else {
				this.isEmergencyCall = false;
			}

			if(this.isEmergencyCall == false && this.isZeroString(normalized_phone_number) == true) {
				this.setCallBtnEnable(false);
			} else {
				this.setCallBtnEnable(true);
			}
		} else {
			this.setCallBtnEnable(false);
		}
	} else {
		this.setCallBtnEnable(false);
	}
}

SceneListMainCall.prototype.isZeroString = function(phone_number) {
	var a = 0;
	var zero_length = 0;
	for( a = 1; a < phone_number.length; a++) {
		if(phone_number.substring(a, a + 1) == "0") {
			zero_length++;
		} else {
			break;
		}
	}

	if(zero_length == phone_number.length - 1) {
		alert("SceneListMainCall.isZeroString() : true ");
		return true;
	} else {
		alert("SceneListMainCall.isZeroString() : false ");
		return false;
	}
}

SceneListMainCall.prototype.setCallBtnEnable = function(flag_enable) {
	alert("SceneListMainCall.setCallBtnEnable() : " + flag_enable);

	this.flagCallBtnEnable = flag_enable;

	if(this.flagCallBtnEnable == true) {
		this.CallBtn.SetFlagDim(false);
	} else {
		this.CallBtn.SetFlagDim(true);
	}
}

SceneListMainCall.prototype.checkPlusBtnEnable = function() {
	alert("SceneListMainCall.checkPlusBtnEnable() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight != this.PhoneNumberInputBox) {
		return;
	}

	var input_phone_number = this.PhoneNumberInputBox.GetText();
	var pos_of_caret = this.PhoneNumberInputBox.GetPosOfCaret();

	if(input_phone_number.length == 0) {
		this.flagPlusBtnEnable = true;
	} else if(input_phone_number.indexOf("+") == 0 || input_phone_number.indexOf("00") == 0 || input_phone_number.indexOf("011") == 0) {
		this.flagPlusBtnEnable = false;
	} else if(pos_of_caret == 0) {
		this.flagPlusBtnEnable = true;
	} else {
		this.flagPlusBtnEnable = false;
	}

	this.setPlusBtnEnable();
}

SceneListMainCall.prototype.setPlusBtnEnable = function() {
	alert("SceneListMainCall.setPlusBtnEnable() ");

	if(this.flagPlusBtnEnable == true) {
		// this.PhoneNumberInputBox.changeHelpBar(this.InputPlusHelpBar);
		this.PhoneNumberInputBox.setFlagPhoneNumber(true);
	} else {
		// this.PhoneNumberInputBox.changeHelpBar(this.InputHelpBar);
		this.PhoneNumberInputBox.setFlagPhoneNumber(false);
	}
}

SceneListMainCall.prototype.addCountryPrefix = function(input_phone_number) {
	alert("SceneListMainCall.addCountryPrefix() --> this.CountryPrefix : " + this.CountryPrefix);

	if(input_phone_number.indexOf("+") == 0) {
		return input_phone_number;
	} else if(input_phone_number.indexOf("00") == 0) {
		return input_phone_number;
	} else if(input_phone_number.indexOf("011") == 0) {
		return input_phone_number;
	} else {
		if(this.CountryPrefix != "0") {
			return "+" + this.CountryPrefix + input_phone_number;
		} else {
			return input_phone_number;
		}
	}
}

SceneListMainCall.prototype.moveToCountryCodeBtn = function() {
	alert("SceneListMainCall.moveToCountryCodeBtn() ");

	//change color down arrow
	// this.ArrowLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_ARROW_ICON_HIGHLIGHT);
	this.highlight(this.CountryCodeBtn);
	//sf.scene.focus('ListMainCall');
	//$.sf.returnFocus();
}

SceneListMainCall.prototype.moveToCallBtn = function() {
	alert("SceneListMainCall.moveToCallBtn() ");

	this.highlight(this.CallBtn);
	//sf.scene.focus('ListMainCall');
	//$.sf.returnFocus();
}

SceneListMainCall.prototype.comebackCallScene = function() {
	alert("SceneListMainCall.comebackCallScene() ");

	if(this.CallBtn.GetFlagDim() == false) {
		this.highlight(this.CallBtn);
	}

	sf.scene.focus('ListMainCall');
}

SceneListMainCall.prototype.moveToPhoneNumberList = function() {
	alert("SceneListMainCall.moveToPhoneNumberList() ");
	var list_scene = sf.scene.get('ListMainCallPhoneNumberList');

	if(list_scene.GetNumberOfPhoneCall() > 0) {
		sf.scene.focus('ListMainCallPhoneNumberList');
		sf.scene.returnFocus();
		sf.key.preventDefault();
		//$.sf.returnFocus();

		// this.ListHelpBar.visibleObj();
	}

}

SceneListMainCall.prototype.showFlagList = function() {
	alert("SceneListMainCall.showFlagList() ");

	var ThisScene = sf.scene.get("ListMainCall");
	ThisScene.CountryPrefixLabel.hiddenObj();
	ThisScene.CountryNameLabel.hiddenObj();

	var Index = g_Data.GetCountryIndexWithCode(ThisScene.CountryCode);
	alert("CountryCode = " + ThisScene.CountryCode);
	alert("Index = " + Index);

	sf.scene.get("CountryFlagList").SetCurIndex(Index);
	sf.scene.show('CountryFlagList');

	setTimeout("CloseTimerCF()", 0);
	CloseTimerCF = function() {
		sf.scene.focus('CountryFlagList');
	}

	ThisScene.ShownFlagList = true;

}

SceneListMainCall.prototype.SetCountryFlag = function() {
	alert("SceneListMainCall.SetCountryFlag() ");

	var Scene = sf.scene.get("CountryFlagList");
	var This_ = sf.scene.get("ListMainCall");

	var FlagImage = Scene.GetCountryFlag();
	var CountryName = Scene.GetCountryName();
	var Prefix = Scene.GetPrefix();
	var CountryCode = Scene.GetCountryCode();

	This_.CountryCodeBtn.SetFgImage(FlagImage);
	This_.CountryPrefix = Prefix;
	This_.CountryNameLabel.SetText("+"+Prefix + "<br>" + CountryName);
	// This_.CountryPrefixLabel.SetText("+" + Prefix);
	This_.CountryCode = CountryCode;

	alert("SceneListMainCall.SetCountryFlag() --> this.CountryPrefix : " + This_.CountryPrefix);

	This_.CountryPrefixLabel.visibleObj();
	This_.CountryNameLabel.visibleObj();
	// This_.CountryListHelpBar.hiddenObj();

	This_.checkCallBtnEnable();

}
SceneListMainCall.prototype.ShowCountryBtn = function() {

	var This_ = sf.scene.get("ListMainCall");
	This_.CountryPrefixLabel.visibleObj();
	This_.CountryNameLabel.visibleObj();
	// This_.CountryListHelpBar.hiddenObj();

}
///////// Processing Click evnet  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

	/*var currentHighlight = this.ListMainCallView.getCurrentHighlight();

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

	if(this.FlagFocus == false) {
		sf.scene.get('ListMain').selectOnCurrHighlight();
	}*/

	if(obj == this.PhoneNumberInputBox) {
		if(this.getKeypadFlag()){
			this.setKeypadFlag(false);
		}
		return;
	}
	
	this.processEnterKey();
}
SceneListMainCall.prototype.processMouseOverEvent = function(obj) {
	alert("SceneListMainCall.processMouseOverEvent() ");

	if(this.FlagFocus == false) {
		alert("this.flagfocus is false");
		sf.scene.get('ListMain').selectOnCurrHighlight();
	}
	
	var currentHighlight = this.ListMainCallView.getCurrentHighlight();
	if(currentHighlight != obj) {
		if(obj == this.CallBtn){
			if(obj.GetFlagDim()==true){		//if call btn is dim....
    			return;
    		}	
		}
		this.highlight(obj);
	}

	

	if(obj == this.PhoneNumberInputBox) {
		alert("obj is PhoneNumberInputBox");
		if(this.getKeypadFlag()){
			this.setKeypadFlag(false);
		}
		return;
	}

	//this.processEnterKey();
}

SceneListMainCall.prototype.processKeyPadClickEvent = function(obj) {
	alert("SceneListMainCall.processKeyPadClickEvent() ");
	var index = 12;
	for( a = 0; a < this.NumBtnList.length; a++) {
		if(this.NumBtnList[a].obj == obj) {
			index = a;
			break;
		}
	}

	if(index < 0 || index >= 12) {
		return;
	}
	this.processKeypad(this.NumBtnList[index].key);
	this.highlightKeypad(this.NumBtnList[index].key);
	// this.processNumberKey(this.NumBtnList[index].key);
}
SceneListMainCall.prototype.processKeyPadMouseOverEvent = function(obj) {
	alert("SceneListMainCall.processKeyPadMouseOverEvent() ");
	var index = 12;
	for( a = 0; a < this.NumBtnList.length; a++) {
		if(this.NumBtnList[a].obj == obj) {
			index = a;
			break;
		}
	}

	if(index < 0 || index >= 12) {
		return;
	}
	if(this.timerId!=null){
		clearTimeout(this.timerId);
	}
	if(this.FlagFocus == false) {
		sf.scene.get('ListMain').selectOnCurrHighlight();
	}
	this.setKeypadFlag(true);
	var index = this.getKeyPadIdx(this.NumBtnList[index].key);
	alert("index is : " + index);
	this.CurrentKeypadInx = index;
	this.highlight(this.NumBtnList[index].obj);
	this.NumBtnList[index].obj.isSelected = true;
	// this.highlight(obj);
	// this.processNumberKey(this.NumBtnList[index].key);
}

SceneListMainCall.prototype.inputPlus = function() {
	alert("SceneListMainCall.inputPlus() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.PhoneNumberInputBox:

			var keycode = 35;
			//plus100
			if(ProcMgr.isTTXMIX == false) {
				keycode = 650;
				// TTXMIX
			}

			currentHighlight.processNumberKey(keycode);
			break;
	}
}

SceneListMainCall.prototype.inputDelete = function() {
	alert("SceneListMainCall.inputDelete() ");

	var currentHighlight = this.ListMainCallView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.PhoneNumberInputBox:

			currentHighlight.processPreChKey();
			break;
	}
}

SceneListMainCall.prototype.closeCountryList = function() {
	this.ShowCountryBtn();

	sf.scene.focus('ListMainCall');
	sf.scene.hide('CountryFlagList');

}

SceneListMainCall.prototype.closePhoneNumberList = function() {
	// this.ListHelpBar.hiddenObj();
	sf.scene.focus('ListMainCall');

}
SceneListMainCall.prototype.moveToKeypad = function() {
	alert("SceneListMainCall.prototype.moveToKeypad()")
	if(!this.getKeypadFlag()) {
		this.setKeypadFlag(true);
	}
	// this.changeHelpbar("numberbox");
	this.checkHelpbarForInputBox();
	this.ListMainCallView.setCurrenHighlight(this.NumBtnList[this.CurrentKeypadInx].obj);
	// this.select(this.NumBtnList[this.CurrentKeypadInx].obj);
}
SceneListMainCall.prototype.setKeypadFlag = function(flag) {
	alert("SceneListMainCall.prototype.setKeypadFlag()");
	if(flag) {
		this.KeypadFlag = flag;
	} else {
		this.KeypadFlag = false;
	}

}

SceneListMainCall.prototype.getKeypadFlag = function() {
	alert("SceneListMainCall.prototype.getKeypadFlag() return : " + this.KeypadFlag);
	return this.KeypadFlag;
}
SceneListMainCall.prototype.enterKeypad = function(){
	var keyCode = this.NumBtnList[this.CurrentKeypadInx].key;
	alert("SceneListMainCall.prototype.enterKeypad() keycode is : "+keyCode);
	// this.PhoneNumberInputBox.processNumberKey(keyCode);
	this.processKeypad(keyCode);
	this.highlightKeypad(keyCode);
}
SceneListMainCall.prototype.processKeypad = function(keycode) {
	alert("SceneListMainCall.prototype.processKeypad() : "+keycode);
	if(this.PhoneNumberInputBox.isMaxLength()) {
		alert(" isMaxLength() == true");
		return;
	}

	var m_NewText = "";

	switch(keycode) {

		case sf.key.N1:
			alert(" KEY_1");
			m_NewText = "1";
			break;

		case sf.key.N2:
			alert(" KEY_2");
			m_NewText = "2";
			break;

		case sf.key.N3:
			alert(" KEY_3");
			m_NewText = "3";
			break;

		case sf.key.N4:
			alert(" KEY_4");
			m_NewText = "4";
			break;

		case sf.key.N5:
			alert(" KEY_5");
			m_NewText = "5";
			break;

		case sf.key.N6:
			alert(" KEY_6");
			m_NewText = "6";
			break;

		case sf.key.N7:
			alert(" KEY_7");
			m_NewText = "7";
			break;

		case sf.key.N8:
			alert(" KEY_8");
			m_NewText = "8";
			break;

		case sf.key.N9:
			alert(" KEY_9");
			m_NewText = "9";
			break;

		case sf.key.N0:
			alert(" KEY_0");
			m_NewText = "0";
			break;

		case 35:
		//plus100
		case  650 :
			// TTXMIX
			if(this.PhoneNumberInputBox.flagPhoneNumber == false) {
				alert("flagphonenumber false!!!");
				return;
			}
			alert(" KEY_plus100");
			m_NewText = "+";
			break;
		//2013 modify by minseok
		case 259:
			this.PhoneNumberInputBox.deleteText();
			alert(" PRE_CH");
			break;

	}

	this.PhoneNumberInputBox.addText(m_NewText);
	var searchString = this.PhoneNumberInputBox.getString(); 
	//2013 add by minseok
	var Scene = sf.scene.get('ListMainCallPhoneNumberList');
	if(Scene) {

		Scene.ResetListforSearch(searchString);

	}
	this.checkHelpbarForInputBox();
	this.checkCallBtnEnable();
	this.checkPlusBtnEnable();
}
SceneListMainCall.prototype.processNumberKey = function(keyCode) {
	alert("SceneListMainCall.prototype.processNumberKey");
	var index = this.getKeyPadIdx(keyCode);
	alert("index is : " + index);
	this.processKeypad(keyCode);
	this.CurrentKeypadInx = index;
	this.highlight(this.NumBtnList[index].obj);
	this.NumBtnList[index].obj.isSelected = true;
	this.highlightKeypad(keyCode);
}
/**
 * 130930 timing issue
 * when highlight() -> select(), delete settimeout
 */
SceneListMainCall.prototype.highlightKeypad = function(keyCode){
	alert("SceneListMainCall.prototype.highlightKeypad");
	if(this.timerId != null){
		clearTimeout(this.timerId);
	}
	var index = 0;
	index = this.getKeyPadIdx(keyCode);
	if(index == -1){	//not number key
		return;
	}
	if(this.getKeypadFlag()){
		if(index == this.CurrentKeypadInx){	//current btn highlight
				if(this.getKeypadFlag()){
					this.NumBtnList[index].obj.select();
				}else{
					this.NumBtnList[index].obj.blur();
				}
			this.timerId = setTimeout(function(obj){
				var Scene = sf.scene.get('ListMainCall');
				if(Scene.getKeypadFlag()){
					obj.highlight();
				}else{
					obj.blur();
				}
			},200,this.NumBtnList[index].obj);	
		}else{								//diffrent btn highlight
			this.NumBtnList[index].obj.select();
			this.timerId = setTimeout(function(obj){
				obj.blur();
			},200,this.NumBtnList[index].obj);
		}
	}else{			//not highlight keypad
		alert("focus is not in keypad");
		this.NumBtnList[index].obj.select();
		this.timerId = setTimeout(function(obj){
			obj.blur();
		},400,this.NumBtnList[index].obj);
	}
}
SceneListMainCall.prototype.getKeyPadIdx = function(KeyCode){
	switch(KeyCode) {
		case sf.key.N1:
			return 0;
		case sf.key.N2:
			return 1;
		case sf.key.N3:
			return 2;
		case sf.key.N4:
			return 3;
		case sf.key.N5:
			return 4;
		case sf.key.N6:
			return 5;
		case sf.key.N7:
			return 6;
		case sf.key.N8:
			return 7;
		case sf.key.N9:
			return 8;
		case 650:	//TTXMIX
		case 35:	// plus100
			return 9;

		case sf.key.N0:
			return 10;

		case 259:
			//sf.key.PRECH:
			return 11;
		default:
			return -1;
	}
}
SceneListMainCall.prototype.resetKeyPadIndex = function(){
	this.CurrentKeypadInx = 0;
}
