/* [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','5001',jdecode('Welcome'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','23601',jdecode('Giving'),jdecode(''),'/23601.html','true',[],''],
	['PAGE','135767',jdecode('CD%2FDVD+Club'),jdecode(''),'/135767.html','true',[],''],
	['PAGE','5094',jdecode('Pastor+Mel'),jdecode(''),'/5094.html','true',[],''],
	['PAGE','26901',jdecode('Mp3+Devotions'),jdecode(''),'/26901.html','true',[],''],
	['PAGE','116867',jdecode('Prayer+Helps'),jdecode(''),'/116867.html','true',[],''],
	['PAGE','5073',jdecode('Contact+Us'),jdecode(''),'/5073.html','true',[],''],
	['PAGE','113915',jdecode('Photos'),jdecode(''),'/113915.html','true',[],''],
	['PAGE','98715',jdecode('Store+'),jdecode(''),'/98715.html','true',[],''],
	['PAGE','142767',jdecode('Message+List'),jdecode(''),'/142767.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5e5e5e';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10448',
				contentColor: 	'FFFFFF',
				contentBGColor: '5e5e5e',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'5E5E5E',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-150']={
webappId:    '7008',
documentId:  '5073',
internalId:  '150',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100302-151501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20100223-142240'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142767',
internalId:  '',
customField: '20100316-150329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20100302-151706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98715',
internalId:  '',
customField: '20100316-150539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23601',
internalId:  '',
customField: '20100316-151950'
};
webappMappings['7060']=webappMappings['7060-2d5c590b432f894598564a89994ba9dc']={
webappId:    '7060',
documentId:  '113915',
internalId:  '2d5c590b432f894598564a89994ba9dc',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20100413-132528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135767',
internalId:  '',
customField: '20100413-132814'
};
webappMappings['4001']=webappMappings['4001-15911200']={
webappId:    '4001',
documentId:  '98715',
internalId:  '15911200',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '113915',
internalId:  '',
customField: '20100218-152355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '116867',
internalId:  '',
customField: '20100316-152622'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABR330INVF76';
var companyName   = '%22Real+Life%22++%2F++Pastor+Mel+Blackaby+++';
var htmlTitle	  = 'ReaLifeTV+-+Dr.+Mel+Blackaby+-++FBC+Jonesboro%2CGA.';
var metaKeywords  = 'Sermons%2C+Teaching%2C+Biblical+teaching%2C+Christian+education%2C+Devotions%2C+Knowing+God%2C+Serving+God%2C+The+Holy+Spirit%2C+';
var metaContents  = 'Pastor+Mel+Blackaby+speaks+to+the+church.+From+First+Baptist+Church+Jonesboro%2C+Georgia.+Timely+message+giving++believers++hope+and+confidence+that+God+is+on+the+throne.+Willing+and+desirous+of+an+intimate+relationship+with+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();
};
