/* [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','6101',jdecode('Home'),jdecode(''),'/6101.html','true',[],''],
	['PAGE','7201',jdecode('Buyers'),jdecode(''),'/7201.html','true',[],''],
	['PAGE','6173',jdecode('Listings'),jdecode(''),'/6173.html','false',[],''],
	['PAGE','6236',jdecode('Real+Estate+Listings'),jdecode(''),'/6236.html','true',[],''],
	['PAGE','10401',jdecode('Contact+Us'),jdecode(''),'/10401.html','true',[],''],
	['PAGE','10601',jdecode('Resources+%26+News'),jdecode(''),'/10601/index.html','true',[ 
		['PAGE','11301',jdecode('California+Foreclosure+Laws'),jdecode(''),'/10601/11301.html','false',[],''],
		['PAGE','11322',jdecode('Georgia+Foreclosure+Laws'),jdecode(''),'/10601/11322.html','false',[],''],
		['PAGE','11343',jdecode('Missouri+Foreclosure+Laws'),jdecode(''),'/10601/11343.html','false',[],'']
	],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Applicant';
theSitetree.paletteFamily='7890D7';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26568';
theSitetree.graphicsetId='13383';
theSitetree.contentColor='21346c';
theSitetree.contentBGColor='becefd';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Applicant',
				paletteFamily: 	'7890D7',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26568',
				graphicsetId: 	'13383',
				contentColor: 	'21346c',
				contentBGColor: 'becefd',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'7890D7',
				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:  '6101',
internalId:  '',
customField: '20090605-015020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6236',
internalId:  '',
customField: '20090612-230222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6173',
internalId:  '',
customField: '20090604-231420'
};
webappMappings['7008']=webappMappings['7008-17362']={
webappId:    '7008',
documentId:  '6101',
internalId:  '17362',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-17364']={
webappId:    '7008',
documentId:  '7201',
internalId:  '17364',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20090605-005147'
};
webappMappings['7050']=webappMappings['7050-10010']={
webappId:    '7050',
documentId:  '6236',
internalId:  '10010',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-17368']={
webappId:    '7008',
documentId:  '6173',
internalId:  '17368',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20090605-131041'
};
webappMappings['7008']=webappMappings['7008-17377']={
webappId:    '7008',
documentId:  '10401',
internalId:  '17377',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20090605-145949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11301',
internalId:  '',
customField: '20090605-143135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11322',
internalId:  '',
customField: '20090605-145044'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11343',
internalId:  '',
customField: '20090605-144959'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3UAX';
var companyName   = 'Appreciating+RE';
var htmlTitle	  = 'AppreciatingRE+Listings';
var metaKeywords  = 'Appreciating+Real+Estate%2C+Appreciating+RE%2C+AppreciatingRealEstate.com%2C+AppreciatingRE.com%2C+discounted+deals%2C+wholesale+properties%2C+distressed+property%2C+discounted+property%2C+wholesale%2C+rehab%2C+OC+wholesalers%2C+orange+county+wholesaler%2C+Los+Angeles+wholesaler%2C+California+wholesaler%2C+handyman+special%2C+distressed+properties%2C+%2C+I+buy+houses%2C+I+buy+homes%2C+real+estate+investor%2C+OC+real+estate%2C+Los+Angeles+real+estate%2C+California+real+estate+deals%2C+real+estate+investments%2C+OC+investments%2C+Missouri+investments%2C+Missouri+real+estate%2C+St+Louis+real+estate%2C+St+Louis+real+estate+investment%2C++Kansas+City+real+estate+investment%2C+';
var metaContents  = 'Appreciating+RE+-+Appreciating+Real+Estate+prides+itself+on+finding+discounted+properties+at+wholesale+deals+for+real+estate+investors%2C+rehabbers%2C+landlords+and+other+owners.';
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();
};

