/* [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','9101',jdecode('Pagina+Inicial'),jdecode(''),'/9101.html','true',[],''],
	['PAGE','873',jdecode('Produtos+Individuais'),jdecode(''),'/873.html','true',[],''],
	['PAGE','894',jdecode('Produtos+Empresariais'),jdecode(''),'/894.html','true',[],''],
	['PAGE','936',jdecode('Planos+de+Sa%C3%BAde'),jdecode(''),'/936.html','true',[],''],
	['PAGE','978',jdecode('Contato'),jdecode(''),'/978.html','true',[],''],
	['PAGE','999',jdecode('Imobili%C3%A1rias+Parceiras'),jdecode(''),'/999.html','true',[],''],
	['PAGE','9401',jdecode('Consulte+nossos+Pre%C3%A7os'),jdecode(''),'/9401.html','true',[],''],
	['PAGE','17801',jdecode('Dicas+Importantes'),jdecode(''),'/17801.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Toronto';
theSitetree.paletteFamily='8756A7';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16882';
theSitetree.graphicsetId='12320';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='8756A7';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				name: 			'Toronto',
				paletteFamily: 	'8756A7',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16882',
				graphicsetId: 	'12320',
				contentColor: 	'FFFFFF',
				contentBGColor: '8756A7',
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				a_color: 		'8756A7',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9101',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-10465']={
webappId:    '7008',
documentId:  '9401',
internalId:  '10465',
customField: 'language:pt;country:BR;'
};
webappMappings['1501']=webappMappings['1501-6622322']={
webappId:    '1501',
documentId:  '9101',
internalId:  '6622322',
customField: '1501'
};
webappMappings['7050']=webappMappings['7050-2765']={
webappId:    '7050',
documentId:  '17801',
internalId:  '2765',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20080918-140614'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INLEAI';
var companyName   = 'APMC+Corretora+e+Consultoria+em+Seguros';
var htmlTitle	  = 'APMC+CORRETORA';
var metaKeywords  = 'SEGUROS%2C+COTA%C3%87%C3%95ES+DE+AUTO%2C+CALCULO+DE+SEGUROS+%2CPLANOS+DE+SAUDE%2C+SEGURO+FIAN%C3%87A%2CSEGURO+DE+NOTEBOOK%2C+CONSORCIO%2CFINANCIAMENTOS%2CSEGURO+DE+VIDA%2CPREVIDENCIA+PRIVADA%2CSEGURO+EMPRESARIAL%2CSEGURO+DE+FROTA%2CSEGURO+RESIDENCIAL%2CSEGURO+FUNERAL%2C+DPVAT%2CSEGURO+DE+CONDOMINIOS%2CALARMES+MONITORADOS+PORTO+SEGURO%2C+RASTREADORES+DE+VEICULOS%2CPLANOS+ODONTOLOGICOS%2C+SEGURO+DE+MAQUINAS+E+EQUIPAMENTOS%2C+SEGURO+DE+TRANSPORTES%2C+SEGURO+DE+MOTO.+';
var metaContents  = 'SEGUROS%2C+COTA%C3%87%C3%95ES+DE+AUTO%2C+CALCULO+DE+SEGUROS+%2CPLANOS+DE+SAUDE%2C+SEGURO+FIAN%C3%87A%2CSEGURO+DE+NOTEBOOK%2C+CONSORCIO%2CFINANCIAMENTOS%2CSEGURO+DE+VIDA%2CPREVIDENCIA+PRIVADA%2CSEGURO+EMPRESARIAL%2CSEGURO+DE+FROTA%2CSEGURO+RESIDENCIAL%2CSEGURO+FUNERAL%2C+DPVAT%2CSEGURO+DE+CONDOMINIOS%2CALARMES+MONITORADOS+PORTO+SEGURO%2C+RASTREADORES+DE+VEICULOS%2CPLANOS+ODONTOLOGICOS%2C+SEGURO+DE+MAQUINAS+E+EQUIPAMENTOS%2C+SEGURO+DE+TRANSPORTES%2C+SEGURO+DE+MOTO';
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();
};

