/* [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','8401',jdecode('Home'),jdecode(''),'/8401.html','true',[],''],
	['PAGE','8452',jdecode('About+us'),jdecode(''),'/8452/index.html','true',[ 
		['PAGE','8473',jdecode('How+to+find+us'),jdecode(''),'/8452/8473.html','true',[],''],
		['PAGE','8494',jdecode('Our+team'),jdecode(''),'/8452/8494.html','true',[],''],
		['PAGE','8515',jdecode('The+practice'),jdecode(''),'/8452/8515.html','true',[],'']
	],''],
	['PAGE','8536',jdecode('Services'),jdecode(''),'/8536/index.html','true',[ 
		['PAGE','10001',jdecode('Physical+Therapy'),jdecode(''),'/8536/10001.html','true',[],''],
		['PAGE','10022',jdecode('Occupational+Therapy'),jdecode(''),'/8536/10022.html','true',[],''],
		['PAGE','10043',jdecode('Speech+Therapy'),jdecode(''),'/8536/10043.html','true',[],'']
	],''],
	['PAGE','8557',jdecode('Special+Programs'),jdecode(''),'/8557.html','true',[],''],
	['PAGE','8578',jdecode('Contact'),jdecode(''),'/8578.html','true',[],''],
	['PAGE','8599',jdecode('News'),jdecode(''),'/8599.html','true',[],''],
	['PAGE','8620',jdecode('Interesting+links'),jdecode(''),'/8620.html','true',[],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Round';
theSitetree.paletteFamily='339966';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='439';
theSitetree.graphicsetId='491';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='72c6a1';
var theTemplate={
				name: 			'Round',
				paletteFamily: 	'339966',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'439',
				graphicsetId: 	'491',
				contentColor: 	'FFFFFF',
				contentBGColor: '72c6a1',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'72c6a1',
				b_color: 		'339966',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20100407-143350'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8452',
internalId:  '',
customField: '20100407-143440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8494',
internalId:  '',
customField: '20100407-142553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8536',
internalId:  '',
customField: '20100407-142835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8557',
internalId:  '',
customField: '20100407-124740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8578',
internalId:  '',
customField: '20100407-143045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8473',
internalId:  '',
customField: '20100407-124740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8515',
internalId:  '',
customField: '20100407-124740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8599',
internalId:  '',
customField: '20100407-124740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8620',
internalId:  '',
customField: '20100407-124740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20100412-110907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10022',
internalId:  '',
customField: '20100412-111801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10043',
internalId:  '',
customField: '20100412-105956'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INLUGE';
var companyName   = 'Children%27s+Therapies%2C+Inc.';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};
