/* [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','182',jdecode('SEARCH+LISTINGS'),jdecode(''),'/182/index.html','true',[ 
		['PAGE','209',jdecode('Residential+Property'),jdecode(''),'/182/209.html','true',[],'']
	],''],
	['PAGE','164',jdecode('Contact+Us'),jdecode(''),'/164.html','true',[],''],
	['PAGE','3229',jdecode('Local+area+Info'),jdecode(''),'/3229.html','true',[],''],
	['PAGE','7630',jdecode('SHORT+SALES'),jdecode(''),'/7630.html','true',[],''],
	['PAGE','7639',jdecode('Use+Foshay+for+Short+Sales'),jdecode(''),'/7639.html','true',[],''],
	['PAGE','23401',jdecode('SEARCH+MLS'),jdecode(''),'/23401.html','true',[],''],
	['PAGE','3256',jdecode('Legal+and+1031+exchanges'),jdecode(''),'/3256.html','true',[],''],
	['PAGE','4120',jdecode('Meet+Our+Agents'),jdecode(''),'/4120.html','true',[],''],
	['PAGE','6200',jdecode('Real+Estate+Lawyers'),jdecode(''),'/6200/index.html','true',[ 
		['PAGE','6209',jdecode('Second+Product'),jdecode(''),'/6200/6209.html','true',[],'']
	],''],
	['PAGE','2769',jdecode('Mortgage+Consultants'),jdecode(''),'/2769.html','true',[],''],
	['PAGE','6601',jdecode('WHY+A+REALTOR%3F'),jdecode(''),'/6601.html','true',[],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Collage';
theSitetree.paletteFamily='6683B6';
theSitetree.keyvisualId='2467';
theSitetree.keyvisualName='umzug.jpg';
theSitetree.fontsetId='404';
theSitetree.graphicsetId='461';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Collage',
				paletteFamily: 	'6683B6',
				keyvisualId: 	'2467',
				keyvisualName: 	'umzug.jpg',
				fontsetId: 		'404',
				graphicsetId: 	'461',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'6683B6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '182',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '182',
internalId:  '1501',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '182',
internalId:  '',
customField: '20090607-095051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '209',
internalId:  '',
customField: '20080106-125713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '164',
internalId:  '',
customField: '20080313-193719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3229',
internalId:  '',
customField: '20080123-210849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7630',
internalId:  '',
customField: '20090326-050555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3256',
internalId:  '',
customField: '20080118-193140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4120',
internalId:  '',
customField: '20090419-153908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6200',
internalId:  '',
customField: '20080107-115935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6209',
internalId:  '',
customField: '20080107-104303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2769',
internalId:  '',
customField: '20080824-075112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20080111-115018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7639',
internalId:  '',
customField: '20081109-135403'
};
webappMappings['1501']=webappMappings['1501-193422']={
webappId:    '1501',
documentId:  '182',
internalId:  '193422',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-248']={
webappId:    '7008',
documentId:  '23401',
internalId:  '248',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20090607-074612'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3RY';
var companyName   = 'J+FOSHAY+REALTY+LTD';
var htmlTitle	  = '+Short+Sales+%2C+MLS+SEARCH+.+FORCLOSURES+IN+Westchester++Putnam+counties+914-603-3111';
var metaKeywords  = '+Short+Sales%2C+for+sale+NY%2CWestchester+MLS%2CPutnam%2C+Homes+for+sale+%2Ccondos+for+sale%2C+investment+properties+for+sale.+REO+Forclosures%2C+Bank+Owned%2C+Buyers+agents%2C+agency+%2CBroker+%2CReal+estate+for+sale+in+westchester.Yorktown+Heights+%2C+Mahopac+Mohegan%2C+Shrub+Oak+Putnam+Valley+Peekskill%2CCortlandt+Manor%2C+Jacqui+Foshay+Broker%2CCroton.+Mamaroneck.Ossining+Yonkers.White+Plains+Houses%2C+Homes+for+sale+%2C+for+sale+by+owner+mls%2C+mls++For+sale+by+owner%2C+short+sales%2C+condos+ap%2Cartments%2C';
var metaContents  = '+META+name%3Dverify-v1+content%3DW4879Pgms1Kal%2B2FMiTIHScmpgzDEyi2mvy16QoIM%2B4%3D+%2FJacqui+Foshay+Broker+%2C+Short+sales%2CWestchester+%2Cforclosures%2C+Buyers+agent.+Reo%2C+Bank+ownedproperties.short+sales++Forclosures.Search+the+MLS.+investment+properties%2C+Homes+%2CCondos+for+sale+Westchester+Putnam%2C+abr+agent+.+Buyers+agent%2CSellers+Agents%2C+Realtors+Real+estate+for+sale+in+westchester%2C+1031+exchang%2Cinvestment+properties%2C+local+Westchester+info%2C+mls+';
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();
};
