/* [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','42',jdecode('Home'),jdecode(''),'/42.html','true',[],'',''],
	['PAGE','63',jdecode('About+the+DEF'),jdecode(''),'/63.html','true',[],'',''],
	['PAGE','207',jdecode('Donate'),jdecode(''),'/207/index.html','true',[ 
		['PAGE','243',jdecode('Corporate+Sponsorship'),jdecode(''),'/207/243.html','true',[],'','']
	],'',''],
	['PAGE','189',jdecode('Apply+for+a+Grant'),jdecode(''),'/189/index.html','true',[ 
		['PAGE','198',jdecode('Grant+Application+Forms'),jdecode(''),'/189/198.html','true',[],'','']
	],'',''],
	['PAGE','162',jdecode('Approved+Grants'),jdecode(''),'/162/index.html','true',[ 
		['PAGE','9675',jdecode('Featured+Grant'),jdecode(''),'/162/9675.html','true',[],'',''],
		['PAGE','9451',jdecode('2008+and+2009++Grants'),jdecode(''),'/162/9451.html','true',[],'',''],
		['PAGE','5351',jdecode('2007+Grants'),jdecode(''),'/162/5351.html','true',[],'',''],
		['PAGE','4863',jdecode('2006+Grants'),jdecode(''),'/162/4863.html','true',[],'',''],
		['PAGE','3118',jdecode('2005+Grants'),jdecode(''),'/162/3118.html','true',[],'',''],
		['PAGE','180',jdecode('2004+Grants'),jdecode(''),'/162/180.html','true',[],'','']
	],'',''],
	['PAGE','6501',jdecode('Grant+Feedback'),jdecode(''),'/6501.html','true',[],'',''],
	['PAGE','108',jdecode('Events'),jdecode(''),'/108/index.html','true',[ 
		['PAGE','135',jdecode('Road+Race'),jdecode(''),'/108/135.html','true',[],'',''],
		['PAGE','1789',jdecode('Annual+Appeal'),jdecode(''),'/108/1789.html','true',[],'',''],
		['PAGE','126',jdecode('Divots+for+Duxbury'),jdecode(''),'/108/126.html','true',[],'',''],
		['PAGE','144',jdecode('Spelling+Bee'),jdecode(''),'/108/144.html','true',[],'',''],
		['PAGE','90620',jdecode('Spelling+Bee+Photo+Album'),jdecode(''),'/108/90620.html','true',[],'','']
	],'',''],
	['PAGE','3244',jdecode('News'),jdecode(''),'/3244.html','true',[],'',''],
	['PAGE','90',jdecode('President%26%23x27%3Bs+Message'),jdecode(''),'/90.html','true',[],'',''],
	['PAGE','81',jdecode('Trustees'),jdecode(''),'/81.html','true',[],'',''],
	['PAGE','99',jdecode('Annual+Report'),jdecode(''),'/99.html','true',[],'',''],
	['PAGE','2469',jdecode('Contact+Us'),jdecode(''),'/2469.html','true',[],'','']];
var siteelementCount=25;
theSitetree.topTemplateName='Cosy';
theSitetree.paletteFamily='6D834C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10401';
theSitetree.graphicsetId='10623';
theSitetree.contentColor='1D2315';
theSitetree.contentBGColor='D3DDC4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Cosy',
				paletteFamily: 	'6D834C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10401',
				graphicsetId: 	'10623',
				contentColor: 	'1D2315',
				contentBGColor: 'D3DDC4',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'6E844D',
				e_color: 		'8DA767',
				f_color: 		'404D2D',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '42',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20100705-102418'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '207',
internalId:  '',
customField: '20100215-153307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3244',
internalId:  '',
customField: '20090707-191453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63',
internalId:  '',
customField: '20090707-182034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81',
internalId:  '',
customField: '20090824-203800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90',
internalId:  '',
customField: '20090124-185841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '99',
internalId:  '',
customField: '20090112-152426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108',
internalId:  '',
customField: '20100705-102125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1789',
internalId:  '',
customField: '20091123-195957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135',
internalId:  '',
customField: '20100705-102223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126',
internalId:  '',
customField: '20090922-164041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '144',
internalId:  '',
customField: '20100202-162918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '162',
internalId:  '',
customField: '20100215-160110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9675',
internalId:  '',
customField: '20090123-143438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9451',
internalId:  '',
customField: '20100223-094358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5351',
internalId:  '',
customField: '20081118-072607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4863',
internalId:  '',
customField: '20080223-181450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3118',
internalId:  '',
customField: '20080223-180214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180',
internalId:  '',
customField: '20080223-180222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20090125-105426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189',
internalId:  '',
customField: '20090831-172322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '198',
internalId:  '',
customField: '20090125-102419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2469',
internalId:  '',
customField: '20100105-135441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '243',
internalId:  '',
customField: '20100215-153307'
};
webappMappings['7060']=webappMappings['7060-cafc3069f61563d21ebca2f617672059']={
webappId:    '7060',
documentId:  '90620',
internalId:  'cafc3069f61563d21ebca2f617672059',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90620',
internalId:  '',
customField: '20100202-142651'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN31PD';
var companyName   = 'Duxbury+Education+Foundation';
var htmlTitle	  = 'Duxbury+Education+Foundation';
var metaKeywords  = 'Duxbury+Education+Foundation%2C+Duxbury%2C+education+grants%2C+education+foundation';
var metaContents  = 'Duxbury+Education+Foundation%2C+Educational+Grants+in+Duxbury';
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();
};

