function SceneListMainCallPhoneNumberList(options) {

	this.options			= options;	
	
    this.PhoneNumberArray 			= null;
	this.SearchNumberResultArray	= null;
	
	this.SearchNumber				= null;
    
    this.flag_Focus	= false;
    this.HelpBarData = null;
    
    this.PhoneIcon	= null;
    this.UpArrow	= null;
    this.DownArrow	= null;
    
	this.WheelOperation = false;    

}

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

SceneListMainCallPhoneNumberList.prototype.handleShow = function () {
	alert("SceneListMainCallPhoneNumberList.handleShow()");
	
	this.ResetOriginArray();
	this.ResetListforSearch(this.SearchNumber);
		
}

SceneListMainCallPhoneNumberList.prototype.handleHide = function () {
	alert("SceneListMainCallPhoneNumberList.handleHide()");

}

SceneListMainCallPhoneNumberList.prototype.handleFocus = function () {
	alert("SceneListMainCallPhoneNumberList.handleFocus()");	
	
	this.flag_Focus = true;
	this.PhoneNumberList.SetHighlightForDataIndex(0);
	HelpBar.changeHelpBarItems(this.HelpBarData);
}

SceneListMainCallPhoneNumberList.prototype.handleBlur = function () {
	alert("SceneListMainCallPhoneNumberList.handleBlur()");
	
	this.flag_Focus = false;
	this.PhoneNumberList.blur();
}

SceneListMainCallPhoneNumberList.prototype.handleKeyDown = function (keyCode) {
	
	alert("SceneListMainCallPhoneNumberList.handleKeyDown(" + keyCode + ")");
	PluginAPIMgr.PlayAudio(keyCode);	
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	switch (keyCode) {
		case sf.key.LEFT:
			this.ProcessKeyReturn();
			break;
		default:
			this.PhoneNumberList.KeyProcess(keyCode);
			break;
	}

}

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

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

       this.PhoneIcon= new Label("list_main_call_phone_icon", null);
    this.PhoneIcon.SetBgImage(g_Image.IMAGE_LIST_MAIN_CALL_PHONE_ICON);    
    this.PhoneIcon.hiddenObj();
    
	this.PhoneNumberList = new ScrollList();
	this.PhoneNumberList.CreateBG("previousPhoneNumberList");
	this.PhoneNumberList.SetBGImage(g_Image.IMAGE_LIST_MAIN_CALL_PREVIOUS_PHONE_NUMBER_LIST_BG);	
	this.PhoneNumberList.SetNumOfVisibleItem(5);
	//this.PhoneNumberList.SetStartDataIndex(0);		
	this.PhoneNumberList.SetItemBgImage(ITEM_STATE.NORMAL," ");
	this.PhoneNumberList.SetItemBgImage(ITEM_STATE.HIGHLIGHT,g_Image.IMAGE_LIST_MAIN_CALL_PREVIOUS_PHONE_NUMBER_LIST_ITEM_HIGHLIGHT_BG);
	this.PhoneNumberList.SetItemDefualtTextStyle(ITEM_STATE.NORMAL,"cPreviousPhoneNumberList_Text_Normal");
	this.PhoneNumberList.SetItemDefualtTextStyle(ITEM_STATE.HIGHLIGHT,"cPreviousPhoneNumberList_Text_Highlight");
	this.PhoneNumberList.SetDataType(ITEM_DATA_TYPE.TEXT_ONLY);
	this.PhoneNumberList.CreateScrBar("PhoneNumberListScrollBar");
	this.PhoneNumberList.SetScrBarImage(g_Image.IMAGE_BLOCK_SCROLLBAR_BG,
		g_Image.IMAGE_BLOCK_SCROLLBAR_TOP,
		g_Image.IMAGE_BLOCK_SCROLLBAR_CENTER,
		g_Image.IMAGE_BLOCK_SCROLLBAR_BOTTOM);
	this.PhoneNumberList.SetScrBarPosition(210,0,4);

	var scene = sf.scene.get("ListMainCallPhoneNumberList");
    var list_ = scene.PhoneNumberList;

	this.PhoneNumberList.SetOnClickCallbackFunc(0,function(){scene.processClick(0);});					
	this.PhoneNumberList.SetOnClickCallbackFunc(1,function(){scene.processClick(1);});	
	this.PhoneNumberList.SetOnClickCallbackFunc(2,function(){scene.processClick(2);});						
	this.PhoneNumberList.SetOnClickCallbackFunc(3,function(){scene.processClick(3);});	
	this.PhoneNumberList.SetOnClickCallbackFunc(4,function(){scene.processClick(4);});	
	this.PhoneNumberList.SetOnMouseOverCallbackFunc(0,function(){scene.processMouseOver(0);});
	this.PhoneNumberList.SetOnMouseOverCallbackFunc(1,function(){scene.processMouseOver(1);});
	this.PhoneNumberList.SetOnMouseOverCallbackFunc(2,function(){scene.processMouseOver(2);});
	this.PhoneNumberList.SetOnMouseOverCallbackFunc(3,function(){scene.processMouseOver(3);});
	this.PhoneNumberList.SetOnMouseOverCallbackFunc(4,function(){scene.processMouseOver(4);});	
		
	this.PhoneNumberList.SetClickEventAvailable(WndMgr.MouseClickEnable);
		

	this.PhoneNumberList.SetEventOnReturnFunc(scene.ProcessKeyReturn);
	this.PhoneNumberList.SetItemPressedEventCallback(scene.ProcessKeyEnter);
	
	this.PhoneNumberList.Show();


	this.UpArrow = new CompBase(); 
	this.UpArrow.CreateBG("PhoneNumberListUpArrow");
	this.UpArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_UP_NOR);
	this.UpArrow.SetOnClickCallbackFunc(function(){list_.PreviousPage();});	
	this.UpArrow.SetOnMouseOverCallbackFunc(function(){scene.ChangeArrow(ARROW_TYPE.UP_SEL);});
	this.UpArrow.SetOnMouseOutCallbackFunc(function(){scene.ChangeArrow(ARROW_TYPE.UP_NOR);});	
	
	this.DownArrow = new CompBase(); 
	this.DownArrow.CreateBG("PhoneNumberListDownArrow");
	this.DownArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_DOWN_NOR);
	this.DownArrow.SetOnClickCallbackFunc(function(){list_.NextPage();});	
	this.DownArrow.SetOnMouseOverCallbackFunc(function(){scene.ChangeArrow(ARROW_TYPE.DOWN_SEL);});
	this.DownArrow.SetOnMouseOutCallbackFunc(function(){scene.ChangeArrow(ARROW_TYPE.DOWN_NOR);});		


    this.TempDiv = document.getElementById("ListMainCallPhoneNumberList");
   	this.TempDiv.onmousewheel = function()
   	{
   		if(scene.WheelOperation == false)
   		{
   			alert("ListMainCallPhoneNumberList.onmousewheel");
	   		scene.WheelOperation = true;
	   		PluginAPIMgr.StartOSDTimer("700" , function() { scene.wheelTimerCallback();}, ENUM_TIMER_TYPE.POPUP_WND);
	   		
			if(event.wheelDelta > 0)
			{
				//alert("Up Up");
				list_.PreviousPage();
			}
			else
			{
				//alert("Down Down");
				list_.NextPage();
			}
	    }		
    };	
    
    this.HelpBarData = {
		'red': IDWS_MOIP_POPUP_EXIT_SIGN_OUT,
		'return' : SID_RETURN
	};
    
}

SceneListMainCallPhoneNumberList.prototype.ResetOriginArray = function(){

	//Never delete  this code.
	//It is necessary to update history list.
	PluginAPIMgr.GetNumberOfHistorys();
	
	//Get PhoneNumber list
	var strPhoneNumberList = PluginAPIMgr.GetPreviousPhoneNumberList();
	this.PhoneNumberArray = null;			//init array
	
	alert("[ResetOriginArray] strPhoneNumberList = " + strPhoneNumberList );

	if (strPhoneNumberList) {

		var STX = String.fromCharCode(2);
		var ETX = String.fromCharCode(3);
		var splitter = ETX + STX;
		
		this.PhoneNumberArray = strPhoneNumberList.split(splitter);
		
		//to cut null item
		var TotalPhoneNumber = this.PhoneNumberArray.length - 1;
		// this.PhoneNumberArray = new Array("+8254896547","4567895");
		// var TotalPhoneNumber = this.PhoneNumberArray.length;
		this.PhoneNumberArray.splice(TotalPhoneNumber);		

		alert("PhoneNumberArray.length = " + this.PhoneNumberArray.length);
		this.SearchNumberResultArray = this.PhoneNumberArray.slice(0,this.PhoneNumberArray.length - 1);
		
        this.PhoneIcon.hiddenObj();
        
	}
	else{
		alert("strPhoneNumberList is null ");
        this.PhoneIcon.visibleObj();
	}

}
//2013 add by minseok
SceneListMainCallPhoneNumberList.prototype.hasItems = function(){
	alert("SearchNumberResultArray.hasItems()");
	if(this.PhoneNumberArray == null){
		return false;
	}else{
		if(this.SearchNumberResultArray.length>0){
			alert("SearchNumberResultArray.length = " + this.SearchNumberResultArray.length);
			return true;
		}else{	
			return false;
		}	
	}
	
}


SceneListMainCallPhoneNumberList.prototype.ProcessKeyReturn = function(){

	alert("SceneListMainCallPhoneNumberList.ProcessKeyReturn() ");
	
	// sf.scene.get('ListMainCall').ListHelpBar.hiddenObj();
	sf.scene.focus('ListMainCall');
	sf.scene.get('ListMainCall').setKeypadFlag(true);
	//sf.scene.hide('ListMainCallPhoneNumberList');

}

SceneListMainCallPhoneNumberList.prototype.ResetListforSearch = function(String){

	alert("SceneListMainCallPhoneNumberList.ResetListforSearch() ");
	this.PhoneNumberList.DeleteDataAll();		//init list
	
	if(this.PhoneNumberArray == null){
		this.PhoneNumberList.HideItem();
        this.PhoneIcon.visibleObj();
		return;
	}
	
	if (this.PhoneNumberArray.length > 0 && (String.length > 1 ||( String.length == 1 && String[0] != '+'))) {
		alert(" PhoneNumberArray.length > 0 && String.length > 0 ");
		
		//this.PhoneNumberList.DeleteDataAll();
		//this.PhoneNumberList.SetStartDataIndex(0);

		//to delete all result array
		if(this.SearchNumberResultArray){
			var prevResultNum = this.SearchNumberResultArray.length;
			this.SearchNumberResultArray.splice(0,prevResultNum );				
		}
		else{
			this.SearchNumberResultArray = new Array(this.PhoneNumberArray.length); 
		}	
				
		var tempData = new Array(this.PhoneNumberArray.length);
		var newListIndex = 0;
		var SearchString;
		
		if(String[0] == '+'){

			SearchString = String.substring(1);
			alert("SearchString >> " + SearchString);					
		}
		else{
			
			SearchString = String;
		}
				
		for (var i=0; i < this.PhoneNumberArray.length; i++) {
						
			if(this.PhoneNumberArray[i].search(SearchString) !=  -1) {
				
				alert("result >> " + this.PhoneNumberArray[i]);
				tempData[newListIndex] = [ this.PhoneNumberArray[i] ,null];				
				this.PhoneNumberList.AddData(tempData[newListIndex]);	
				newListIndex++;
				this.SearchNumberResultArray.push(this.PhoneNumberArray[i]);
			}
		}
			
		this.PhoneNumberList.ShowItem();
		this.PhoneNumberList.ResetTotalPage();
		this.PhoneNumberList.RefreshPage();
		
		if(this.PhoneNumberList.TotalPage > 1)
		{
			this.UpArrow.Show();;			
			this.DownArrow.Show();
		}
		else
		{
			this.UpArrow.Hide();;			
			this.DownArrow.Hide();;
		}

		
		
	}
	else if(this.PhoneNumberArray.length > 0 && (String.length == 0 || (String.length == 1 && String[0] == '+'))) {
		alert(" PhoneNumberArray.length > 0 && String.length == 0");
					
		this.PhoneNumberList.DeleteDataAll();
		//this.PhoneNumberList.SetStartDataIndex(0);

		//to delete all result array
		if(this.SearchNumberResultArray){
			var prevResultNum = this.SearchNumberResultArray.length;
			this.SearchNumberResultArray.splice(0,prevResultNum );				
		}
		else{
			this.SearchNumberResultArray = new Array(this.PhoneNumberArray.length); 
		}
			
		var tempData = new Array(this.PhoneNumberArray.length);
					
		for (var i=0; i < this.PhoneNumberArray.length; i++) {

			tempData[i] = [ this.PhoneNumberArray[i] ,null];	
			this.PhoneNumberList.AddData(tempData[i]);
			
			this.SearchNumberResultArray.push(this.PhoneNumberArray[i]);				
		}
		this.PhoneNumberList.ShowItem();
		this.PhoneNumberList.ResetTotalPage();
		this.PhoneNumberList.RefreshPage();

		if(this.PhoneNumberList.TotalPage > 1)
		{
			this.UpArrow.Show();;			
			this.DownArrow.Show();
		}
		else
		{
			this.UpArrow.Hide();;			
			this.DownArrow.Hide();;
		}
			
	}
    
    if(this.SearchNumberResultArray.length == 0)
    {
        this.PhoneIcon.visibleObj();
    }
    else
    {
        this.PhoneIcon.hiddenObj();
    }

}


SceneListMainCallPhoneNumberList.prototype.ProcessKeyEnter = function(){

	alert("SceneListMainCallPhoneNumberList.ProcessKeyEnter() ");
	
	var scene = sf.scene.get("ListMainCallPhoneNumberList");
	var Index = scene.PhoneNumberList.GetCurrentDataIndex();
	
	alert("Index = " + Index);
	alert("PhoneNumber = " + scene.SearchNumberResultArray[Index]);


	//sf.scene.hide('ListMainCallPhoneNumberList');
	//2013 modify by minseok
	var MainCallScene = sf.scene.get("ListMainCall"); 
    MainCallScene.PhoneNumberInputBox.setInitString(scene.SearchNumberResultArray[Index]);
    MainCallScene.checkCallBtnEnable();
    // MainCallScene.ListHelpBar.hiddenObj();
	//2013 add by minseok
	if(MainCallScene.getKeypadFlag()){
		MainCallScene.setKeypadFlag(false);
	}
	MainCallScene.highlight(MainCallScene.CallBtn);
	
    MainCallScene.comebackCallScene();
	//sf.scene.focus('ListMainCall');
    
    scene.ResetListforSearch(scene.SearchNumberResultArray[Index]);
}

SceneListMainCallPhoneNumberList.prototype.SetSearchNumber = function(String){

	this.SearchNumber = String;
}

SceneListMainCallPhoneNumberList.prototype.GetNumberOfPhoneCall = function(){

	if(this.SearchNumberResultArray){
		
		return this.SearchNumberResultArray.length;
	}
	else{
		
		return 0;
	}
}


SceneListMainCallPhoneNumberList.prototype.processClick = function(ItmeIndex)
{
	alert("SceneListMainCallPhoneNumberList.processClick() -- " + ItmeIndex);
	
	this.PhoneNumberList.MoveItem(ItmeIndex);
	var Index = this.PhoneNumberList.GetCurrentDataIndex();
	
	alert("Index = " + Index);
	alert("PhoneNumber = " + this.SearchNumberResultArray[Index]);

    sf.scene.get("ListMainCall").PhoneNumberInputBox.setInitString(this.SearchNumberResultArray[Index]);
    sf.scene.get("ListMainCall").checkCallBtnEnable();
    // sf.scene.get('ListMainCall').ListHelpBar.hiddenObj();
	
    sf.scene.get("ListMainCall").comebackCallScene();

    this.ResetListforSearch(this.SearchNumberResultArray[Index]);

	if(this.flag_Focus == false)
	{		
		this.PhoneNumberList.blur();
	}
        
}
SceneListMainCallPhoneNumberList.prototype.processMouseOver = function(ItmeIndex)
{
	alert("SceneListMainCallPhoneNumberList.processMouseOver() -- " + ItmeIndex);
	if(this.flag_Focus==false){
		this.flag_Focus=true;
		sf.scene.focus('ListMainCallPhoneNumberList');
	}
	this.PhoneNumberList.MoveItem(ItmeIndex);
	/*var Index = this.PhoneNumberList.GetCurrentDataIndex();
	
	alert("Index = " + Index);
	alert("PhoneNumber = " + this.SearchNumberResultArray[Index]);

    sf.scene.get("ListMainCall").PhoneNumberInputBox.setInitString(this.SearchNumberResultArray[Index]);
    sf.scene.get("ListMainCall").checkCallBtnEnable();
    // sf.scene.get('ListMainCall').ListHelpBar.hiddenObj();
	
    sf.scene.get("ListMainCall").comebackCallScene();

    this.ResetListforSearch(this.SearchNumberResultArray[Index]);

	if(this.flag_Focus == false)
	{		
		this.PhoneNumberList.blur();
	}*/
        
}
    
SceneListMainCallPhoneNumberList.prototype.ChangeArrow = function(Type)
{
	alert("SceneListMainCallPhoneNumberList.ChangeArrow");

	switch(Type)
	{
		case ARROW_TYPE.UP_NOR:
			this.UpArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_UP_NOR);
			break;
			
		case ARROW_TYPE.UP_SEL:
			this.UpArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_UP_SEL);
			break;

		case ARROW_TYPE.DOWN_NOR:
			this.DownArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_DOWN_NOR);
			break;
			
		case ARROW_TYPE.DOWN_SEL:
			this.DownArrow.SetBGImage(g_Image.IMAGE_LIST_MAIN_ARROW_DOWN_SEL);
			break;		
	}
}

SceneListMainCallPhoneNumberList.prototype.wheelTimerCallback=function()
{
	this.WheelOperation = false;
}
