/* [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(''), jdecode('%2F11.html'), 'true',[],'',''],
	['PAGE','1018',jdecode('Anima%C3%A7%C3%A3o+Festa'),jdecode(''), jdecode('%2F1018%2Findex.html'), 'true',[ 
		['PAGE','12401',jdecode('Personagens'),jdecode(''), jdecode('%2F1018%2F12401.html'), 'true',[],'',''],
		['PAGE','12422',jdecode('Gincanas'),jdecode(''), jdecode('%2F1018%2F12422.html'), 'true',[],'',''],
		['PAGE','61201',jdecode('Espacinho+da+Beleza'),jdecode(''), jdecode('%2F1018%2F61201.html'), 'true',[],'',''],
		['PAGE','76901',jdecode('Oficinas+criativas'),jdecode(''), jdecode('%2F1018%2F76901.html'), 'true',[],'','']
	],'',''],
	['PAGE','126012',jdecode('Brinquedos'),jdecode(''), jdecode('%2F126012.html'), 'true',[],'',''],
	['PAGE','1054',jdecode('Decora%C3%A7%C3%A3o+Festa'),jdecode(''), jdecode('%2F1054%2Findex.html'), 'true',[ 
		['PAGE','12443',jdecode('Mesas'),jdecode(''), jdecode('%2F1054%2F12443.html'), 'true',[],'',''],
		['PAGE','12464',jdecode('Bal%C3%B5es'),jdecode(''), jdecode('%2F1054%2F12464.html'), 'true',[],'','']
	],'',''],
	['PAGE','1090',jdecode('Eventos+e+Escolas'),jdecode(''), jdecode('%2F1090.html'), 'true',[],'',''],
	['PAGE','30901',jdecode('Monitores'),jdecode(''), jdecode('%2F30901.html'), 'true',[],'',''],
	['PAGE','1126',jdecode('Contato'),jdecode(''), jdecode('%2F1126.html'), 'true',[],'',''],
	['PAGE','64606',jdecode('Livro+de+visitas%2FF%C3%B3rum'),jdecode(''), jdecode('%2F64606%2Findex.html'), 'true',[ 
		['PAGE','64601',jdecode('Servi%C3%A7o+de+bilhetes'),jdecode(''), jdecode('%2F64606%2F64601.html'), 'true',[],'','']
	],'',''],
	['PAGE','118701',jdecode('Promo%C3%A7%C3%B5es+e+Lan%C3%A7amentos'),jdecode(''), jdecode('%2F118701.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Celebration';
theSitetree.paletteFamily='51C862';
theSitetree.keyvisualId='3787';
theSitetree.keyvisualName='kv_3787.jpg';
theSitetree.fontsetId='10478';
theSitetree.graphicsetId='10981';
theSitetree.contentColor='000000';
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: 			'Celebration',
				paletteFamily: 	'51C862',
				keyvisualId: 	'3787',
				keyvisualName: 	'kv_3787.jpg',
				fontsetId: 		'10478',
				graphicsetId: 	'10981',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'47B757',
				e_color: 		'FB454D',
				f_color: 		'4545FB',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20110910-114028'
};
webappMappings['1501']=webappMappings['1501-1257525']={
webappId:    '1501',
documentId:  '11',
internalId:  '1257525',
customField: '1501'
};
webappMappings['7060']=webappMappings['7060-1168933fbd839a2607ef9a9bb3e63027']={
webappId:    '7060',
documentId:  '30901',
internalId:  '1168933fbd839a2607ef9a9bb3e63027',
customField: 'language:pt;country:BR;'
};
webappMappings['1002']=webappMappings['1002-64606avec10in2ej8']={
webappId:    '1002',
documentId:  '64606',
internalId:  '64606avec10in2ej8',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1018',
internalId:  '',
customField: '20110910-114122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20110910-114237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12422',
internalId:  '',
customField: '20091012-162238'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61201',
internalId:  '',
customField: '20090327-001421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '76901',
internalId:  '',
customField: '20110910-114411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1054',
internalId:  '',
customField: '20110910-114521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12443',
internalId:  '',
customField: '20110112-135253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12464',
internalId:  '',
customField: '20110910-114819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126012',
internalId:  '',
customField: '20111104-085950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1090',
internalId:  '',
customField: '20080529-214320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30901',
internalId:  '',
customField: '20110112-131938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1126',
internalId:  '',
customField: '20110910-115042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64606',
internalId:  '',
customField: '20070531-220557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64601',
internalId:  '',
customField: '20070531-220557'
};
webappMappings['7060']=webappMappings['7060-f92a2174c30209c83af7c0efd3e608cb']={
webappId:    '7060',
documentId:  '12443',
internalId:  'f92a2174c30209c83af7c0efd3e608cb',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '118701',
internalId:  '',
customField: '20111104-090248'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2EJ8';
var companyName   = 'PIPA+Festas+e+Eventos';
var htmlTitle	  = 'PIPA+FESTAS+E+EVENTOS+++5061.7021+%2F+9637.9730';
var metaKeywords  = 'Festas%2C+Anima%C3%A7%C3%A3o%2C+Decora%C3%A7%C3%A3o%2C+Personagens%2C+Teatro%2C+Infantil%2C+Bal%C3%B5es%2C+Lembrancinhas%2C+Oficinas%2C+Pintura%2C+Maquiagem';
var metaContents  = '';
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();
};

