/* [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','21601',jdecode('Xestential.com'),jdecode(''),'/21601/index.html','true',[ 
		['PAGE','22601',jdecode('Music+%26+Video'),jdecode(''),'/21601/22601.html','true',[],'']
	],''],
	['PAGE','22622',jdecode('Perception+%26+Reality'),jdecode(''),'/22622.html','true',[],''],
	['PAGE','22643',jdecode('Reason+%26+Logic'),jdecode(''),'/22643.html','true',[],''],
	['PAGE','22664',jdecode('Philosophy+%26+Intelligence'),jdecode(''),'/22664.html','true',[],''],
	['PAGE','22685',jdecode('Science+%26+Knowledge'),jdecode(''),'/22685.html','true',[],''],
	['PAGE','22706',jdecode('Humanity+%26+Religion'),jdecode(''),'/22706.html','true',[],''],
	['PAGE','22727',jdecode('Space-Time+%3A+%22Blog%22'),jdecode(''),'/22727.html','true',[],''],
	['PAGE','23901',jdecode('Search+%26+Glossary'),jdecode(''),'/23901.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Stars';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10510';
theSitetree.graphicsetId='10916';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Stars',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10510',
				graphicsetId: 	'10916',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '21601',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '23901',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '21601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-12028111']={
webappId:    '1501',
documentId:  '21601',
internalId:  '12028111',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20080928-190847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22622',
internalId:  '',
customField: '20080925-182439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21601',
internalId:  '',
customField: '20090406-223106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22643',
internalId:  '',
customField: '20080928-074403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22664',
internalId:  '',
customField: '20081006-064155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22685',
internalId:  '',
customField: '20080929-215636'
};
webappMappings['7050']=webappMappings['7050-5002']={
webappId:    '7050',
documentId:  '22727',
internalId:  '5002',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22706',
internalId:  '',
customField: '20080928-074856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22727',
internalId:  '',
customField: '20080925-182528'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22601',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22622',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22643',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22664',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22685',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22706',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22727',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23901',
internalId:  '',
customField: '20080925-180950'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '23901',
internalId:  'search',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INEWE8';
var companyName   = 'Xestential.com';
var htmlTitle	  = 'Xestential%2COriginal+Songs+%26+Videos%2CMusic%2CVideo%2CPerception%2CReality%2CReason%2CLogic%2CPhilosophy%2CIntelligence%2CScience%2CKnowledge%2CHumanity%2CReligion%2CSpace%2CTime%2CExistentialism.';
var metaKeywords  = 'Xestential.com%2CXestential%2CMusic%2CVideo%2COriginal+songs+and+Original+Videos%2CSongs%2CVideos%2CArt%2CPhilosophy%2CSpace%2CTime%2CReality%2CReason%2CLogic%2CExistentialism.Musician%2CArtist%2CPhilosopher%2COriginal+Songs%2COriginal+Videos%2CPerception%2CReality%2CSelf+Control.Relativity%2CIntelligence%2CTruth%2CFaith%2CAnalytical+Thought%2CWisdom%2CObjectivity%2CMyth%2CLegend.';
var metaContents  = 'Xestential.com%2CXestential%2CMusic%2CVideo%2COriginal+songs+and+Original+Videos%2CSongs%2CVideos%2CArt%2CPhilosophy%2CSpace%2CTime%2CReality%2CReason%2CLogic%2CExistentialism.Musician%2CArtist%2CPhilosopher%2COriginal+Songs%2COriginal+Videos%2CPerception%2CReality%2CSelf+Control.Relativity%2CIntelligence%2CTruth%2CFaith%2CAnalytical+Thought%2CWisdom%2CObjectivity%2CMyth%2CLegend.';
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();
};
