local M = {}

local pattern = 0
local timer = 0
local cycleComplete = 0
local cycleStarting = 0
local nextPatternName = "Flashing"

local function toggleState()
	electrics.values.neon = 1 - (electrics.values.neon or 0)
	if electrics.values.neon == 1 then
		guihooks.message("Underglow enabled", 4, "vehicle.vertexUnderglow.underglowState", "filter_none") 
	else
		guihooks.message("Underglow disabled", 4, "vehicle.vertexUnderglow.underglowState", "filter_none") 
	end
end

local function nextPattern()	

	if electrics.values["neon"] == 1 and pattern == 3 then
		guihooks.message("Underglow pattern changed! Now showing: " .. nextPatternName .. " (" .. pattern+1 .. "/" .. 4 .. ")", 4, "vehicle.vertexUnderglow.underglowPattern", "filter_none") 
		
		pattern = 0
		timer = 0
	
	elseif electrics.values["neon"] == 1 then
		guihooks.message("Underglow pattern changed! Now showing: '" .. nextPatternName .. "' (" .. pattern+1 .. "/" .. 4 .. ")", 4, "vehicle.vertexUnderglow.underglowPattern", "filter_none") 

		pattern = pattern + 1
		timer = 0
	--To fully reset the lights before switching pattern cycle
	--front
	electrics.values["neonf1"] = 0
    electrics.values["neonf2r"] = 0
    electrics.values["neonf2l"] = 0
    electrics.values["neonf3r"] = 0
    electrics.values["neonf3l"] = 0
    electrics.values["neonf4r"] = 0
    electrics.values["neonf4l"] = 0
    electrics.values["neonf5r"] = 0
    electrics.values["neonf5l"] = 0
    electrics.values["neonf6r"] = 0
    electrics.values["neonf6l"] = 0
    electrics.values["neonf7r"] = 0
    electrics.values["neonf7l"] = 0
	--rear
	electrics.values["neonr1"] = 0
    electrics.values["neonr2r"] = 0
    electrics.values["neonr2l"] = 0
    electrics.values["neonr3r"] = 0
    electrics.values["neonr3l"] = 0
    electrics.values["neonr4r"] = 0
    electrics.values["neonr4l"] = 0
    electrics.values["neonr5r"] = 0
    electrics.values["neonr5l"] = 0
    electrics.values["neonr6r"] = 0
    electrics.values["neonr6l"] = 0
    electrics.values["neonr7r"] = 0
    electrics.values["neonr7l"] = 0
    electrics.values["neonr8r"] = 0
    electrics.values["neonr8l"] = 0
	--middle
	electrics.values["neonm1r"] = 0
	electrics.values["neonm1l"] = 0
    electrics.values["neonm2r"] = 0
    electrics.values["neonm2l"] = 0
    electrics.values["neonm3r"] = 0
    electrics.values["neonm3l"] = 0
    electrics.values["neonm4r"] = 0
    electrics.values["neonm4l"] = 0
    electrics.values["neonm5r"] = 0
    electrics.values["neonm5l"] = 0
    electrics.values["neonm6r"] = 0
    electrics.values["neonm6l"] = 0
    electrics.values["neonm7r"] = 0
    electrics.values["neonm7l"] = 0
    electrics.values["neonm8r"] = 0
    electrics.values["neonm8l"] = 0
    electrics.values["neonm9r"] = 0
    electrics.values["neonm9l"] = 0
    electrics.values["neonm10r"] = 0
    electrics.values["neonm10l"] = 0

	else
		guihooks.message("Turn on the underglow first.", 4, "vehicle.vertexUnderglow.underglowPattern", "filter_none") 
	end
end

local function onInit(jbeamData)
	--front
	electrics.values["neonf1"] = 0
    electrics.values["neonf2r"] = 0
    electrics.values["neonf2l"] = 0
    electrics.values["neonf3r"] = 0
    electrics.values["neonf3l"] = 0
    electrics.values["neonf4r"] = 0
    electrics.values["neonf4l"] = 0
    electrics.values["neonf5r"] = 0
    electrics.values["neonf5l"] = 0
    electrics.values["neonf6r"] = 0
    electrics.values["neonf6l"] = 0
    electrics.values["neonf7r"] = 0
    electrics.values["neonf7l"] = 0
	--rear
	electrics.values["neonr1"] = 0
    electrics.values["neonr2r"] = 0
    electrics.values["neonr2l"] = 0
    electrics.values["neonr3r"] = 0
    electrics.values["neonr3l"] = 0
    electrics.values["neonr4r"] = 0
    electrics.values["neonr4l"] = 0
    electrics.values["neonr5r"] = 0
    electrics.values["neonr5l"] = 0
    electrics.values["neonr6r"] = 0
    electrics.values["neonr6l"] = 0
    electrics.values["neonr7r"] = 0
    electrics.values["neonr7l"] = 0
    electrics.values["neonr8r"] = 0
    electrics.values["neonr8l"] = 0
	--middle
	electrics.values["neonm1r"] = 0
	electrics.values["neonm1l"] = 0
    electrics.values["neonm2r"] = 0
    electrics.values["neonm2l"] = 0
    electrics.values["neonm3r"] = 0
    electrics.values["neonm3l"] = 0
    electrics.values["neonm4r"] = 0
    electrics.values["neonm4l"] = 0
    electrics.values["neonm5r"] = 0
    electrics.values["neonm5l"] = 0
    electrics.values["neonm6r"] = 0
    electrics.values["neonm6l"] = 0
    electrics.values["neonm7r"] = 0
    electrics.values["neonm7l"] = 0
    electrics.values["neonm8r"] = 0
    electrics.values["neonm8l"] = 0
    electrics.values["neonm9r"] = 0
    electrics.values["neonm9l"] = 0
    electrics.values["neonm10r"] = 0
    electrics.values["neonm10l"] = 0
	
	nextPatternName = "Flashing"
	timer2 = 0
	timer = 0
	timer3 = 0
	cycleStarting = 0
	cycleComplete = 0
end

local function updateGFX(dt) 
  if pattern == 0 and electrics.values["neon"] == 1 then
	--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf2r"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf3l"] = 1
    electrics.values["neonf4r"] = 1
    electrics.values["neonf4l"] = 1
    electrics.values["neonf5r"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonf6l"] = 1
    electrics.values["neonf7r"] = 1
    electrics.values["neonf7l"] = 1
	--rear
	electrics.values["neonr1"] = 1
    electrics.values["neonr2r"] = 1
    electrics.values["neonr2l"] = 1
    electrics.values["neonr3r"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr4l"] = 1
    electrics.values["neonr5r"] = 1
    electrics.values["neonr5l"] = 1
    electrics.values["neonr6r"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonr7l"] = 1
    electrics.values["neonr8r"] = 1
    electrics.values["neonr8l"] = 1
	--middle
	electrics.values["neonm1r"] = 1
	electrics.values["neonm1l"] = 1
    electrics.values["neonm2r"] = 1
    electrics.values["neonm2l"] = 1
    electrics.values["neonm3r"] = 1
    electrics.values["neonm3l"] = 1
    electrics.values["neonm4r"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm5r"] = 1
    electrics.values["neonm5l"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm6l"] = 1
    electrics.values["neonm7r"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm8r"] = 1
    electrics.values["neonm8l"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm9l"] = 1
    electrics.values["neonm10r"] = 1
    electrics.values["neonm10l"] = 1
	nextPatternName = "Flashing"
	
	--1st pattern with front/back and middle alternating
  elseif pattern == 1 and electrics.values["neon"] == 1 then
	timer = timer + dt
	nextPatternName = "Loop"
	if timer <= 0.4 then
	--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf2r"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf3l"] = 1
    electrics.values["neonf4r"] = 1
    electrics.values["neonf4l"] = 1
    electrics.values["neonf5r"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonf6l"] = 1
    electrics.values["neonf7r"] = 1
    electrics.values["neonf7l"] = 1
	--rear
	electrics.values["neonr1"] = 1
    electrics.values["neonr2r"] = 1
    electrics.values["neonr2l"] = 1
    electrics.values["neonr3r"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr4l"] = 1
    electrics.values["neonr5r"] = 1
    electrics.values["neonr5l"] = 1
    electrics.values["neonr6r"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonr7l"] = 1
    electrics.values["neonr8r"] = 1
    electrics.values["neonr8l"] = 1
	
	--middle
	electrics.values["neonm1r"] = 0
	electrics.values["neonm1l"] = 0
    electrics.values["neonm2r"] = 0
    electrics.values["neonm2l"] = 0
    electrics.values["neonm3r"] = 0
    electrics.values["neonm3l"] = 0
    electrics.values["neonm4r"] = 0
    electrics.values["neonm4l"] = 0
    electrics.values["neonm5r"] = 0
    electrics.values["neonm5l"] = 0
    electrics.values["neonm6r"] = 0
    electrics.values["neonm6l"] = 0
    electrics.values["neonm7r"] = 0
    electrics.values["neonm7l"] = 0
    electrics.values["neonm8r"] = 0
    electrics.values["neonm8l"] = 0
    electrics.values["neonm9r"] = 0
    electrics.values["neonm9l"] = 0
    electrics.values["neonm10r"] = 0
    electrics.values["neonm10l"] = 0
	
	elseif timer >= 0.4 and timer <= 0.8 then
	--middle
	electrics.values["neonm1r"] = 1
	electrics.values["neonm1l"] = 1
    electrics.values["neonm2r"] = 1
    electrics.values["neonm2l"] = 1
    electrics.values["neonm3r"] = 1
    electrics.values["neonm3l"] = 1
    electrics.values["neonm4r"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm5r"] = 1
    electrics.values["neonm5l"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm6l"] = 1
    electrics.values["neonm7r"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm8r"] = 1
    electrics.values["neonm8l"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm9l"] = 1
    electrics.values["neonm10r"] = 1
    electrics.values["neonm10l"] = 1
	
	--front
	electrics.values["neonf1"] = 0
    electrics.values["neonf2r"] = 0
    electrics.values["neonf2l"] = 0
    electrics.values["neonf3r"] = 0
    electrics.values["neonf3l"] = 0
    electrics.values["neonf4r"] = 0
    electrics.values["neonf4l"] = 0
    electrics.values["neonf5r"] = 0
    electrics.values["neonf5l"] = 0
    electrics.values["neonf6r"] = 0
    electrics.values["neonf6l"] = 0
    electrics.values["neonf7r"] = 0
    electrics.values["neonf7l"] = 0
	--rear
	electrics.values["neonr1"] = 0
    electrics.values["neonr2r"] = 0
    electrics.values["neonr2l"] = 0
    electrics.values["neonr3r"] = 0
    electrics.values["neonr3l"] = 0
    electrics.values["neonr4r"] = 0
    electrics.values["neonr4l"] = 0
    electrics.values["neonr5r"] = 0
    electrics.values["neonr5l"] = 0
    electrics.values["neonr6r"] = 0
    electrics.values["neonr6l"] = 0
    electrics.values["neonr7r"] = 0
    electrics.values["neonr7l"] = 0
    electrics.values["neonr8r"] = 0
    electrics.values["neonr8l"] = 0
	
	else timer = 0

	end
	--second pattern with 4 lights looping aroung
  elseif pattern == 2 and electrics.values["neon"] == 1 then
	timer = timer + dt
	nextPatternName = "Obnoxious Shop"
	if timer <= 0.1 then
	--toggling old
	--front
    electrics.values["neonm3r"] = 0

	--rear
    electrics.values["neonm9l"] = 0
	
	--middle
    electrics.values["neonr4r"] = 0

    electrics.values["neonf4l"] = 0
	
	--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf3l"] = 1

	--rear
	electrics.values["neonr1"] = 1
    electrics.values["neonr2r"] = 1
    electrics.values["neonr3r"] = 1
	
	--middle
    electrics.values["neonm5r"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm4r"] = 1

    electrics.values["neonm6l"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm8l"] = 1
	
	elseif timer >= 0.1 and timer <= 0.2 then
	--toggling old
	--front
    electrics.values["neonf3l"] = 0

	--rear
    electrics.values["neonr3r"] = 0
	
	--middle
    electrics.values["neonm4r"] = 0

    electrics.values["neonm8l"] = 0
	
	--toggling new
	
		--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf2r"] = 1

	--rear
	electrics.values["neonr1"] = 1
    electrics.values["neonr2r"] = 1
    electrics.values["neonr2l"] = 1
	
	--middle
    electrics.values["neonm5r"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm7r"] = 1

    electrics.values["neonm6l"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm5l"] = 1

	elseif timer >= 0.2 and timer <= 0.3 then
	--toggling old
	--front
    electrics.values["neonf2l"] = 0

	--rear
    electrics.values["neonr2r"] = 0
	
	--middle
    electrics.values["neonm5r"] = 0

    electrics.values["neonm7l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf2r"] = 1

	--rear
	electrics.values["neonr1"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr2l"] = 1
	
	--middle
    electrics.values["neonm8r"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm7r"] = 1

    electrics.values["neonm6l"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm5l"] = 1
	
	elseif timer >= 0.3 and timer <= 0.4 then
	--toggling old
	--front
    electrics.values["neonf1"] = 0

	--rear
    electrics.values["neonr1"] = 0
	
	--middle
    electrics.values["neonm6r"] = 0

    electrics.values["neonm6l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf4r"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf2r"] = 1

	--rear
	electrics.values["neonr4l"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr2l"] = 1
	
	--middle
    electrics.values["neonm8r"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm7r"] = 1

    electrics.values["neonm3l"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm5l"] = 1
	
	elseif timer >= 0.4 and timer <= 0.5 then
	--toggling old
	--front
    electrics.values["neonf2r"] = 0

	--rear
    electrics.values["neonr2l"] = 0
	
	--middle
    electrics.values["neonm7r"] = 0

    electrics.values["neonm5l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf4r"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf5r"] = 1

	--rear
	electrics.values["neonr4l"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr5l"] = 1
	
	--middle
    electrics.values["neonm8r"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm10r"] = 1

    electrics.values["neonm3l"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm2l"] = 1
	
	elseif timer >= 0.5 and timer <= 0.6 then
	--toggling old
	--front
    electrics.values["neonf3r"] = 0

	--rear
    electrics.values["neonr3l"] = 0
	
	--middle
    electrics.values["neonm8r"] = 0

    electrics.values["neonm4l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf4r"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonf5r"] = 1

	--rear
	electrics.values["neonr4l"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr5l"] = 1
	
	--middle
    electrics.values["neonr8r"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm10r"] = 1

    electrics.values["neonm3l"] = 1
    electrics.values["neonm1l"] = 1
    electrics.values["neonm2l"] = 1
	
	elseif timer >= 0.6 and timer <= 0.7 then
	--toggling old
	--front
    electrics.values["neonf4r"] = 0

	--rear
    electrics.values["neonr4l"] = 0
	
	--middle
    electrics.values["neonm9r"] = 0

    electrics.values["neonm3l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf7r"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonf5r"] = 1

	--rear
	electrics.values["neonr7l"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr5l"] = 1
	
	--middle
    electrics.values["neonr8r"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonm10r"] = 1

    electrics.values["neonf7l"] = 1
    electrics.values["neonm1l"] = 1
    electrics.values["neonm2l"] = 1
	
	elseif timer >= 0.7 and timer <= 0.8 then
	--toggling old
	--front
    electrics.values["neonf5r"] = 0

	--rear
    electrics.values["neonr5l"] = 0
	
	--middle
    electrics.values["neonm10r"] = 0

    electrics.values["neonm2l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf7r"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonm1r"] = 1

	--rear
	electrics.values["neonr7l"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr8l"] = 1
	
	--middle
    electrics.values["neonr8r"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonr6r"] = 1

    electrics.values["neonf7l"] = 1
    electrics.values["neonm1l"] = 1
    electrics.values["neonf6l"] = 1

	elseif timer >= 0.8 and timer <= 0.9 then
	--toggling old
	--front
    electrics.values["neonf6r"] = 0

	--rear
    electrics.values["neonr6l"] = 0
	
	--middle
    electrics.values["neonr8r"] = 0

    electrics.values["neonm1l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonf7r"] = 1
    electrics.values["neonm2r"] = 1
    electrics.values["neonm1r"] = 1

	--rear
	electrics.values["neonr7l"] = 1
    electrics.values["neonm10l"] = 1
    electrics.values["neonr8l"] = 1
	
	--middle
    electrics.values["neonr5r"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonr6r"] = 1

    electrics.values["neonf7l"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf6l"] = 1

	elseif timer >= 0.9 and timer <= 1.0 then
	--toggling old
	--front
    electrics.values["neonf7r"] = 0

	--rear
    electrics.values["neonr7l"] = 0
	
	--middle
    electrics.values["neonr7r"] = 0

    electrics.values["neonf7l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonm3r"] = 1
    electrics.values["neonm2r"] = 1
    electrics.values["neonm1r"] = 1

	--rear
	electrics.values["neonm9l"] = 1
    electrics.values["neonm10l"] = 1
    electrics.values["neonr8l"] = 1
	
	--middle
    electrics.values["neonr5r"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr6r"] = 1

    electrics.values["neonf4l"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf6l"] = 1

	elseif timer >= 1.0 and timer <= 1.1 then
	--toggling old
	--front
    electrics.values["neonm1r"] = 0

	--rear
    electrics.values["neonr6r"] = 0
	
	--middle
    electrics.values["neonr8l"] = 0

    electrics.values["neonf6l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonm3r"] = 1
    electrics.values["neonm2r"] = 1
    electrics.values["neonm4r"] = 1

	--rear
	electrics.values["neonm9l"] = 1
    electrics.values["neonm10l"] = 1
    electrics.values["neonm8l"] = 1
	
	--middle
    electrics.values["neonr5r"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr3r"] = 1

    electrics.values["neonf4l"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf3l"] = 1
	
	elseif timer >= 1.1 and timer <= 1.2 then
	--toggling old
	--front
    electrics.values["neonm2r"] = 0

	--rear
    electrics.values["neonm10l"] = 0
	
	--middle
    electrics.values["neonr5r"] = 0

    electrics.values["neonf5l"] = 0
	
	--toggling new
	
	--front
	electrics.values["neonm3r"] = 1
    electrics.values["neonm5r"] = 1
    electrics.values["neonm4r"] = 1

	--rear
	electrics.values["neonm9l"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm8l"] = 1
	
	--middle
    electrics.values["neonr2r"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr3r"] = 1

    electrics.values["neonf4l"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf3l"] = 1
	
	else timer = 0

	end
	
  elseif pattern == 3 and electrics.values["neon"] == 1 then
	timer = timer + dt
	nextPatternName = "No Pattern"
	if timer <= 0.2 then
	--toggle off
	--front
	electrics.values["neonf1"] = 0
    electrics.values["neonf3r"] = 0
    electrics.values["neonf3l"] = 0
    electrics.values["neonf5r"] = 0
    electrics.values["neonf5l"] = 0
    electrics.values["neonf7r"] = 0
    electrics.values["neonf7l"] = 0
	--rear                       
	electrics.values["neonr1"] = 0
    electrics.values["neonr3r"] = 0
    electrics.values["neonr3l"] = 0
    electrics.values["neonr5r"] = 0
    electrics.values["neonr5l"] = 0
    electrics.values["neonr7r"] = 0
    electrics.values["neonr7l"] = 0
	--middle                      
    electrics.values["neonm2r"] = 0
    electrics.values["neonm2l"] = 0
    electrics.values["neonm4r"] = 0
    electrics.values["neonm4l"] = 0
    electrics.values["neonm6r"] = 0
    electrics.values["neonm6l"] = 0
    electrics.values["neonm8r"] = 0
    electrics.values["neonm8l"] = 0
    electrics.values["neonm10r"] = 0
    electrics.values["neonm10l"] = 0
	
	--front
    electrics.values["neonf2r"] = 1
    electrics.values["neonf2l"] = 1
    electrics.values["neonf4r"] = 1
    electrics.values["neonf4l"] = 1
    electrics.values["neonf6r"] = 1
    electrics.values["neonf6l"] = 1
	--rear
    electrics.values["neonr2r"] = 1
    electrics.values["neonr2l"] = 1
    electrics.values["neonr4r"] = 1
    electrics.values["neonr4l"] = 1
    electrics.values["neonr6r"] = 1
    electrics.values["neonr6l"] = 1
    electrics.values["neonr8r"] = 1
    electrics.values["neonr8l"] = 1
	
	--middle
	electrics.values["neonm1r"] = 1
	electrics.values["neonm1l"] = 1
    electrics.values["neonm3r"] = 1
    electrics.values["neonm3l"] = 1
    electrics.values["neonm5r"] = 1
    electrics.values["neonm5l"] = 1
    electrics.values["neonm7r"] = 1
    electrics.values["neonm7l"] = 1
    electrics.values["neonm9r"] = 1
    electrics.values["neonm9l"] = 1
	
	elseif timer >= 0.2 and timer <= 0.4 then
	--toggle off
	--front
    electrics.values["neonf2r"] = 0
    electrics.values["neonf2l"] = 0
    electrics.values["neonf4r"] = 0
    electrics.values["neonf4l"] = 0
    electrics.values["neonf6r"] = 0
    electrics.values["neonf6l"] = 0
	--rear                        
    electrics.values["neonr2r"] = 0
    electrics.values["neonr2l"] = 0
    electrics.values["neonr4r"] = 0
    electrics.values["neonr4l"] = 0
    electrics.values["neonr6r"] = 0
    electrics.values["neonr6l"] = 0
    electrics.values["neonr8r"] = 0
    electrics.values["neonr8l"] = 0

	--middle                      
	electrics.values["neonm1r"] = 0
	electrics.values["neonm1l"] = 0
    electrics.values["neonm3r"] = 0
    electrics.values["neonm3l"] = 0
    electrics.values["neonm5r"] = 0
    electrics.values["neonm5l"] = 0
    electrics.values["neonm7r"] = 0
    electrics.values["neonm7l"] = 0
    electrics.values["neonm9r"] = 0
    electrics.values["neonm9l"] = 0
	--toggle on
	--front
	electrics.values["neonf1"] = 1
    electrics.values["neonf3r"] = 1
    electrics.values["neonf3l"] = 1
    electrics.values["neonf5r"] = 1
    electrics.values["neonf5l"] = 1
    electrics.values["neonf7r"] = 1
    electrics.values["neonf7l"] = 1
	--rear                       
	electrics.values["neonr1"] = 1
    electrics.values["neonr3r"] = 1
    electrics.values["neonr3l"] = 1
    electrics.values["neonr5r"] = 1
    electrics.values["neonr5l"] = 1
    electrics.values["neonr7r"] = 1
    electrics.values["neonr7l"] = 1
	--middle                      
    electrics.values["neonm2r"] = 1
    electrics.values["neonm2l"] = 1
    electrics.values["neonm4r"] = 1
    electrics.values["neonm4l"] = 1
    electrics.values["neonm6r"] = 1
    electrics.values["neonm6l"] = 1
    electrics.values["neonm8r"] = 1
    electrics.values["neonm8l"] = 1
    electrics.values["neonm10r"] = 1
    electrics.values["neonm10l"] = 1
	
	else timer = 0

	end
	
  else
	--front
	electrics.values["neonf1"] = 0
    electrics.values["neonf2r"] = 0
    electrics.values["neonf2l"] = 0
    electrics.values["neonf3r"] = 0
    electrics.values["neonf3l"] = 0
    electrics.values["neonf4r"] = 0
    electrics.values["neonf4l"] = 0
    electrics.values["neonf5r"] = 0
    electrics.values["neonf5l"] = 0
    electrics.values["neonf6r"] = 0
    electrics.values["neonf6l"] = 0
    electrics.values["neonf7r"] = 0
    electrics.values["neonf7l"] = 0
	--rear
	electrics.values["neonr1"] = 0
    electrics.values["neonr2r"] = 0
    electrics.values["neonr2l"] = 0
    electrics.values["neonr3r"] = 0
    electrics.values["neonr3l"] = 0
    electrics.values["neonr4r"] = 0
    electrics.values["neonr4l"] = 0
    electrics.values["neonr5r"] = 0
    electrics.values["neonr5l"] = 0
    electrics.values["neonr6r"] = 0
    electrics.values["neonr6l"] = 0
    electrics.values["neonr7r"] = 0
    electrics.values["neonr7l"] = 0
    electrics.values["neonr8r"] = 0
    electrics.values["neonr8l"] = 0
	--middle
	electrics.values["neonm1r"] = 0
	electrics.values["neonm1l"] = 0
    electrics.values["neonm2r"] = 0
    electrics.values["neonm2l"] = 0
    electrics.values["neonm3r"] = 0
    electrics.values["neonm3l"] = 0
    electrics.values["neonm4r"] = 0
    electrics.values["neonm4l"] = 0
    electrics.values["neonm5r"] = 0
    electrics.values["neonm5l"] = 0
    electrics.values["neonm6r"] = 0
    electrics.values["neonm6l"] = 0
    electrics.values["neonm7r"] = 0
    electrics.values["neonm7l"] = 0
    electrics.values["neonm8r"] = 0
    electrics.values["neonm8l"] = 0
    electrics.values["neonm9r"] = 0
    electrics.values["neonm9l"] = 0
    electrics.values["neonm10r"] = 0
    electrics.values["neonm10l"] = 0
	timer = 0	
  end
end


M.updateGFX = updateGFX
M.onInit = onInit
M.nextPattern = nextPattern
M.toggleState = toggleState
return M