/* [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','13',jdecode('Home'),jdecode(''), jdecode('%2F13.html'), 'true',[],'',''],
	['PAGE','34',jdecode('Mestres'),jdecode(''), jdecode('%2F34%2Findex.html'), 'true',[ 
		['PAGE','65701',jdecode('Dudjom+Rinpoche'),jdecode(''), jdecode('%2F34%2F65701.html'), 'true',[],'',''],
		['PAGE','3004',jdecode('Chagdud+Rinpoche'),jdecode(''), jdecode('%2F34%2F3004.html'), 'true',[],'',''],
		['PAGE','3533',jdecode('Jigme+Rinpoche'),jdecode(''), jdecode('%2F34%2F3533.html'), 'true',[],'',''],
		['PAGE','3013',jdecode('Chagdud+Khadro'),jdecode(''), jdecode('%2F34%2F3013.html'), 'true',[],'',''],
		['PAGE','3022',jdecode('Lama+Sherab'),jdecode(''), jdecode('%2F34%2F3022.html'), 'true',[],'','']
	],'',''],
	['PAGE','43',jdecode('Ensinamentos'),jdecode(''), jdecode('%2F43%2Findex.html'), 'true',[ 
		['PAGE','3067',jdecode('Eventos'),jdecode(''), jdecode('%2F43%2F3067.html'), 'true',[],'',''],
		['PAGE','3590',jdecode('Links'),jdecode(''), jdecode('%2F43%2F3590.html'), 'true',[],'',''],
		['PAGE','57001',jdecode('Ora%C3%A7%C3%A3o+do+Despertar'),jdecode(''), jdecode('%2F43%2F57001.html'), 'true',[],'',''],
		['PAGE','3076',jdecode('Quatro+Pensamentos'),jdecode(''), jdecode('%2F43%2F3076.html'), 'true',[],'',''],
		['PAGE','3932',jdecode('Chagdud+Rinpoche'),jdecode(''), jdecode('%2F43%2F3932.html'), 'true',[],'','']
	],'',''],
	['PAGE','52',jdecode('Padma+Ling'),jdecode(''), jdecode('%2F52%2Findex.html'), 'true',[ 
		['PAGE','3436',jdecode('Pr%C3%A1ticas'),jdecode(''), jdecode('%2F52%2F3436.html'), 'true',[],'',''],
		['PAGE','3085',jdecode('Programa%C3%A7%C3%A3o+do+m%C3%AAs'),jdecode(''), jdecode('%2F52%2F3085.html'), 'true',[],'',''],
		['PAGE','3094',jdecode('Torne-se+membro'),jdecode(''), jdecode('%2F52%2F3094.html'), 'true',[],'',''],
		['PAGE','3690',jdecode('Mapa'),jdecode(''), jdecode('%2F52%2F3690.html'), 'true',[],'','']
	],'',''],
	['PAGE','128201',jdecode('Entre+em+contato'),jdecode(''), jdecode('%2F128201.html'), 'true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Stripes';
theSitetree.paletteFamily='003399';
theSitetree.keyvisualId='1588';
theSitetree.keyvisualName='seerose.jpg';
theSitetree.fontsetId='245';
theSitetree.graphicsetId='304';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FCFCFB';
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: 			'Stripes',
				paletteFamily: 	'003399',
				keyvisualId: 	'1588',
				keyvisualName: 	'seerose.jpg',
				fontsetId: 		'245',
				graphicsetId: 	'304',
				contentColor: 	'A00000',
				contentBGColor: 'FCFCFB',
				a_color: 		'003399',
				b_color: 		'DEDECA',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '13',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34',
internalId:  '',
customField: '20061220-183209'
};
webappMappings['7008']=webappMappings['7008-3828']={
webappId:    '7008',
documentId:  '3094',
internalId:  '3828',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13',
internalId:  '',
customField: '20111225-201116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65701',
internalId:  '',
customField: '20070317-134439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3004',
internalId:  '',
customField: '20060705-172549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3533',
internalId:  '',
customField: '20070317-134657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3013',
internalId:  '',
customField: '20060705-215751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3022',
internalId:  '',
customField: '20090415-075015'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43',
internalId:  '',
customField: '20080503-130541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3067',
internalId:  '',
customField: '20061220-185632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3590',
internalId:  '',
customField: '20061220-185738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57001',
internalId:  '',
customField: '20070101-075435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3076',
internalId:  '',
customField: '20060705-180311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3932',
internalId:  '',
customField: '20060917-091322'
};
webappMappings['7008']=webappMappings['7008-6003']={
webappId:    '7008',
documentId:  '128201',
internalId:  '6003',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52',
internalId:  '',
customField: '20090711-172626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3436',
internalId:  '',
customField: '20070221-080446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3085',
internalId:  '',
customField: '20111225-201006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3094',
internalId:  '',
customField: '20100403-085726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3690',
internalId:  '',
customField: '20090921-064808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128201',
internalId:  '',
customField: '20090401-071222'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2I2W';
var companyName   = '+++Chagdud+Gonpa+Padma+Ling';
var htmlTitle	  = 'Budismo+Tibetano+Vajrayana+Linhagem+Nyingma';
var metaKeywords  = 'Budismo+Dharma+Darma+Vajrayana+Padma';
var metaContents  = 'Budismo+Vajrayana+Vajraiana+Tibet+Tibetano+Padma';
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();
};

