/* [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','1001',jdecode('Hist%C3%B3ria'),jdecode(''),'/1001.html','true',[],'',''],
	['PAGE','42206',jdecode('Contabilidade'),jdecode(''),'/42206/index.html','true',[ 
		['PAGE','57743',jdecode('Abertura+de+Empresa'),jdecode(''),'/42206/57743.html','true',[],'',''],
		['PAGE','57764',jdecode('Encerramento+de+Empresa'),jdecode(''),'/42206/57764.html','true',[],'','']
	],'',''],
	['PAGE','57701',jdecode('Escrita+Fiscal'),jdecode(''),'/57701.html','true',[],'',''],
	['PAGE','57722',jdecode('Trabalhista'),jdecode(''),'/57722.html','true',[],'',''],
	['PAGE','57785',jdecode('Servi%C3%A7os+Prestados'),jdecode(''),'/57785.html','true',[],'',''],
	['PAGE','42311',jdecode('Downloads'),jdecode(''),'/42311.html','true',[],'',''],
	['PAGE','45501',jdecode('Parceiros'),jdecode(''),'/45501/index.html','true',[ 
		['PAGE','60701',jdecode('Cogumelo+do+Sol'),jdecode(''),'/45501/60701.html','false',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='View';
theSitetree.paletteFamily='236A8C';
theSitetree.keyvisualId='11132';
theSitetree.keyvisualName='kv_11132.jpg';
theSitetree.fontsetId='32028';
theSitetree.graphicsetId='13853';
theSitetree.contentColor='2F2F2F';
theSitetree.contentBGColor='236A8C';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'View',
				paletteFamily: 	'236A8C',
				keyvisualId: 	'11132',
				keyvisualName: 	'kv_11132.jpg',
				fontsetId: 		'32028',
				graphicsetId: 	'13853',
				contentColor: 	'2F2F2F',
				contentBGColor: '236A8C',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57722',
internalId:  '',
customField: '20091202-101753'
};
webappMappings['1501']=webappMappings['1501-8222497']={
webappId:    '1501',
documentId:  '1001',
internalId:  '8222497',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57764',
internalId:  '',
customField: '20091202-095419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20091209-074059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57701',
internalId:  '',
customField: '20091202-095047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57743',
internalId:  '',
customField: '20091202-095151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45501',
internalId:  '',
customField: '20091202-113236'
};
webappMappings['7060']=webappMappings['7060-056b757f51f7f2c8f8dfd3438439ccb4']={
webappId:    '7060',
documentId:  '42311',
internalId:  '056b757f51f7f2c8f8dfd3438439ccb4',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42311',
internalId:  '',
customField: '20091202-102130'
};
webappMappings['7060']=webappMappings['7060-62db2e018459a25677352acf91e1feed']={
webappId:    '7060',
documentId:  '42311',
internalId:  '62db2e018459a25677352acf91e1feed',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42206',
internalId:  '',
customField: '20091202-100036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57785',
internalId:  '',
customField: '20091202-101818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60701',
internalId:  '',
customField: '20091202-120303'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INZ3FM';
var companyName   = '.%27.+Contabil+Mooca+.%27.';
var htmlTitle	  = 'Grupo+Contabil+Mooca';
var metaKeywords  = 'O+Grupo+Cont%C3%A1bil+Mo%C3%B3ca%2C+em+sua+ess%C3%AAncia+%C3%A9+um+escrit%C3%B3rio+Contabil+unificando+a+assessoria+jur%C3%ADdica+e+imobili%C3%A1ria.+Possu%C3%ADmos+no+ponto+de+apoio+Mooca+uma+loja+de+produtos+naturais+com+exclusividade+dos+Produtos+Cogumelo+do+Sol+e+tamb%C3%A9m+uma+Loja+da+Fabrica+da+Mingnello+Brinquedos.';
var metaContents  = 'A+Cont%C3%A1bil+Mo%C3%B3ca%2C+%C3%A9+um+escrit%C3%B3rio+de+Contabilidade+e+Assessoria+Empresarial.';
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();
};
