/* [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','5101',jdecode('Home'),jdecode(''),'/5101.html','true',[],''],
	['PAGE','24301',jdecode('Yard+Sale'),jdecode(''),'/24301.html','true',[],''],
	['PAGE','25601',jdecode('Quilt+Drawing'),jdecode(''),'/25601.html','true',[],''],
	['PAGE','17901',jdecode('Exclusively+OE'),jdecode(''),'/17901/index.html','true',[ 
		['PAGE','21501',jdecode('Homes+for+Rent+or+Sale'),jdecode(''),'/17901/21501.html','true',[],''],
		['PAGE','21522',jdecode('Bed+%26+Breakfasts'),jdecode(''),'/17901/21522.html','true',[],''],
		['PAGE','22901',jdecode('Products+for+Sale'),jdecode(''),'/17901/22901.html','true',[],'']
	],''],
	['PAGE','26901',jdecode('New+Homeowners'),jdecode(''),'/26901.html','true',[],''],
	['PAGE','10601',jdecode('Organization'),jdecode(''),'/10601/index.html','true',[ 
		['PAGE','12001',jdecode('Newsletters'),jdecode(''),'/10601/12001.html','true',[],''],
		['PAGE','13201',jdecode('By+Laws'),jdecode(''),'/10601/13201.html','true',[],''],
		['PAGE','22601',jdecode('Meetings'),jdecode(''),'/10601/22601.html','true',[],''],
		['PAGE','23901',jdecode('District+Issues'),jdecode(''),'/10601/23901.html','true',[],''],
		['PAGE','25901',jdecode('Past+Events'),jdecode(''),'/10601/25901.html','true',[],'']
	],''],
	['PAGE','5152',jdecode('Home+Tour'),jdecode(''),'/5152/index.html','true',[ 
		['PAGE','20201',jdecode('Thank+You'),jdecode(''),'/5152/20201.html','false',[],'']
	],''],
	['PAGE','5201',jdecode('Calendar+of+Events'),jdecode(''),'/5201.html','true',[],''],
	['PAGE','11701',jdecode('Contact+Us'),jdecode(''),'/11701.html','true',[],''],
	['PAGE','12201',jdecode('Links'),jdecode(''),'/12201.html','true',[],'']];
var siteelementCount=19;
theSitetree.topTemplateName='Antique';
theSitetree.paletteFamily='CAB996';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11061';
theSitetree.graphicsetId='11834';
theSitetree.contentColor='D1C3A6';
theSitetree.contentBGColor='856A3B';
var theTemplate={
				name: 			'Antique',
				paletteFamily: 	'CAB996',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11061',
				graphicsetId: 	'11834',
				contentColor: 	'D1C3A6',
				contentBGColor: '856A3B',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'664F23',
				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:  '5101',
internalId:  '',
customField: '20100109-000047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5152',
internalId:  '',
customField: '20091216-185227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100108-234456'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20091216-183859'
};
webappMappings['7008']=webappMappings['7008-2865']={
webappId:    '7008',
documentId:  '11701',
internalId:  '2865',
customField: 'language:en;country:US;'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC241']={
webappId:    '5003',
documentId:  '5101',
internalId:  'tid:1;pid:WSCSYSSSSLYTC241',
customField: 'en:US::;language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12001',
internalId:  '',
customField: '20091005-011230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12201',
internalId:  '',
customField: '20091005-020028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20090412-152518'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13201',
internalId:  '',
customField: '20090412-141636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17901',
internalId:  '',
customField: '20091024-234243'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '20201',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20201',
internalId:  '',
customField: '20090421-233444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21501',
internalId:  '',
customField: '20090602-140443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21522',
internalId:  '',
customField: '20090602-140443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20091216-183517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20091005-230857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23901',
internalId:  '',
customField: '20091005-230428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20091024-235313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25601',
internalId:  '',
customField: '20091020-184357'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25901',
internalId:  '',
customField: '20091005-191533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20091012-181730'
};
webappMappings['1501']=webappMappings['1501-6039383']={
webappId:    '1501',
documentId:  '5101',
internalId:  '6039383',
customField: '1501'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INLJ9C';
var companyName   = 'Old+Escondido+Historic+District';
var htmlTitle	  = 'Old+Escondido+Historic+District';
var metaKeywords  = 'Old+Escondido%2C+Old+Escondido+Historic+District%2C+Old+Escondido+Neighborhood%2C+Old+Escondido+Neighborhood+Group%2C+Old+Escondido+Mothers+Day+Home+Tour%2C+Mothers+Day+Home+Tour%2C+Mothers+Day%2C+Historic+Home+Tour%2C+OEHD%2C+Yard+Sales%2C+Escondido+History%2C+Escondido+Historic%2C+Opportunity+Quilt';
var metaContents  = 'Old+Escondido+Historic+District';
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();
};
