/* [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','5301',jdecode('Welcome'),jdecode(''),'/5301.html','true',[],''],
	['PAGE','5352',jdecode('TENNVA+MLS+Search+'),jdecode(''),'/5352.html','true',[],''],
	['PAGE','5373',jdecode('Tax+Credit'),jdecode(''),'/5373.html','true',[],''],
	['PAGE','16922',jdecode('Greeneville+Info'),jdecode(''),'/16922.html','true',[],''],
	['PAGE','34501',jdecode('Tricities+Info'),jdecode(''),'/34501.html','true',[],''],
	['PAGE','16901',jdecode('Hiking+%26+Area+Info'),jdecode(''),'/16901.html','true',[],''],
	['PAGE','16943',jdecode('Area+Photos'),jdecode(''),'/16943.html','true',[],''],
	['PAGE','50801',jdecode('Helpful+Advice'),jdecode(''),'/50801.html','true',[],''],
	['PAGE','5394',jdecode('Contact%2FAbout+me'),jdecode(''),'/5394.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='93A6CC';
theSitetree.keyvisualId='2252';
theSitetree.keyvisualName='reise2.jpg';
theSitetree.fontsetId='364';
theSitetree.graphicsetId='415';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='93A6CC';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Enjoy',
				paletteFamily: 	'93A6CC',
				keyvisualId: 	'2252',
				keyvisualName: 	'reise2.jpg',
				fontsetId: 		'364',
				graphicsetId: 	'415',
				contentColor: 	'000000',
				contentBGColor: '93A6CC',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'93A6CC',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100210-170325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5352',
internalId:  '',
customField: '20090619-135920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5373',
internalId:  '',
customField: '20100210-165958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5394',
internalId:  '',
customField: '20080825-085655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20090917-205316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16943',
internalId:  '',
customField: '20091025-172528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16922',
internalId:  '',
customField: '20100204-150255'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34501',
internalId:  '',
customField: '20080825-085747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50801',
internalId:  '',
customField: '20091006-201906'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2H52';
var companyName   = 'Get+A+TN+Home+-++Dana+Ganyer%2C+Realtor+';
var htmlTitle	  = 'Get+a+TN+Home+-+Real+Estate+in+Eastern+Tennessee';
var metaKeywords  = 'Real+estate%2C+tennessee%2C+east%2C+MLS+search%2C+land%2C+homes%2C+for+sale%2C+house%2C+property%2C+mountain%2C+Century+21%2C+Tricities%2C+Washington+County%2C+Greene+County%2C+Johnson+City%2C+Kingsport%2C+Bristol%2C+Greeneville%2C+Jonesborough%2C+Erwin%2C+Carter+County%2C+Elizabethton%2C+Piney+Flats%2C+Gray%2C+Sullivan+County%2C+Chuckey%2C+Limestone%2C+Telford%2C+Hawkins+County%2C+Church+Hill%2C+Mt.+Carmel%2C+Bluff+City';
var metaContents  = 'Real+time+MLS+search+engine+to+find+your+next+home+in+East+Tennessee.+Get+helpful+advice+and+assistance+from+Dana+Ganyer%2C+CENTURY+21+Legacy.';
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();
};
