function Number(str){
	return str*1;
}
OnCommand=function(cmdObj){
	var cmd=cmdObj.cmd.toLowerCase();
	if(cmd=="list_play"||cmd=="list_random"||cmd=="list_favorites"){
		if(cmdObj.itemId.toLowerCase()=="length"&&cmdObj.type=="NOTIFY_CHILD"){
			var childCmdObj=cmdObj.data;
			var childCmd=childCmdObj.cmd.toLowerCase();
			if(childCmd=="btn_custom"){
				SendMenuMsg("M_RING",Number(cmdObj.rowIndex)+1);
			}
			else if(childCmd=="btn_addto"){
				SendMenuMsg("M_ADDTO",Number(cmdObj.rowIndex)+1);
			}
		}
	}	
	else if(cmd=="check_list"){
		if(cmdObj.ctrl.IsCheck()){
		var rect=CreateDataObject();
		var size=CreateDataObject();
		if(check_playlist.IsCheck()){
			rect.SetRect(0,0,0,0);
			size.SetSize(120,31);
			check_playlist.Reset(rect,size,"lt",100);
			rect.SetRect(120,0,0,0);
			size.SetSize(87,31);
			check_favorites.Reset(rect,size,"lt",100);
			rect.SetRect(207,0,0,0);
			size.SetSize(87,31);
			check_random.Reset(rect,size,"lt",100);
			}
		else if(check_favorites.IsCheck()){
			rect.SetRect(0,0,0,0);
			size.SetSize(87,31);
			check_playlist.Reset(rect,size,"lt",100);
			rect.SetRect(87,0,0,0);
			size.SetSize(120,31);
			check_favorites.Reset(rect,size,"lt",100);
			rect.SetRect(207,0,0,0);
			size.SetSize(87,31);
			check_random.Reset(rect,size,"lt",100);
			}
		else if(check_random.IsCheck()){
			rect.SetRect(0,0,0,0);
			size.SetSize(87,31);
			check_playlist.Reset(rect,size,"lt",100);
			rect.SetRect(87,0,0,0);
			size.SetSize(87,31);
			check_favorites.Reset(rect,size,"lt",100);
			rect.SetRect(174,0,0,0);
			size.SetSize(120,31);			
			check_random.Reset(rect,size,"lt",100);
			}
		}
	}
}
function RefreshListItemInfo_length(index,item,newState,oldState){
	var bShow=false;
	if(index>=0){
		var strs=newState.split(",");
		var state=strs[0].toLowerCase();
		if(state=="in"||state=="insel"){
			bShow=true;
			if(strs.length>1&&strs[1].toLowerCase()=="error"){
				bShow=false;
			}
		}
	}
	item.btn_addto.ShowCtrl(bShow);
	item.btn_custom.ShowCtrl(bShow);
}
list_play.OnItemInfoChanged_length=RefreshListItemInfo_length;
list_random.OnItemInfoChanged_length=RefreshListItemInfo_length;
LIST_FAVORITES.OnItemInfoChanged_length=RefreshListItemInfo_length;