/* [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('Principal'),jdecode(''),'/11.html','true',[],''],
	['PAGE','41401',jdecode('MADEIRAS'),jdecode(''),'/41401.html','true',[],''],
	['PAGE','32',jdecode('TELHAS+CER%C3%82MICAS'),jdecode(''),'/32/index.html','true',[ 
		['PAGE','2507',jdecode('branca+e+mesclada'),jdecode(''),'/32/2507.html','true',[],''],
		['PAGE','2525',jdecode('esmaltada'),jdecode(''),'/32/2525.html','true',[],'']
	],''],
	['PAGE','41',jdecode('TELHAS+DE+CONCRETO'),jdecode(''),'/41/index.html','true',[ 
		['PAGE','17501',jdecode('Pe%C3%A7as+Complementares'),jdecode(''),'/41/17501.html','true',[],''],
		['PAGE','17522',jdecode('Informa%C3%A7%C3%B5es+T%C3%A9cnicas'),jdecode(''),'/41/17522.html','true',[],''],
		['PAGE','17543',jdecode('Tecnologia'),jdecode(''),'/41/17543.html','true',[],''],
		['PAGE','17564',jdecode('Vantagens'),jdecode(''),'/41/17564.html','true',[],'']
	],''],
	['PAGE','50',jdecode('TELHAS+DE+VIDRO'),jdecode(''),'/50.html','true',[],''],
	['PAGE','59',jdecode('Telhas+Antigas'),jdecode(''),'/59.html','true',[],''],
	['PAGE','68',jdecode('Impermeabilizantes'),jdecode(''),'/68.html','true',[],''],
	['PAGE','77',jdecode('Subcoberturas'),jdecode(''),'/77.html','true',[],''],
	['PAGE','4833',jdecode('Fale+conosco'),jdecode(''),'/4833.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='B0CBD6';
theSitetree.keyvisualId='1996';
theSitetree.keyvisualName='zeichner.jpg';
theSitetree.fontsetId='328';
theSitetree.graphicsetId='383';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				name: 			'Stylus',
				paletteFamily: 	'B0CBD6',
				keyvisualId: 	'1996',
				keyvisualName: 	'zeichner.jpg',
				fontsetId: 		'328',
				graphicsetId: 	'383',
				contentColor: 	'A00000',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20090330-175541'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-5977']={
webappId:    '7008',
documentId:  '32',
internalId:  '5977',
customField: 'language:pt;country:BR;'
};
webappMappings['7008']=webappMappings['7008-5978']={
webappId:    '7008',
documentId:  '4833',
internalId:  '5978',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20081109-181737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2507',
internalId:  '',
customField: '20081109-181820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2525',
internalId:  '',
customField: '20081109-181857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41',
internalId:  '',
customField: '20081109-181932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17501',
internalId:  '',
customField: '20070611-134741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17522',
internalId:  '',
customField: '20070611-134858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17543',
internalId:  '',
customField: '20070611-134947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17564',
internalId:  '',
customField: '20070611-135114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50',
internalId:  '',
customField: '20081109-182005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59',
internalId:  '',
customField: '20081109-182239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68',
internalId:  '',
customField: '20081109-182312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77',
internalId:  '',
customField: '20081109-182346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4833',
internalId:  '',
customField: '20081101-173047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41401',
internalId:  '',
customField: '20090330-154217'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN22QF';
var companyName   = 'www.madtelhas.com.br';
var htmlTitle	  = 'MAD+TELHAS+CERAMICA+BARRO+VERMELHA+BRANCA+ESMALTADA+PAULISTA+PLAN+ROMANA+PORTUGUESA+FRANCESA+COLONIAL+CUMEEIRA+ITALIANA+AMERICANA';
var metaKeywords  = 'telhas%2C+telha%2C+telha+barro%2C+telhas+barro%2C+telha+ceramica%2C+telhas+ceramicas%2C+telha+concreto%2C+telhas+concreto%2C+telha+vidro%2C+telhas+vidro%2C+telha+esmaltada%2C+telhas+esmaltadas';
var metaContents  = 'telhas+ceramicas+barro+concreto+vidro+esmaltada+paulista+plan+romana+portuguesa+francesa+colonial+cumeeira+italiana+americana';
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();
};
