/* [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','301',jdecode('Home'),jdecode(''), jdecode('%2F301.html'), 'true',[],'',''],
	['PAGE','31101',jdecode('Counselling+Approach'),jdecode(''), jdecode('%2F31101.html'), 'true',[],'',''],
	['PAGE','31122',jdecode('Professional+Services'),jdecode(''), jdecode('%2F31122.html'), 'true',[],'',''],
	['PAGE','31143',jdecode('Fees+and+Insurance'),jdecode(''), jdecode('%2F31143.html'), 'true',[],'',''],
	['PAGE','52101',jdecode('Qualifications'),jdecode(''), jdecode('%2F52101.html'), 'true',[],'',''],
	['PAGE','31206',jdecode('Contact'),jdecode(''), jdecode('%2F31206.html'), 'true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Activate';
theSitetree.paletteFamily='747474';
theSitetree.keyvisualId='2041';
theSitetree.keyvisualName='partner.jpg';
theSitetree.fontsetId='337';
theSitetree.graphicsetId='395';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='747474';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'aplus',
  product: 'WSCSYSSSSLYTCPZ2'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Activate',
				paletteFamily: 	'747474',
				keyvisualId: 	'2041',
				keyvisualName: 	'partner.jpg',
				fontsetId: 		'337',
				graphicsetId: 	'395',
				contentColor: 	'FFFFFF',
				contentBGColor: '747474',
				a_color: 		'747474',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-116']={
webappId:    '7008',
documentId:  '31206',
internalId:  '116',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20120107-070913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31101',
internalId:  '',
customField: '20091103-135409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31122',
internalId:  '',
customField: '20090328-123031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31143',
internalId:  '',
customField: '20100601-082833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52101',
internalId:  '',
customField: '20120107-065610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31206',
internalId:  '',
customField: '20120107-070119'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '301',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '31101',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '31122',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '31143',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '52101',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '31206',
internalId:  '',
customField: 'language:en;country:US;'
};
var webAppHostname = 'cm4all.aplus.net:80';
var canonHostname = 'cm4all01.carrierzone.com';
var accountId     = 'AAPLU0INLA66';
var companyName   = 'OLGA+SUTHERLAND%2C+Ph.D.%2C+C.Psych.';
var htmlTitle	  = 'Dr.+Olga+Sutherland+C.+Psych%2C+RMFT';
var metaKeywords  = 'counselling+counseling+couples+counselling+couples+counseling+marriage+counselling+marriage+counseling+psychologist+ontario+chartered+certified+psychotherapy+family+therapy+couples+therapy+psychological+assessment+treatment+EAP+employment+assistance+program+extended+benefits+clinical+psychology+depression+anxiety+PTSD+trauma+abuse+psychotherapy+mental+health+psychological+problems+EMDR+gay+lesbian';
var metaContents  = 'I+am+a+Certified+Psychologist%2C+Registered+Marriage+and+Family+Therapist%2C+and+a+Canadian+Certified+Counsellor+in+private+practice+offering+psychological+counselling+to+individuals%2C+couples%2C+and+families.++I+can+help+you+overcome+emotional+problems%2C+stress+related+problems%2C+and+relationship+problems.+I+work+with+a+variety+of+clients%2C+including+people+from+different+cultural+backgrounds%2C+ages+%28adolescents+to+older+adults%29%2C+races%2C+and+lifestyles.';
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();
};

