/* [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','552',jdecode('About+us'),jdecode(''), jdecode('%2F552%2Findex.html'), 'true',[ 
		['PAGE','573',jdecode('Our+REALTORS'),jdecode(''), jdecode('%2F552%2F573.html'), 'true',[],'','']
	],'',''],
	['PAGE','594',jdecode('Our+Services'),jdecode(''), jdecode('%2F594%2Findex.html'), 'true',[ 
		['PAGE','615',jdecode('If+You+Want+to+Sell...'),jdecode(''), jdecode('%2F594%2F615.html'), 'true',[],'',''],
		['PAGE','636',jdecode('If+You+Want+to+Buy...'),jdecode(''), jdecode('%2F594%2F636.html'), 'true',[],'',''],
		['PAGE','657',jdecode('Property+Management'),jdecode(''), jdecode('%2F594%2F657.html'), 'true',[],'',''],
		['PAGE','60301',jdecode('Get+A+Home+Loan'),jdecode(''), jdecode('%2F594%2F60301.html'), 'true',[],'','']
	],'',''],
	['PAGE','26801',jdecode('Our+Inventory'),jdecode(''), jdecode('%2F26801%2Findex.html'), 'true',[ 
		['PAGE','32901',jdecode('Pre-owned'),jdecode(''), jdecode('%2F26801%2F32901.html'), 'true',[],'',''],
		['PAGE','32922',jdecode('New+Homes'),jdecode(''), jdecode('%2F26801%2F32922.html'), 'true',[],'',''],
		['PAGE','58101',jdecode('Comm%2FRanch%2FLots'),jdecode(''), jdecode('%2F26801%2F58101.html'), 'true',[],'','']
	],'',''],
	['PAGE','55401',jdecode('Espana+Homes+'),jdecode(''), jdecode('%2F55401.html'), 'true',[],'',''],
	['PAGE','678',jdecode('Real+Estate+Careers'),jdecode(''), jdecode('%2F678.html'), 'true',[],'',''],
	['PAGE','699',jdecode('Broker+-+Owners'),jdecode(''), jdecode('%2F699%2Findex.html'), 'true',[ 
		['PAGE','720',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F699%2F720.html'), 'true',[],'','']
	],'',''],
	['PAGE','14106',jdecode('Guestbook'),jdecode(''), jdecode('%2F14106%2Findex.html'), 'true',[ 
		['PAGE','14101',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F14106%2F14101.html'), 'true',[],'','']
	],'',''],
	['PAGE','48601',jdecode('Contact+Us'),jdecode(''), jdecode('%2F48601.html'), 'true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Disco';
theSitetree.paletteFamily='3D5465';
theSitetree.keyvisualId='4606';
theSitetree.keyvisualName='architekt.jpg';
theSitetree.fontsetId='311';
theSitetree.graphicsetId='364';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3D5465';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Disco',
				paletteFamily: 	'3D5465',
				keyvisualId: 	'4606',
				keyvisualName: 	'architekt.jpg',
				fontsetId: 		'311',
				graphicsetId: 	'364',
				contentColor: 	'FFFFFF',
				contentBGColor: '3D5465',
				a_color: 		'3D5465',
				b_color: 		'FFFFFF',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '552',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-14106avec10inzl2b']={
webappId:    '1002',
documentId:  '14106',
internalId:  '14106avec10inzl2b',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20110418-145043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58101',
internalId:  '',
customField: '20111013-133027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20110920-105152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20110505-210233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20100411-201833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20110418-164206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '657',
internalId:  '',
customField: '20110418-164311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26801',
internalId:  '',
customField: '20101108-213125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20111013-160844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20110329-163054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '720',
internalId:  '',
customField: '20080129-000854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14106',
internalId:  '',
customField: '20080202-175543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14101',
internalId:  '',
customField: '20080202-175543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55401',
internalId:  '',
customField: '20111019-134337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32901',
internalId:  '',
customField: '20111013-132902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32922',
internalId:  '',
customField: '20111013-135802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60301',
internalId:  '',
customField: '20110505-210410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48601',
internalId:  '',
customField: '20101010-220236'
};
webappMappings['7008']=webappMappings['7008-16229']={
webappId:    '7008',
documentId:  '48601',
internalId:  '16229',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INZL2B';
var companyName   = 'Alamo+Real+Estate+Brokers';
var htmlTitle	  = 'Alamo+Real+Estate+Brokers';
var metaKeywords  = 'San+Antonio+Real+Estate+Homes+for+sale+San+Antonio+Real+Estate+Property+Management+New+Homes+San+Antonio+NewLeaf+Homes+';
var metaContents  = 'San+Antonio+Real+Estate++homes+for+sales+san+antonio+property+management++NewLeaf+Homes+preferred+REALTOR+';
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();
};

