/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var theSitetree=[ 
	['PAGE','116',jdecode('Home'),jdecode(''),'/116.html','true',[],''],
	['PAGE','12901',jdecode('My+Bands'),jdecode(''),'/12901/index.html','true',[ 
		['PAGE','12922',jdecode('Solo'),jdecode(''),'/12901/12922.html','true',[],''],
		['PAGE','14301',jdecode('The+G-Strings'),jdecode(''),'/12901/14301.html','true',[],''],
		['PAGE','14322',jdecode('The+Rock+Brothers'),jdecode(''),'/12901/14322.html','true',[],'']
	],''],
	['PAGE','13027',jdecode('My+Music'),jdecode(''),'/13027/index.html','true',[ 
		['PAGE','13048',jdecode('Audio'),jdecode(''),'/13027/13048.html','true',[],''],
		['PAGE','13069',jdecode('Video'),jdecode(''),'/13027/13069.html','true',[],''],
		['PAGE','14343',jdecode('Lyrics'),jdecode(''),'/13027/14343.html','true',[],'']
	],''],
	['PAGE','12964',jdecode('Music+News'),jdecode(''),'/12964/index.html','true',[ 
		['PAGE','12985',jdecode('Scheduled+Events'),jdecode(''),'/12964/12985.html','true',[],''],
		['PAGE','14364',jdecode('Press'),jdecode(''),'/12964/14364.html','true',[],'']
	],''],
	['PAGE','13153',jdecode('Photographs'),jdecode(''),'/13153.html','true',[],''],
	['PAGE','146',jdecode('My+Software'),jdecode(''),'/146/index.html','true',[ 
		['PAGE','155',jdecode('Shareware'),jdecode(''),'/146/155.html','true',[],''],
		['PAGE','164',jdecode('Freeware'),jdecode(''),'/146/164.html','true',[],''],
		['PAGE','173',jdecode('Source+Code'),jdecode(''),'/146/173.html','true',[],'']
	],''],
	['PAGE','200',jdecode('Contact'),jdecode(''),'/200.html','true',[],''],
	['PAGE','182',jdecode('Links'),jdecode(''),'/182.html','true',[],'']];
var siteelementCount=19;
theSitetree.topTemplateName='Instrument';
theSitetree.paletteFamily='FBBE5D';
theSitetree.keyvisualId='6151';
theSitetree.keyvisualName='kv_6151.jpg';
theSitetree.fontsetId='11134';
theSitetree.graphicsetId='11931';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F9CE7C';
var theTemplate={
				name: 			'Instrument',
				paletteFamily: 	'FBBE5D',
				keyvisualId: 	'6151',
				keyvisualName: 	'kv_6151.jpg',
				fontsetId: 		'11134',
				graphicsetId: 	'11931',
				contentColor: 	'000000',
				contentBGColor: 'F9CE7C',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'98631A',
				e_color: 		'98631A',
				f_color: 		'98631A',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '116',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1977342']={
webappId:    '1501',
documentId:  '116',
internalId:  '1977342',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '116',
internalId:  '',
customField: '20090924-192443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20090924-184744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12922',
internalId:  '',
customField: '20090924-191912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14301',
internalId:  '',
customField: '20090924-191411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12964',
internalId:  '',
customField: '20090517-155624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12985',
internalId:  '',
customField: '20090924-192214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13027',
internalId:  '',
customField: '20090517-155624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13048',
internalId:  '',
customField: '20090517-155624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13069',
internalId:  '',
customField: '20090517-155624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14343',
internalId:  '',
customField: '20090517-163538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14364',
internalId:  '',
customField: '20090517-163538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14322',
internalId:  '',
customField: '20090924-190203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '146',
internalId:  '',
customField: '20090924-192558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '155',
internalId:  '',
customField: '20061211-230707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '164',
internalId:  '',
customField: '20061211-230707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '173',
internalId:  '',
customField: '20061211-230707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13153',
internalId:  '',
customField: '20090517-155624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '200',
internalId:  '',
customField: '20090924-192230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182',
internalId:  '',
customField: '20090924-192418'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC24G']={
webappId:    '5003',
documentId:  '116',
internalId:  'tid:1;pid:WSCSYSSSSLYTC24G',
customField: 'en:US::;language:en;country:US;'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3UJO';
var companyName   = 'Chuck+Finch+Music+%26+Software';
var htmlTitle	  = 'Chuck+Finch+Music+%26+Software';
var metaKeywords  = 'Chuck+Finch+Music+Band+Gig+CD+Download+Software+Media+Programmer+Engineer';
var metaContents  = 'Chuck+Finch+is+an+singer-songwriter+and+independant+programmer%2Fengineer.';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
