
function MenuList() {
	
	this.DisableTextStyle;
	
    List.call(this);
}

MenuList.prototype = new List(); 


//Temp Code  !! 
//MaxNumOfItem & NumOfVisibleItem  
//check later...
MenuList.prototype.SetNumOfMaxItem = function(NumOfItems){
	
    alert("MenuList.SetNumOfMaxItem()");
	this.NumOfVisibleItem = NumOfItems;
}

MenuList.prototype.SetItemDisableTextStyle = function(style) {
	
	this.DisableTextStyle = style;
	        
}

MenuList.prototype.SetDisableItem = function(nIndex) {
	
	alert("MenuList.SetDisableItem" );
	if(this.ItemArray[nIndex]){
		this.ItemArray[nIndex].Disable();
		this.ItemArray[nIndex].SetDisableTextStyle(this.DisableTextStyle);
	}
	else{
		alert(" ItemArray[" + nIndex + "] is null !!" );		
	}
	        
}

MenuList.prototype.SetEnableItem = function(nIndex) {
	
	alert("MenuList.SetEnableItem" );
	if(this.ItemArray[nIndex]){
		this.ItemArray[nIndex].Enable();	
	}
}

MenuList.prototype.Next = function(f_simplex){
	alert("MenuList.Next()");
	
	var CurItemIndex = 	this.CurrentItemIndex;
	
	alert("List.Next() : this.CurrentItemIndex( " + this.CurrentItemIndex + " ), this.NumOfVisibleItem( " + this.NumOfVisibleItem + ")");
	if(f_simplex == true) {
		if(this.CurrentItemIndex == this.NumOfVisibleItem-1)
			return
	}

	alert("CurItemIndex = " + CurItemIndex + " >> NumOfVisibleItem = " + this.NumOfVisibleItem);
	
	for (var i = CurItemIndex + 1; i < this.NumOfVisibleItem; i++) {
		if(this.ItemArray[i].FlagDisable() == false){
			CurItemIndex = i;
			this.CurrentDataIndex = i;
			break;
		}
	}

	if(CurItemIndex == this.CurrentItemIndex){
		
		for (var j = 0; j < this.CurrentItemIndex ; j++) {
			
			if(this.ItemArray[j].FlagDisable() == false){
				CurItemIndex = j;
				this.CurrentDataIndex = j;
				break;
			}							
		}		
	}

	
	this.SetCurrentItem(CurItemIndex);	
}

MenuList.prototype.Previous = function(f_simplex){
	alert("MenuList.Previous()");

	var CurItemIndex = 	this.CurrentItemIndex;

	alert("List.Previous() : this.CurrentItemIndex( " + this.CurrentItemIndex + " ), this.StartDataIndex( " + this.NumOfVisibleItem + ")");
	if(f_simplex == true) {
		if(this.CurrentItemIndex == this.StartDataIndex)
			return
	}

	for (var i = CurItemIndex - 1; i > -1; i--) {
		if(this.ItemArray[i].FlagDisable() == false){
			CurItemIndex = i;
			this.CurrentDataIndex = i;
			break;
		}
	}

	if(CurItemIndex == this.CurrentItemIndex){
		
		for (var j = this.NumOfVisibleItem -1 ; j > this.CurrentItemIndex ; j--) {
			
			if(this.ItemArray[j].FlagDisable() == false){
				CurItemIndex = j;
				this.CurrentDataIndex = j;
				break;
			}							
		}		
	}
		
	this.SetCurrentItem(CurItemIndex);		
}


MenuList.prototype.highlight = function(index){
	
	alert("MenuList.highlight");

	this.Flag_Focus	= true;

	if(index > 0 && index != null) {
		this.SetCurrentItem(index);
	} else {
		this.SetStartDataIndex(0);	
		this.SetCurrentItem(0);
	}
}

MenuList.prototype.blur = function(){

	alert("MenuList.blur >>> curIndex : " + this.CurrentItemIndex);	
	
	this.Flag_Focus	= false;
	
	if(this.ItemArray[this.CurrentItemIndex]){
		
		this.ItemArray[this.CurrentItemIndex].Normal();
	}
	
}

MenuList.prototype.ChangeData = function(DataIndex,DataObject) {

	this.DataArray[DataIndex] = DataObject;    
	
	if(this.ItemArray[DataIndex]){
		
		this.ItemArray[DataIndex].SetItem(DataObject);
		
		// if(DataObject)
		// {
			// // this.ItemArray[DataIndex].SetItem(DataObject);
			// alert("MenuList.ChangeData >>> DataObject");
			// this.ItemArray[DataIndex].SetFlagForExistData(true);
		// }
		// else
		// {
			// //var tempdata = [null,null];
			// // this.ItemArray[DataIndex].SetItem(DataObject);	
			// alert("MenuList.ChangeData >>> DataObject is null");		
			// this.ItemArray[DataIndex].SetFlagForExistData(false);
		// }	
	}	
}

//2013 add by minseok
MenuList.prototype.GetData = function(DataIndex){
	return this.DataArray[DataIndex];
}
