/* [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','12101',jdecode('Home'),jdecode(''), jdecode('%2F12101.html'), 'true',[],'',''],
	['PAGE','157245',jdecode('SPIRIT'),jdecode(''), jdecode('%2F157245.html'), 'true',[],'',''],
	['PAGE','157845',jdecode('TODAY%26%23x27%3Bs+WORD'),jdecode(''), jdecode('%2F157845.html'), 'true',[],'',''],
	['PAGE','159845',jdecode('SPARKLING+DIAMONDS'),jdecode(''), jdecode('%2F159845.html'), 'true',[],'',''],
	['PAGE','161045',jdecode('EMERALDS'),jdecode(''), jdecode('%2F161045.html'), 'true',[],'',''],
	['PAGE','161445',jdecode('SAPPHIRES'),jdecode(''), jdecode('%2F161445.html'), 'true',[],'',''],
	['PAGE','161645',jdecode('The+LIGHT'),jdecode(''), jdecode('%2F161645.html'), 'true',[],'',''],
	['PAGE','158245',jdecode('INSPIRATION'),jdecode(''), jdecode('%2F158245.html'), 'true',[],'',''],
	['PAGE','160245',jdecode('CRYSTALS'),jdecode(''), jdecode('%2F160245.html'), 'true',[],'',''],
	['PAGE','159245',jdecode('MOTIVATION'),jdecode(''), jdecode('%2F159245.html'), 'true',[],'',''],
	['PAGE','158645',jdecode('PEARLS+of+WISDOM'),jdecode(''), jdecode('%2F158645.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Greeting';
theSitetree.paletteFamily='8C8B75';
theSitetree.keyvisualId='8439';
theSitetree.keyvisualName='kv_8439.jpg';
theSitetree.fontsetId='17079';
theSitetree.graphicsetId='12452';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLY0XFEL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Greeting',
				paletteFamily: 	'8C8B75',
				keyvisualId: 	'8439',
				keyvisualName: 	'kv_8439.jpg',
				fontsetId: 		'17079',
				graphicsetId: 	'12452',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20111221-144418'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '157245',
internalId:  '',
customField: '20111227-101021'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '12101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '161645',
internalId:  '',
customField: '20120119-162244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '157845',
internalId:  '',
customField: '20111227-101346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '158245',
internalId:  '',
customField: '20111227-101706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '158645',
internalId:  '',
customField: '20111227-105300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '159245',
internalId:  '',
customField: '20111227-104240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '159845',
internalId:  '',
customField: '20111221-140620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '160245',
internalId:  '',
customField: '20111221-144812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '161045',
internalId:  '',
customField: '20111227-112030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '161445',
internalId:  '',
customField: '20120119-161514'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INZX8U';
var companyName   = '%22Journey+With+Spirit%22';
var htmlTitle	  = 'Journey+With+Spirit';
var metaKeywords  = 'Todays+Prayers%0D%0A%0D%0A%0D%0A%0D%0ATodays+Quotes%0D%0A%0D%0AJoyce+BeLynda+Russaw%0D%0A%0D%0AJourney+with+Spirit%0D%0A%0D%0A%0D%0A%0D%0AAffirmations%0D%0A%0D%0AJoyce+Belynda+Russaw%0D%0AJourney+With+Spirit%0D%0A%0D%0ANewsletters';
var metaContents  = 'An+Inspiration%2FMotivational+site+that+provides+you+with+spiritual+guidance+for+each+day.%0D%0A%0D%0A%0D%0A%0D%0AWe+also+offer+a+daily+newsletter+by+request+to+russaw%40bellsouth.net.';
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();
};

