/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],''],
	['PAGE','652',jdecode('Philosophy'),jdecode(''),'/652.html','true',[],''],
	['PAGE','673',jdecode('Faculty+and+Staff'),jdecode(''),'/673/index.html','true',[ 
		['PAGE','35101',jdecode('Our+Teacher'),jdecode(''),'/673/35101.html','true',[],'']
	],''],
	['PAGE','694',jdecode('Parent+Duties'),jdecode(''),'/694.html','true',[],''],
	['PAGE','19022',jdecode('Schedules'),jdecode(''),'/19022/index.html','true',[ 
		['PAGE','31701',jdecode('Orientation'),jdecode(''),'/19022/31701.html','true',[],''],
		['PAGE','49601',jdecode('Field+Trips'),jdecode(''),'/19022/49601.html','true',[],''],
		['PAGE','31743',jdecode('Parent+of+the+Day'),jdecode(''),'/19022/31743.html','true',[],''],
		['PAGE','45201',jdecode('NK+Schools'),jdecode(''),'/19022/45201.html','true',[],'']
	],''],
	['PAGE','736',jdecode('Parent+of+the+Day'),jdecode(''),'/736/index.html','true',[ 
		['PAGE','32101',jdecode('3s'),jdecode(''),'/736/32101.html','true',[],''],
		['PAGE','32122',jdecode('AM+PreK'),jdecode(''),'/736/32122.html','true',[],''],
		['PAGE','32143',jdecode('PM+PreK'),jdecode(''),'/736/32143.html','true',[],''],
		['PAGE','45601',jdecode('Snacks'),jdecode(''),'/736/45601.html','true',[],'']
	],''],
	['PAGE','757',jdecode('Enrolling'),jdecode(''),'/757/index.html','true',[ 
		['PAGE','51501',jdecode('Letter'),jdecode(''),'/757/51501.html','true',[],''],
		['PAGE','33501',jdecode('PDF+Forms'),jdecode(''),'/757/33501.html','true',[],'']
	],''],
	['PAGE','48101',jdecode('Minutes'),jdecode(''),'/48101.html','true',[],''],
	['PAGE','17001',jdecode('Contact'),jdecode(''),'/17001.html','true',[],''],
	['PAGE','55501',jdecode('Map'),jdecode(''),'/55501.html','true',[],''],
	['PAGE','59801',jdecode('Forum'),jdecode(''),'/59801.html','false',[],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Roadsign';
theSitetree.paletteFamily='3E3C83';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10741';
theSitetree.graphicsetId='10498';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Roadsign',
				paletteFamily: 	'3E3C83',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10741',
				graphicsetId: 	'10498',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'666666',
				e_color: 		'999999',
				f_color: 		'663300',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-7178318']={
webappId:    '1501',
documentId:  '601',
internalId:  '7178318',
customField: '1501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '55501',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20091110-094937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20090120-194356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20091110-095534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35101',
internalId:  '',
customField: '20090803-101806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '694',
internalId:  '',
customField: '20090120-194454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20100315-141444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51501',
internalId:  '',
customField: '20100125-152349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33501',
internalId:  '',
customField: '20100315-141410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48101',
internalId:  '',
customField: '20080704-193025'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17001',
internalId:  '',
customField: '20070820-222507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55501',
internalId:  '',
customField: '20080704-193414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19022',
internalId:  '',
customField: '20091110-095710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20091110-095745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49601',
internalId:  '',
customField: '20091110-095803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31743',
internalId:  '',
customField: '20080704-192629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45201',
internalId:  '',
customField: '20090817-144902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '736',
internalId:  '',
customField: '20090120-194654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20080704-192827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32122',
internalId:  '',
customField: '20080704-192845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32143',
internalId:  '',
customField: '20080704-192905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20091110-095932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59801',
internalId:  '',
customField: '20090709-234530'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INEWCM';
var companyName   = 'The+Children%27s+Workshop+Preschool';
var htmlTitle	  = 'The+Childrens+Workshop+Preschool';
var metaKeywords  = 'Childrens+Childrens+Workshop+Little+Red+Schoolhouse+School+House+Preschool+Pre-school+Coop+Co-op+cooperative+co-operative++North+Kingstown+RI+Rhode+Island+';
var metaContents  = 'The+Home+Page+of+The+Childrens+Workshop+Cooperative+Preschool+located+at+the+Little+Red+Schoolhouse+in+North+Kingstown%2C+RI.';
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();
};
