/* [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','240',jdecode('Home'),jdecode(''),'/240.html','true',[],''],
	['PAGE','261',jdecode('About+us'),jdecode(''),'/261/index.html','true',[ 
		['PAGE','270',jdecode('The+team'),jdecode(''),'/261/270.html','true',[],'']
	],''],
	['PAGE','279',jdecode('Products'),jdecode(''),'/279/index.html','true',[ 
		['PAGE','288',jdecode('First+Product'),jdecode(''),'/279/288.html','true',[],''],
		['PAGE','297',jdecode('Second+Product'),jdecode(''),'/279/297.html','true',[],''],
		['PAGE','306',jdecode('Third+Product'),jdecode(''),'/279/306.html','true',[],'']
	],''],
	['PAGE','315',jdecode('Offers'),jdecode(''),'/315.html','true',[],''],
	['PAGE','324',jdecode('Jobs'),jdecode(''),'/324.html','true',[],''],
	['PAGE','333',jdecode('Contact'),jdecode(''),'/333/index.html','true',[ 
		['PAGE','342',jdecode('Adresses'),jdecode(''),'/333/342.html','true',[],''],
		['PAGE','351',jdecode('How+to+find+us'),jdecode(''),'/333/351.html','true',[],'']
	],''],
	['PAGE','360',jdecode('Tips+%26+Tricks'),jdecode(''),'/360.html','true',[],''],
	['PAGE','842',jdecode('Pictures'),jdecode(''),'/842.html','true',[],''],
	['PAGE','1921',jdecode('Journal'),jdecode(''),'/1921.html','true',[],''],
	['PAGE','6075',jdecode('Art+Work'),jdecode(''),'/6075.html','true',[],'']];
var siteelementCount=16;
theSitetree.topTemplateName='Zoe';
theSitetree.paletteFamily='243356';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='409';
theSitetree.graphicsetId='456';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Zoe',
				paletteFamily: 	'243356',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'409',
				graphicsetId: 	'456',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'1B2B52',
				e_color: 		'676F74',
				f_color: 		'FE7F01',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '240',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1684070']={
webappId:    '1501',
documentId:  '240',
internalId:  '1684070',
customField: '1501'
};
webappMappings['7050']=webappMappings['7050-660']={
webappId:    '7050',
documentId:  '1921',
internalId:  '660',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-87d77d4cc74929c284a74e7164756395']={
webappId:    '7060',
documentId:  '842',
internalId:  '87d77d4cc74929c284a74e7164756395',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-b1db2b19b175275d8c07f66bdc679192']={
webappId:    '7060',
documentId:  '6075',
internalId:  'b1db2b19b175275d8c07f66bdc679192',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '240',
internalId:  '',
customField: '20100326-212733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '261',
internalId:  '',
customField: '20070723-164902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '270',
internalId:  '',
customField: '20051024-230127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '279',
internalId:  '',
customField: '20051024-230554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '288',
internalId:  '',
customField: '20051021-020547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '297',
internalId:  '',
customField: '20051021-020547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '306',
internalId:  '',
customField: '20051021-020548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '315',
internalId:  '',
customField: '20051021-020548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '324',
internalId:  '',
customField: '20051024-023610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '333',
internalId:  '',
customField: '20051024-023729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '342',
internalId:  '',
customField: '20051021-020548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '351',
internalId:  '',
customField: '20051021-020548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '360',
internalId:  '',
customField: '20051024-023426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '842',
internalId:  '',
customField: '20070706-214056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1921',
internalId:  '',
customField: '20090225-221539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6075',
internalId:  '',
customField: '20070723-164935'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3JOL';
var companyName   = 'SaveCapeAnn.com+-+Gloucester+Island+News';
var htmlTitle	  = 'Save+Cape+Ann';
var metaKeywords  = '';
var metaContents  = '';
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();
};
