/* [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','5101',jdecode('Home'),jdecode(''),'/5101.html','true',[],''],
	['PAGE','23201',jdecode('Featured+Listings'),jdecode(''),'/23201.html','true',[],''],
	['PAGE','16901',jdecode('Wall+of+Honor'),jdecode(''),'/16901.html','true',[],''],
	['PAGE','6901',jdecode('About+Us'),jdecode(''),'/6901.html','true',[],''],
	['PAGE','5236',jdecode('Links'),jdecode(''),'/5236.html','true',[],''],
	['PAGE','5257',jdecode('Contact+Us'),jdecode(''),'/5257.html','true',[],'']];
var siteelementCount=6;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1766';
theSitetree.keyvisualName='zuhause.jpg';
theSitetree.fontsetId='290';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1766',
				keyvisualName: 	'zuhause.jpg',
				fontsetId: 		'290',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20080819-194947'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20080630-215421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5236',
internalId:  '',
customField: '20080715-232052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5257',
internalId:  '',
customField: '20080709-154227'
};
webappMappings['7008']=webappMappings['7008-4283']={
webappId:    '7008',
documentId:  '5257',
internalId:  '4283',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23201',
internalId:  '',
customField: '20080709-150944'
};
webappMappings['1501']=webappMappings['1501-10232614']={
webappId:    '1501',
documentId:  '5101',
internalId:  '10232614',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20080708-122216'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2G1N';
var companyName   = 'StL+Gold+Team';
var htmlTitle	  = 'StL+Gold+Team+-+Mark+Becker+and+Brian+Jones%2C+Realtors+You+Can+Trust+To+Get+The+Job+Done%21';
var metaKeywords  = 'StL+Gold+Team%2C+StLGoldTeam%2C+Mark+Becker%2C+Brian+Jones%2C+Realtor%2C+Realtors%2C+Real+Estate%2C+Realty+Executives%2C+St+Louis%2C+St.+Louis%2C+Saint+Louis%2C+Missouri%2C+MO%2C+South+County%2C+Jefferson+County%2C+St+Louis+County%2C+St+Louis+City%2C+Richmond+Heights%2C+Richmond+Hts%2C+Oakville%2C+Mehlville%2C+Afton%2C+Arnold%2C+Imperial%2C+High+Ridge%2C+Webster+Groves%2C+Maplewood%2C+Brentwood%2C+Shrewsbury%2C+Remax%2C+RE%2FMAX%2C+cbg%2C+coldwell%2C+banker%2C+gundaker%2C+saint%2C+louis%2C+jefferson%2C+county%2C+co%2C+st.%2C+Clayton%2C+Ladue%2C+Kirkwood%2C+Glendale%2C+Crestwood%2C+Sunset+Hills%2C+Florissant%2C+Concord%2C+concord+village%2C+prudential%2C+sold%2C+home%2C+house%2C+sell%2C+comparative+analysis%2C+Maryland+Heights%2C+Maryland+Hts%2C+Creve+Coeur';
var metaContents  = 'With+the+StL+Gold+Team%2C+you+have+two+full+time+active+Realtors+with+the+experience+and+knowledge+to+assist+you+in+your+home+selling+or+buying+needs.';
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();
};

