--------------------------------------------
--
-- SMART UNIT FRAME NUDE SKIN
--
--------------------------------------------
SMART_SKIN_ENABLE = true
SMART_SKIN_NAME = "Basic"
SMART_SKIN_Config = {statusStyle="steel"}
SMART_SKIN_statusStyle = {"bantobar","otravi","smooth","charcoal","sponge","water","steel"}

SUF.PartyTarget.xPos = 172

CreateFrame("Frame", "SmartUnitFrameNude", UIParent)
SmartUnitFrameNude:RegisterEvent("PLAYER_ENTERING_WORLD")
SmartUnitFrameNude:SetScript("OnEvent", function() SmartUnitFrameNude_StartUp() end)

local initialized = false

function SmartUnitFrameNude_StartUp()
	if initialized then
		return
	end

	initialized = true

	PetFrameTexture:SetAlpha(0)
	PetFrameHealthBar:SetFrameLevel(PetFrame:GetFrameLevel()+1)
	PetFrameHealthBar:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",47,-22)
	PetFrameHealthBar:SetHeight(12)
	PetFrameManaBar:SetFrameLevel(PetFrame:GetFrameLevel()+1)
	PetFrameManaBar:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",47,-34)
	PetFrameManaBar:SetHeight(5)
	CreateFrame("Frame", "SmartPetNudeFrame", PetFrame)
	SmartPetNudeFrame:SetFrameLevel(PetFrame:GetFrameLevel())
	SmartPetNudeFrame:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",42,-17)
	SmartPetNudeFrame:SetWidth(80)
	SmartPetNudeFrame:SetHeight(27)
	SmartPetNudeFrame:SetBackdrop({
		bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
		tile = true, tileSize = 16, edgeSize = 16, 
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	})
	SmartPetNudeFrame:CreateTexture("SmartPetNudeFrameTexture","BORDER")
	SmartPetNudeFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-SmallTargetingFrame.tga")
	SmartPetNudeFrameTexture:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",1,-1)
	SmartPetNudeFrameTexture:SetHeight(64)
	SmartPetNudeFrameTexture:SetWidth(128)
	CreateFrame("StatusBar", "SmartPetNudeFrameHealthBarBack", PetFrame)
	SmartPetNudeFrameHealthBarBack:SetFrameLevel(PetFrame:GetFrameLevel())
	SmartPetNudeFrameHealthBarBack:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",47,-22)
	SmartPetNudeFrameHealthBarBack:SetHeight(12)
	SmartPetNudeFrameHealthBarBack:SetWidth(70)
	SmartPetNudeFrameHealthBarBack:SetAlpha(0.4)
	CreateFrame("StatusBar", "SmartPetNudeFrameManaBarBack", PetFrame)
	SmartPetNudeFrameManaBarBack:SetFrameLevel(PetFrame:GetFrameLevel())
	SmartPetNudeFrameManaBarBack:SetPoint("TOPLEFT",PetFrame,"TOPLEFT",47,-34)
	SmartPetNudeFrameManaBarBack:SetHeight(5)
	SmartPetNudeFrameManaBarBack:SetWidth(70)
	SmartPetNudeFrameManaBarBack:SetAlpha(0.4)

	local prefix, frame, nudePrefix, nudeFrame, smartPrefix
	local healthBar, manaBar

	for id=1, MAX_PARTY_MEMBERS do
		prefix = "PartyMemberFrame"..id
		nudePrefix = "SmartPartyNudeFrame"..id
		smartPrefix = "SmartPartyTargetFrame"..id

		frame = getglobal(prefix)

		getglobal(prefix.."Texture"):SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-PartyFrame.tga")
	
		healthBar = getglobal(prefix.."HealthBar")
		healthBar:SetFrameLevel(frame:GetFrameLevel()+1)
		healthBar:SetPoint("TOPLEFT", frame, "TOPLEFT", 47, -13)
		healthBar:SetHeight(12)

		manaBar = getglobal(prefix.."ManaBar")
		manaBar:SetFrameLevel(healthBar:GetFrameLevel())
		manaBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -1)
		manaBar:SetHeight(5)

		getglobal(prefix.."MasterIcon"):SetPoint("TOPLEFT", getglobal(prefix.."MasterIcon"):GetParent(), "TOPLEFT", 29, -31)
		getglobal(prefix.."PVPIcon"):ClearAllPoints()
		getglobal(prefix.."PVPIcon"):SetPoint("TOPLEFT", getglobal(prefix.."Portrait"), "TOPLEFT", -15, -5)

		nudeFrame = CreateFrame("Frame", nudePrefix, frame)
		nudeFrame:SetFrameStrata("BACKGROUND")
		nudeFrame:SetPoint("TOPLEFT",frame,"TOPLEFT",42,-8)
		nudeFrame:SetWidth(80)
		nudeFrame:SetHeight(27)
		nudeFrame:SetBackdrop({
			bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
			edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
			tile = true, tileSize = 16, edgeSize = 16, 
			insets = { left = 5, right = 5, top = 5, bottom = 5 }
		})
		nudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)

		healthBar = CreateFrame("StatusBar", nudePrefix.."HealthBarBack", nudeFrame)
		healthBar:SetFrameLevel(nudeFrame:GetFrameLevel())
		healthBar:SetPoint("TOPLEFT", getglobal(prefix.."HealthBar"), "TOPLEFT", 0, 0)
		healthBar:SetHeight(12)
		healthBar:SetWidth(70)
		healthBar:SetAlpha(0.4)

		manaBar = CreateFrame("StatusBar", nudePrefix.."ManaBarBack", nudeFrame)
		manaBar:SetFrameLevel(nudeFrame:GetFrameLevel())
		manaBar:SetPoint("TOPLEFT", getglobal(prefix.."ManaBar"), "TOPLEFT", 0, 0)
		manaBar:SetHeight(5)
		manaBar:SetWidth(70)
		manaBar:SetAlpha(0.4)

		if (SMART_CLASSICON_ENABLE and SMART_CLASSICON_PARTY) or (IsAddOnLoaded("ClassIcons")) then
			getglobal(smartPrefix.."LevelText"):ClearAllPoints()
			getglobal(smartPrefix.."LevelText"):SetPoint("BOTTOMLEFT", getglobal(prefix.."Portrait"), "BOTTOMLEFT", 2, -2)
			getglobal(smartPrefix.."LevelText"):SetJustifyH("LEFT")
		end
	end

	for id=1, MAX_PARTY_MEMBERS do
		prefix = "PartyTargetFrame"..id
		nudePrefix = "SmartPartyTargetNudeFrame"..id
		smartPrefix = "SmartPartyTargetFrame"..id

		frame = getglobal(prefix)

		getglobal(prefix.."Texture"):SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-PartyFrame.tga")
	
		healthBar = getglobal(prefix.."HealthBar")
		healthBar:SetFrameLevel(frame:GetFrameLevel()+1)
		healthBar:SetPoint("TOPLEFT", frame, "TOPLEFT", 47, -13)
		healthBar:SetHeight(12)

		getglobal(smartPrefix.."HealthBarText"):ClearAllPoints()
		getglobal(smartPrefix.."HealthBarText"):SetPoint("LEFT",getglobal(prefix.."HealthBar"),"RIGHT",2,1)
		getglobal(smartPrefix.."HealthBarText"):SetJustifyH("CENTER")

		manaBar = getglobal(prefix.."ManaBar")
		manaBar:SetFrameLevel(healthBar:GetFrameLevel())
		manaBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -1)
		manaBar:SetHeight(5)

		getglobal(smartPrefix.."ManaBarText"):ClearAllPoints()
		getglobal(smartPrefix.."ManaBarText"):SetPoint("LEFT",getglobal(prefix.."ManaBar"),"RIGHT",2,1)
		getglobal(smartPrefix.."ManaBarText"):SetJustifyH("CENTER")

		getglobal(prefix.."PVPIcon"):ClearAllPoints()
		getglobal(prefix.."PVPIcon"):SetPoint("TOPLEFT", getglobal(prefix.."Portrait"), "TOPLEFT", -15, -5)

		nudeFrame = CreateFrame("Frame", nudePrefix, frame)
		nudeFrame:SetFrameStrata("BACKGROUND")
		nudeFrame:SetPoint("TOPLEFT",frame,"TOPLEFT",42,-8)
		nudeFrame:SetWidth(80)
		nudeFrame:SetHeight(27)
		nudeFrame:SetBackdrop({
			bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
			edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
			tile = true, tileSize = 16, edgeSize = 16, 
			insets = { left = 5, right = 5, top = 5, bottom = 5 }
		})
		nudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)
	
		healthBar = CreateFrame("StatusBar", nudePrefix.."HealthBarBack", nudeFrame)
		healthBar:SetFrameLevel(nudeFrame:GetFrameLevel())
		healthBar:SetPoint("TOPLEFT", getglobal(prefix.."HealthBar"), "TOPLEFT", 0, 0)
		healthBar:SetHeight(12)
		healthBar:SetWidth(70)
		healthBar:SetAlpha(0.4)

		manaBar = CreateFrame("StatusBar", nudePrefix.."ManaBarBack", nudeFrame)
		manaBar:SetFrameLevel(nudeFrame:GetFrameLevel())
		manaBar:SetPoint("TOPLEFT", getglobal(prefix.."ManaBar"), "TOPLEFT", 0, 0)
		manaBar:SetHeight(5)
		manaBar:SetWidth(70)
		manaBar:SetAlpha(0.4)

		if (SMART_CLASSICON_ENABLE and SMART_CLASSICON_PARTY) or (IsAddOnLoaded("ClassIcons")) then
			getglobal(smartPrefix.."LevelText"):ClearAllPoints()
			getglobal(smartPrefix.."LevelText"):SetPoint("BOTTOMLEFT", getglobal(prefix.."Portrait"), "BOTTOMLEFT", 2, -2)
			getglobal(smartPrefix.."LevelText"):SetJustifyH("LEFT")
		end
	end

	PlayerFrameBackground:SetAlpha(0)
	PlayerLevelText:SetPoint("CENTER", PlayerLevelText:GetParent(), "CENTER", -62, -16)
	PlayerRestIcon:ClearAllPoints()
	PlayerRestIcon:SetPoint("CENTER", PlayerLevelText, "CENTER", 0, 0)
	PlayerAttackBackground:ClearAllPoints()
	PlayerAttackBackground:SetPoint("TOPLEFT", PlayerRestIcon, "TOPLEFT", 0, 0)
	PlayerPortrait:SetPoint("TOPLEFT", PlayerFrame, "TOPLEFT",41, -11)
	PlayerFrameHealthBar:SetFrameLevel(PlayerFrame:GetFrameLevel()+1)
	PlayerFrameHealthBar:SetHeight(16)
	PlayerFrameHealthBar:SetWidth(120)
	PlayerFrameManaBar:SetFrameLevel(PlayerFrame:GetFrameLevel()+1)
	PlayerFrameManaBar:SetPoint("TOPLEFT",PlayerFrame,"TOPLEFT",106,-57)
	PlayerFrameManaBar:SetHeight(7)
	PlayerFrameManaBar:SetWidth(120)
	CreateFrame("Frame", "SmartPlayerNudeFrame", PlayerFrame)
	SmartPlayerNudeFrame:SetFrameLevel(PlayerFrame:GetFrameLevel())
	SmartPlayerNudeFrame:SetPoint("TOPLEFT",PlayerFrame,"TOPLEFT",101,-17)
	SmartPlayerNudeFrame:SetWidth(130)
	SmartPlayerNudeFrame:SetHeight(52)
	SmartPlayerNudeFrame:SetBackdrop({
		bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
		tile = true, tileSize = 16, edgeSize = 16, 
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	})
	CreateFrame("StatusBar", "SmartPlayerNudeFrameHealthBarBack", PlayerFrame)
	SmartPlayerNudeFrameHealthBarBack:SetFrameLevel(PlayerFrame:GetFrameLevel())
	SmartPlayerNudeFrameHealthBarBack:SetPoint("TOPLEFT",PlayerFrame,"TOPLEFT",106,-41)
	SmartPlayerNudeFrameHealthBarBack:SetHeight(16)
	SmartPlayerNudeFrameHealthBarBack:SetWidth(120)
	SmartPlayerNudeFrameHealthBarBack:SetAlpha(0.4)
	CreateFrame("StatusBar", "SmartPlayerNudeFrameManaBarBack", PlayerFrame)
	SmartPlayerNudeFrameManaBarBack:SetFrameLevel(PlayerFrame:GetFrameLevel())
	SmartPlayerNudeFrameManaBarBack:SetPoint("TOPLEFT",PlayerFrame,"TOPLEFT",106,-57)
	SmartPlayerNudeFrameManaBarBack:SetHeight(7)
	SmartPlayerNudeFrameManaBarBack:SetWidth(120)
	SmartPlayerNudeFrameManaBarBack:SetAlpha(0.4)

	PlayerFrameGroupIndicator:SetPoint("BOTTOMLEFT",PlayerFrameGroupIndicator:GetParent(),"TOPLEFT",97,-19)

	TargetFrameAggroIndicator:SetPoint("BOTTOMLEFT",SmartTargetFrame,"TOPLEFT",4,-19)
	TargetFrameGroupIndicator:SetPoint("BOTTOMLEFT",SmartTargetFrame,"TOPLEFT",4,-19)
	TargetFrameClassIndicator:SetPoint("BOTTOMRIGHT",SmartTargetFrame,"TOPRIGHT",-97,-19)

	TargetFrameFlash:Hide()
	TargetFrameTextureFrame:CreateTexture("TargetFocusIcon","ARTWORK")
	TargetFocusIcon:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-SmallIcon-Star.tga")
	TargetFocusIcon:SetPoint("CENTER",TargetPortrait,"TOPRIGHT",0,0)
	TargetFocusIcon:SetWidth(16)
	TargetFocusIcon:SetHeight(16)
	TargetFocusIcon:Hide()
	TargetLevelText:SetPoint("CENTER",TargetLevelText:GetParent(),"CENTER",62,-16)
	TargetHighLevelTexture:SetPoint("CENTER",TargetHighLevelTexture:GetParent(),"CENTER",62,-16)
	TargetPortrait:SetPoint("TOPRIGHT",TargetFrame,"TOPRIGHT",-41,-11)
	TargetFrameBackground:SetAlpha(0)
	TargetFrameNameBackground:SetWidth(120)
	TargetFrameHealthBar:SetFrameLevel(TargetFrame:GetFrameLevel()+1)
	TargetFrameHealthBar:SetHeight(16)
	TargetFrameHealthBar:SetWidth(120)
	TargetFrameManaBar:SetFrameLevel(TargetFrame:GetFrameLevel()+1)
	TargetFrameManaBar:SetPoint("TOPRIGHT",TargetFrame,"TOPRIGHT",-106,-57)
	TargetFrameManaBar:SetHeight(7)
	TargetFrameManaBar:SetWidth(120)
	CreateFrame("Frame", "SmartTargetNudeFrame", TargetFrame)
	SmartTargetNudeFrame:SetFrameLevel(TargetFrame:GetFrameLevel())
	SmartTargetNudeFrame:SetPoint("TOPRIGHT",TargetFrame,"TOPRIGHT",-101,-17)
	SmartTargetNudeFrame:SetWidth(130)
	SmartTargetNudeFrame:SetHeight(52)
	SmartTargetNudeFrame:SetBackdrop({
		bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
		tile = true, tileSize = 16, edgeSize = 16, 
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	})
	CreateFrame("StatusBar", "SmartTargetNudeFrameHealthBarBack", TargetFrame)
	SmartTargetNudeFrameHealthBarBack:SetFrameLevel(TargetFrame:GetFrameLevel())
	SmartTargetNudeFrameHealthBarBack:SetPoint("TOPRIGHT",TargetFrame,"TOPRIGHT",-106,-41)
	SmartTargetNudeFrameHealthBarBack:SetHeight(16)
	SmartTargetNudeFrameHealthBarBack:SetWidth(120)
	SmartTargetNudeFrameHealthBarBack:SetAlpha(0.4)
	CreateFrame("StatusBar", "SmartTargetNudeFrameManaBarBack", TargetFrame)
	SmartTargetNudeFrameManaBarBack:SetFrameLevel(TargetFrame:GetFrameLevel())
	SmartTargetNudeFrameManaBarBack:SetPoint("TOPRIGHT",TargetFrame,"TOPRIGHT",-106,-57)
	SmartTargetNudeFrameManaBarBack:SetHeight(7)
	SmartTargetNudeFrameManaBarBack:SetWidth(120)
	SmartTargetNudeFrameManaBarBack:SetAlpha(0.4)

	SmartToTBackground:SetAlpha(0)
	SmartToTTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetofTargetFrame.tga")
	if getglobal("Adapt") then
		SmartToTPortrait:SetPoint("TOPLEFT",SmartToTFrame,"TOPLEFT",4,-3)
	end
	SmartToTHealthBar:SetFrameLevel(SmartToTFrame:GetFrameLevel()+1)
	SmartToTHealthBar:SetPoint("TOPRIGHT",SmartToTFrame,"TOPRIGHT",-2,-14)
	SmartToTHealthBar:SetHeight(12)
	SmartToTManaBar:SetFrameLevel(SmartToTFrame:GetFrameLevel()+1)
	SmartToTManaBar:SetPoint("TOPRIGHT",SmartToTFrame,"TOPRIGHT",-2,-26)
	SmartToTManaBar:SetHeight(5)
	CreateFrame("Frame", "SmartToTNudeFrame", SmartToTFrame)
	SmartToTNudeFrame:SetFrameLevel(SmartToTFrame:GetFrameLevel())
	SmartToTNudeFrame:SetPoint("TOPRIGHT",SmartToTFrame,"TOPRIGHT",3,-9)
	SmartToTNudeFrame:SetWidth(56)
	SmartToTNudeFrame:SetHeight(27)
	SmartToTNudeFrame:SetBackdrop({
		bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
		tile = true, tileSize = 16, edgeSize = 16, 
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	})
	CreateFrame("StatusBar", "SmartToTNudeFrameHealthBarBack", SmartToTFrame)
	SmartToTNudeFrameHealthBarBack:SetFrameLevel(SmartToTFrame:GetFrameLevel())
	SmartToTNudeFrameHealthBarBack:SetPoint("TOPRIGHT",SmartToTFrame,"TOPRIGHT",-2,-14)
	SmartToTNudeFrameHealthBarBack:SetHeight(12)
	SmartToTNudeFrameHealthBarBack:SetWidth(46)
	SmartToTNudeFrameHealthBarBack:SetAlpha(0.4)
	CreateFrame("StatusBar", "SmartToTNudeFrameManaBarBack", SmartToTFrame)
	SmartToTNudeFrameManaBarBack:SetFrameLevel(SmartToTFrame:GetFrameLevel())
	SmartToTNudeFrameManaBarBack:SetPoint("TOPRIGHT",SmartToTFrame,"TOPRIGHT",-2,-26)
	SmartToTNudeFrameManaBarBack:SetHeight(5)
	SmartToTNudeFrameManaBarBack:SetWidth(46)
	SmartToTNudeFrameManaBarBack:SetAlpha(0.4)

	SmartToTTBackground:SetAlpha(0)
	SmartToTTTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetofTargetFrame.tga")
	if getglobal("Adapt") then
		SmartToTTPortrait:SetPoint("TOPLEFT",SmartToTTFrame,"TOPLEFT",4,-3)
	end
	SmartToTTHealthBar:SetFrameLevel(SmartToTTFrame:GetFrameLevel()+1)
	SmartToTTHealthBar:SetPoint("TOPRIGHT",SmartToTTFrame,"TOPRIGHT",-2,-14)
	SmartToTTHealthBar:SetHeight(12)
	SmartToTTManaBar:SetFrameLevel(SmartToTTFrame:GetFrameLevel()+1)
	SmartToTTManaBar:SetPoint("TOPRIGHT",SmartToTTFrame,"TOPRIGHT",-2,-26)
	SmartToTTManaBar:SetHeight(5)
	CreateFrame("Frame", "SmartToTTNudeFrame", SmartToTTFrame)
	SmartToTTNudeFrame:SetFrameLevel(SmartToTTFrame:GetFrameLevel())
	SmartToTTNudeFrame:SetPoint("TOPRIGHT",SmartToTTFrame,"TOPRIGHT",3,-9)
	SmartToTTNudeFrame:SetWidth(56)
	SmartToTTNudeFrame:SetHeight(27)
	SmartToTTNudeFrame:SetBackdrop({
		bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
		tile = true, tileSize = 16, edgeSize = 16, 
		insets = { left = 5, right = 5, top = 5, bottom = 5 }
	})
	CreateFrame("StatusBar", "SmartToTTNudeFrameHealthBarBack", SmartToTTFrame)
	SmartToTTNudeFrameHealthBarBack:SetFrameLevel(SmartToTTFrame:GetFrameLevel())
	SmartToTTNudeFrameHealthBarBack:SetPoint("TOPRIGHT",SmartToTTFrame,"TOPRIGHT",-2,-14)
	SmartToTTNudeFrameHealthBarBack:SetHeight(12)
	SmartToTTNudeFrameHealthBarBack:SetWidth(46)
	SmartToTTNudeFrameHealthBarBack:SetAlpha(0.4)
	CreateFrame("StatusBar", "SmartToTTNudeFrameManaBarBack", SmartToTTFrame)
	SmartToTTNudeFrameManaBarBack:SetFrameLevel(SmartToTTFrame:GetFrameLevel())
	SmartToTTNudeFrameManaBarBack:SetPoint("TOPRIGHT",SmartToTTFrame,"TOPRIGHT",-2,-26)
	SmartToTTNudeFrameManaBarBack:SetHeight(5)
	SmartToTTNudeFrameManaBarBack:SetWidth(46)
	SmartToTTNudeFrameManaBarBack:SetAlpha(0.4)

	SmartPlayer_OnEvent = SmartPlayerNude_OnEvent
	if SMART_PLAYER_Config.elite then
		if SMART_PLAYER_Config.rare then
			PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-RareNude.tga")
			SmartPlayerNudeFrame:SetBackdropBorderColor(0.5,0.82,1)
		else
			PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-EliteNude.tga")
			SmartPlayerNudeFrame:SetBackdropBorderColor(1,0.82,0)
		end
	else
		PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-Nude.tga")
		SmartPlayerNudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)
	end
	TargetFrame_CheckClassification = SmartTargetNude_CheckClassification

	if SMART_FOCUS_ENABLE then

		SmartFocusFrameGroupIndicator:SetPoint("BOTTOMLEFT",SmartFocusFrameGroupIndicator:GetParent(),"TOPLEFT",4,-19)
		SmartFocusFrameClassIndicator:SetPoint("BOTTOMRIGHT",SmartFocusFrameGroupIndicator:GetParent(),"TOPRIGHT",-97,-19)

		SmartFocusLevelText:SetPoint("CENTER",SmartFocusHighLevelTexture:GetParent(),"CENTER",62,-16)
		SmartFocusHighLevelTexture:SetPoint("CENTER",SmartFocusHighLevelTexture:GetParent(),"CENTER",62,-16)
		SmartFocusPortrait:SetPoint("TOPRIGHT",SmartFocusFrame,"TOPRIGHT",-41,-11)
		SmartFocusFrameBackground:SetAlpha(0)
		SmartFocusFrameNameBackground:SetWidth(120)
		SmartFocusFrameStatusBarText:SetFrameLevel(SmartFocusFrame:GetFrameLevel()+1)
		SmartFocusFrameHealthBar:SetFrameLevel(SmartFocusFrame:GetFrameLevel()+1)
		SmartFocusFrameHealthBar:SetHeight(16)
		SmartFocusFrameHealthBar:SetWidth(120)
		SmartFocusFrameHealthBar:SetHitRectInsets(0,120,0,16)
		SmartFocusFrameManaBar:SetFrameLevel(SmartFocusFrame:GetFrameLevel()+1)
		SmartFocusFrameManaBar:SetPoint("TOPRIGHT",SmartFocusFrame,"TOPRIGHT",-106,-57)
		SmartFocusFrameManaBar:SetHeight(7)
		SmartFocusFrameManaBar:SetWidth(120)
		CreateFrame("Frame", "SmartFocusNudeFrame", SmartFocusFrame)
		SmartFocusNudeFrame:SetFrameLevel(SmartFocusFrame:GetFrameLevel())
		SmartFocusNudeFrame:SetPoint("TOPRIGHT",SmartFocusFrame,"TOPRIGHT",-101,-17)
		SmartFocusNudeFrame:SetWidth(130)
		SmartFocusNudeFrame:SetHeight(52)
		SmartFocusNudeFrame:SetBackdrop({
			bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
			edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
			tile = true, tileSize = 16, edgeSize = 16, 
			insets = { left = 5, right = 5, top = 5, bottom = 5 }
		})
		CreateFrame("StatusBar", "SmartFocusNudeFrameHealthBarBack", SmartFocusFrame)
		SmartFocusNudeFrameHealthBarBack:SetFrameLevel(SmartFocusFrame:GetFrameLevel())
		SmartFocusNudeFrameHealthBarBack:SetPoint("TOPRIGHT",SmartFocusFrame,"TOPRIGHT",-106,-41)
		SmartFocusNudeFrameHealthBarBack:SetHeight(16)
		SmartFocusNudeFrameHealthBarBack:SetWidth(120)
		SmartFocusNudeFrameHealthBarBack:SetAlpha(0.4)
		CreateFrame("StatusBar", "SmartFocusNudeFrameManaBarBack", SmartFocusFrame)
		SmartFocusNudeFrameManaBarBack:SetFrameLevel(SmartFocusFrame:GetFrameLevel())
		SmartFocusNudeFrameManaBarBack:SetPoint("TOPRIGHT",SmartFocusFrame,"TOPRIGHT",-106,-57)
		SmartFocusNudeFrameManaBarBack:SetHeight(7)
		SmartFocusNudeFrameManaBarBack:SetWidth(120)
		SmartFocusNudeFrameManaBarBack:SetAlpha(0.4)
		SmartFocusFrame_CheckClassification = SmartFocusNude_CheckClassification
		if UnitExists("focus") then
			SmartFocusFrame_CheckClassification()
		end
	end
	SmartUnitFrameNude_StatusBarChange()
end

function SmartUnitFrameNude_StatusBarChange()
	local statusBarTexture = "Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\StatusBar\\"..SMART_SKIN_Config.statusStyle..".tga"

	PetFrameHealthBar:SetStatusBarTexture(statusBarTexture)
	PetFrameManaBar:SetStatusBarTexture(statusBarTexture)
	SmartPetNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
	SmartPetNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)

	for id=1, MAX_PARTY_MEMBERS do
		getglobal("PartyMemberFrame"..id.."ManaBar"):SetStatusBarTexture(statusBarTexture)
		getglobal("PartyMemberFrame"..id.."HealthBar"):SetStatusBarTexture(statusBarTexture)
		getglobal("SmartPartyNudeFrame"..id.."HealthBarBack"):SetStatusBarTexture(statusBarTexture)
		getglobal("SmartPartyNudeFrame"..id.."ManaBarBack"):SetStatusBarTexture(statusBarTexture)
	end

	for id=1, MAX_PARTY_MEMBERS do
		getglobal("PartyTargetFrame"..id.."ManaBar"):SetStatusBarTexture(statusBarTexture)
		getglobal("PartyTargetFrame"..id.."HealthBar"):SetStatusBarTexture(statusBarTexture)
		getglobal("SmartPartyTargetNudeFrame"..id.."HealthBarBack"):SetStatusBarTexture(statusBarTexture)
		getglobal("SmartPartyTargetNudeFrame"..id.."ManaBarBack"):SetStatusBarTexture(statusBarTexture)
	end

	PlayerFrameHealthBar:SetStatusBarTexture(statusBarTexture)
	PlayerFrameManaBar:SetStatusBarTexture(statusBarTexture)
	SmartPlayerNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
	SmartPlayerNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)

	TargetFrameHealthBar:SetStatusBarTexture(statusBarTexture)
	TargetFrameManaBar:SetStatusBarTexture(statusBarTexture)
	SmartTargetNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
	SmartTargetNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)

	SmartToTHealthBar:SetStatusBarTexture(statusBarTexture)
	SmartToTManaBar:SetStatusBarTexture(statusBarTexture)
	SmartToTNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
	SmartToTNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)

	SmartToTTHealthBar:SetStatusBarTexture(statusBarTexture)
	SmartToTTManaBar:SetStatusBarTexture(statusBarTexture)
	SmartToTTNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
	SmartToTTNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)

	if SMART_FOCUS_ENABLE then
		SmartFocusFrameHealthBar:SetStatusBarTexture(statusBarTexture)
		SmartFocusFrameManaBar:SetStatusBarTexture(statusBarTexture)
		SmartFocusNudeFrameHealthBarBack:SetStatusBarTexture(statusBarTexture)
		SmartFocusNudeFrameManaBarBack:SetStatusBarTexture(statusBarTexture)
	end
end

function TargetFrame_CheckFocus()
	if ( UnitIsUnit("target","focus") ) then
		TargetFocusIcon:Show()
	else
		TargetFocusIcon:Hide()
	end
end

function SmartTargetNude_CheckClassification()
	local classification = UnitClassification("target")
	if ( classification == "worldboss" ) or ( classification == "rareelite"  ) or ( classification == "elite"  ) then
		TargetFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-EliteNude.tga")
		SmartTargetNudeFrame:SetBackdropBorderColor(1,0.82,0)
	elseif ( classification == "rare"  ) then
		TargetFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-RareNude.tga")
		SmartTargetNudeFrame:SetBackdropBorderColor(0.5,0.82,1)
	else
		TargetFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-Nude.tga")
		SmartTargetNudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)
	end
end

function SmartFocusNude_CheckClassification()
	local classification = UnitClassification("focus")
	if ( classification == "worldboss" ) or ( classification == "rareelite"  ) or ( classification == "elite"  ) then
		SmartFocusFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-EliteNude.tga")
		SmartFocusNudeFrame:SetBackdropBorderColor(1,0.82,0)
	elseif ( classification == "rare"  ) then
		SmartFocusFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-RareNude.tga")
		SmartFocusNudeFrame:SetBackdropBorderColor(0.5,0.82,1)
	else
		SmartFocusFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-Nude.tga")
		SmartFocusNudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)
	end
end

function SmartPlayerNude_OnEvent(event)
	if (event == "PLAYER_ENTERING_WORLD") then
		if SMART_PLAYER_Config.elite then
			if SMART_PLAYER_Config.rare then
				PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-RareNude.tga")
				SmartPlayerNudeFrame:SetBackdropBorderColor(0.5,0.82,1)
			else
				PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-EliteNude.tga")
				SmartPlayerNudeFrame:SetBackdropBorderColor(1,0.82,0)
			end
		else
			PlayerFrameTexture:SetTexture("Interface\\AddOns\\SmartUnitSkin_"..SMART_SKIN_NAME.."\\UI-TargetingFrame-Nude.tga")
			SmartPlayerNudeFrame:SetBackdropBorderColor(0.75,0.75,0.75)
		end
		SmartPlayer_HealthUpdate()
		SmartPlayer_ManaUpdate()
		if UnitExists("pet") then
			SmartPlayerPet_HealthUpdate()
			SmartPlayerPet_ManaUpdate()
		end
		if not PartyMemberFrame1:IsUserPlaced() then
			SmartParty_ResetPosition()
		end
		SmartPartyTarget_ResetPosition()
	elseif (event == "VARIABLES_LOADED") then
		if not PlayerFrame:IsUserPlaced() then
			SmartPlayer_ResetPosition()
		end
		SmartPlayer_PetFramePosition()
	elseif (event == "UNIT_PET") then
		if (arg1 == "player") then
			if UnitExists("pet") then
				SmartPlayerPet_HealthUpdate()
				SmartPlayerPet_ManaUpdate()
			end
			if not PartyMemberFrame1:IsUserPlaced() then
				SmartParty_ResetPosition()
			end
			SmartPartyTarget_ResetPosition()
		end
	elseif (event == "UNIT_COMBAT") then
		if (arg1 == "player") then
			SmartPlayer_HealthUpdate()
			SmartPlayer_ManaUpdate()
		end
		if (arg1 == "pet") then
			SmartPlayerPet_HealthUpdate()
			SmartPlayerPet_ManaUpdate()
		end
	elseif (event == "UNIT_HEALTH") or (event == "UNIT_MAXHEALTH") then
		if (arg1 == "player") then
			SmartPlayer_HealthUpdate()
		end
		if (arg1 == "pet") then
			SmartPlayerPet_HealthUpdate()
		end
	elseif (event == "UNIT_DISPLAYPOWER") or (event == "UNIT_FOCUS") or (event == "UNIT_MANA") or (event == "UNIT_RAGE") or (event == "UNIT_ENERGY")  or (event == "UNIT_MAXFOCUS") or (event == "UNIT_MAXMANA") or (event == "UNIT_MAXRAGE") or (event == "UNIT_MAXENERGY")then
		if (arg1 == "player") then
			SmartPlayer_ManaUpdate()
		end
		if (arg1 == "pet") then
			SmartPlayerPet_ManaUpdate()
		end
	end
end
