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

	<Layer Type="ActorFrame" OnCommand="y,-60"><children>
<Layer
		File="@ThemeFile('p2bg_active')"
		OnCommand="addy,110;cropbottom,0.1"
		/>
	<Layer
		File="@ThemeFile('p2bg_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/userP2')"
        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(2)"
		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

            --[[
            if IsUsingMemoryCard( PLAYER_1 ) and USBState == false and USBRemoved == false then
                self:settext( 'Using MemoryCard' )
                self:diffuse(230/255,142/255,27/255,1)
                USBState = true;
                USBRemoved = false;
            end

            if not IsUsingMemoryCard( PLAYER_1 ) and USBState == true and USBRemoved == false then
                self:settext('MemoryCard Removed')
                self:diffuse(230/255,0/255,27/255,1)
                USBState = false;
                USBRemoved = true;
            end

            if not IsUsingMemoryCard( PLAYER_1 ) and not USBState == false and not USBRemoved == true then
                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.DWITotalSongsPlayedP2 then
            	self:settext('0')
            	Pr.DWITotalSongsPlayedP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalSongsPlayedP2 )
            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.DWITotalStepsHitP2 then
            	self:settext('0')
            	Pr.DWITotalStepsHitP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalStepsHitP2 )
            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.DWIHighestScoreP2 or not Pr.DWIHighestSessionScoreP2 then
            	self:settext('          ')
            	Pr.DWIHighestScoreP2 = 0
            	Pr.DWIHighestSessionScoreP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	if Pr.DWIHighestSessionScore then
            		self:settext( string.format('% 9d', Pr.DWIHighestSessionScoreP2 ) )
            	else
            		self:settext( string.format('% 9d', Pr.DWIHighestScoreP2 ) )
            	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.DWIHighestComboP2 then
            	self:settext('0')
            	Pr.DWIHighestComboP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboP2 )
            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.DWIHighestScoreNonstopP2 then
                self:settext( string.format('% 9d','0') )
                Pr.DWIHighestScoreNonstopP2 = 0
                PROFILEMAN:SaveMachineProfile()
            else
                self:settext( string.format('% 9d', Pr.DWIHighestScoreNonstopP2 ) )
            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.DWILongestTimeNonstopP2 then
                self:settext( SecondsToHHMMSS(0) )
                Pr.DWILongestTimeNonstopP2 = 0
                PROFILEMAN:SaveMachineProfile()
            else
                self:settext( SecondsToHHMMSS( Pr.DWILongestTimeNonstopP2 ) )
            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.DWIHighestComboNonstopP2 then
            	self:settext('0')
            	Pr.DWIHighestComboNonstopP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboNonstopP2 )
            end
            end"
            />
    </children></Layer>
<!--
	<Layer
		Font="_sui generis"
		Text="Data1"
		OnCommand="%function(self)
		self:zoom(0.5);
		self:y(50)
		self:shadowlength(1)

		local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalSongsPlayedP2 then
            	self:settext('0')
            	Pr.DWITotalSongsPlayedP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext('Total Songs Played: '.. Pr.DWITotalSongsPlayedP2 )
            end

		end"
		/>

	<Layer
		Font="_sui generis"
		Text="Data1"
		OnCommand="%function(self)
		self:zoom(0.5);
		self:y(50*1.28)
		self:shadowlength(1)

		local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalStepsHitP2 then
            	self:settext('0')
            	Pr.DWITotalStepsHitP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( 'Total Steps Hit: '.. Pr.DWITotalStepsHitP2 )
            end

		end"
		/>

	<Layer
		Font="_sui generis"
		Text="Data1"
		OnCommand="%function(self)
		self:zoom(0.5);
		self:y(50*1.54)
		self:shadowlength(1)

		local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestScoreP2 or not Pr.DWIHighestSessionScoreP2 then
            	self:settext('          ')
            	Pr.DWIHighestScoreP2 = 0
            	Pr.DWIHighestSessionScoreP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	if Pr.DWIHighestSessionScore then
            		self:settext( 'Total Score: '.. Pr.DWIHighestSessionScoreP2 )
            	else
            		self:settext( 'Total Score: '.. Pr.DWIHighestScoreP2 )
            	end
            end

		end"
		/>
	-->
	</children></ActorFrame>