/* [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','2101',jdecode('Quem+Somos'),jdecode(''), jdecode('%2F2101.html'), 'true',[],'',''],
	['PAGE','5122',jdecode('Servi%C3%A7os'),jdecode(''), jdecode('%2F5122.html'), 'true',[],'',''],
	['PAGE','6622',jdecode('Convite+Personalizado'),jdecode(''), jdecode('%2F6622.html'), 'true',[],'',''],
	['PAGE','15501',jdecode('Adesivos+'),jdecode(''), jdecode('%2F15501.html'), 'true',[],'',''],
	['PAGE','16801',jdecode('Banner'),jdecode(''), jdecode('%2F16801.html'), 'true',[],'',''],
	['PAGE','6601',jdecode('Brindes'),jdecode(''), jdecode('%2F6601.html'), 'true',[],'',''],
	['PAGE','5143',jdecode('Notas+Fiscais'),jdecode(''), jdecode('%2F5143.html'), 'true',[],'',''],
	['PAGE','8301',jdecode('Imprensa'),jdecode(''), jdecode('%2F8301.html'), 'true',[],'',''],
	['PAGE','30001',jdecode('Crach%C3%A1s+PVC'),jdecode(''), jdecode('%2F30001.html'), 'true',[],'',''],
	['PAGE','31201',jdecode('Calend%C3%A1rio+2012+%2F+2013'),jdecode(''), jdecode('%2F31201.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='FBB044';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32054';
theSitetree.graphicsetId='13869';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
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: 			'Grace',
				paletteFamily: 	'FBB044',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32054',
				graphicsetId: 	'13869',
				contentColor: 	'484848',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20120128-073853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16801',
internalId:  '',
customField: '20101002-092502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20101002-091012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5143',
internalId:  '',
customField: '20110416-094507'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20100926-120734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15501',
internalId:  '',
customField: '20111011-154456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31201',
internalId:  '',
customField: '20111223-095752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20111101-160825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6622',
internalId:  '',
customField: '20101014-144546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30001',
internalId:  '',
customField: '20110719-155517'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30I7CC9S';
var companyName   = '++++RosaNorte+Gr%C3%A1fica+Editora';
var htmlTitle	  = 'ROSANORTE+GR%C3%81FICA+EDITORA';
var metaKeywords  = 'JORNAIS%2CJORNAL%2C+FORMUL%C3%81RIOS%2C+FORMUL%C3%81RIO%2CNOTA+FISCAL%2CNOTAS+FISCAIS%2CCART%C3%83O%2CCART%C3%95ES%2C+PANFLETO%2CPANFLETOS%2CTAG%2CTAGS%2C+TAL%C3%83O%2CTAL%C3%95ES%2CIMPRESS%C3%83O%2CGR%C3%81FICA%2C+EDITORA%2CFORMUL%C3%81RIO+CONT%C3%8DNUO%2C+FORMUL%C3%81RIOS+CONT%C3%8DNUOS%2CRECEITU%C3%81RIO%2C+RECEITU%C3%81RIOS%2CTIMBRADOS%2CPAPEL+TIMBRADO%2CCONVITE%2C+CONVITES%2CCONVITE+PERSONALIZADO%2CCONVITES+PERSONALIZADOS%2CBRINDE%2CBRINDES%2C+ENVELOPES%2C+ENVELOPE%2CPASTA%2CPASTAS%2CCRIA%C3%87%C3%83O+DE+TEXTO%2C+ARTE-FINALIZA%C3%87%C3%83O%2CDESIGN%2CMARKETING%2C+ENDOMARKETING%2C+RECEITU%C3%81RIO+CONTROLADO%2CRECEITU%C3%81RIOS+CONTROLADOS%2CAUTOCOPIATIVOS%2CAUTOCOPIATIVO%2C+CARBONOS%2C+CARBONO%2CROTULO%2CROTULOS%2CCHAVEIRO%2CCHAVEIROS%2CCANECAS%2CCANECA%2CPRESENTE%2CPRESENTES%2CBLOCOS%2CBLOCO%2CCANETA%2CCANETAS%2C+BLOCO%2C+BLOCOS%2C+BLOCO+BRINDE%2C+BLOCO+ANOTA%C3%87%C3%95ES%2C+BRINDES%2C+ESPIRAL+BLOCO%2C+COLA+BLOCO+%2CBANNER%2CBANNERS%2CBANNER+EM+LONA%2CBANNER+COM+TUBO%2CBANNER+PARA+ANIVERS%C3%81RIO%2CBANNER+PARA+FESTA%2CBANNER+PARA+CRIAN%C3%87A%2CBANNER+PARA+APRESENTA%C3%87%C3%83O%2C+BANNER+PARA+EMPRESA.+++';
var metaContents  = 'GR%C3%81FICA+E+EDITORA+%3CGRAFICA%3E+%3CBRINDES%3E+%3CIMPRESSOS%3E+%3CCONVITE%3E%3CCART%C3%95ES+VISITA%3E%3CFOLHETOS%3EBLOCOS%2C+FOLHETOS%2CJORNAIS+%0D%0ACRIA%C3%87%C3%83O+E+IMPRESS%C3%83O+DE+JORNAIS%2C+REVISTAS%2C+FOLHETOS%2C+CART%C3%95ES%2C+FORMUL%C3%81RIOS%2C+PANFLETOS.+DESENVOLVIMENTO+DE+TEXTOS+E+DESIGN.';
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();
};

