/* [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','201',jdecode('Home'),jdecode(''),'/201.html','true',[],'',''],
	['PAGE','40823',jdecode('Buying'),jdecode(''),'/40823/index.html','true',[ 
		['PAGE','32701',jdecode('Four+Things+to+Avoid'),jdecode(''),'/40823/32701.html','true',[],'',''],
		['PAGE','40907',jdecode('Special+Reports'),jdecode(''),'/40823/40907.html','true',[],'','']
	],'',''],
	['PAGE','40928',jdecode('Renting'),jdecode(''),'/40928/index.html','true',[ 
		['PAGE','45923',jdecode('Property+Management'),jdecode(''),'/40928/45923.html','true',[],'','']
	],'',''],
	['PAGE','222',jdecode('Selling+Your+Home'),jdecode(''),'/222/index.html','true',[ 
		['PAGE','33401',jdecode('Checklist+for+Moving'),jdecode(''),'/222/33401.html','true',[],'','']
	],'',''],
	['PAGE','41012',jdecode('Services'),jdecode(''),'/41012.html','true',[],'',''],
	['PAGE','3101',jdecode('About+Tarbell'),jdecode(''),'/3101.html','true',[],'',''],
	['PAGE','217',jdecode('Luxury+Homes+Division'),jdecode(''),'/217/index.html','true',[ 
		['PAGE','9447',jdecode('Preferred+Properties'),jdecode(''),'/217/9447.html','true',[],'',''],
		['PAGE','9452',jdecode('The+Estates+Collection'),jdecode(''),'/217/9452.html','true',[],'','']
	],'',''],
	['PAGE','237',jdecode('Valuable+Links'),jdecode(''),'/237.html','true',[],'',''],
	['PAGE','242',jdecode('Information+Requests'),jdecode(''),'/242/index.html','true',[ 
		['PAGE','11511',jdecode('Information+Requests+%28follow+up+page%29'),jdecode(''),'/242/11511.html','false',[],'','']
	],'',''],
	['PAGE','28801',jdecode('A+Career+in+Real+Estate'),jdecode(''),'/28801.html','true',[],'',''],
	['PAGE','41138',jdecode('About+us'),jdecode(''),'/41138/index.html','true',[ 
		['PAGE','11202',jdecode('How+to+Find+Us'),jdecode(''),'/41138/11202.html','true',[],'','']
	],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Case';
theSitetree.paletteFamily='10224E';
theSitetree.keyvisualId='11329';
theSitetree.keyvisualName='kv_11329.jpg';
theSitetree.fontsetId='31938';
theSitetree.graphicsetId='13780';
theSitetree.contentColor='51689A';
theSitetree.contentBGColor='F6FBFE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Case',
				paletteFamily: 	'10224E',
				keyvisualId: 	'11329',
				keyvisualName: 	'kv_11329.jpg',
				fontsetId: 		'31938',
				graphicsetId: 	'13780',
				contentColor: 	'51689A',
				contentBGColor: 'F6FBFE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3101',
internalId:  '',
customField: '20081111-064519'
};
webappMappings['7008']=webappMappings['7008-1656']={
webappId:    '7008',
documentId:  '242',
internalId:  '1656',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '11202',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40823',
internalId:  '',
customField: '20090812-152116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '201',
internalId:  '',
customField: '20100515-064854'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '201',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1710537']={
webappId:    '1501',
documentId:  '201',
internalId:  '1710537',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '217',
internalId:  '',
customField: '20050827-183206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9447',
internalId:  '',
customField: '20090618-194640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9452',
internalId:  '',
customField: '20050827-182408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '222',
internalId:  '',
customField: '20060702-131811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33401',
internalId:  '',
customField: '20070709-182411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32701',
internalId:  '',
customField: '20070709-182844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '237',
internalId:  '',
customField: '20090812-152919'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '242',
internalId:  '',
customField: '20050827-214941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11511',
internalId:  '',
customField: '20050827-205601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11202',
internalId:  '',
customField: '20090618-194448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28801',
internalId:  '',
customField: '20100515-065559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41138',
internalId:  '',
customField: '20090618-172305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40907',
internalId:  '',
customField: '20090812-152150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40928',
internalId:  '',
customField: '20090812-152231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41012',
internalId:  '',
customField: '20090618-192419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45923',
internalId:  '',
customField: '20090618-193550'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN010IN2MIU';
var companyName   = 'Leighton+Tegland%2C+Realtor';
var htmlTitle	  = 'Leighton+B.+Tegland%2C+Realtor-Attorney';
var metaKeywords  = 'Real+Estate%2C+buyers%2C+sellers%2C+property%2C+management%2C+preferred%2C+estates%2C+lease%2C+list%2C+homes%2C+golf%2C+luxury%2C+vacation%2C+Rent+';
var metaContents  = 'Real+Estate%2C+Desert%2C+Palm+Springs%2C+Rancho+Mirage%2C+La+Quinta%2C+Coachella+Valley%2C+Luxury+Homes%2C+Golf+Properties%2C+Estates%2C+Property%2C+Properties%2C+Homes%2C+House%2C+Sale%2C+Lease%2C+Rent';
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();
};
