/* [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('Home'),jdecode(''),'/11.html','true',[],'',''],
	['PAGE','2422',jdecode('Projetos'),jdecode(''),'/2422.html','true',[],'',''],
	['PAGE','41',jdecode('Constru%C3%A7%C3%B5es+%26+Reformas'),jdecode(''),'/41.html','true',[],'',''],
	['PAGE','32',jdecode('Outros+Servi%C3%A7os'),jdecode(''),'/32.html','true',[],'',''],
	['PAGE','50',jdecode('Servi%C3%A7os+Executados'),jdecode(''),'/50.html','true',[],'',''],
	['PAGE','59',jdecode('Participa%C3%A7%C3%A3o+em+Eventos'),jdecode(''),'/59.html','true',[],'',''],
	['PAGE','27701',jdecode('Regularidade+Fiscal'),jdecode(''),'/27701.html','true',[],'',''],
	['PAGE','31501',jdecode('Fotos'),jdecode(''),'/31501.html','true',[],'',''],
	['PAGE','24001',jdecode('Enquete'),jdecode(''),'/24001.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Champagne';
theSitetree.paletteFamily='426388';
theSitetree.keyvisualId='11361';
theSitetree.keyvisualName='kv_11361.jpg';
theSitetree.fontsetId='31946';
theSitetree.graphicsetId='13786';
theSitetree.contentColor='153963';
theSitetree.contentBGColor='426388';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Champagne',
				paletteFamily: 	'426388',
				keyvisualId: 	'11361',
				keyvisualName: 	'kv_11361.jpg',
				fontsetId: 		'31946',
				graphicsetId: 	'13786',
				contentColor: 	'153963',
				contentBGColor: '426388',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1275179']={
webappId:    '1501',
documentId:  '11',
internalId:  '1275179',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20091025-152724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20091017-184218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41',
internalId:  '',
customField: '20091017-200951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50',
internalId:  '',
customField: '20090915-212859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59',
internalId:  '',
customField: '20090915-005313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2422',
internalId:  '',
customField: '20091017-201239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27701',
internalId:  '',
customField: '20091017-143343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31501',
internalId:  '',
customField: '20090915-020506'
};
webappMappings['7005']=webappMappings['7005-520']={
webappId:    '7005',
documentId:  '24001',
internalId:  '520',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24001',
internalId:  '',
customField: '20090316-153146'
};
webappMappings['7060']=webappMappings['7060-80d6f2c13f1db673c0834bfced9499db']={
webappId:    '7060',
documentId:  '31501',
internalId:  '80d6f2c13f1db673c0834bfced9499db',
customField: 'language:pt;country:BR;'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2EEL';
var companyName   = 'TMT+-+Projetos%2C+Engenharia+e+Constru%C3%A7%C3%B5es';
var htmlTitle	  = 'TMT+Engenharia+e+Constru%C3%A7%C3%B5es';
var metaKeywords  = 'TMT%2C+alto+padr%C3%A3o%2C+litoral+norte%2C+obra%2C+projeto%2C+constru%C3%A7%C3%A3o%2C+bertioga%2C+riviera+de+sao+louren%C3%A7o%2C+decora%C3%A7%C3%A3o%2C+tmt%2C+engenharia%2C+constru%C3%A7%C3%B5es%2C+santos%2C+guaruj%C3%A1%2C+hanga+hoa%2C+sfera%2C+tom%C3%A9%2C+evandro+tom%C3%A9%2C+eduardo+tom%C3%A9%2C+pousada+serramar%2C+projetos%2C+maquete%2C+laudos%2C+estudo+de+viabilidade%2C+S%C3%A3o+Louren%C3%A7o%2C+CRF%2C+Impertec%2C+Pratika%2C+aquecedores%2C+reformas%2C+imoveis%2C+Tom%C3%A9%2C+TMT%2C+engenharia%2C+constru%C3%A7%C3%B5es%2C+im%C3%B3veis%2C+reformas%2C+casa%2C+sobrado%2C+apartamento%2C+bertioga%2C+litoral%2C+baixada+santista%2C+reforma%2C+constru%C3%A7%C3%A3o%2C+obra%2C+pintura%2C+el%C3%A9trica%2C+hidr%C3%A1ulica%2C+projeto%2C+projetos%2C+aprova%C3%A7%C3%B5es%2C+prefeitura%2C+vende%2C+aluga';
var metaContents  = 'Estamos+focados+em+obras+de+alto+padr%C3%A3o+no+Litoral+Norte+de+S%C3%A3o+Paulo+e+Costa+da+Mata+Atl%C3%A2ntica';
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();
};
