/* [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','14',jdecode('Home'),jdecode(''), jdecode('%2F14.html'), 'true',[],'',''],
	['PAGE','35',jdecode('Carimbo+Auto-entintado'),jdecode(''), jdecode('%2F35.html'), 'true',[],'',''],
	['PAGE','44',jdecode('Carimbos+Comuns'),jdecode(''), jdecode('%2F44.html'), 'true',[],'',''],
	['PAGE','53',jdecode('Caneta+Carimbo'),jdecode(''), jdecode('%2F53.html'), 'true',[],'',''],
	['PAGE','62',jdecode('Chancela'),jdecode(''), jdecode('%2F62.html'), 'true',[],'',''],
	['PAGE','1458',jdecode('Datadores%2FNumeradores'),jdecode(''), jdecode('%2F1458.html'), 'true',[],'',''],
	['PAGE','80',jdecode('Facas+de+Corte+e+Vinco'),jdecode(''), jdecode('%2F80.html'), 'true',[],'',''],
	['PAGE','89',jdecode('Clich%C3%AAs'),jdecode(''), jdecode('%2F89.html'), 'true',[],'',''],
	['PAGE','98',jdecode('Or%C3%A7amento'),jdecode(''), jdecode('%2F98.html'), 'true',[],'',''],
	['PAGE','107',jdecode('Promo%C3%A7%C3%B5es'),jdecode(''), jdecode('%2F107.html'), 'true',[],'',''],
	['PAGE','16901',jdecode('VIDEO'),jdecode(''), jdecode('%2F16901.html'), 'true',[],'',''],
	['PAGE','33801',jdecode('Onde+estamos'),jdecode(''), jdecode('%2F33801.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Champagne';
theSitetree.paletteFamily='426388';
theSitetree.keyvisualId='11063';
theSitetree.keyvisualName='kv_11063.jpg';
theSitetree.fontsetId='31943';
theSitetree.graphicsetId='13786';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='426388';
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: 			'Champagne',
				paletteFamily: 	'426388',
				keyvisualId: 	'11063',
				keyvisualName: 	'kv_11063.jpg',
				fontsetId: 		'31943',
				graphicsetId: 	'13786',
				contentColor: 	'000000',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14',
internalId:  '',
customField: '20111220-193901'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '14',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1121989']={
webappId:    '1501',
documentId:  '14',
internalId:  '1121989',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-2174']={
webappId:    '7008',
documentId:  '98',
internalId:  '2174',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33801',
internalId:  '',
customField: '20111220-135304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35',
internalId:  '',
customField: '20111220-192307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20100105-140242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44',
internalId:  '',
customField: '20111220-130545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20101120-102341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1458',
internalId:  '',
customField: '20101120-102505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80',
internalId:  '',
customField: '20111220-130752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89',
internalId:  '',
customField: '20100105-142724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98',
internalId:  '',
customField: '20061208-083053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107',
internalId:  '',
customField: '20111220-185302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20111220-140509'
};
webappMappings['7008']=webappMappings['7008-14034']={
webappId:    '7008',
documentId:  '62',
internalId:  '14034',
customField: 'language:pt;country:BR;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2322';
var companyName   = 'V+E+R+A+++C+R+U+Z+++B+R+A+S+I+L';
var htmlTitle	  = 'VERA+CRUZ+BRASIL';
var metaKeywords  = 'CHANCELA%2C+CHANCELAS%2C+CARIMBO+COLO+TRODAT%2C+CARIMBOS.+DATADOR%2C+NUMERADOR.+FACAS+DE+CORTE+E+VINCO%2C+CLICH%C3%8AS%2C+MARCA%C3%87%C3%83O+INDUSTRIAL%2C+IMPRESS%C3%83O+AUTO+RELEVO%2C+MARCA+DAGUA%2C+CARIMBO+DE+RELEVO%2C+SINETE%2C+STAMP+CARIMBO+DE+RELEVO%2C+seal%2C+pr%C3%A4gestempel%2C+timbre+sec%2C+sello+en+seco%2C+timbre%2C+sello%2C++s%C3%A3o+paulo%2C++CHANCELA%2C+CHANCELA%2C+CHANCELA%2C+CHANCELA%2C+FACAS+DE+CORTE+E+VINCO+trodat+trodat+';
var metaContents  = 'CHANCELA%2C+CHANCELAS%2C+CARIMBO+TRODAT+COLOP%2C+CARIMBOS+TRODAT+COLOP.+DATADOR%2C+NUMERADOR.+FACAS+DE+CORTE+E+VINCO%2C+CLICH%C3%8AS%2C++IMPRESS%C3%83O+AUTO+RELEVO%2C+MARCA+DAGUA%2C+CARIMBO+DE+RELEVO%2C+SINETE%2C+STAMP%2C+CARIMBO+DE+RELEVO%2C+CHANCEL+CHANCELA+CHANCELA+CHANCELA+CHANCELA+CHANCELA+CHANCELA+CHANCELA+CHANCECA+CARIMBO+CARIMBO+CARIMBO+CARIMBO+FACA+DE+CORTE+E+VINCO+FACA+DE+CORTE+E+VINCO+EMBALAGENS+EMBALAGENS';
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();
};

