
function HistoryList() {

	this.ListPropNum = 10;
				
	MainList.call(this);
}

HistoryList.prototype = new MainList(); 


HistoryList.prototype.Costomizing = function(){

	this.ElimentName = "history";
	this.ItemClass = HistoryItem;
	this.FuncPopupClass = HistoryFuncButtons;
	this.NoItemString = TV_SID_YOU_HAVE_NO_HISTORY_OF_CALLS;
	this.SceneName = "ListMainHistory";	
}

//costomize...
HistoryList.prototype.GetNumberOfDatas = function(){
	
	return PluginAPIMgr.GetNumberOfHistorys();
}

HistoryList.prototype.GetIndexOfData = function(DataID){
	
	return PluginAPIMgr.GetIndexOfHistory(DataID);
}

HistoryList.prototype.UpdatePage = function(){

	alert("HistoryList.UpdatePage"); 

	var startIndexOfPage = (this.CurPage - 1) * MaxNumOfMainItem;
	
	var strHistoryList = PluginAPIMgr.GetHistoryList(startIndexOfPage);
	//alert("strHistoryList = " + strHistoryList );

	var TypeArray			= new Array(MaxNumOfMainItem);
	var ContactNameArray	= new Array(MaxNumOfMainItem);
	var DisplayNameArray	= new Array(MaxNumOfMainItem);
	var TimeStampArray 		= new Array(MaxNumOfMainItem);
	var IsMissedArray 		= new Array(MaxNumOfMainItem);
	var IsConferenceArray 	= new Array(MaxNumOfMainItem);
	var IsInCommingArray 	= new Array(MaxNumOfMainItem);	
	var IsPSTNArray 		= new Array(MaxNumOfMainItem);
	var DurationArray 		= new Array(MaxNumOfMainItem);
	var IDArray 			= new Array(MaxNumOfMainItem);
			
	var NumOfItemInThisPage = 0;						
							
	if(strHistoryList)
	{				
		var STX = String.fromCharCode(2);
		var ETX = String.fromCharCode(3);
		var splitter = ETX + STX;
	
		var Result = strHistoryList.split(splitter);	
		NumOfItemInThisPage = parseInt(Result.length / this.ListPropNum);

		var TokenNum = 0;
		
		for (var i=0; i < NumOfItemInThisPage ; i++) {
					
			TokenNum = i*(this.ListPropNum);						
			
			TypeArray[i] 			= Result[TokenNum];			
			ContactNameArray[i] 	= Result[TokenNum+1];			
			DisplayNameArray[i] 	= Result[TokenNum+2];						
			TimeStampArray[i] 		= Result[TokenNum+3];						
			IsMissedArray[i] 		= Result[TokenNum+4];						
			IsConferenceArray[i] 	= Result[TokenNum+5];
			IsInCommingArray[i]		= Result[TokenNum+6];					
			IsPSTNArray[i] 			= Result[TokenNum+7];	
			DurationArray[i] 		= Result[TokenNum+8];
			IDArray[i]				= Result[TokenNum+9];
			


			alert("TypeArray[" + i +"] = " + TypeArray[i] );	
			alert("ContactNameArray[" + i +"] = " + ContactNameArray[i] );				
			alert("DisplayNameArray[" + i +"] = " + DisplayNameArray[i] );
			alert("TimeStampArray[" + i +"] = " + TimeStampArray[i] );
			alert("IsMissedArray[" + i +"] = " + IsMissedArray[i] );
			alert("IsConferenceArray[" + i +"] = " + IsConferenceArray[i] );
			alert("IsInCommingArray[" + i +"] = " + IsInCommingArray[i] );
			alert("IsPSTNArray[" + i +"] = " + IsPSTNArray[i] );		
			alert("DurationArray[" + i +"] = " + DurationArray[i] );

		
							
		}
	}
		
	var tempData = new Array(MaxNumOfMainItem);
			
	for (var j=0; j < NumOfItemInThisPage; j++) {
	
		//alert("tempData[" + j +"] create");
	
		tempData[j] = new HistoryData();		
		tempData[j].SetData(TypeArray[j],ContactNameArray[j],DisplayNameArray[j],TimeStampArray[j],IsMissedArray[j],
			IsConferenceArray[j],IsInCommingArray[j],IsPSTNArray[j],DurationArray[j],IDArray[j],startIndexOfPage+j);
					
		this.ItemArray[j].SetItem(tempData[j]);
				
	}
	
	this.NumOfVisibleItem = NumOfItemInThisPage;
	for(var k = NumOfItemInThisPage; k < MaxNumOfMainItem ; k++) {
		
		//alert("ItemArray[" + k +"] not include data!!");
		
		if(this.ItemArray[k]){			
			this.ItemArray[k].SetFlagForExistData(false);
		}		
	}

	this.ShowItem();
	
	this.ResetPageUI();		

	if(this.TotalDataNum < 1) { 
		alert("History UpdatePage : NumOfVisibleItem = "+this.NumOfVisibleItem); 
		this.NotifingLabel.Show();
		this.flagNoItem = true;
	}	else {
		this.NotifingLabel.Hide();
	}
	
}

HistoryList.prototype.ProcessVM = function(EventType){
	
	this.FuncPopup.ProcessVM(EventType);	
}

HistoryList.prototype.VMProgressPlayback = function(strTime){
	
	this.FuncPopup.ProgressPlayBack(strTime);	
}

HistoryList.prototype.ProgressStopkey = function(strTime){
	
	this.FuncPopup.PushStopBtn();	
}
