<ActorFrame InitCommand="%function(self)
	ProfileImageSize = 65
	end"><children>

<Layer Type="ActorFrame" OnCommand="x,SCREEN_CENTER_X-150;y,SCREEN_CENTER_Y-90"><children>
	<Layer Type="ActorFrame" OnCommand="y,-60"><children>
<Layer
		File="@ThemeFile('p1bg_active')"
		OnCommand="addy,110;cropbottom,0.1"
		/>
	<Layer
		File="@ThemeFile('p1bg_active')"
		OnCommand="addy,212;croptop,0.603"
		/>
	<Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize+2,ProfileImageSize+2,0,0)
            self:shadowlength(1)
            end"
            />
        <Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize-2,ProfileImageSize-2,0,0)
            self:shadowlength(1)
            self:diffuse(0,0,0,1)
            end"
            />
           <Layer
        File="@ThemeFile('ProfileIcon/userP1')"
        OnCommand="%function(self)
        self:zoomto(ProfileImageSize,ProfileImageSize,0,0);
        end"
        GainFocusCommand="%function(self)
		self:diffuse(1,1,1,1)
		end"
		LoseFocusCommand="%function(self)
		self:diffuse(0.8,0.8,0.8,1)
		end"	
        />
    </children></Layer>

	<Layer
		File="dwi2-selector.png"
		OnCommand="%function(self)
		self:diffusealpha(0)
		end"
		GainFocusCommand="%function(self)
		self:diffusealpha(0.5)
		end"
		LoseFocusCommand="%function(self)
		self:diffusealpha(0)
		end"
		/>
		
	<Layer
		Font="_sui generis"
		Text="@GetProfileName(1)"
		OnCommand="%function(self)
		self:zoom(0.8);
		self:shadowlength(1)
		end"
		/>
<Layer Type="ActorFrame" OnCommand="addy,-70"><children>
		 <Layer
            Font="_sui generis"
            Text=" "
            OnCommand="%function(self)
            self:addy(80)
            self:zoom(0.6)
            self:shadowlength(1)
            self:sleep(0.01)

            USBRemoved = false
            USBState = false

            self:queuecommand('Update')
            end"
            UpdateCommand="%function(self)

            if IsUsingMemoryCard( PLAYER_1 )  then
                self:settext( 'Using MemoryCard' )
                self:diffuse(230/255,142/255,27/255,1)
            else
                self:settext(' ')
            end

            self:sleep(0.2)
            self:queuecommand('Update')

            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Songs"
            OnCommand="x,-140;y,100;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,100;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalSongsPlayedP1 then
            	self:settext('0')
            	Pr.DWITotalSongsPlayedP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalSongsPlayedP1 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Steps"
            OnCommand="x,-140;y,118;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,118;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalStepsHitP1 then
            	self:settext('0')
            	Pr.DWITotalStepsHitP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalStepsHitP1 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Machine Perfect: 0%"
            OnCommand="x,140;y,140;zoom,0.6;shadowlength,1;diffuse,1,1,0,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            self:settext( 'Machine Perfect: '.. FormatPercentScore( GetTotalPercentComplete(STEPS_TYPE_DANCE_SINGLE))  )
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Score"
            OnCommand="x,-140;y,160;zoom,0.6;shadowlength,1;horizalign,left;sleep,0.01;queuecommand,CheckLabel"
            CheckLabelCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if Pr.DWIHighestSessionScore then
            	self:settext('Highest Session Score')
            else
            	self:settext('Highest Score')
            end
            end"
            />

        <Layer
            Font="_score"
            Text="0"
            OnCommand="x,135;y,185;zoom,1;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestScoreP1 or not Pr.DWIHighestSessionScoreP1 then
            	self:settext('          ')
            	Pr.DWIHighestScoreP1 = 0
            	Pr.DWIHighestSessionScoreP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	if Pr.DWIHighestSessionScore then
            		self:settext( string.format('% 9d', Pr.DWIHighestSessionScoreP1 ) )
            	else
            		self:settext( string.format('% 9d', Pr.DWIHighestScoreP1 ) )
            	end
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Combo"
            OnCommand="x,-140;y,210;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
		File="@ThemeFile('Combo label')"
		OnCommand="x,110;y,240;zoom,0.65"
		/>

        <Layer
            Font="Combo numbers"
            Text="0"
            OnCommand="x,80;y,235;zoom,0.6;shadowlength,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestComboP1 then
            	self:settext('0')
            	Pr.DWIHighestComboP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboP1 )
            end
            end"
            />
</children></Layer>

<Layer Type="ActorFrame" OnCommand="addy,65"><children>

        <Layer
            Font="_sui generis"
            Text="Highest Percentage"
            OnCommand="x,-140;y,125;zoom,0.6;shadowlength,1;horizalign,left"
            />

        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,135;y,125;zoom,0.6;shadowlength,1;horizalign,right;sleep,0.05;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local possible = PROFILEMAN:GetMachineProfile():GetCoursesPossible(STEPS_TYPE_DANCE_SINGLE,COURSE_DIFFICULTY_REGULAR)+
                PROFILEMAN:GetMachineProfile():GetCoursesPossible(STEPS_TYPE_DANCE_SINGLE,COURSE_DIFFICULTY_DIFFICULT)
            local actual = PROFILEMAN:GetMachineProfile():GetCoursesActual(STEPS_TYPE_DANCE_SINGLE,COURSE_DIFFICULTY_REGULAR)+
                PROFILEMAN:GetMachineProfile():GetCoursesActual(STEPS_TYPE_DANCE_SINGLE,COURSE_DIFFICULTY_DIFFICULT)
            	self:settext( string.format( '%5.2f', ( possible - actual ) ) ..'%' )
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Nonstop Score"
            OnCommand="x,-140;y,145;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
            Font="_score"
            Text="0"
            OnCommand="x,130;y,168;zoom,0.9;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.05;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestScoreNonstopP1 then
                self:settext( string.format('% 9d','0') )
                Pr.DWIHighestScoreNonstopP1 = 0
                PROFILEMAN:SaveMachineProfile()
            else
                self:settext( string.format('% 9d', Pr.DWIHighestScoreNonstopP1 ) )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Longest Time"
            OnCommand="x,-140;y,190;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
            Font="_score"
            Text="0"
            OnCommand="x,130;y,210;zoom,0.7;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.05;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWILongestTimeNonstopP1 then
                self:settext( SecondsToHHMMSS(0) )
                Pr.DWILongestTimeNonstopP1 = 0
                PROFILEMAN:SaveMachineProfile()
            else
                self:settext( SecondsToHHMMSS( Pr.DWILongestTimeNonstopP1 ) )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Nonstop Combo"
            OnCommand="x,-140;y,228;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
		File="@ThemeFile('Combo label')"
		OnCommand="x,110;y,247;zoom,0.65"
		/>

        <Layer
            Font="Combo numbers"
            Text="0"
            OnCommand="x,80;y,245;zoom,0.4;shadowlength,1;horizalign,right;sleep,0.05;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestComboNonstopP1 then
            	self:settext('0')
            	Pr.DWIHighestComboNonstopP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboNonstopP1 )
            end
            end"
            />
    </children></Layer>
</children></Layer>
<Layer
            Type="Quad"
            OnCommand="%function(self)
            self:x( SCREEN_CENTER_X+150 )
            self:y( SCREEN_CENTER_Y-100 )
            self:zoomto(ProfileImageSize+2,ProfileImageSize+2,0,0)
            self:shadowlength(1)
            end"
            />
        <Layer
            Type="Quad"
            OnCommand="%function(self)
            self:x( SCREEN_CENTER_X+150 )
            self:y( SCREEN_CENTER_Y-100 )
            self:zoomto(ProfileImageSize-2,ProfileImageSize-2,0,0)
            self:shadowlength(1)
            self:diffuse(0,0,0,1)
            end"
            />
           <Layer
        File="@ThemeFile('ProfileIcon/userP1')"
        OnCommand="%function(self)
        self:x( SCREEN_CENTER_X+150 )
        self:y( SCREEN_CENTER_Y-100 )
        self:zoomto(ProfileImageSize,ProfileImageSize,0,0);
        end"
        />
<Layer
		Font="_sui generis"
		Text="Are you sure you want to delete::this profile's content?"
		OnCommand="%function(self)
		self:x( SCREEN_CENTER_X+150 )
		self:y( SCREEN_CENTER_Y-43 )
		self:zoom(0.6);
		self:shadowlength(2);
		end"
		/>
</children></ActorFrame>