/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','19086',jdecode('A+Empresa'),jdecode(''),'/19086.html','true',[],'',''],
	['PAGE','27423',jdecode('Clientes'),jdecode(''),'/27423.html','true',[],'',''],
	['PAGE','452',jdecode('Servi%C3%A7os+%2F+Produtos'),jdecode(''),'/452/index.html','true',[ 
		['PAGE','27223',jdecode('Impressora+Digital'),jdecode(''),'/452/27223.html','true',[],'','']
	],'',''],
	['PAGE','28223',jdecode('Contato'),jdecode(''),'/28223.html','true',[],'',''],
	['PAGE','33723',jdecode('Or%C3%A7amentos'),jdecode(''),'/33723.html','true',[],'',''],
	['PAGE','46634',jdecode('Galeria+de+Fotos'),jdecode(''),'/46634.html','true',[],'',''],
	['PAGE','54234',jdecode('Enquete'),jdecode(''),'/54234.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Multimedia';
theSitetree.paletteFamily='3D464F';
theSitetree.keyvisualId='11111';
theSitetree.keyvisualName='kv_11111.jpg';
theSitetree.fontsetId='32003';
theSitetree.graphicsetId='13835';
theSitetree.contentColor='000F1F';
theSitetree.contentBGColor='3D464F';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Multimedia',
				paletteFamily: 	'3D464F',
				keyvisualId: 	'11111',
				keyvisualName: 	'kv_11111.jpg',
				fontsetId: 		'32003',
				graphicsetId: 	'13835',
				contentColor: 	'000F1F',
				contentBGColor: '3D464F',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100726-081624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27223',
internalId:  '',
customField: '20100427-074848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27423',
internalId:  '',
customField: '20100427-055608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100726-072847'
};
webappMappings['1501']=webappMappings['1501-9201043']={
webappId:    '1501',
documentId:  '401',
internalId:  '9201043',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46634',
internalId:  '',
customField: '20100426-081009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19086',
internalId:  '',
customField: '20100726-072455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33723',
internalId:  '',
customField: '20100726-113250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28223',
internalId:  '',
customField: '20100427-075417'
};
webappMappings['7008']=webappMappings['7008-16280']={
webappId:    '7008',
documentId:  '33723',
internalId:  '16280',
customField: 'language:pt;country:BR;'
};
webappMappings['7060']=webappMappings['7060-21785f79bedd8cdd51a435b095a2dbe2']={
webappId:    '7060',
documentId:  '46634',
internalId:  '21785f79bedd8cdd51a435b095a2dbe2',
customField: 'language:pt;country:BR;'
};
webappMappings['7005']=webappMappings['7005-1476']={
webappId:    '7005',
documentId:  '54234',
internalId:  '1476',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54234',
internalId:  '',
customField: '20100427-090342'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INVSNM';
var companyName   = 'Visual+Marketing+-+Excel%C3%AAncia+em+Servi%C3%A7os+de+Impress%C3%A3o%21';
var htmlTitle	  = 'Visual+Marketing+-+Comunica%C3%A7%C3%A3o+Visual';
var metaKeywords  = 'Adesivos+%0D%0A%0D%0AAdesivos+Micro+Perfurados%0D%0A%0D%0AComunica%C3%A7%C3%A3o+Visual%0D%0A%0D%0APublicidade+e+Propaganda%0D%0A%0D%0APlacas%2C+Faixas%0D%0A%0D%0AImpress%C3%A3o+Digital%0D%0A%0D%0APlotter%0D%0A%0D%0AO+que+%C3%A9+Plotter+de+Recorte';
var metaContents  = 'Trabalhamos+com+Impress%C3%A3o+Digital%2C+decora%C3%A7%C3%A3o+de+ve%C3%ADculos%2C+frotas%2C+Decora%C3%A7%C3%A3o+de+paredes%2C+Vidros.+Fazemos+seu+or%C3%A7amento+pelo+site';
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();
};
