/* [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','3301',jdecode('Home'),jdecode(''),'/3301.html','true',[],''],
	['PAGE','3401',jdecode('About+Dr.+Akdag'),jdecode(''),'/3401.html','true',[],''],
	['PAGE','3422',jdecode('Services'),jdecode(''),'/3422/index.html','true',[ 
		['PAGE','12501',jdecode('Neuropsychological+Assessment'),jdecode(''),'/3422/12501.html','false',[],''],
		['PAGE','12522',jdecode('Psycho-educational+Assessment'),jdecode(''),'/3422/12522.html','false',[],''],
		['PAGE','12543',jdecode('Consultation'),jdecode(''),'/3422/12543.html','false',[],'']
	],''],
	['PAGE','3443',jdecode('Appointments'),jdecode(''),'/3443.html','true',[],''],
	['PAGE','34101',jdecode('Fees'),jdecode(''),'/34101.html','true',[],''],
	['PAGE','3485',jdecode('Contact'),jdecode(''),'/3485.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Weekend';
theSitetree.paletteFamily='9097E1';
theSitetree.keyvisualId='3947';
theSitetree.keyvisualName='kv_3947.jpg';
theSitetree.fontsetId='10527';
theSitetree.graphicsetId='11148';
theSitetree.contentColor='2D347C';
theSitetree.contentBGColor='9DA4EB';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Weekend',
				paletteFamily: 	'9097E1',
				keyvisualId: 	'3947',
				keyvisualName: 	'kv_3947.jpg',
				fontsetId: 		'10527',
				graphicsetId: 	'11148',
				contentColor: 	'2D347C',
				contentBGColor: '9DA4EB',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3301',
internalId:  '',
customField: '20081007-103408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20081007-103633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3422',
internalId:  '',
customField: '20081007-105314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20081007-111909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12522',
internalId:  '',
customField: '20081007-105856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12543',
internalId:  '',
customField: '20080913-112157'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3443',
internalId:  '',
customField: '20081007-112937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3485',
internalId:  '',
customField: '20080913-000003'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20100419-191449'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INEWBM';
var companyName   = '+++Dr.+Sare+Akdag+++++++++++++++++++++Registered+Psychologist';
var htmlTitle	  = 'Dr.+Sare+Akdag';
var metaKeywords  = 'pediatric+neuropsychology%2C+pediatric+psychologist%2C+psycho-educational+assessment%2C+psychoeducational%2C+neuropsychological+assessment%2C+registered+psychologist%2C+British+Columbia%2C+psychologist%2C+Vancouver%2C+neuropsychologist%2C+Lower+Mainland%2C+Fraser+Valley%2C+psychology%2C+psychological%2C+consultation%2C+paediatric%2C+evaluation%2C+testing%2C+psychological+evaulation%2C+neuropsychological+evaluation%2C+child%2C+adolescence%2C+children%2C+adolescent%2C+';
var metaContents  = 'Dr.+Akdag+is+a+registered+psychologist+with+expertise+in+pediatric+neuropsychology+and+assessment.++She+provides+neuropsychological+and+psycho-educational+assessment+and+consultation+services+to+children+and+adolescents+living+in+Vancouver+and+the+Lower+Mainland+of+British+Columbia.';
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();
};
