/* [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','2434',jdecode('Home'),jdecode(''),'/2434.html','true',[],'',''],
	['PAGE','198712',jdecode('Nova+Margem+INSS'),jdecode(''),'/198712.html','true',[],'',''],
	['PAGE','11',jdecode('Aposentados%2FPensionistas'),jdecode(''),'/11.html','true',[],'',''],
	['PAGE','150001',jdecode('Servidores+Prefeitura+S.+Paulo'),jdecode(''),'/150001.html','false',[],'',''],
	['PAGE','150043',jdecode('Servidores+Federal+Civil'),jdecode(''),'/150043.html','true',[],'',''],
	['PAGE','150064',jdecode('Militares+das+For%C3%A7as+Armadas'),jdecode(''),'/150064.html','true',[],'',''],
	['PAGE','21830',jdecode('Cart%C3%B5es+de+Cr%C3%A9dito+BMG'),jdecode(''),'/21830.html','true',[],'',''],
	['PAGE','67701',jdecode('BMG+Eletro+'),jdecode(''),'/67701.html','true',[],'',''],
	['PAGE','22573',jdecode('Recomenda%C3%A7%C3%B5es+%C3%9Ateis'),jdecode(''),'/22573.html','true',[],'',''],
	['PAGE','68',jdecode('Seja+Agente+BMG'),jdecode(''),'/68/index.html','true',[ 
		['PAGE','22791',jdecode('Seja+Agente+Cr%C3%A9dito+M%C3%BAtuo+%28p%C3%A1gina+seguir%29'),jdecode(''),'/68/22791.html','false',[],'','']
	],'',''],
	['PAGE','59',jdecode('BMG-Saiba+Mais'),jdecode(''),'/59.html','true',[],'',''],
	['PAGE','223712',jdecode('Atendimento+Pessoal'),jdecode(''),'/223712.html','true',[],'',''],
	['PAGE','77',jdecode('Fale+Conosco'),jdecode(''),'/77/index.html','true',[ 
		['PAGE','12656',jdecode('Contato+%28p%C3%A1gina+seguir%29'),jdecode(''),'/77/12656.html','false',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Blog';
theSitetree.paletteFamily='649B30';
theSitetree.keyvisualId='11513';
theSitetree.keyvisualName='kv_11513.jpg';
theSitetree.fontsetId='32865';
theSitetree.graphicsetId='13949';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='989696';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blog',
				paletteFamily: 	'649B30',
				keyvisualId: 	'11513',
				keyvisualName: 	'kv_11513.jpg',
				fontsetId: 		'32865',
				graphicsetId: 	'13949',
				contentColor: 	'FFFFFF',
				contentBGColor: '989696',
				a_color: 		'FFB434',
				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['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '198712',
internalId:  '1501',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '198712',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '223712',
internalId:  '',
customField: '20091007-054724'
};
webappMappings['7008']=webappMappings['7008-7882']={
webappId:    '7008',
documentId:  '68',
internalId:  '7882',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20091007-054812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2434',
internalId:  '',
customField: '20090824-201350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '150001',
internalId:  '',
customField: '20091111-134224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '150043',
internalId:  '',
customField: '20090824-193222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '150064',
internalId:  '',
customField: '20090824-193043'
};
webappMappings['7008']=webappMappings['7008-8940']={
webappId:    '7008',
documentId:  '77',
internalId:  '8940',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '198712',
internalId:  '',
customField: '20091007-110927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21830',
internalId:  '',
customField: '20090824-194110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67701',
internalId:  '',
customField: '20090824-193538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22573',
internalId:  '',
customField: '20090824-193600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68',
internalId:  '',
customField: '20091001-130806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59',
internalId:  '',
customField: '20090918-085800'
};
webappMappings['7008']=webappMappings['7008-8037']={
webappId:    '7008',
documentId:  '198712',
internalId:  '8037',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22791',
internalId:  '',
customField: '20060917-210403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77',
internalId:  '',
customField: '20090629-200605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12656',
internalId:  '',
customField: '20051012-220919'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2SJH';
var companyName   = 'www.correspondentebmg.com.br';
var htmlTitle	  = 'CR%C3%89DITO+MUTUO';
var metaKeywords  = 'empr%C3%A9stimos%3B+correspondente+bancario+bmg%3B+aposentados%3Bpensionistas%3Binss%3Bempr%C3%A9stimos+a+aposentados+e+pensionistas+do+INSS%3Bbmg%3Bservidores%3Bcorrespondentebmg+publicos%3Bemprestimos%3Bsem+spc+e+serasa%3Bsem+avalista%3Bprimeiro+banco+em+varejo+massificado%3Bemprestimosbmg%3Bagentebmg%3Bcorrespondente%3Bdinheiro%3Bdindin%3B';
var metaContents  = 'emprestimos%3B+financiamentos%3A++aposentados+e+pensionistas+INSS%3Acredito+pessoal%3B+servidores+publicos%3Bfuncionario+publico%3Bcorrespondentebmg%3Bcorrespondentebancario%3Brefinanciamentos%3Badiantamento+de+salario%3Brefinanciamento%3Bpeinsionistadoinss%3Baposentadosdoinss%3B';
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();
};
