/* [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','401',jdecode('Home+Page'),jdecode(''),'/401.html','true',[],''],
	['PAGE','494',jdecode('Families'),jdecode(''),'/494.html','true',[],''],
	['PAGE','6901',jdecode('Pediatricians'),jdecode(''),'/6901.html','true',[],''],
	['PAGE','452',jdecode('Schools'),jdecode(''),'/452.html','true',[],''],
	['PAGE','473',jdecode('Teachers'),jdecode(''),'/473.html','true',[],''],
	['PAGE','515',jdecode('The+Behavior+Doctors'),jdecode(''),'/515.html','true',[],''],
	['PAGE','536',jdecode('Contact+Us'),jdecode(''),'/536.html','true',[],''],
	['PAGE','557',jdecode('Products+%26+Podcasts'),jdecode(''),'/557.html','true',[],''],
	['PAGE','28901',jdecode('Coaching'),jdecode(''),'/28901.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Scenery';
theSitetree.paletteFamily='6585B8';
theSitetree.keyvisualId='6936';
theSitetree.keyvisualName='kv_6936.jpg';
theSitetree.fontsetId='11227';
theSitetree.graphicsetId='12047';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='8AA6D2';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Scenery',
				paletteFamily: 	'6585B8',
				keyvisualId: 	'6936',
				keyvisualName: 	'kv_6936.jpg',
				fontsetId: 		'11227',
				graphicsetId: 	'12047',
				contentColor: 	'000000',
				contentBGColor: '8AA6D2',
				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: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100308-163803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20080516-193643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20080316-200329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100308-154442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20080328-225552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20080318-224059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20081028-163947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28901',
internalId:  '',
customField: '20100308-162328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20100206-100738'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN21AX';
var companyName   = 'The+Behavior+Doctors';
var htmlTitle	  = 'Behavior+Doctors';
var metaKeywords  = 'behavior%2C+discipline%2C+misbehavior%2C+behavior+management%2C+behavior+modification%2C+behavior+therapy%2C+behavior+coaching%2C+behavior+coaches%2C+child+behavior%2C+teacher+support%2C+school+support%2C+parent+support%2C+parent+help%2C+behavior+consultants%2C+kids%2C+children%2C+special+education%2C+behavior+disorders%2C+student+assessment%2C+student+evaluation%2C+discipline+problems%2C+school+help%2C+out+of+control+kids%2C+bad+attitude%2C+at-risk+kids%2C+disobedient%2C+at-risk%2C+unruly%2C+ADHD%2C+bad+kid%2C+emotionally+disturbed%2C+socially+maladjusted%2C+severely+emotionally+disturbed%2C+behavior+help%2C+functional+behavior+assessment%2C+behavior+change%2C+psycho-social+assessment%2C+bad+apple%2C+bad+seed%2C+nasty+kid%2C+conduct+disorder%2C+gangs%2C+bad+crowd%2C+aggression%2C+bullying%2C+aggressive+behavior%2C+bullied%2C+bully+victim%2C+self+destructive+behavior%2C+behavior+interventions%2C+behaviour%2Cstaff+development%2C+parent+training%2C+teacher+coaching%2C+parent+coaching%2C+teacher+coach%2C+parent+coach%2C+parent+help%2C+help+for+parents%2C+family+coaching%2C+Westchester+county';
var metaContents  = 'Child+behavior+specialists+offering+online%2C+phone%2C+and+video-conferencing+coaching+to+families%2C+teachers%2C+and+other+professionals+serving+youngsters+with+emotional+and+behavioral+challenges.++In-person+assessment+of+children+and+youth+is+also+available.';
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();
};
