function Number(str){
	return str*1;
}
OnCommand=function(cmdObj){
	var cmd=cmdObj.cmd.toLowerCase();
	if(cmd=="list_favorites"){
		if(cmdObj.itemId.toLowerCase()=="title"&&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(childCmd=="btn_favor"){
				SendMenuMsg("M_FAVOR",Number(cmdObj.rowIndex)+1);
			}
			else if(childCmd=="btn_down"){
				SendMenuMsg("M_DOWN",Number(cmdObj.rowIndex)+1);
			}
		}
	}
}

function RefreshListItemInfo_title2(index,item,newState,oldState,gress){
	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);
	item.btn_favor.ShowCtrl(bShow);
	item.btn_down.ShowCtrl(bShow);
	item.btn_download.ShowCtrl(bShow);
}
function RefreshListItemInfo_title3(index,item,newState,oldState,gress,bLocfavor,textwidth){
	var bShow=false;
	if(index>=0){
		var strs=newState.split(",");
		var state=strs[0].toLowerCase();
		var bfavor=(bLocfavor==1);
		if(state=="in"||state=="insel"){
			bShow=true;
			if(strs.length>1&&strs[1].toLowerCase()=="error"){
				bShow=false;
			}
		}
		item.slider_progress.SetData(gress/100);
	}
	item.slider_progress.Enable(false);
	item.slider_progress.ShowCtrl((gress > 0 && gress < 100) && (index >= 0));
	item.btn_addto.ShowCtrl(bShow);
	item.btn_play.ShowCtrl(bShow);
	item.btn_favor.ShowCtrl(bShow&&bfavor);
	item.btn_down.ShowCtrl(bShow&&bDown);
}
OnNotifyPlayListReName=function(width){
    var rect = CreateDataObject();
    var size = CreateDataObject();
    rect.SetRect(width+102, 10, 0, 0);
    size.SetSize(100, 18);
    text_songnumber.Reset(rect, size, "lt", 100);
}
localsonglist.OnItemInfoChanged_title = RefreshListItemInfo_title2;
downloadsoglist.OnItemInfoChanged_speed_size = RefreshListItemInfo_title3;