/* [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','5501',jdecode('home'),jdecode(''),'/5501.html','true',[],''],
	['PAGE','282622',jdecode('main+street+week'),jdecode(''),'/282622.html','true',[],''],
	['PAGE','46512',jdecode('laurentian+towns+%26+villages'),jdecode(''),'/46512/index.html','true',[ 
		['PAGE','46533',jdecode('MRC+d%26%23x27%3BArgenteuil'),jdecode(''),'/46512/46533.html','true',[],''],
		['PAGE','46554',jdecode('MRC+des-Pays-d%26%23x27%3Ben-Haut'),jdecode(''),'/46512/46554.html','true',[],''],
		['PAGE','48712',jdecode('MRC+des+Laurentides'),jdecode(''),'/46512/48712.html','true',[],'']
	],''],
	['PAGE','195922',jdecode('health+%26+social+services'),jdecode(''),'/195922/index.html','true',[ 
		['PAGE','196422',jdecode('English-language+services'),jdecode(''),'/195922/196422.html','true',[],''],
		['PAGE','196622',jdecode('about+the+health+system'),jdecode(''),'/195922/196622.html','true',[],''],
		['PAGE','262322',jdecode('health+links'),jdecode(''),'/195922/262322.html','true',[],''],
		['PAGE','256122',jdecode('emergency+numbers'),jdecode(''),'/195922/256122.html','true',[],'']
	],''],
	['PAGE','256264',jdecode('emergency+numbers+%26+contacts'),jdecode(''),'/256264.html','true',[],''],
	['PAGE','256222',jdecode('laurentian+schools'),jdecode(''),'/256222.html','true',[],''],
	['PAGE','279022',jdecode('heritage+links'),jdecode(''),'/279022.html','true',[],''],
	['PAGE','247822',jdecode('the+link+exchange'),jdecode(''),'/247822.html','true',[],''],
	['PAGE','32833',jdecode('advertise+with+us'),jdecode(''),'/32833/index.html','true',[ 
		['PAGE','343663',jdecode('10th+Anniversary+Specials'),jdecode(''),'/32833/343663.html','true',[],''],
		['PAGE','34912',jdecode('advertise+in+the+main+street'),jdecode(''),'/32833/34912.html','true',[],''],
		['PAGE','323841',jdecode('advertise+in+MSW'),jdecode(''),'/32833/323841.html','true',[],''],
		['PAGE','32812',jdecode('main+street+distribution'),jdecode(''),'/32833/32812.html','true',[],'']
	],''],
	['PAGE','94727',jdecode('contact+us'),jdecode(''),'/94727.html','true',[],'']];
var siteelementCount=21;
theSitetree.topTemplateName='Office';
theSitetree.paletteFamily='727D9C';
theSitetree.keyvisualId='11154';
theSitetree.keyvisualName='kv_11154.jpg';
theSitetree.fontsetId='32062';
theSitetree.graphicsetId='13879';
theSitetree.contentColor='4e5978';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Office',
				paletteFamily: 	'727D9C',
				keyvisualId: 	'11154',
				keyvisualName: 	'kv_11154.jpg',
				fontsetId: 		'32062',
				graphicsetId: 	'13879',
				contentColor: 	'4e5978',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20100706-103712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '262322',
internalId:  '',
customField: '20090302-104144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '343663',
internalId:  '',
customField: '20100316-084223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34912',
internalId:  '',
customField: '20100316-084553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '256122',
internalId:  '',
customField: '20090217-080930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '256222',
internalId:  '',
customField: '20100107-203058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '256264',
internalId:  '',
customField: '20090217-080749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32833',
internalId:  '',
customField: '20100125-131403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '195922',
internalId:  '',
customField: '20090217-083642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32812',
internalId:  '',
customField: '20090821-090541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '279022',
internalId:  '',
customField: '20090424-102537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '247822',
internalId:  '',
customField: '20100104-081311'
};
webappMappings['7008']=webappMappings['7008-15453']={
webappId:    '7008',
documentId:  '282622',
internalId:  '15453',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '94727',
internalId:  '',
customField: '20100119-153348'
};
webappMappings['7008']=webappMappings['7008-3991']={
webappId:    '7008',
documentId:  '94727',
internalId:  '3991',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-22332']={
webappId:    '7008',
documentId:  '323841',
internalId:  '22332',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46512',
internalId:  '',
customField: '20081023-162837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46533',
internalId:  '',
customField: '20100615-094558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46554',
internalId:  '',
customField: '20100225-153936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '196622',
internalId:  '',
customField: '20090208-125545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '196422',
internalId:  '',
customField: '20090208-125511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48712',
internalId:  '',
customField: '20090312-084854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '282622',
internalId:  '',
customField: '20090409-105105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '323841',
internalId:  '',
customField: '20100125-132832'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2JQP';
var companyName   = 'laurentianlife.com+%E2%80%A2+main+street+%E2%80%A2+main+street+week';
var htmlTitle	  = '';
var metaKeywords  = 'Main+Street+Newspaper%2C+Main+Street+Week%2C+on-line+newspaper%2C+the+Laurentians%2C+English%2C+news%2C+community%2C+living%2C+visiting%2C+dining%2C+real+estate%2C+history%2C+arts%2C+culture%2C+events%2C+festivals%2C+health%2C+education%2C+social+services%2C+youth';
var metaContents  = 'Main+Street%2C+the+Laurentians+%231+English+language+monthly+community+newspaper%2C+presents%2C+a+guide+to+living+in+the+Laurentians%2C+in+English.+Now+the+home+of+Main+Street+Week%2C+the+Laurentians+ONLY+weekly+English+language+on-line+publication.+Lodging%2C+arts++culture%2C+fairs++festivals%2C+dining%2C+real+estate%2C+tourism%2C+outdoor+adventures%2C+historical+points+of+interest%2C+health%2C+education++social+services%2C+shopping%2C+all+you+need+to+navigate+the+Laurentians%2C+in+English%21';
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();
};
