/* [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 POS_TARGET=8;
var theSitetree=[ 
	['PAGE','501',jdecode('HOME'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','5901',jdecode('OUR+AGENTS'),jdecode(''),'/5901/index.html','true',[ 
		['PAGE','9101',jdecode('John+Drewel'),jdecode(''),'/5901/9101.html','true',[],'',''],
		['PAGE','40001',jdecode('Sarah+Lawrence'),jdecode(''),'/5901/40001.html','true',[],'',''],
		['PAGE','9122',jdecode('Mandy+Tuel'),jdecode(''),'/5901/9122.html','true',[],'','']
	],'',''],
	['PAGE','5922',jdecode('MLS+LISTINGS'),jdecode(''),'/5922.html','true',[],'',''],
	['PAGE','5943',jdecode('VISUAL+HOUSE+TOURS'),jdecode(''),'/5943.html','true',[],'',''],
	['PAGE','18201',jdecode('FIRST+TIME+BUYER'),jdecode(''),'/18201.html','true',[],'',''],
	['PAGE','34101',jdecode('OBTAIN+A+MORTGAGE'),jdecode(''),'/34101.html','true',[],'',''],
	['PAGE','22601',jdecode('HOME+SELLERS'),jdecode(''),'/22601.html','true',[],'',''],
	['PAGE','35701',jdecode('MOVING+with+LOWES'),jdecode(''),'/35701.html','true',[],'',''],
	['PAGE','6322',jdecode('FREE+NEWSLETTER'),jdecode(''),'/6322.html','true',[],'',''],
	['PAGE','5964',jdecode('CONTACT+US'),jdecode(''),'/5964.html','true',[],'',''],
	['PAGE','6601',jdecode('OFFICE+DIRECTIONS'),jdecode(''),'/6601.html','true',[],'',''],
	['PAGE','10301',jdecode('LINKS+OF+INTEREST'),jdecode(''),'/10301.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='1235';
theSitetree.keyvisualName='handschlag.jpg';
theSitetree.fontsetId='190';
theSitetree.graphicsetId='232';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Profile',
				paletteFamily: 	'990000',
				keyvisualId: 	'1235',
				keyvisualName: 	'handschlag.jpg',
				fontsetId: 		'190',
				graphicsetId: 	'232',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'990000',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-1343543']={
webappId:    '1501',
documentId:  '501',
internalId:  '1343543',
customField: '1501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '6601',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['7008']=webappMappings['7008-513']={
webappId:    '7008',
documentId:  '6322',
internalId:  '513',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20110105-181859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20080506-193925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20110817-163350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9122',
internalId:  '',
customField: '20110817-163539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5922',
internalId:  '',
customField: '20071130-033452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5943',
internalId:  '',
customField: '20071130-102452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20071130-033353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20081208-001551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6322',
internalId:  '',
customField: '20080211-180637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5964',
internalId:  '',
customField: '20110817-163240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20071128-070947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20071222-232123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20081207-143622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35701',
internalId:  '',
customField: '20081229-172554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40001',
internalId:  '',
customField: '20110817-163500'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INX3I2';
var companyName   = 'your+Professional+All+Area+Realtor';
var htmlTitle	  = 'DREWEL+REALTY+-+Serving+Troy%2C+Missouri+and+all+Surrounding+Counties';
var metaKeywords  = 'Drewel+Realty%2C+Drewel+Realty+LLC%2C+Real+Estate%2C+Property%2C+Homes%2C+Houses%2C+Residential%2C+Residential+Real+Estate%2C+Land';
var metaContents  = 'Drewel+Realty+is+your+professional+all+area+Realtor.+Providing+Real+Estate+Services+to+Troy%2C+Missouri+and+all+surrounding+counties.+++';
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();
};

