/* [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','1101',jdecode('Home'),jdecode(''),'/1101.html','true',[],''],
	['PAGE','35201',jdecode('RITA%26%23x27%3BS+BLOG'),jdecode(''),'/35201.html','true',[],''],
	['PAGE','7701',jdecode('AUTHOR'),jdecode(''),'/7701.html','true',[],''],
	['PAGE','7722',jdecode('REFLECTIONS'),jdecode(''),'/7722.html','true',[],''],
	['PAGE','8401',jdecode('STORIES+OF+HOPE'),jdecode(''),'/8401/index.html','true',[ 
		['PAGE','8422',jdecode('The+Hope+of+Bethlehem'),jdecode(''),'/8401/8422.html','true',[],''],
		['PAGE','32701',jdecode('The+Amazing+Gift'),jdecode(''),'/8401/32701.html','true',[],'']
	],''],
	['PAGE','74901',jdecode('PUBLISHING+GALLERY'),jdecode(''),'/74901/index.html','true',[ 
		['PAGE','71801',jdecode('Delivered'),jdecode(''),'/74901/71801.html','true',[],''],
		['PAGE','7764',jdecode('Struggle+Creek'),jdecode(''),'/74901/7764.html','true',[],''],
		['PAGE','39001',jdecode('Abundance+of+Life'),jdecode(''),'/74901/39001.html','true',[],'']
	],''],
	['PAGE','57301',jdecode('Scriptures+for+the+Heart'),jdecode(''),'/57301.html','true',[],''],
	['PAGE','57801',jdecode('Positive+Thinking+Area'),jdecode(''),'/57801.html','true',[],''],
	['PAGE','7806',jdecode('FAVORITE+LINKS'),jdecode(''),'/7806.html','true',[],'']];
var siteelementCount=14;
theSitetree.topTemplateName='Wave';
theSitetree.paletteFamily='4382B8';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16368';
theSitetree.graphicsetId='12118';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4382B8';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Wave',
				paletteFamily: 	'4382B8',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16368',
				graphicsetId: 	'12118',
				contentColor: 	'FFFFFF',
				contentBGColor: '4382B8',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'1F4C73',
				e_color: 		'1F4C73',
				f_color: 		'1F4C73',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1101',
internalId:  '',
customField: '20100521-181405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7701',
internalId:  '',
customField: '20091001-113016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7722',
internalId:  '',
customField: '20080916-012039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20081206-131402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8422',
internalId:  '',
customField: '20081206-124317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7764',
internalId:  '',
customField: '20081109-132256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7806',
internalId:  '',
customField: '20091001-112225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35201',
internalId:  '',
customField: '20100304-131137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32701',
internalId:  '',
customField: '20081206-131301'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1101',
internalId:  '1006',
customField: '1006'
};
webappMappings['7050']=webappMappings['7050-4267']={
webappId:    '7050',
documentId:  '35201',
internalId:  '4267',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39001',
internalId:  '',
customField: '20100202-235425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57301',
internalId:  '',
customField: '20090318-205655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57801',
internalId:  '',
customField: '20100304-205715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71801',
internalId:  '',
customField: '20100202-152053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74901',
internalId:  '',
customField: '20100203-145653'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN2MW6';
var companyName   = 'ritagarcia.com';
var htmlTitle	  = 'ritagarcia.com';
var metaKeywords  = 'christian+writinginspirational+writingrita+garciastruggle+creekfaithwriters';
var metaContents  = 'christian+inspirational+writingInspiring+others+to+live+the+life+God+designed+for+them.';
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();
};
