/* [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','11',jdecode('HOME'),jdecode(''),'/11.html','true',[],''],
	['PAGE','2135',jdecode('A+EMPRESA'),jdecode(''),'/2135.html','true',[],''],
	['PAGE','7501',jdecode('LAN%C3%87AMENTOS'),jdecode(''),'/7501.html','true',[],''],
	['PAGE','2144',jdecode('NOSSOS+PRODUTOS'),jdecode(''),'/2144.html','true',[],''],
	['PAGE','25601',jdecode('***LOJA+VIRTUAL***'),jdecode(''),'/25601.html','true',[],''],
	['PAGE','2153',jdecode('MODOS+E+DICAS+DE+USO'),jdecode(''),'/2153.html','true',[],''],
	['PAGE','2162',jdecode('FALE+CONOSCO'),jdecode(''),'/2162/index.html','true',[ 
		['PAGE','2390',jdecode('FALE+CONOSCO+%28p%C3%A1gina+seguir%29'),jdecode(''),'/2162/2390.html','false',[],'']
	],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Global';
theSitetree.paletteFamily='006600';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='87';
theSitetree.graphicsetId='104';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				name: 			'Global',
				paletteFamily: 	'006600',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'87',
				graphicsetId: 	'104',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'176B03',
				b_color: 		'669900',
				c_color: 		'000000',
				d_color: 		'E0EEE3',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				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:  '25601',
internalId:  '',
customField: '20091028-133538'
};
webappMappings['1501']=webappMappings['1501-1162897']={
webappId:    '1501',
documentId:  '11',
internalId:  '1162897',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20070904-073348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2135',
internalId:  '',
customField: '20090423-132906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20070904-073204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2144',
internalId:  '',
customField: '20070904-073234'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2153',
internalId:  '',
customField: '20070127-170927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2162',
internalId:  '',
customField: '20070127-170545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2390',
internalId:  '',
customField: '20060409-173845'
};
webappMappings['7008']=webappMappings['7008-6817']={
webappId:    '7008',
documentId:  '2162',
internalId:  '6817',
customField: 'language:pt;country:BR;'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2SO9';
var companyName   = 'Dermabel+-+A+Vitamina+dos+Cabelos';
var htmlTitle	  = 'Dermabel+Cosm%C3%A9ticos';
var metaKeywords  = 'Dermabel++cosm%C3%A9ticos%2C+Loja+Virtual%2C+vitaminas+capilares%2C+queda+de+cabelo%2C+calv%C3%ADcie%2C+vitaminhas%2C+ampolas%2C+cabelo%2C+crescimento+dos+cabelos.';
var metaContents  = 'Dermabel+cosm%C3%A9ticos%2C+Loja+Virtual%2C+vitaminas+capilares%2C+queda+de+cabelo%2C+calv%C3%ADcie%2C+%2C+ampolas%2C+T%C3%B4nicos+para+cabelos%2C+crescimento+dos+cabelos.';
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();
};
