function addBands(_dTree)
{
	var arr = [
	[ 'Triggerman', 		['02/02/07' ] ],
	[ 'Asassinate The Itch', 	['04/01/07' ] ],
	[ 'Let Me Bleed', 		['08/12/06' ] ],
	[ 'Jackalfeud', 		['02/02/07', '08/12/06' ] ],
	[ 'November Dead List', 	['02/02/07', '26/08/07' ] ],
	[ 'Iron Skies', 		['02/02/07' ] ],
	[ 'Libido Switch', 		['02/02/07', '08/12/06' ] ],
	[ 'Jedi Jane', 			['04/01/07' ] ],
	[ 'The Nexus', 			['17/10/06' ] ],
	[ 'We Are Knives', 		['02/02/07', '17/02/07' ] ],
	[ 'Clone Quartet',	['17/03/07' ] ],
	[ 'Vitaria',			['21/04/07', '02/09/07' ] ],
	[ 'Gallows',			['13/06/07' ] ],
	[ 'UFC',				['16/06/07' ] ],
	[ 'Residual Effect',	['11/08/07' ] ],
	[ 'Escape Fails',		['26/08/07' ] ],
	[ 'Hand Of Death',		['26/08/07' ] ],
	[ 'Interrogate',		['26/08/07' ] ],
	[ 'Stand Up Guy',		['26/08/07' ] ]

			];



	// sort bands alphabetically
	arr.sort(function (a,b){
		if(a[0] == b[0]) return 0;
		else if(a[0] > b[0]) return 1;
		else return -1;
	});


	// setup the dTRee
	_dTree.add(0, -1, 'Gallery', '','','','http://www.wakeuphate.com/images/dtree/base.gif');
	_dTree.add(1, 0, 'Recent', '','','','http://www.wakeuphate.com/images/dtree/imgfolder.gif');

	var totalindex = 1;

	// adds the bands to the dTRee
	var l = arr.length;
	for(var i=0; i<l; i++)
	{
		var element = arr[i];
		var band = element[0];

		// add the main menu item
		//*
		_dTree.add(++totalindex, 1,  band);
		/*/
		document.write("_dTree.add("+ (++totalindex) +", 1, '"+ band +"');\r\n");
		//*/
		bandindex = totalindex;

		// add the band's pages

		// just one page, incase someone forgets the parenthesis' around a single page
		if(typeof element[1] == 'string')
		{
			addBand(_dTree, ++totalindex, bandindex, band, element[1]);

		} else
		{
			 // more pages, run through them all

			 // sort them first
			element[1].sort(function(a,b)
			{
			var a = new Number(a.split('/').reverse().join(''));
			var b = new Number(b.split('/').reverse().join(''));
			if(a == b) return 0;
			else if(a > b) return 1;
			else return -1;
			});

			var el = element[1].length;
			for(var page = 0; page < el; page++)
			{
				addBand(_dTree, ++totalindex, bandindex, band, element[1][page]);
			}
		}
	}
}

function addBand(_dTree, firstindex, secondindex, band, identifier)
{
	url = '/index.html';
	// if the identifier's a date, remove the slashes and add it to the url
	if(identifier.indexOf('/') != -1) url = '/' + identifier.split('/').join('') + url;

	// normalize bandname for the url
	band = '/' + band.replace(/[^a-z0-9-_]/ig,'').toLowerCase();

	//add it to the menu
	//*
	_dTree.add(firstindex, secondindex, identifier, "http://www.wakeuphate.com/images/gallery" + band + url);
	/*/
	document.write('_dTree.add('+ firstindex +', '+ secondindex +', \''+ identifier +
	'\', "http://www.wakeuphate.com/images/gallery'+ (band + url) +'");' + "\r\n");
	//*/
}

function InsertMenu()
{
		wuh = new dTree('wuh');
		addBands(wuh);
		document.write(wuh);
}
