/* [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','1901',jdecode('Home'),jdecode(''),'/1901.html','true',[],'',''],
	['PAGE','4329',jdecode('Groups'),jdecode(''),'/4329/index.html','true',[ 
		['PAGE','6529',jdecode('TNT'),jdecode(''),'/4329/6529.html','true',[],'',''],
		['PAGE','6550',jdecode('SWAP'),jdecode(''),'/4329/6550.html','true',[],'',''],
		['PAGE','6571',jdecode('MIGHT'),jdecode(''),'/4329/6571.html','true',[],'',''],
		['PAGE','6592',jdecode('Girl%26%23x27%3Bs+Night'),jdecode(''),'/4329/6592.html','true',[],'','']
	],'',''],
	['PAGE','4371',jdecode('Adult+Leaders'),jdecode(''),'/4371.html','true',[],'',''],
	['PAGE','23229',jdecode('Workcamp+2011'),jdecode(''),'/23229.html','true',[],'',''],
	['PAGE','12729',jdecode('Calendar'),jdecode(''),'/12729.html','true',[],'',''],
	['PAGE','4350',jdecode('Pictures'),jdecode(''),'/4350.html','true',[],'',''],
	['PAGE','17929',jdecode('Resources'),jdecode(''),'/17929/index.html','true',[ 
		['PAGE','11571',jdecode('Devotional+Material'),jdecode(''),'/17929/11571.html','true',[],'',''],
		['PAGE','16329',jdecode('Volunteering'),jdecode(''),'/17929/16329.html','true',[],'',''],
		['PAGE','17950',jdecode('Dating+%26+Relationships'),jdecode(''),'/17929/17950.html','true',[],'',''],
		['PAGE','17971',jdecode('Depression+'),jdecode(''),'/17929/17971.html','true',[],'',''],
		['PAGE','29029',jdecode('Parents'),jdecode(''),'/17929/29029.html','true',[],'','']
	],'',''],
	['PAGE','27129',jdecode('Kids+Time'),jdecode(''),'/27129.html','true',[],'',''],
	['PAGE','4434',jdecode('Contact+Us'),jdecode(''),'/4434/index.html','true',[ 
		['PAGE','11592',jdecode('Email'),jdecode(''),'/4434/11592.html','true',[],'','']
	],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Scenery';
theSitetree.paletteFamily='A01D1A';
theSitetree.keyvisualId='6950';
theSitetree.keyvisualName='kv_6950.jpg';
theSitetree.fontsetId='11227';
theSitetree.graphicsetId='12052';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='B92E2B';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Scenery',
				paletteFamily: 	'A01D1A',
				keyvisualId: 	'6950',
				keyvisualName: 	'kv_6950.jpg',
				fontsetId: 		'11227',
				graphicsetId: 	'12052',
				contentColor: 	'FFFFFF',
				contentBGColor: 'B92E2B',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20100811-091022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4329',
internalId:  '',
customField: '20091214-094413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6529',
internalId:  '',
customField: '20100427-091826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6550',
internalId:  '',
customField: '20091207-132446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6571',
internalId:  '',
customField: '20091207-133651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6592',
internalId:  '',
customField: '20091207-135126'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4350',
internalId:  '',
customField: '20100421-134959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4434',
internalId:  '',
customField: '20100125-170511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4371',
internalId:  '',
customField: '20100301-093108'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16329',
internalId:  '',
customField: '20100324-151326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17929',
internalId:  '',
customField: '20100407-094100'
};
webappMappings['7008']=webappMappings['7008-25279']={
webappId:    '7008',
documentId:  '11592',
internalId:  '25279',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17971',
internalId:  '',
customField: '20100415-094257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11592',
internalId:  '',
customField: '20100125-170624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17950',
internalId:  '',
customField: '20100415-094243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11571',
internalId:  '',
customField: '20100713-140902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12729',
internalId:  '',
customField: '20100825-132032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27129',
internalId:  '',
customField: '20100825-204532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29029',
internalId:  '',
customField: '20100901-162608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23229',
internalId:  '',
customField: '20100704-093458'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INVTOZ';
var companyName   = 'Ruthfred+Youth+Ministry';
var htmlTitle	  = 'Ruthfred+Youth+Ministry';
var metaKeywords  = '';
var metaContents  = '';
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();
};
