/* [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','5301',jdecode('Home'),jdecode(''),'/5301.html','true',[],''],
	['PAGE','20022',jdecode('About+us'),jdecode(''),'/20022/index.html','true',[ 
		['PAGE','33501',jdecode('Faith+and+Philosophy'),jdecode(''),'/20022/33501.html','true',[],''],
		['PAGE','34601',jdecode('Accreditation'),jdecode(''),'/20022/34601.html','true',[],''],
		['PAGE','33522',jdecode('Athletics'),jdecode(''),'/20022/33522.html','true',[],''],
		['PAGE','6201',jdecode('Academics'),jdecode(''),'/20022/6201.html','true',[],''],
		['PAGE','6401',jdecode('Fine+Arts'),jdecode(''),'/20022/6401.html','true',[],''],
		['PAGE','5701',jdecode('Tuition+and+Fees'),jdecode(''),'/20022/5701.html','true',[],''],
		['PAGE','33543',jdecode('School+Calendar'),jdecode(''),'/20022/33543.html','true',[],''],
		['PAGE','33564',jdecode('Giving+to+Grace'),jdecode(''),'/20022/33564.html','true',[],''],
		['PAGE','20001',jdecode('Employment'),jdecode(''),'/20022/20001.html','true',[],''],
		['PAGE','20064',jdecode('Directions'),jdecode(''),'/20022/20064.html','true',[],'']
	],''],
	['PAGE','20401',jdecode('News'),jdecode(''),'/20401.html','true',[],''],
	['PAGE','46501',jdecode('Home+school+Programs'),jdecode(''),'/46501/index.html','true',[ 
		['PAGE','45601',jdecode('Join-A-Class'),jdecode(''),'/46501/45601.html','true',[],''],
		['PAGE','46522',jdecode('Join-A-Team'),jdecode(''),'/46501/46522.html','true',[],'']
	],''],
	['PAGE','38401',jdecode('Blog'),jdecode(''),'/38401.html','true',[],''],
	['PAGE','33585',jdecode('Photo+Album'),jdecode(''),'/33585.html','true',[],''],
	['PAGE','20422',jdecode('Contact+Us'),jdecode(''),'/20422.html','true',[],'']];
var siteelementCount=19;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='54';
theSitetree.graphicsetId='57';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Easy',
				paletteFamily: 	'003366',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'54',
				graphicsetId: 	'57',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003366',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20090511-165155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20090330-130902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20090511-163205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20090427-105532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20090420-093935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20001',
internalId:  '',
customField: '20090420-132855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20022',
internalId:  '',
customField: '20090330-154758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20064',
internalId:  '',
customField: '20090504-102339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20422',
internalId:  '',
customField: '20090427-104741'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-16461180']={
webappId:    '1501',
documentId:  '5301',
internalId:  '16461180',
customField: '1501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '20064',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['7008']=webappMappings['7008-15152']={
webappId:    '7008',
documentId:  '20422',
internalId:  '15152',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-3b0a1f3d086ef6d4c1afcf656fe51931']={
webappId:    '7060',
documentId:  '33585',
internalId:  '3b0a1f3d086ef6d4c1afcf656fe51931',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33564',
internalId:  '',
customField: '20090413-145312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33501',
internalId:  '',
customField: '20090420-115305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33522',
internalId:  '',
customField: '20090511-163358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33543',
internalId:  '',
customField: '20090511-162916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33585',
internalId:  '',
customField: '20090420-132734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20090511-163328'
};
webappMappings['7050']=webappMappings['7050-8774']={
webappId:    '7050',
documentId:  '38401',
internalId:  '8774',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38401',
internalId:  '',
customField: '20090427-111831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46501',
internalId:  '',
customField: '20090625-160501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20090512-231153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46522',
internalId:  '',
customField: '20090625-160501'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN3A53';
var companyName   = 'Grace+Academy+of+Creative+Learning';
var htmlTitle	  = 'Grace+Academy+of+Creative+Learning%2C+Inc.';
var metaKeywords  = 'private+schools%2C+high+school%2C+elementary%2C+christian+schools%2C+education%2C+northern+kentucky%2C+erlanger';
var metaContents  = 'Home+website+for+Grace+Academy+of+Creative+Learning+in+Erlanger%2C+Kentucky.+';
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();
};
