//Copyright (C) Ben Parbury - All Rights Reserved. Unauthorized copying of this file, via any medium is strictly prohibited. Written by Ben Parbury <ben@gridlockinteractive.com> 2014
gLevelsBySet = {
	"green" : ["vanilla", "switch", "restraint", "vanilla2", "fading", "constraint"],
	
	"vanilla" : ["blocks", "pushy", "multi"],
	"vanilla2" : ["trap", "warm", "square"],
	"switch" : ["backwards", "swap", "change"],
	"restraint" : ["cornered", "storage", "cross"],
	"constraint" : ["border", "attack", "space"],
	"fading" : ["cartel", "ordering", "ready"],
	
	"blue" : ["opposites", "polyomino", "polyomino2", "switch2", "fading2", "wildblocks", "static"],
	
	"opposites" : ["gap", "cavern", "rubble"],
	"polyomino" : ["recur", "slot", "bottle"],
	"polyomino2" : ["way", "tiling", "bridge"],
	"switch2" : ["thin", "bars", "places"],
	"fading2" : ["run", "memorial", "split"],
	"wildblocks" : ["instruction", "drag", "deuce"],
	"static" :  ["station", "platform", "signal"],

	"red" : ["wildblocks2", "vanilla3", "opposites2", "polyswitch", "polyswitch2", "tricksy", "tricksy2"],
	
	"wildblocks2" : ["straight", "joker", "stakes"],
	"vanilla3" : ["edge", "woven", "encompass"],
	"opposites2" : ["order", "ruins", "palace"],
	"polyswitch" : ["steps", "bypass", "lockdown"],
	"polyswitch2" : ["line", "elevators", "leverage"],
	"tricksy" : ["teach", "face", "logic"],
	"tricksy2" : ["intersections", "diagonal", "verts"],
}

gLevelsCount = 60

gHubs = ["green", "blue", "red"];

function IsHubSet(set)
{
	for(var i = 0; i < gHubs.length; i++)
	{
		if(set == gHubs[i])
		{
			return true
		}
	}
	
	return false;
}

function GetParentHub(set)
{
	for(var i = 0; i < gHubs.length; i++)
	{
		for(var h = 0; h < gHubs.length; h++)
		{
			var hub = gHubs[h];
			for(var i = 0; i < gLevelsBySet[hub].length; i++)
			{
				var setName = gLevelsBySet[hub][i];
				if(set == setName)
				{
					return hub;
				}
			}
		}
	}
	
	return null;
}

function GetHubIndex(hubSet)
{
	for(var i = 0; i < gHubs.length; i++)
	{
		if(hubSet == gHubs[i])
		{
			return i;
		}
	}

	return null;
}


if(gDemo)
{
	gLevelsCount = 7;
	
	gHubs = ["green", "blue", "red", "demosets"];
		
	gLevelsBySet = {
	"green" : ["vanilla", "switch", "restraint", "vanilla2", "fading", "constraint"],
	"blue" : ["opposites", "polyomino", "polyomino2", "switch2", "fading2", "wildblocks", "static"],
	"red" : ["wildblocks2", "vanilla3", "opposites2", "polyswitch", "polyswitch2", "tricksy", "tricksy2"],

	"demosets" : ["vanilla", "vanilla2", "switch", "polyomino", "polyswitch"],
	
	"vanilla" : ["blocks", "multi"],
	"vanilla2" : ["warm"],
	"switch" : ["backwards", "swap"],
	"polyomino" : ["slot"],
	"polyswitch" : ["lockdown"]
	}
}