/* [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','1001',jdecode('Doyle+Inspections++'),jdecode(''),'/1001/index.html','true',[ 
		['PAGE','9501',jdecode('Certification'),jdecode(''),'/1001/9501.html','true',[],'',''],
		['PAGE','9522',jdecode('Work+Samples'),jdecode(''),'/1001/9522.html','true',[],'','']
	],'',''],
	['PAGE','1052',jdecode('Services+%26+Rates'),jdecode(''),'/1052/index.html','true',[ 
		['PAGE','1073',jdecode('Home+Inspections'),jdecode(''),'/1052/1073.html','true',[],'',''],
		['PAGE','1094',jdecode('Septic+systems'),jdecode(''),'/1052/1094.html','true',[],'',''],
		['PAGE','1115',jdecode('Mold+Investigations'),jdecode(''),'/1052/1115.html','true',[],'','']
	],'',''],
	['PAGE','1136',jdecode('Contact+Us'),jdecode(''),'/1136.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Americanlife';
theSitetree.paletteFamily='49813F';
theSitetree.keyvisualId='4277';
theSitetree.keyvisualName='kv_4277.jpg';
theSitetree.fontsetId='10673';
theSitetree.graphicsetId='11193';
theSitetree.contentColor='1A3D13';
theSitetree.contentBGColor='689F5E';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Americanlife',
				paletteFamily: 	'49813F',
				keyvisualId: 	'4277',
				keyvisualName: 	'kv_4277.jpg',
				fontsetId: 		'10673',
				graphicsetId: 	'11193',
				contentColor: 	'1A3D13',
				contentBGColor: '689F5E',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20091005-133258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1052',
internalId:  '',
customField: '20091005-140100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20091005-134114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9522',
internalId:  '',
customField: '20091005-134316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20091005-135412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1094',
internalId:  '',
customField: '20091005-135801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1115',
internalId:  '',
customField: '20091005-140207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1136',
internalId:  '',
customField: '20091005-140414'
};
var canonHostname = 'cm1b.dca2.superb.net';
var accountId     = 'ASB030IN2M62';
var companyName   = 'Rural+%26+City+Home%2C+Septic%2C+Mold+Inspections+-+Ottawa+Region';
var htmlTitle	  = '';
var metaKeywords  = 'Septic%2C+mold%2C+home+inspection%2C+home+inspector%2C+septic+inspection%2C+septic+inspector%2C+sewage%2C+rural%2C+Ottawa+septic%2C+ottawa+home+inspection%2C+ottawa+home+inspector%2C+Old+city+of+Ottawa%2C+Central+Ottawa%2C+Gloucester%2C+Kanata%2C+Nepean%2C+Cumberland%2C+Goulbourn%2C+Osgoode%2C+Rideau%2C+Marlborough%2C+North+Gower%2C+West+Carleton%2C+Fitzroy%2C++Torbolton%2C+Huntley%2C+constance+bay%2C+Nepean%2C+Orleans%2C+Barrhaven%2C+Bells+Corners%2C+Blackburn+Hamlet+%2C+Hunt+Club%2C+Riverview%2C+Stittsville%2C+Riverside+South%2C+Morgans+Grant%2C+Rockcliffle+Park%2C+Burritts+Rapids%2C+Ashton%2C+Galetta%2C+Dunrobin%2C+Kenmore%2C+Fallowfield%2C+Edwards%2C+Sarsfield%2C+Vernon%2C+Kars%2C+Fitzroy+Harbour%2C+Vars++Munster%2C+Carp%2C+Navan%2C+North+Gower%2C+Cumberland%2C+Metcalfe%2C+Constance+Bay%2C+Osgoode%2C+Richmond%2C+Greely%2C+Manotick%2C+Merrickville%2C+Chesterville%2C+Winchester++Casselman%2C+Kemptville%2C+Almonte%2C+Arnprior%2C+Rockland%2C+Carleton+Place%2C+Smith+Falls%2C+Hull%2C+Gatineau';
var metaContents  = 'Ottawas+Doyle+Home+Inspection++Septic+Assessment+Service';
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();
};
