/* [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','4901',jdecode('QUEM+SOMOS'),jdecode(''),'/4901/index.html','true',[ 
		['PAGE','65201',jdecode('Nossa+equipa'),jdecode(''),'/4901/65201.html','true',[],'',''],
		['PAGE','65901',jdecode('Nosso+Espa%C3%A7o+F%C3%ADsico'),jdecode(''),'/4901/65901.html','true',[],'',''],
		['PAGE','135501',jdecode('Identifica%C3%A7%C3%A3o+Digital'),jdecode(''),'/4901/135501.html','true',[],'','']
	],'',''],
	['PAGE','66701',jdecode('IMPLANTOLOGIA'),jdecode(''),'/66701/index.html','true',[ 
		['PAGE','66722',jdecode('Implantology'),jdecode(''),'/66701/66722.html','true',[],'',''],
		['PAGE','66743',jdecode('Casos+Cl%C3%ADnicos'),jdecode(''),'/66701/66743.html','true',[],'',''],
		['PAGE','66764',jdecode('Perguntas+Frequentes'),jdecode(''),'/66701/66764.html','true',[],'','']
	],'',''],
	['PAGE','66301',jdecode('ESPECIALIDADES'),jdecode(''),'/66301/index.html','true',[ 
		['PAGE','66343',jdecode('Cirurgia+Oral'),jdecode(''),'/66301/66343.html','true',[],'',''],
		['PAGE','78201',jdecode('Periodontologia'),jdecode(''),'/66301/78201.html','true',[],'',''],
		['PAGE','66364',jdecode('Cariologia+e+Dentisteria'),jdecode(''),'/66301/66364.html','true',[],'',''],
		['PAGE','66322',jdecode('Ortod%C3%B4ncia'),jdecode(''),'/66301/66322.html','true',[],'',''],
		['PAGE','66385',jdecode('Reabilita%C3%A7%C3%A3o+Oral'),jdecode(''),'/66301/66385.html','true',[],'',''],
		['PAGE','78222',jdecode('Preven%C3%A7%C3%A3o'),jdecode(''),'/66301/78222.html','true',[],'','']
	],'',''],
	['PAGE','108501',jdecode('Forma%C3%A7%C3%A3o%2F+PRO-CAP'),jdecode(''),'/108501.html','true',[],'',''],
	['PAGE','135801',jdecode('3%C2%BA+PROCAP'),jdecode(''),'/135801.html','true',[],'',''],
	['PAGE','121601',jdecode('ACORDOS'),jdecode(''),'/121601.html','true',[],'',''],
	['PAGE','10301',jdecode('Contacto'),jdecode(''),'/10301/index.html','true',[ 
		['PAGE','25801',jdecode('Contacto%28p%C3%A1gina+seguir%29'),jdecode(''),'/10301/25801.html','false',[],'','']
	],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='01343D';
theSitetree.keyvisualId='2182';
theSitetree.keyvisualName='zahnmedizin.jpg';
theSitetree.fontsetId='356';
theSitetree.graphicsetId='409';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='01343D';
var localeDef={
  language: 'pt',
  country: 'PT'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'01343D',
				keyvisualId: 	'2182',
				keyvisualName: 	'zahnmedizin.jpg',
				fontsetId: 		'356',
				graphicsetId: 	'409',
				contentColor: 	'FFFFFF',
				contentBGColor: '01343D',
				a_color: 		'01343D',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20100506-181216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20080824-104621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135501',
internalId:  '',
customField: '20100505-175711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25801',
internalId:  '',
customField: '20080418-142834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65201',
internalId:  '',
customField: '20100506-180220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65901',
internalId:  '',
customField: '20090601-154858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66301',
internalId:  '',
customField: '20091102-112002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66701',
internalId:  '',
customField: '20100113-171437'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66722',
internalId:  '',
customField: '20100113-132236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66743',
internalId:  '',
customField: '20100114-114740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66764',
internalId:  '',
customField: '20090329-201159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66322',
internalId:  '',
customField: '20090514-142206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66343',
internalId:  '',
customField: '20090514-194610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66364',
internalId:  '',
customField: '20090903-180305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66385',
internalId:  '',
customField: '20091102-114907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78201',
internalId:  '',
customField: '20090514-165005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135801',
internalId:  '',
customField: '20100506-184507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78222',
internalId:  '',
customField: '20090329-183751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108501',
internalId:  '',
customField: '20100505-181727'
};
webappMappings['7008']=webappMappings['7008-7240']={
webappId:    '7008',
documentId:  '10301',
internalId:  '7240',
customField: 'language:pt;country:PT;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '121601',
internalId:  '',
customField: '20100415-001925'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20IN36G1';
var companyName   = 'Flex+Medicina+Dent%C3%A1ria';
var htmlTitle	  = 'Flex+Medicina+Dent%C3%A1ria';
var metaKeywords  = 'Implants+Dent%C3%A1ria+Flex+Medicina+Cl%C3%ADnic+Dentista';
var metaContents  = 'Dent%C3%A1ria+Cl%C3%ADnica+Lisboa+Implante';
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();
};
