/* [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 theSitetree=[ 
	['PAGE','13',jdecode('Home'),jdecode(''),'/13.html','true',[],''],
	['PAGE','8672',jdecode('Empresa'),jdecode(''),'/8672/index.html','true',[ 
		['PAGE','10809',jdecode('Nossa+Hist%C3%B3ria'),jdecode(''),'/8672/10809.html','true',[],''],
		['PAGE','9115',jdecode('Logomarca'),jdecode(''),'/8672/9115.html','true',[],'']
	],''],
	['PAGE','9165',jdecode('Lojas'),jdecode(''),'/9165/index.html','true',[ 
		['PAGE','9208',jdecode('S%C3%A3o+Paulo'),jdecode(''),'/9165/9208.html','true',[],''],
		['PAGE','9217',jdecode('Rio+de+Janeiro'),jdecode(''),'/9165/9217.html','true',[],'']
	],''],
	['PAGE','10583',jdecode('Servi%C3%A7os'),jdecode(''),'/10583.html','true',[],''],
	['PAGE','29901',jdecode('Assist.+Farmac%C3%AAutica'),jdecode(''),'/29901.html','true',[],''],
	['PAGE','11777',jdecode('Nota+de+Esclarecimento'),jdecode(''),'/11777.html','true',[],''],
	['PAGE','11481',jdecode('Area+M%C3%A9dica+'),jdecode(''),'/11481.html','true',[],''],
	['PAGE','10047',jdecode('Workshops+'),jdecode(''),'/10047.html','true',[],''],
	['PAGE','40801',jdecode('DownLoads'),jdecode(''),'/40801.html','true',[],''],
	['PAGE','32201',jdecode('Envie+seu+Curriculum'),jdecode(''),'/32201.html','true',[],''],
	['PAGE','9511',jdecode('Fale+Conosco'),jdecode(''),'/9511.html','true',[],''],
	['PAGE','36901',jdecode('Links+interessantes'),jdecode(''),'/36901.html','true',[],''],
	['PAGE','41032',jdecode('Espa%C3%A7o+M%C3%A9dico'),jdecode(''),'/41032.html','true',[],''],
	['PAGE','72601',jdecode('BLOG+-+Magistral'),jdecode(''),'/72601.html','true',[],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='B0CBD6';
theSitetree.keyvisualId='1962';
theSitetree.keyvisualName='beauty.jpg';
theSitetree.fontsetId='330';
theSitetree.graphicsetId='383';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Stylus',
				paletteFamily: 	'B0CBD6',
				keyvisualId: 	'1962',
				keyvisualName: 	'beauty.jpg',
				fontsetId: 		'330',
				graphicsetId: 	'383',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'B0CBD6',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-2743']={
webappId:    '7008',
documentId:  '9511',
internalId:  '2743',
customField: 'language:pt;country:BR;'
};
webappMappings['7005']=webappMappings['7005-313']={
webappId:    '7005',
documentId:  '10583',
internalId:  '313',
customField: 'language:pt;country:BR;'
};
webappMappings['7005']=webappMappings['7005-314']={
webappId:    '7005',
documentId:  '9115',
internalId:  '314',
customField: 'language:pt;country:BR;'
};
webappMappings['1501']=webappMappings['1501-1237957']={
webappId:    '1501',
documentId:  '13',
internalId:  '1237957',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13',
internalId:  '',
customField: '20081118-092601'
};
webappMappings['7008']=webappMappings['7008-2744']={
webappId:    '7008',
documentId:  '29901',
internalId:  '2744',
customField: 'language:pt;country:BR;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '13',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN22NO';
var companyName   = 'Farm%C3%A1cia+Magistral+de+Manipula%C3%A7%C3%A3o';
var htmlTitle	  = 'Magistral+Laborat%C3%B3rio+de+Manipula%C3%A7%C3%A3o';
var metaKeywords  = 'farm%C3%A1cia+magistral++magistral++laborat%C3%B3rio++farm%C3%A1cia+de+manipula%C3%A7%C3%A3o++f%C3%B3rmulas+aviadas++receitas++or%C3%A7amento+de+f%C3%B3rmulas++laborat%C3%B3rio++magistral++qualidade+e+seguran%C3%A7a++capsulas++cremes++f%C3%B3rmulas+alop%C3%A1tica+e+fitoter%C3%A1picas++intradermoterapia++ortomolecular++medicina+est%C3%A9tica++medicamentos+injet%C3%A1veis+manipula%C3%A7%C3%A3o+de+f%C3%B3rmulas++';
var metaContents  = 'Farm%C3%A1cia+Magistral++manipula%C3%A7%C3%A3o+de+f%C3%B3rmulas+Magistral+farm%C3%A1cia+de+manipula%C3%A7%C3%A3o+magistral+laboratorio+magistral+f%C3%B3rmulas+aviadas';
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();
};
