function FrettaPanelTest(ply)
Msg("Shit balls")
local testpanel = nil
		testpanel = vgui.CreateFromTable( vgui_Splash )
		testpanel:SetHeaderText( "Ship Selection" )
local xsize = 500
local ysize = 400

local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( testpanel )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( xsize - 20, ysize - 10 )
PropertySheet:SetSkin(GAMEMODE.HudSkin)
local Prop1 = vgui.Create( "DPanel" )
Prop1:SetParent( testpanel )
Prop1:SetPos( 5, 30 )
Prop1:SetSize( xsize - 20, ysize - 10 )
Prop1:SetName("Shit1")
Prop1:SetSkin(GAMEMODE.HudSkin)
local Prop2 = vgui.Create( "DPanel" )
Prop2:SetParent( testpanel )
Prop2:SetPos( 5, 30 )
Prop2:SetSize( xsize - 20, ysize - 10 )
Prop2:SetName("Shit2")
Prop2:SetSkin(GAMEMODE.HudSkin)
local Prop3 = vgui.Create( "DPanel" )
Prop3:SetParent( testpanel )
Prop3:SetPos( 5, 30 )
Prop3:SetSize( xsize - 20, ysize - 10 )
Prop3:SetName("Shit3")
Prop3:SetSkin(GAMEMODE.HudSkin)
PropertySheet:AddSheet( "Light", Prop1, "gui/silkicons/user", false, false, "Fighter sized" )
PropertySheet:AddSheet( "Medium",  Prop2, "gui/silkicons/wrench", false, false, "Destroyers and Cruisers" )
PropertySheet:AddSheet( "Heavy", Prop3, "gui/silkicons/world", false, false, "Battleships and such." )
PropertySheet.Think = function() 
	if Prop1:IsVisible() then
	SelectedShipType = 1
	elseif Prop2:IsVisible() then
	SelectedShipType = 2
	elseif Prop3:IsVisible() then
	SelectedShipType = 3
	end
	PropertySheet.animFade:Run()
end
opened = 0

local LightPanelList = vgui.Create("DListView",Prop1)
LightPanelList:SetPos(25, 30)
LightPanelList:SetSize(ScrW()*0.35, 240)
LightPanelList:SetMultiSelect(false)
LightPanelList:SetSkin(GAMEMODE.HudSkin)
local col1 = LightPanelList:AddColumn("Ship Name")
local col2 = LightPanelList:AddColumn("Description")
local col3 = LightPanelList:AddColumn("ID")
col1:PerformLayout()
col2:PerformLayout()
col3:SetFixedWidth(0)
col3:PerformLayout()
LightPanelList:SetSortable(true)
LightPanelList.OnClickLine = function(parent,selected,isselected)
SSPanelCall(selected:GetValue(1),selected:GetValue(3))
end  


local MidPanelList = vgui.Create("DListView",Prop2)
MidPanelList:SetPos(25, 30)
MidPanelList:SetSize(ScrW()*0.35, 240)
MidPanelList:SetMultiSelect(false)
MidPanelList:SetSkin(GAMEMODE.HudSkin)
local col1 = MidPanelList:AddColumn("Ship Name")
local col2 = MidPanelList:AddColumn("Description")
local col3 = MidPanelList:AddColumn("ID")
col1:PerformLayout()
col2:PerformLayout()
col3:SetFixedWidth(0)
col3:PerformLayout()
MidPanelList:SetSortable(true)
MidPanelList.OnClickLine = function(parent,selected,isselected)
SSPanelCall(selected:GetValue(1),selected:GetValue(3))
end

local HeavyPanelList = vgui.Create("DListView",Prop3)
HeavyPanelList:SetPos(25, 30)
HeavyPanelList:SetSize(ScrW()*0.35, 240)
HeavyPanelList:SetMultiSelect(false)
HeavyPanelList:SetSkin(GAMEMODE.HudSkin)
local col1 = HeavyPanelList:AddColumn("Ship Name")
local col2 = HeavyPanelList:AddColumn("Description")
local col3 = HeavyPanelList:AddColumn("ID")
col1:PerformLayout()
col2:PerformLayout()
col3:SetFixedWidth(0)
col3:PerformLayout()
HeavyPanelList:SetSortable(true)
HeavyPanelList.OnClickLine = function(parent,selected,isselected)
SSPanelCall(selected:GetValue(1),selected:GetValue(3))
end
--local scroller = vgui.Create("DHorizontalScroller", DermaPanel)
--scroller:AddPanel(MidPanelList)
	for k,v in pairs(ShipTypes[1]) do
	LightPanelList:AddLine(v["Name"], v["Description"], k)
	end
	for k,v in pairs(ShipTypes[2]) do
	MidPanelList:AddLine(v["Name"], v["Description"], k)
	end
	for k,v in pairs(ShipTypes[3]) do
	HeavyPanelList:AddLine(v["Name"], v["Description"], k)
	end
	testpanel:AddCancelButton()
testpanel:MakePopup()
end

function SSPanelCall(Replacer, ID)
    if opened == 1 then
    xp,yp = ShipSelectFrame:GetPos()
    ShipSelectFrame:Remove()
    end
SSPanel(Replacer,xp, yp, ID)
end

function SSPanel(Name, XPos, YPos,ID)
opened = 1
	if Name == nil then
	Name = "??"
	end


	if XPos == nil || YPos == nil then
	XPos = 25
	YPos = 425
	end

ShipSelectFrame = vgui.Create( "DFrame", testpanel ) -- Creates the frame itself
ShipSelectFrame:SetPos( XPos, YPos ) -- Position on the players screen
ShipSelectFrame:SetSize( 500, 300 ) -- Size of the frame
ShipSelectFrame:SetTitle( Name )
ShipSelectFrame:SetVisible( true )
ShipSelectFrame:SetSizable(true)
ShipSelectFrame:SetDraggable( true ) -- Draggable by mouse?
ShipSelectFrame:ShowCloseButton( true ) -- Show the close button?
ShipSelectFrame:SetSkin(GAMEMODE.HudSkin)
ShipSelectFrame:MakePopup() -- Show the frame

local CostLabel = vgui.Create("DLabel", ShipSelectFrame)
CostLabel:SetText("Cost: " .. ShipTypes[SelectedShipType][ID]["Cost"])
CostLabel:SetPos(10,25)
CostLabel:SizeToContents()
local HullStrengthLabel = vgui.Create("DLabel", ShipSelectFrame)
HullStrengthLabel:SetText("Hull Armor: " .. ShipTypes[SelectedShipType][ID]["Hull"])
HullStrengthLabel:SetPos(10,40)
HullStrengthLabel:SizeToContents()
local ShieldStrengthLabel = vgui.Create("DLabel", ShipSelectFrame)
ShieldStrengthLabel:SetText("Shield Strength: " .. ShipTypes[SelectedShipType][ID]["Shields"])
ShieldStrengthLabel:SetPos(10,55)
ShieldStrengthLabel:SizeToContents()
local ShieldRegenLabel = vgui.Create("DLabel", ShipSelectFrame)
ShieldRegenLabel:SetPos(10,70)
ShieldRegenLabel:SetText("Shield Regen: " .. ShipTypes[SelectedShipType][ID]["ShieldRegen"])
ShieldRegenLabel:SizeToContents()
local HardPointsLabel = vgui.Create("DLabel", ShipSelectFrame)
HardPointsLabel:SetPos(10,85)
HardPointsLabel:SetText("Hardpoints: " .. #ShipTypes[SelectedShipType][ID]["Hardpoints"])
HardPointsLabel:SizeToContents()

local LastX = 150
local LastY = 25
HardpointChoice = {}
local HardpointLabels = {}
	for i=1, 10 do
	HardpointChoice[i] = 1
	HardpointLabels[i] = ""
	end
	
local HardpointMenus = {}

	for k,v in pairs (ShipTypes[SelectedShipType][ID]["Hardpoints"]) do
	LastY = LastY + 10
		if k == 6 || k == 12 then
		LastX = LastX + 150
		LastY = 35
		end
	HardpointLabels[k] = vgui.Create("DLabel", ShipSelectFrame)
	HardpointLabels[k]:SetPos(LastX, LastY)
	HardpointLabels[k]:SetText(ShipTypes[SelectedShipType][ID]["HardpointNames"][k])
	HardpointLabels[k]:SizeToContents()
	HardpointLabels[k]:SetSkin(GAMEMODE.HudSkin)
	  HardpointMenus[k] = vgui.Create("DMultiChoice", ShipSelectFrame )
	  HardpointMenus[k]:SetText(ShipTypes[SelectedShipType][ID]["Hardpoints"][k])
	  HardpointMenus[k]:SetPos (LastX, LastY + 20)
	  HardpointMenus[k]:SetSize( 125, 20 )
	  LastY = LastY + 40
		for x, y in pairs (HardpointTypes[ShipTypes[SelectedShipType][ID]["Hardpoints"][k]]) do
		   HardpointMenus[k]:AddChoice(HardpointTypes[ShipTypes[SelectedShipType][ID]["Hardpoints"][k]][x][1])
		end
		HardpointChoice[k] = 1
		HardpointMenus[k].OnSelect = function(index,value,data)
		HardpointChoice[k] = value
		end
	  --HardpointMenus[k].OnSelect = function(index,value,data)
		--HardPointChoice[i] = HeavyShips[index]
	  --end
	end

local ConfirmButton = vgui.Create( "DButton", ShipSelectFrame )
ConfirmButton:SetText( "Confirm Loadout" )
ConfirmButton:SetPos( 15, 125 )
ConfirmButton:SetSize(125, 25)
ConfirmButton:SetSkin(GAMEMODE.HudSkin)
ConfirmButton.DoClick = function()
    RunConsoleCommand( "LoadoutConfirmed", SelectedShipType, ID, HardpointChoice[1], HardpointChoice[2], HardpointChoice[3], HardpointChoice[4], HardpointChoice[5], HardpointChoice[6], HardpointChoice[7], HardpointChoice[8], HardpointChoice[9], HardpointChoice[10] )
    ShipSelectFrame:Remove()
	end
    
	
local seltex = "DMenus/BattleCruiser"
local seltexID = surface.GetTextureID( seltex )
	
	local ShipModelViewFrame = vgui.Create( "DFrame", ShipSelectFrame );
	ShipModelViewFrame:SetPos(ShipSelectFrame:GetWide()*0.9, 30)
	ShipModelViewFrame:SetSize( 425,425);
	ShipModelViewFrame:SetTitle( "3d View" );
	ShipModelViewFrame:SetSkin(GAMEMODE.HudSkin)
	ShipModelViewFrame:MakePopup();

	local ShipModelView = vgui.Create("DModelPanel", ShipModelViewFrame)
	ShipModelView:SetModel("models/battlecruiser/battlecruiser8x.mdl")
	ShipModelView:SetSize(400,400)
	ShipModelView:SetSkin(GAMEMODE.HudSkin)
	ShipModelView:SetCamPos( ShipModelView.Entity:OBBMaxs() + Vector(25,25,25))
	Msg(ShipModelView.Entity:OBBMaxs())
	
 	/*local ShipPicFrame = vgui.Create( "DFrame", ShipSelectFrame )
	ShipPicFrame:SetSize( ShipSelectFrame:GetWide() - 10, ShipSelectFrame:GetTall() + 100 )
	ShipPicFrame:SetPos( ShipSelectFrame:GetWide()*0.9, 30 )
	ShipPicFrame:SetTitle( "Ship Selection" ) -- Title of the frame
	ShipPicFrame:SetDraggable( true ) -- Draggable by mouse?
	ShipPicFrame:ShowCloseButton( true ) -- Show the close button?
	ShipPicFrame:MakePopup() -- Show the frame
	
	local ShipPic = vgui.Create("DImage", ShipPicFrame)
	ShipPic:SetPos(25, 25)
	ShipPic:SetImage("DMenus/BattleCruiser")
	ShipPic:SizeToContents()	--ShipPicFrame:SetImage("DMenus/BattleCruiser")
	--ShipPicFrame:SizeToContents()
--	html2:OpenURL("data/Dark_Skies/picturetemplate.txt")*/
	
--local PicPanel = vgui.Create( "DImage", ShipSelectFrame )
--PicPanel:SetPos( ShipSelectFrame:GetWide()*0.5, 5 )   
--PicPanel:SetSize( ShipSelectFrame:GetWide()*0.4, ShipSelectFrame:GetTall() - 30 )   
--PicPanel:SetImage("selectonemelon")
end

concommand.Add("FrettaPanelTest", FrettaPanelTest)