/* [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','5801',jdecode('Home'),jdecode(''),'/5801.html','true',[],''],
	['PAGE','12401',jdecode('MOBILE+HOMEPARKS'),jdecode(''),'/12401.html','true',[],''],
	['PAGE','12422',jdecode('ELECTRICBILL'),jdecode(''),'/12422.html','true',[],''],
	['PAGE','20401',jdecode('FORCLOSURE+'),jdecode(''),'/20401.html','true',[],''],
	['PAGE','47523',jdecode('CONFINDENTINAL+'),jdecode(''),'/47523.html','true',[],''],
	['PAGE','72967',jdecode('REFERAL+AGR'),jdecode(''),'/72967.html','true',[],''],
	['PAGE','73267',jdecode('CO+BROKER+AGREEMENT'),jdecode(''),'/73267.html','true',[],''],
	['PAGE','73667',jdecode('LAS+VEGAS+REPOS'),jdecode(''),'/73667.html','true',[],''],
	['PAGE','74667',jdecode('LINK'),jdecode(''),'/74667.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Plainly';
theSitetree.paletteFamily='ABC600';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32124';
theSitetree.graphicsetId='13925';
theSitetree.contentColor='6e6e6d';
theSitetree.contentBGColor='fbfae8';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Plainly',
				paletteFamily: 	'ABC600',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32124',
				graphicsetId: 	'13925',
				contentColor: 	'6e6e6d',
				contentBGColor: 'fbfae8',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20091209-114020'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-12160861']={
webappId:    '1501',
documentId:  '5801',
internalId:  '12160861',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-14062']={
webappId:    '7008',
documentId:  '12401',
internalId:  '14062',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72967',
internalId:  '',
customField: '20091107-173957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73267',
internalId:  '',
customField: '20091107-180908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20090809-170153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12422',
internalId:  '',
customField: '20090330-220951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20091101-205101'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5801',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '12401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '12422',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47523',
internalId:  '',
customField: '20091101-224049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73667',
internalId:  '',
customField: '20091201-104813'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '20401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-18684']={
webappId:    '7008',
documentId:  '5801',
internalId:  '18684',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-18685']={
webappId:    '7008',
documentId:  '12422',
internalId:  '18685',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74667',
internalId:  '',
customField: '20091225-200059'
};
webappMappings['7008']=webappMappings['7008-18687']={
webappId:    '7008',
documentId:  '20401',
internalId:  '18687',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INE4TZ';
var companyName   = 'WWW.REFERRALREALESTATE.COM';
var htmlTitle	  = 'WWW.REFERRALREALESTATE.COM';
var metaKeywords  = 'MOBILE+HOME+PARK%2CIBUY+MOBILE+HOMEPARKS%2CREFERALFEE%2CHUD%2CELECTRIC+BILLL%2CGREEN%2CWINDMILL%2CJOINT+VENTURE%2CBIGBEARCALIFORINA%2CHIRING+REAL+ESTATE+AGENTS%2CJOINT+VENTURE+RAW+LAND+FOR+HOTEL+AND+SHOPPING+CENTERS+AND+FAST+FOOD+CHAINS%2FHUD+%2CFORCLOOSURE%2CBUYER%2CSELLLER%2CESCROW%2CREPOS%2CSILVERCREST%2CFLEETWOOD%2CFINANCING%2CREALESTATE%2CDEVELOPEMENTS%2CPEOPLE+INTERNET+POLL%2CINVESTOR%2CHARDMONEY+LENDERS%2CFLOIDA%2CLAS+VEGAS%2CTEXAS%2CFOIGHT+NORTH%2CFIGHT+SOUTH%2C+WRESTLING+LASVEGAS%2C+FIGHT+LASVEGAS%2CFIGHT+CHHANNEL%2C';
var metaContents  = 'MOBILE+HOME+PARK%2CI+BUY+MOBILE+HOMEPARK%2CI+SELL+MOBILE+HOME+PARKS%2CMANUFACTURE+HOME%2CREALESTATE%2CLAND%2CDEVELOPEMENT%2CIBUYELECTRIC+BILLIN+CALIFORINA%2CSELLHUD+REPOS%2CSELLBIG+BEAR+PROPRETY%2CJOINT+VENTURE+LAND+AS+LONG+NO+DEBT.BUY+CASINO+OR+HOTEL%2CREBATE%2CDISCOUNT%2CBESTVALUE%2CBARGAIN%2CBEST+DEAL%2C+BUYER+FFRIENDLY%2CWWW.USHOMEAUCTION.COM%2CVAREPO%2CBANK%2CREPOS%2C';
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();
};
