/* [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','4598',jdecode('Home'),jdecode(''), jdecode('%2F4598.html'), 'true',[],'',''],
	['PAGE','4655',jdecode('Casas%2C+Terrenos+-+Real+Estate'),jdecode(''), jdecode('%2F4655%2Findex.html'), 'true',[ 
		['PAGE','4709',jdecode('Casas+Venta'),jdecode(''), jdecode('%2F4655%2F4709.html'), 'true',[],'',''],
		['PAGE','20386',jdecode('Casas+Renta'),jdecode(''), jdecode('%2F4655%2F20386.html'), 'true',[],'',''],
		['PAGE','4736',jdecode('Locales+comerciales%2C+Bodegas'),jdecode(''), jdecode('%2F4655%2F4736.html'), 'true',[],'',''],
		['PAGE','4763',jdecode('Terrenos%2C+Fincas%2C+Ranchos'),jdecode(''), jdecode('%2F4655%2F4763.html'), 'true',[],'','']
	],'',''],
	['PAGE','4790',jdecode('Servicios+Inmobiliarios'),jdecode(''), jdecode('%2F4790.html'), 'true',[],'',''],
	['PAGE','4817',jdecode('Servicios+Juridicos'),jdecode(''), jdecode('%2F4817.html'), 'true',[],'',''],
	['PAGE','4844',jdecode('Cont%C3%A1ctenos'),jdecode(''), jdecode('%2F4844.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Collage';
theSitetree.paletteFamily='F9C116';
theSitetree.keyvisualId='2467';
theSitetree.keyvisualName='umzug.jpg';
theSitetree.fontsetId='406';
theSitetree.graphicsetId='459';
theSitetree.contentColor='2F325F';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'grp13-hostin',
  product: 'WSCVWLSSSLYTC2IW'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Collage',
				paletteFamily: 	'F9C116',
				keyvisualId: 	'2467',
				keyvisualName: 	'umzug.jpg',
				fontsetId: 		'406',
				graphicsetId: 	'459',
				contentColor: 	'2F325F',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'F9C116',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4598',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-44563']={
webappId:    '1501',
documentId:  '4598',
internalId:  '44563',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4598',
internalId:  '',
customField: '20110226-144843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4655',
internalId:  '',
customField: '20110702-143414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20386',
internalId:  '',
customField: '20110328-185529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4709',
internalId:  '',
customField: '20110702-145610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4736',
internalId:  '',
customField: '20110328-191111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4763',
internalId:  '',
customField: '20110328-185635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4790',
internalId:  '',
customField: '20070602-182517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4817',
internalId:  '',
customField: '20060902-103256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4844',
internalId:  '',
customField: '20090904-203651'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INXXMA';
var companyName   = 'INMUEBLES+DEL+MAYAB++++++++++++++++++';
var htmlTitle	  = 'INMAYAB';
var metaKeywords  = 'CASA%2C+CASAS%2C+RESIDENCIA.+TERRENO%2C+TERRENOS%2C+PISO%2C+PISOS%2C+PROPIEDAD%2C+HABITACION%2C+LOCALES%2C+BODEGAS%2C+VENTA%2C+RENTA%2C+VENDO%2C+RENTO%2C+ALQUILO%2C+ALQUILER%2C+TRASPASO%2C+OFREZCO%2C+OFRESCO%2C+MERIDA%2C+M%C3%89RIDA%2C+YUCATAN%2C+YUCAT%C3%81N%2C+BIENES+RAICES%2C+REAL+ESTATE%2C+CORREDOR%2C+BROKER%2C+CASA%2C+PREDIO%2C+CASONA%2C+CAZA%2C+DEPARTAMENTO%2C+MAGNIFICA%2C+MAGNIFICO%2C+IDEAL%2C+PLANTAS%2C+CASITA%2C+OFICINA%2C+UBICACION%2C+UBICADA%2C+UBICADO%2C+PLAYA%2C+FRACCIONAMIENTO%2C+COLONIA%2C+CIUDAD%2C+EXCELENTE%2C+BONITA%2C+ECONOMICA%2C+INTERESANTE%2C+OPORTUNIDAD%2C+CERCA%2C+FINCA%2C+RANCHO%2C+POBLACION%2C+CONSTRUCCION%2C+SALA%2C+COMEDOR%2C+COCINA%2C+RECAMARA%2C+HABITACION%2C+HABITACIONAL%2C+BA%C3%91O%2C+ESTUDIO%2C+PATIO%2C+CUARTO%2C+SERVICIO%2C+TERRAZA%2C+COCHERA%2C+REJAS%2C+PROTECTORES%2C+BARDAS%2C+BARDEADA%2C+CALLE%2C+PARQUE%2C+CENTRO%2C+COMERCIAL%2C';
var metaContents  = 'VENTA+DE+CASAS%2C+RESIDENCIAS%2C+TERRENOS%2C+APARTAMENTOS%2C+LOCALES+COMERCIALES%2C+RENTAS%2C++ALQUILER%2C+TRASPASOS';
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();
};

