/* [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','97201',jdecode('Terreno+Canoa%C2%B7Fortim30+Ha'),jdecode(''), jdecode('%2F97201.html'), 'true',[],'',''],
	['PAGE','473',jdecode('IRACEMA+LUXUS+HOUSE+'),jdecode(''), jdecode('%2F473.html'), 'true',[],'',''],
	['PAGE','452',jdecode('BEACHFRONT+LOTS'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','106912',jdecode('TERRENO+en+FORTLEZA'),jdecode(''), jdecode('%2F106912.html'), 'true',[],'',''],
	['PAGE','401',jdecode('TERRA%C3%87OS+Apartments'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','67101',jdecode('RESERVAR+-+BOOK'),jdecode(''), jdecode('%2F67101.html'), 'false',[],'',''],
	['PAGE','82701',jdecode('NATAL+LUXUS+APART'),jdecode(''), jdecode('%2F82701.html'), 'true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Ocean';
theSitetree.paletteFamily='E6D6D7';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33080';
theSitetree.graphicsetId='14056';
theSitetree.contentColor='00386f';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC210'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Ocean',
				paletteFamily: 	'E6D6D7',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33080',
				graphicsetId: 	'14056',
				contentColor: 	'00386f',
				contentBGColor: 'FFFFFF',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-4625']={
webappId:    '7008',
documentId:  '106912',
internalId:  '4625',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82701',
internalId:  '',
customField: '20110401-144954'
};
webappMappings['7008']=webappMappings['7008-2648']={
webappId:    '7008',
documentId:  '82701',
internalId:  '2648',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '97201',
internalId:  '',
customField: '20120106-115244'
};
webappMappings['7008']=webappMappings['7008-4155']={
webappId:    '7008',
documentId:  '97201',
internalId:  '4155',
customField: 'language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-16027824']={
webappId:    '1501',
documentId:  '473',
internalId:  '16027824',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '473',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '473',
internalId:  '1501',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106912',
internalId:  '',
customField: '20110914-182812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110516-062900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20120106-112616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67101',
internalId:  '',
customField: '20090619-091055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20120106-115934'
};
webappMappings['4001']=webappMappings['4001-20442571']={
webappId:    '4001',
documentId:  '67101',
internalId:  '20442571',
customField: 'language:en;country:US;'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN010IN3M6M';
var companyName   = 'EM+CEAR%C3%81++APARTMENTS+%26+LOTS';
var htmlTitle	  = 'APARTMENTS+IN+BRAZIL%2C+FORTALEZA%2C+BOOK+ONLINE+%2C+NATAL+%2C+CEARA%2C+BEACHFRONT++BRAZIL%2C+APARTAMENTOS+EN+FORTALEZA%2C+CANOA+QUEBRADA%2C+FORTIM%2C+ARACATI%2C+FORTALEZA%2C+CEARA%2C';
var metaKeywords  = 'head+meta+name%3Dverify-v1+content%3DIct30TKjWu5d3s1yNczwo2m5SxTFakV1ILWcAOfMeM4%3D+%2F+++title+My+title+%2Ftitle++%2FheadTITLEApartments+in+Fortaleza.+TITLEApartments+in+Brazil.+TITLEApartments+in+Ceara%2C+Apartamentos+en+Fortaleza%2C+Apartamentos+en+Natal%2FTITLE%21-+-Apartments+in+Fortaleza++Brazil.+Apartamentos+en+Fortaleza+Brasil%2C+Natal-+-++%21-+-+Inicio+MetaTags+-+-++meta+name%3Dtitle+content%3DApartments+in+Fortaleza+Brazil.+Apartamentos+en+Fortaleza%2C+Natal%2C+Brasil++meta+name%3Ddescription+content%3DApartments+in+Brazil%2C+Fortaleza%2C+Ceara.+Apartamentos+en++Fortaleza%2C+Canoa+Quebrada%2C+Fortim%2C+Aracati%2C+Pontal+do+Maceio++meta+name%3Dkeywords++content%3DApartments%2CApartamento%2CApartamenteos%2CBrazil%2CBrasil%2CFortaleza%2CNatal%2CCeara%2CComprar%2CVenta++meta+name%3Ddistribution+content%3DGlobal++meta+name%3Dcategory+content%3DInmobiliarias++meta+name%3Dlanguage+content%3Des++meta+name%3Didentifier-url+content%3Dhttp%3A%2F%2Fwww.emceara.com%2F++meta+name%3Drating+content%3DGeneral++meta+name%3Dauthor+content%3DUnetcom++meta+name%3Dreply-to+content%3Dunetcom%40ono.com++meta+name%3Dcopyright+content%3DCasatramit++meta+http-equiv%3Dcache-control+content%3Dno-cache++meta+http-equiv%3Dpragma+content%3Dno-cache++meta+http-equiv%3DContent-Type+content%3Dtext%2Fhtml%3B+charset%3DISO-8859-1++meta+name%3Dresource-type+content%3Ddocument++meta+name%3Drobots+content%3Dall++meta+name%3Drevisit-after+content%3D1++%21-+-+Final+MetaTags+-+-++';
var metaContents  = 'TITLEApartments+in+Fortaleza.+Apartamentos+en+Fortaleza%2FTITLE%21-+-Apartments+in+Fortaleza++Brazil.+Apartamentos+en+Fortaleza%2C+Natal%2C+Brasil-+-++%21-+-+Inicio+MetaTags+-+-++meta+name%3Dtitle+content%3DApartments+in+Fortaleza+Brazil.+Apartamentos+en+Fortaleza+Brasil++meta+name%3Ddescription+content%3DApartments+in+Brazil%2C+Fortaleza%2CNatal%2C+Ceara.+Apartamentos+en++Fortaleza%2CNatal%2C+Canoa+Quebrada%2C+Fortim%2C+Aracati%2C+Pontal+do+Maceio++meta+name%3Dkeywords++content%3DApartments%2CApartamento%2CApartamenteos%2CBrazil%2CBrasil%2CFortaleza%2CCeara%2CComprar%2CVenta++meta+name%3Ddistribution+content%3DGlobal++meta+name%3Dcategory+content%3DInmobiliarias++meta+name%3Dlanguage+content%3Des++meta+name%3Didentifier-url+content%3Dhttp%3A%2F%2Fwww.emceara.com%2F++meta+name%3Drating+content%3DGeneral++meta+name%3Dauthor+content%3DUnetcom++meta+name%3Dreply-to+content%3Dunetcom%40ono.com++meta+name%3Dcopyright+content%3DCasatramit++meta+http-equiv%3Dcache-control+content%3Dno-cache++meta+http-equiv%3Dpragma+content%3Dno-cache++meta+http-equiv%3DContent-Type+content%3Dtext%2Fhtml%3B+charset%3DISO-8859-1++meta+name%3Dresource-type+content%3Ddocument++meta+name%3Drobots+content%3Dall++meta+name%3Drevisit-after+content%3D1++%21-+-+Final+MetaTags+-+-++';
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();
};

