/* [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(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','452',jdecode('Quem+somos'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','494',jdecode('Estatuto+RGS-BRA'),jdecode(''), jdecode('%2F494%2Findex.html'), 'true',[ 
		['PAGE','97701',jdecode('Estatuto+APV-RGS'),jdecode(''), jdecode('%2F494%2F97701.html'), 'true',[],'','']
	],'',''],
	['PAGE','515',jdecode('Regra+RGS'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','114001',jdecode('REGRA+2011'),jdecode(''), jdecode('%2F114001%2Findex.html'), 'false',[ 
		['PAGE','115201',jdecode('Formul%C3%A1rio+Vota%C3%A7%C3%A3o'),jdecode(''), jdecode('%2F114001%2F115201.html'), 'false',[],'','']
	],'',''],
	['PAGE','64801',jdecode('Certificado+2.011'),jdecode(''), jdecode('%2F64801.html'), 'true',[],'',''],
	['PAGE','87901',jdecode('Comiss%C3%A3o+T%C3%A9cnica'),jdecode(''), jdecode('%2F87901.html'), 'true',[],'',''],
	['PAGE','536',jdecode('Procedimento+de+medi%C3%A7%C3%A3o'),jdecode(''), jdecode('%2F536.html'), 'true',[],'',''],
	['PAGE','578',jdecode('Informa%C3%A7%C3%B5es+Importantes'),jdecode(''), jdecode('%2F578.html'), 'true',[],'',''],
	['PAGE','13401',jdecode('Certificados+RGS'),jdecode(''), jdecode('%2F13401.html'), 'true',[],'',''],
	['PAGE','40501',jdecode('Listagem+TMFAAs'),jdecode(''), jdecode('%2F40501.html'), 'true',[],'',''],
	['PAGE','683',jdecode('Medidores'),jdecode(''), jdecode('%2F683.html'), 'true',[],'',''],
	['PAGE','788',jdecode('Contato'),jdecode(''), jdecode('%2F788.html'), 'true',[],'',''],
	['PAGE','662',jdecode('Calend%C3%A1rio'),jdecode(''), jdecode('%2F662.html'), 'true',[],'',''],
	['PAGE','61601',jdecode('Avisos+de+Regata'),jdecode(''), jdecode('%2F61601.html'), 'true',[],'',''],
	['PAGE','59701',jdecode('Resultado+Regatas'),jdecode(''), jdecode('%2F59701.html'), 'true',[],'',''],
	['PAGE','767',jdecode('Links+de+interesse'),jdecode(''), jdecode('%2F767.html'), 'true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Deepcolor';
theSitetree.paletteFamily='35AD5A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10349';
theSitetree.graphicsetId='10470';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='026821';
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: 			'Deepcolor',
				paletteFamily: 	'35AD5A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10349',
				graphicsetId: 	'10470',
				contentColor: 	'000000',
				contentBGColor: '026821',
				a_color: 		'35AD5A',
				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['1501']=webappMappings['1501-2857989']={
webappId:    '1501',
documentId:  '401',
internalId:  '2857989',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61601',
internalId:  '',
customField: '20110302-184744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115201',
internalId:  '',
customField: '20101026-100033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20111007-100807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '662',
internalId:  '',
customField: '20101115-063928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59701',
internalId:  '',
customField: '20110105-212441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '683',
internalId:  '',
customField: '20110408-082909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20110222-064452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40501',
internalId:  '',
customField: '20111020-121507'
};
webappMappings['7008']=webappMappings['7008-5299']={
webappId:    '7008',
documentId:  '64801',
internalId:  '5299',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114001',
internalId:  '',
customField: '20110118-214905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090521-053833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20061205-041955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20110118-214805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20110125-113506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13401',
internalId:  '',
customField: '20100706-075201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '788',
internalId:  '',
customField: '20100613-063931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64801',
internalId:  '',
customField: '20110125-113600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '767',
internalId:  '',
customField: '20100412-080431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '97701',
internalId:  '',
customField: '20100610-062617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87901',
internalId:  '',
customField: '20110222-064539'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INE44O';
var companyName   = 'ASSOCIA%C3%87%C3%83O+PAULISTA+DOS+VELEJADORES+-+RGS';
var htmlTitle	  = 'Associa%C3%A7%C3%A3o+Paulista+dos+Velejadores+da+Classe+RGS';
var metaKeywords  = 'Classe+RGS+veleiro+regata+vela+oce%C3%A2nica+medi%C3%A7%C3%B5es+certificados+oceano';
var metaContents  = 'Associa%C3%A7%C3%A3o+Paulista+dos+Velejadores+da+Classe+RGS.+Informa%C3%A7%C3%B5es+sobre+a+Classe+RGS+-+Vela+Oce%C3%A2nica+no+Estado+de+S%C3%A3o+Paulo.';
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();
};

