/* [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','3401',jdecode('Home'),jdecode(''),'/3401/index.html','true',[ 
		['PAGE','16101',jdecode('About+Us'),jdecode(''),'/3401/16101.html','true',[],'']
	],''],
	['PAGE','3452',jdecode('Contact+Us'),jdecode(''),'/3452.html','true',[],''],
	['PAGE','3473',jdecode('Directions'),jdecode(''),'/3473.html','true',[],''],
	['PAGE','3557',jdecode('CNA+Class'),jdecode(''),'/3557/index.html','true',[ 
		['PAGE','11701',jdecode('Online+CNA+Class+Application+'),jdecode(''),'/3557/11701.html','true',[],'']
	],''],
	['PAGE','4701',jdecode('Links'),jdecode(''),'/4701.html','true',[],''],
	['PAGE','8001',jdecode('Privacy+Notice'),jdecode(''),'/8001/index.html','true',[ 
		['PAGE','3515',jdecode('History'),jdecode(''),'/8001/3515.html','false',[],'']
	],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Snapshot';
theSitetree.paletteFamily='555F8C';
theSitetree.keyvisualId='3618';
theSitetree.keyvisualName='kv_3618.jpg';
theSitetree.fontsetId='10755';
theSitetree.graphicsetId='10876';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='555F8C';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Snapshot',
				paletteFamily: 	'555F8C',
				keyvisualId: 	'3618',
				keyvisualName: 	'kv_3618.jpg',
				fontsetId: 		'10755',
				graphicsetId: 	'10876',
				contentColor: 	'FFFFFF',
				contentBGColor: '555F8C',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FC5E7B',
				e_color: 		'BFBFBF',
				f_color: 		'050001',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20090121-172935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3452',
internalId:  '',
customField: '20100611-223715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3473',
internalId:  '',
customField: '20090409-102901'
};
webappMappings['7008']=webappMappings['7008-4157']={
webappId:    '7008',
documentId:  '11701',
internalId:  '4157',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3557',
internalId:  '',
customField: '20100115-203255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20081206-141704'
};
webappMappings['7008']=webappMappings['7008-4047']={
webappId:    '7008',
documentId:  '3452',
internalId:  '4047',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20100611-224214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3515',
internalId:  '',
customField: '20080403-233742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20080523-032141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20090121-181328'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2AEJ';
var companyName   = 'NHC+HealthCare%2C+Johnson+City';
var htmlTitle	  = 'NHC+HealthCare+Johnson+City';
var metaKeywords  = 'NHC%2C+Long+Term+Care%2C+Nursing+Home%2C+Care%2C+Therapy%2C+Rehab%2C+Rehabilitation%2C+Post+Acute+Care';
var metaContents  = 'Long+term+care+nursing+home+and+rehabilitation+facillity';
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();
};
