/* [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','11',jdecode('Quem+Somos'),jdecode(''), jdecode('%2F11.html'), 'true',[],'',''],
	['PAGE','234601',jdecode('Consulte+J%C3%A1+%21'),jdecode(''), jdecode('%2F234601.html'), 'true',[],'',''],
	['PAGE','260112',jdecode('Exemplos+INSS+e+SIAPE'),jdecode(''), jdecode('%2F260112.html'), 'true',[],'',''],
	['PAGE','222401',jdecode('Refinanciamentos+'),jdecode(''), jdecode('%2F222401.html'), 'false',[],'',''],
	['PAGE','232801',jdecode('Consignado+CLT'),jdecode(''), jdecode('%2F232801.html'), 'true',[],'',''],
	['PAGE','14515',jdecode('Importante'),jdecode(''), jdecode('%2F14515.html'), 'true',[],'',''],
	['PAGE','4910',jdecode('Fale+Conosco'),jdecode(''), jdecode('%2F4910.html'), 'false',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Vita02';
theSitetree.paletteFamily='88A6B5';
theSitetree.keyvisualId='11283';
theSitetree.keyvisualName='kv_11283.jpg';
theSitetree.fontsetId='32116';
theSitetree.graphicsetId='13936';
theSitetree.contentColor='3C3D3C';
theSitetree.contentBGColor='F6FBFE';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var prodDef={
  wl_name: 'brazilprod',
  product: 'WSCSYSSSSLY0X9A9'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Vita02',
				paletteFamily: 	'88A6B5',
				keyvisualId: 	'11283',
				keyvisualName: 	'kv_11283.jpg',
				fontsetId: 		'32116',
				graphicsetId: 	'13936',
				contentColor: 	'3C3D3C',
				contentBGColor: 'F6FBFE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '232801',
internalId:  '',
customField: '20110608-163507'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '234601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '234601',
internalId:  '',
customField: '20120129-195709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '260112',
internalId:  '',
customField: '20120129-192927'
};
webappMappings['7008']=webappMappings['7008-7879']={
webappId:    '7008',
documentId:  '4910',
internalId:  '7879',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14515',
internalId:  '',
customField: '20110609-172718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20120201-053114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '222401',
internalId:  '',
customField: '20100902-061605'
};
webappMappings['7008']=webappMappings['7008-19479']={
webappId:    '7008',
documentId:  '234601',
internalId:  '19479',
customField: 'language:pt;country:BR;'
};
webappMappings['1501']=webappMappings['1501-1151005']={
webappId:    '1501',
documentId:  '234601',
internalId:  '1151005',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4910',
internalId:  '',
customField: '20100902-061834'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2SQ5';
var companyName   = '+CreditONet+-+Desde+2005+++';
var htmlTitle	  = 'Correspondente+BMG+-++0800+772+1314+-+Ligue+Gratis+de+S%C3%A3o+Paulo-+Capital';
var metaKeywords  = 'dinheiro%2C++emprestimos%2C++credito+pessoal%2C+desconto+em+folha%2C++boleto+bancario%2C+debito+em+conta+corrente%2Cconsignado%2C+consignados%2C+emprestimo%2C+bmg%2C+bv%2C+santander%2C+crefisa%2C+sabemi%2C+bmc%2C+bgn%2C+bv+financeira%2C+banco+bmg%2C+banco+santander%2C+credito+inss.+consignado+inss%2C+inss+consignado.';
var metaContents  = 'emprestimos++consignados%2C+emprestimos%2C+desconto+em+folha+de+pagamento%2C+correspondente+bmg%2C+promotora+bv%2C+correspondente+Santander%2C+Aposentados+e+Pensionistas+do+INSS%2C+Empr%C3%A9stimos+Siape%2C+bv+na+vila+mariana%2C+bmg+na+vila+mariana%2C+santander+na+vila+mariana%2C%0D%0Abmg+no+jabaquara%2C+bmg+na+pra%C3%A7a+da+arvores%2C+bv+no+jabaquara%2C+bv+na+pra%C3%A7a+da+arvore.';
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();
};

