/* [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','18322',jdecode('%C3%9Altimas+not%C3%ADcias'),jdecode(''),'/18322.html','true',[],'',''],
	['PAGE','601',jdecode('Home'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','652',jdecode('Servi%C3%A7os'),jdecode(''),'/652.html','true',[],'',''],
	['PAGE','694',jdecode('Nossa+equipe'),jdecode(''),'/694.html','true',[],'',''],
	['PAGE','18301',jdecode('AmuRio'),jdecode(''),'/18301.html','true',[],'',''],
	['PAGE','29701',jdecode('Links+%C3%9Ateis'),jdecode(''),'/29701.html','true',[],'',''],
	['PAGE','715',jdecode('Endere%C3%A7os'),jdecode(''),'/715.html','true',[],'',''],
	['PAGE','757',jdecode('Fale+Conosco'),jdecode(''),'/757.html','true',[],'',''],
	['PAGE','57101',jdecode('Seja+Nosso+Parceiro'),jdecode(''),'/57101.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Display';
theSitetree.paletteFamily='222222';
theSitetree.keyvisualId='11078';
theSitetree.keyvisualName='kv_11078.jpg';
theSitetree.fontsetId='31963';
theSitetree.graphicsetId='13802';
theSitetree.contentColor='1B1B1B';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Display',
				paletteFamily: 	'222222',
				keyvisualId: 	'11078',
				keyvisualName: 	'kv_11078.jpg',
				fontsetId: 		'31963',
				graphicsetId: 	'13802',
				contentColor: 	'1B1B1B',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1928']={
webappId:    '7008',
documentId:  '757',
internalId:  '1928',
customField: 'language:pt;country:BR;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20090724-071251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20090703-043220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '694',
internalId:  '',
customField: '20090702-102300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29701',
internalId:  '',
customField: '20090702-131155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18322',
internalId:  '',
customField: '20090727-135256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18301',
internalId:  '',
customField: '20090703-094822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57101',
internalId:  '',
customField: '20090629-110730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '715',
internalId:  '',
customField: '20100316-105722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20090204-140030'
};
webappMappings['1501']=webappMappings['1501-9281866']={
webappId:    '1501',
documentId:  '601',
internalId:  '9281866',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-8783']={
webappId:    '7008',
documentId:  '57101',
internalId:  '8783',
customField: 'language:pt;country:BR;'
};
webappMappings['7060']=webappMappings['7060-d8ef494cdca2020d7dcf26f1d1ec54ba']={
webappId:    '7060',
documentId:  '18322',
internalId:  'd8ef494cdca2020d7dcf26f1d1ec54ba',
customField: 'language:pt;country:BR;'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INZWFY';
var companyName   = 'ABRAE+-+ASSOC.+BRASILEIRA+DE+ASSIST%C3%8ANCIA+AO+ESTRANGEIRO';
var htmlTitle	  = '.%3A%3A+ABRAE+-+Asoc.+Brasile%C3%B1a+De+Asistencia+A+Los+Extranjeros+%3A%3A.';
var metaKeywords  = 'imigrantes%3B+abrae%3B+imigrante%3B+espanha%3B+brasil%3B+barcelona%3B+aeroporto%3B+madri%3B+deportado%3B+extranjeiros%3B+amurio%3B+associa%C3%A7%C3%A3o%3B+associa%C3%A7ao%3B+asociacion%3B+extranjeros%3B+barcelona%3B+estrangeiros%3B+associa%C3%A7ao+brasileira%3B+espanha%3B+visto%3B+consulado%3Bemigra%C3%A7ao%3B+emigra%C3%A7ao+brasileira%3B+emigra%C3%A7%C3%A3o+brasileira%3B+brasileiros+na+espanha%3B+brasil+na+espanha%3B+brasil+espanha%3B+espanha+brasil%3B+flavio+carvalho%3B+Fl%C3%A1vio+Carvalho%3B+fl%C3%A1vio+carvalho%3B';
var metaContents  = 'ABRAE+-+Associa%C3%A7%C3%A3o+Brasileira+de+Assist%C3%AAncia+aos+Estrangeiros.+Ligue+agora+mesmo+para+93+467+3877+e+a+qualquer+hora+do+dia+deixe+sua+mensagem+e+n%C3%BAmero+de+telefone+que+logo+entraremos+em+contato%2C+o+mais+breve+poss%C3%ADvel.+Nossa+miss%C3%A3o+%C3%A9+ajudar+voc%C3%AA...';
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();
};
