/* [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','1201',jdecode('Home'),jdecode(''),'/1201.html','true',[],''],
	['PAGE','182576',jdecode('Music+Networks'),jdecode(''),'/182576/index.html','true',[ 
		['PAGE','182597',jdecode('Music+Tracks'),jdecode(''),'/182576/182597.html','true',[],''],
		['PAGE','182639',jdecode('Website+Music'),jdecode(''),'/182576/182639.html','true',[],''],
		['PAGE','184576',jdecode('Music+Workshops'),jdecode(''),'/182576/184576.html','true',[],''],
		['PAGE','182660',jdecode('Gospel+Piano'),jdecode(''),'/182576/182660.html','true',[],''],
		['PAGE','182618',jdecode('Stage+Play+Music'),jdecode(''),'/182576/182618.html','true',[],'']
	],''],
	['PAGE','5701',jdecode('Keith+Rowel%26%23x27%3Bs+Bio'),jdecode(''),'/5701.html','true',[],''],
	['PAGE','154460',jdecode('Links'),jdecode(''),'/154460.html','true',[],''],
	['PAGE','5827',jdecode('Music+Buiness-Technology'),jdecode(''),'/5827.html','true',[],''],
	['PAGE','155576',jdecode('Music+Talk'),jdecode(''),'/155576.html','true',[],''],
	['PAGE','154376',jdecode('Equipment'),jdecode(''),'/154376.html','true',[],''],
	['PAGE','75001',jdecode('Contact'),jdecode(''),'/75001.html','true',[],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Pain';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10379';
theSitetree.graphicsetId='10552';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Pain',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10379',
				graphicsetId: 	'10552',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1201',
internalId:  '',
customField: '20100224-005530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182618',
internalId:  '',
customField: '20100224-005711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182639',
internalId:  '',
customField: '20100224-005618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182660',
internalId:  '',
customField: '20100224-005652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20100225-085011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '155576',
internalId:  '',
customField: '20100224-005800'
};
webappMappings['1002']=webappMappings['1002-155576aendu0inxv86']={
webappId:    '1002',
documentId:  '155576',
internalId:  '155576aendu0inxv86',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154460',
internalId:  '',
customField: '20100209-001408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '184576',
internalId:  '',
customField: '20100224-005638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5827',
internalId:  '',
customField: '20100207-005303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182576',
internalId:  '',
customField: '20100224-005545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182597',
internalId:  '',
customField: '20100224-005601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '154376',
internalId:  '',
customField: '20100131-035955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75001',
internalId:  '',
customField: '20100224-005510'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXV86';
var companyName   = 'K.A.R++MUSIC+%28Christian+Music+Networks%29';
var htmlTitle	  = 'Keith+A.+Rowel%2C+Film+and+T.V.+Music+Productions';
var metaKeywords  = 'Film+Music+production%2C+Film+Composer%2C+Accompaniment+Tracks%2C+Sound+Effects%2C+Sound+Tracks%2C+Stage+Play+Music+Productions';
var metaContents  = 'Keith+A.+Rowel+is+aspiring+to+become+a+Music+Composer+of+Film+Scores+and+Soundtrack+Production%3B+Keith+is+very+fond+of+the+works+of+Film+Composer+Shawn+Clements+who+scored+Quantum+Quest+a++3-D%2C+computer+animated%2C+large+format%2C+action-adventure+film+that+interweaves+animated+sequences+with+actual+space+...';
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();
};
