-- This file is provided under the Open Game License version 1.0a
-- For more information on OGL and related issues, see 
--   http://www.wizards.com/d20
--
-- For information on the Fantasy Grounds d20 Ruleset licensing and
-- the OGL license text, see the d20 ruleset license in the program
-- options.
--
-- All producers of work derived from this definition are adviced to
-- familiarize themselves with the above licenses, and to take special
-- care in providing the definition of Product Identity (as specified
-- by the OGL) in their products.
--
-- Copyright 2007 SmiteWorks Ltd.

function onSortCompare(w1, w2)
	if w1.label.getValue() == "" then
		return true;
	elseif w2.label.getValue() == "" then
		return false;
	end
    
	return w1.label.getValue() > w2.label.getValue();
end

function addNewInstance(label)
	local data = skilldata[label];
	
	if data and data.sublabeling then
		local newwin = createWindow();
		
		newwin.label.setValue(label);
		newwin.sublabel.setVisible(true);
		newwin.stat.setStat(data.stat);
		newwin.setCustom(false);
		
		newwin.sublabel.setFocus();
	end
end

function onInit()
    directadjustment = true;
	activesetnode = window.getDatabaseNode().getChild("activeskillset");
	if not activesetnode then
		activesetnode = window.getDatabaseNode().createChild("activeskillset", "number");
		activesetnode.setValue(1);
	end
end

