/* [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','42',jdecode('Home'),jdecode(''),'/42.html','true',[],''],
	['PAGE','99',jdecode('Preschool+Program'),jdecode(''),'/99/index.html','true',[ 
		['PAGE','4143',jdecode('Hours+and+Costs'),jdecode(''),'/99/4143.html','true',[],'']
	],''],
	['PAGE','63',jdecode('Before%2FAfter+School+'),jdecode(''),'/63/index.html','true',[ 
		['PAGE','117',jdecode('Hours+and+Costs'),jdecode(''),'/63/117.html','true',[],''],
		['PAGE','72',jdecode('Locations'),jdecode(''),'/63/72.html','true',[],'']
	],''],
	['PAGE','90',jdecode('Vacation+Programs'),jdecode(''),'/90.html','true',[],''],
	['PAGE','108',jdecode('Forms+and+Information'),jdecode(''),'/108.html','true',[],''],
	['PAGE','81',jdecode('Staff'),jdecode(''),'/81.html','true',[],''],
	['PAGE','126',jdecode('Contact+Us'),jdecode(''),'/126/index.html','true',[ 
		['PAGE','705',jdecode('Contact+Us+%28follow+up+page%29'),jdecode(''),'/126/705.html','false',[],'']
	],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Macao';
theSitetree.paletteFamily='607FB8';
theSitetree.keyvisualId='6421';
theSitetree.keyvisualName='kv_6421.jpg';
theSitetree.fontsetId='11167';
theSitetree.graphicsetId='11976';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='A3BAE5';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Macao',
				paletteFamily: 	'607FB8',
				keyvisualId: 	'6421',
				keyvisualName: 	'kv_6421.jpg',
				fontsetId: 		'11167',
				graphicsetId: 	'11976',
				contentColor: 	'000000',
				contentBGColor: 'A3BAE5',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1001']=webappMappings['1001-awh010inxptn10a03d366e4']={
webappId:    '1001',
documentId:  '126',
internalId:  'awh010inxptn10a03d366e4',
customField: ''
};
webappMappings['1001']=webappMappings['1001-awh010inxptn10a03d366e4']={
webappId:    '1001',
documentId:  '705',
internalId:  'awh010inxptn10a03d366e4',
customField: 'followUp'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '42',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20100618-164617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '99',
internalId:  '',
customField: '20100603-103946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4143',
internalId:  '',
customField: '20100603-104200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63',
internalId:  '',
customField: '20100310-110058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117',
internalId:  '',
customField: '20100323-111209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72',
internalId:  '',
customField: '20100310-111640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90',
internalId:  '',
customField: '20100310-112002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108',
internalId:  '',
customField: '20100603-110513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81',
internalId:  '',
customField: '20100323-115835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126',
internalId:  '',
customField: '20090603-103912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '705',
internalId:  '',
customField: '20060316-091127'
};
webappMappings['1501']=webappMappings['1501-1026607']={
webappId:    '1501',
documentId:  '42',
internalId:  '1026607',
customField: '1501'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH010INXPTN';
var companyName   = 'Stoughton+Extended+Day+';
var htmlTitle	  = '';
var metaKeywords  = 'After+school%2C+school%2C+working%2C+parents%2C+child%2C+children%2C+childcare%2C+child+care%2C+summer+camp%2C+program%2C+stoughton%2C+Stoughton%2C+Massachusetts%2C+affordable%2C+quality%2C+school+age%2C+preschool%2C+infant%2C+toddler%2C+afterschool+programs';
var metaContents  = 'after+school+preschool+program+for+working+parents+in+Stoughton%2C+Massachusetts.';
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();
};
