/* [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 POS_TARGET=8;
var theSitetree=[ 
	['PAGE','2101',jdecode('Home'),jdecode(''),'/2101.html','true',[],'',''],
	['PAGE','2194',jdecode('Paranormal+Investigations'),jdecode(''),'/2194/index.html','true',[ 
		['PAGE','8001',jdecode('Tips+%26+Tools'),jdecode(''),'/2194/8001.html','true',[],'','']
	],'',''],
	['PAGE','2173',jdecode('Psychic+Research'),jdecode(''),'/2173.html','true',[],'',''],
	['PAGE','3743',jdecode('Astrology+Reports'),jdecode(''),'/3743.html','true',[],'',''],
	['PAGE','3722',jdecode('Imprints'),jdecode(''),'/3722.html','true',[],'',''],
	['PAGE','2215',jdecode('Events'),jdecode(''),'/2215.html','true',[],'',''],
	['PAGE','3785',jdecode('About+us'),jdecode(''),'/3785/index.html','true',[ 
		['PAGE','3806',jdecode('How+to+find+us'),jdecode(''),'/3785/3806.html','true',[],'',''],
		['PAGE','3827',jdecode('The+Teams'),jdecode(''),'/3785/3827.html','true',[],'','']
	],'',''],
	['PAGE','2236',jdecode('Contact+Us'),jdecode(''),'/2236.html','true',[],'',''],
	['PAGE','3701',jdecode('Ghostly+Physics'),jdecode(''),'/3701.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='2E2E2E';
theSitetree.keyvisualId='11075';
theSitetree.keyvisualName='kv_11075.jpg';
theSitetree.fontsetId='31959';
theSitetree.graphicsetId='13798';
theSitetree.contentColor='DDC18B';
theSitetree.contentBGColor='2E2E2E';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'2E2E2E',
				keyvisualId: 	'11075',
				keyvisualName: 	'kv_11075.jpg',
				fontsetId: 		'31959',
				graphicsetId: 	'13798',
				contentColor: 	'DDC18B',
				contentBGColor: '2E2E2E',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20100723-125853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2194',
internalId:  '',
customField: '20100418-131430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20091005-175635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2173',
internalId:  '',
customField: '20100831-030410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3701',
internalId:  '',
customField: '20091011-184535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3743',
internalId:  '',
customField: '20090703-125226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3722',
internalId:  '',
customField: '20100421-185031'
};
webappMappings['7008']=webappMappings['7008-12408']={
webappId:    '7008',
documentId:  '3743',
internalId:  '12408',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2215',
internalId:  '',
customField: '20100113-202818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3785',
internalId:  '',
customField: '20091118-234457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3806',
internalId:  '',
customField: '20090117-173903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3827',
internalId:  '',
customField: '20100726-120550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2236',
internalId:  '',
customField: '20090117-171740'
};
webappMappings['7060']=webappMappings['7060-004c41c009c6320f5416450039bacdcc']={
webappId:    '7060',
documentId:  '2194',
internalId:  '004c41c009c6320f5416450039bacdcc',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-12562']={
webappId:    '7008',
documentId:  '2236',
internalId:  '12562',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '3806',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['7080']=webappMappings['7080-388']={
webappId:    '7080',
documentId:  '3701',
internalId:  '388',
customField: 'language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-15202577']={
webappId:    '1501',
documentId:  '2101',
internalId:  '15202577',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INE37X';
var companyName   = 'The+Ghostly+Portal';
var htmlTitle	  = 'The+Ghostly+Portal';
var metaKeywords  = 'ghost%2C+paranormal%2C+imprints%2C+psychic%2C+investigators%2C+spirits%2C+entities%2C+science%2C+theory%2C+communities%2C+spiritual%2C+metaphysical%2C+physics%2C+protocol%2C+ghostly%2C+portal%2C+modern%2C+research';
var metaContents  = 'Paranormal+Investigations+with+our+team+including+gallery+archives+for+the+review+of+evidence%2C+forums%2C+psychic+research+section%2C+ghost+hunters+section+with+tips+and+tools%2C+chat+rooms+and+much+more.';
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();
};
