/* [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','7601',jdecode('About+Us'),jdecode(''),'/7601.html','true',[],'',''],
	['PAGE','7652',jdecode('Photos+and+Testimonials'),jdecode(''),'/7652.html','true',[],'',''],
	['ITEM','47182',jdecode('Media+Album'),jdecode(''),'http://s1190.photobucket.com/albums/z441/kitflynn/?albumview=slideshow','true',[],'','_blank'],
	['ITEM','46182',jdecode('Great+books+%26+products+'),jdecode(''),'http://astore.amazon.ca/kitflynnca-20','true',[],'','_blank'],
	['ITEM','45282',jdecode('Kit%26%23x27%3Bs+Blog'),jdecode(''),'http://kitflynn.ca/blog/','true',[],'','_blank'],
	['PAGE','7673',jdecode('Prices+and+Packages'),jdecode(''),'/7673.html','true',[],'',''],
	['PAGE','41703',jdecode('Contact+Us'),jdecode(''),'/41703.html','true',[],'',''],
	['PAGE','41682',jdecode('Going+Strong+Article'),jdecode(''),'/41682.html','false',[],'',''],
	['PAGE','46882',jdecode('Slideshow'),jdecode(''),'/46882.html','false',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Amaze';
theSitetree.paletteFamily='0A2447';
theSitetree.keyvisualId='2418';
theSitetree.keyvisualName='gesundes_leben.jpg';
theSitetree.fontsetId='394';
theSitetree.graphicsetId='444';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='0A2447';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Amaze',
				paletteFamily: 	'0A2447',
				keyvisualId: 	'2418',
				keyvisualName: 	'gesundes_leben.jpg',
				fontsetId: 		'394',
				graphicsetId: 	'444',
				contentColor: 	'FFFFFF',
				contentBGColor: '0A2447',
				a_color: 		'0A2447',
				b_color: 		'081B35',
				c_color: 		'3268E2',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20110129-145104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7652',
internalId:  '',
customField: '20101129-212847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7673',
internalId:  '',
customField: '20110129-144527'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7601',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7652',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7673',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-3648']={
webappId:    '7008',
documentId:  '41703',
internalId:  '3648',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41703',
internalId:  '',
customField: '20110129-102015'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41682',
internalId:  '',
customField: '20110129-145510'
};
webappMappings['7060']=webappMappings['7060-7dc4cf0aafcd9523a07ee9f9899de91c']={
webappId:    '7060',
documentId:  '46882',
internalId:  '7dc4cf0aafcd9523a07ee9f9899de91c',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '41703',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '41682',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'localhost';
var accountId     = 'ANFI10INXSHT';
var companyName   = 'Kit+Flynn+%26+Associates+-+Personal+Training';
var htmlTitle	  = 'Personal+Training+in+Ottawa%2C+Canada+for+adults+over+50';
var metaKeywords  = 'personal+training%2C+Ottawa%2C+seniors%2C+home+personal+training%2C+nutrition%2C+wellness%2C+50+plus%2C+home%2C+studio%2C+Westboro%2C+weight+loss%2C+life+coaching%2C+weight+watchers%2C';
var metaContents  = 'Personal+Training%2C+Nutrition+and+Wellness+for+adults+over+50+in+Ottawa%2C+Canada.';
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();
};

