/* [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','112',jdecode('Home'),jdecode(''),'/112.html','true',[],''],
	['PAGE','151',jdecode('Contacts'),jdecode(''),'/151/index.html','true',[ 
		['PAGE','1864',jdecode('Links'),jdecode(''),'/151/1864.html','true',[],'']
	],''],
	['PAGE','16333',jdecode('Most+recent+newsletter'),jdecode(''),'/16333/index.html','true',[ 
		['PAGE','15512',jdecode('Archived+newsletters'),jdecode(''),'/16333/15512.html','true',[],'']
	],''],
	['PAGE','18512',jdecode('Photo+Gallery'),jdecode(''),'/18512.html','true',[],''],
	['PAGE','133',jdecode('Events'),jdecode(''),'/133.html','true',[],''],
	['PAGE','1809',jdecode('Membership+and+Policy'),jdecode(''),'/1809/index.html','true',[ 
		['PAGE','1345',jdecode('Membership+Form'),jdecode(''),'/1809/1345.html','true',[],'']
	],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Clearline';
theSitetree.paletteFamily='C7C6C5';
theSitetree.keyvisualId='3290';
theSitetree.keyvisualName='kv_3290.jpg';
theSitetree.fontsetId='10421';
theSitetree.graphicsetId='10718';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Clearline',
				paletteFamily: 	'C7C6C5',
				keyvisualId: 	'3290',
				keyvisualName: 	'kv_3290.jpg',
				fontsetId: 		'10421',
				graphicsetId: 	'10718',
				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: 		'C7C6C5',
				e_color: 		'989696',
				f_color: 		'989696',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '112',
internalId:  '',
customField: '20060514-204904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '133',
internalId:  '',
customField: '20090526-214732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1809',
internalId:  '',
customField: '20090413-215820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '151',
internalId:  '',
customField: '20091023-174455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1345',
internalId:  '',
customField: '20090413-220306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1864',
internalId:  '',
customField: '20070329-030513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18512',
internalId:  '',
customField: '20090930-214244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16333',
internalId:  '',
customField: '20100121-222448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15512',
internalId:  '',
customField: '20100121-214329'
};
webappMappings['7060']=webappMappings['7060-4ed8d6cec299a8978b36c410b103cf92']={
webappId:    '7060',
documentId:  '18512',
internalId:  '4ed8d6cec299a8978b36c410b103cf92',
customField: 'language:en;country:US;'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH010INXH80';
var companyName   = 'Wenatchee+Row+%26+Paddle+Club';
var htmlTitle	  = 'Wenatchee+Row+and+Paddle+Club';
var metaKeywords  = 'Rowing%2C+Kayaking+and+Canoeing';
var metaContents  = 'Open+water+Rowing%2C+Kayaking+and+Canoeing+Club+in+Wenatchee%2C+WA';
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();
};
