
var iconSize = null;
var shadowSize = null;
var iconAnchor = null;
var imageMap = null;

var themescount = 2;

var iconcubehome1;

var initialized = false

function getIcon(theme, name, id)
{
	if(initialized == false)
	  Initialize();
	if (theme.indexOf('wappen') == 0)
		id = 1;
	var icon = new GIcon(G_DEFAULT_ICON,'/gps-mission/gfx-gif/gps-mission/themes/'+theme+'/cube_'+name+'_'+id+'.gif');
	if (theme.indexOf('wappen') != 0)
		icon.shadow = '/gps-mission/gfx/gps-mission/themes/'+theme+'/cube_shadow_'+id+'.png';

	icon.iconSize =  iconSize[themeToInt(theme)][id];
	icon.shadowSize = shadowSize[themeToInt(theme)][id];
	icon.iconAnchor = iconAnchor[themeToInt(theme)][id];
	icon.imageMap = imageMap[themeToInt(theme)][id];

	return icon;
}

function Initialize()
{
	iconSize = new Array(themescount);
	shadowSize = new Array(themescount);
	iconAnchor = new Array(themescount);
	imageMap = new Array(themescount);
	for (var i = 0; i <= themescount; i++)
	{
		iconSize[i] = new Array(10);
		shadowSize[i] = new Array(10);
		iconAnchor[i] = new Array(10);
		imageMap[i] = new Array(10);
	}
	InitializeWappenTheme();
	InitializeCubesTheme();
	initialized = true;
}

function themeToInt(theme)
{
	if (theme == 'cubes')
		return 0;
	if (theme.indexOf('wappen') == 0)
		return 1;
}

function InitializeCubesTheme()
{
 	iconSize[themeToInt('cubes')][1] = new GSize(44,44);
	shadowSize[themeToInt('cubes')][1] = new GSize(69,69);
	iconAnchor[themeToInt('cubes')][1] = new GPoint(22,22);
	imageMap[themeToInt('cubes')][1] = [25,0,32,5,42,31,15,41,1,10,25,0];
	iconSize[themeToInt('cubes')][2] = new GSize(42,42);
	shadowSize[themeToInt('cubes')][2] = new GSize(68,68);
	iconAnchor[themeToInt('cubes')][2] = new GPoint(21,21);
	imageMap[themeToInt('cubes')][2] = [24,0,32,5,40,33,13,40,7,30,1,7,24,0];
	iconSize[themeToInt('cubes')][3] = new GSize(40,40);
	shadowSize[themeToInt('cubes')][3] = new GSize(67,67);
	iconAnchor[themeToInt('cubes')][3] = new GPoint(20,20);
	imageMap[themeToInt('cubes')][3] = [24,0,33,5,38,33,10,38,5,28,1,5,24,0];
	iconSize[themeToInt('cubes')][4] = new GSize(39,39);
	shadowSize[themeToInt('cubes')][4] = new GSize(67,67);
	iconAnchor[themeToInt('cubes')][4] = new GPoint(19,19);
	imageMap[themeToInt('cubes')][4] = [26,1,34,7,36,34,9,37,3,28,2,4,26,1];
	iconSize[themeToInt('cubes')][5] = new GSize(37,37);
	shadowSize[themeToInt('cubes')][5] = new GSize(66,66);
	iconAnchor[themeToInt('cubes')][5] = new GPoint(18,18);
	imageMap[themeToInt('cubes')][5] = [26,1,34,7,34,34,7,34,2,26,2,2,26,1];
	iconSize[themeToInt('cubes')][6] = new GSize(39,39);
	shadowSize[themeToInt('cubes')][6] = new GSize(67,67);
	iconAnchor[themeToInt('cubes')][6] = new GPoint(19,19);
	imageMap[themeToInt('cubes')][6] = [4,2,28,4,36,9,34,36,7,34,2,27,4,2];
	iconSize[themeToInt('cubes')][7] = new GSize(40,40);
	shadowSize[themeToInt('cubes')][7] = new GSize(67,67);
	iconAnchor[themeToInt('cubes')][7] = new GPoint(20,20);
	imageMap[themeToInt('cubes')][7] = [5,1,29,5,37,10,33,38,5,33,1,25,5,1];
	iconSize[themeToInt('cubes')][8] = new GSize(42,42);
	shadowSize[themeToInt('cubes')][8] = new GSize(68,68);
	iconAnchor[themeToInt('cubes')][8] = new GPoint(21,21);
	imageMap[themeToInt('cubes')][8] = [7,1,30,7,39,13,32,39,6,33,1,24,7,1];
	iconSize[themeToInt('cubes')][9] = new GSize(44,44);
	shadowSize[themeToInt('cubes')][9] = new GSize(69,69);
	iconAnchor[themeToInt('cubes')][9] = new GPoint(22,22);
	imageMap[themeToInt('cubes')][9] = [10,2,41,15,32,41,5,32,1,24,10,2];
 }
 
 function InitializeWappenTheme()
{
 	for (var i = 1; i <= 9; i++)
 	{
	 	iconSize[themeToInt('wappen')][i] = new GSize(23,23);
		shadowSize[themeToInt('wappen')][i] = new GSize(0,0);
		iconAnchor[themeToInt('wappen')][i] = new GPoint(12,12);
		imageMap[themeToInt('wappen')][i] = [11,0,20,3,22,11,20,19,11,22,2,19,0,11,2,3,11,0];
	}
 }
 