/* [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','6001',jdecode('Home'),jdecode(''), jdecode('%2F6001.html'), 'true',[],'',''],
	['PAGE','9801',jdecode('Organization'),jdecode(''), jdecode('%2F9801.html'), 'true',[],'',''],
	['PAGE','9822',jdecode('Members'),jdecode(''), jdecode('%2F9822.html'), 'true',[],'',''],
	['PAGE','9843',jdecode('Events'),jdecode(''), jdecode('%2F9843.html'), 'true',[],'',''],
	['PAGE','51829',jdecode('Photos+2010+Dutch+Youth'),jdecode(''), jdecode('%2F51829.html'), 'true',[],'',''],
	['PAGE','9864',jdecode('Photos+2009+Dutch+Adults'),jdecode(''), jdecode('%2F9864.html'), 'true',[],'',''],
	['PAGE','37529',jdecode('Photos+2009+Royal+Visit'),jdecode(''), jdecode('%2F37529.html'), 'true',[],'',''],
	['PAGE','35001',jdecode('Gallery+2'),jdecode(''), jdecode('%2F35001.html'), 'true',[],'',''],
	['PAGE','9885',jdecode('Links'),jdecode(''), jdecode('%2F9885.html'), 'true',[],'',''],
	['PAGE','9906',jdecode('News+%26+Comments'),jdecode(''), jdecode('%2F9906.html'), 'true',[],'',''],
	['PAGE','9927',jdecode('Archives'),jdecode(''), jdecode('%2F9927.html'), 'true',[],'',''],
	['PAGE','9948',jdecode('Contacts'),jdecode(''), jdecode('%2F9948.html'), 'true',[],'',''],
	['PAGE','22301',jdecode('Itinerary'),jdecode(''), jdecode('%2F22301.html'), 'true',[],'',''],
	['PAGE','46829',jdecode('Forms'),jdecode(''), jdecode('%2F46829.html'), 'true',[],'',''],
	['PAGE','52429',jdecode('Weather+information'),jdecode(''), jdecode('%2F52429.html'), 'true',[],'',''],
	['PAGE','54340',jdecode('New+media+album'),jdecode(''), jdecode('%2F54340.html'), 'false',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Gaudy';
theSitetree.paletteFamily='5C5D96';
theSitetree.keyvisualId='5936';
theSitetree.keyvisualName='kv_5936.jpg';
theSitetree.fontsetId='11115';
theSitetree.graphicsetId='11905';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='6E8BCE';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Gaudy',
				paletteFamily: 	'5C5D96',
				keyvisualId: 	'5936',
				keyvisualName: 	'kv_5936.jpg',
				fontsetId: 		'11115',
				graphicsetId: 	'11905',
				contentColor: 	'000000',
				contentBGColor: '6E8BCE',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20101203-155002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9864',
internalId:  '',
customField: '20090926-174334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9843',
internalId:  '',
customField: '20110327-100859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9801',
internalId:  '',
customField: '20101129-113909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9822',
internalId:  '',
customField: '20101108-145303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9885',
internalId:  '',
customField: '20100626-175848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9906',
internalId:  '',
customField: '20100417-165019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9927',
internalId:  '',
customField: '20110327-100526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9948',
internalId:  '',
customField: '20091007-103426'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22301',
internalId:  '',
customField: '20110327-101137'
};
webappMappings['7060']=webappMappings['7060-62fb96d82efb61c2b3a914e375562242']={
webappId:    '7060',
documentId:  '9864',
internalId:  '62fb96d82efb61c2b3a914e375562242',
customField: 'language:en;country:US;'
};
webappMappings['7050']=webappMappings['7050-12185']={
webappId:    '7050',
documentId:  '9906',
internalId:  '12185',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-1758044c004ee72513205fb80c9498a9']={
webappId:    '7060',
documentId:  '54340',
internalId:  '1758044c004ee72513205fb80c9498a9',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35001',
internalId:  '',
customField: '20100827-121505'
};
webappMappings['7060']=webappMappings['7060-910ce8eacbe1001c0b909397076e0b14']={
webappId:    '7060',
documentId:  '37529',
internalId:  '910ce8eacbe1001c0b909397076e0b14',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37529',
internalId:  '',
customField: '20090928-154047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46829',
internalId:  '',
customField: '20100822-115644'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51829',
internalId:  '',
customField: '20110112-133857'
};
webappMappings['7080']=webappMappings['7080-800']={
webappId:    '7080',
documentId:  '52429',
internalId:  '800',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52429',
internalId:  '',
customField: '20101201-171728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54340',
internalId:  '',
customField: '20100619-155142'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INVK55';
var companyName   = 'Schenectady-Nijkerk+Council';
var htmlTitle	  = '';
var metaKeywords  = 'Schenectady+Nijkerk+Dutch+Netherlands+sister-city+Arendt+Van+Curler+exchange+heritage';
var metaContents  = 'Schenectady-Nijkerk+Council+supports+exchange+programs+with+sister-city+Nijkerk+in+the+Netherlands';
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();
};

