/* [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','110312',jdecode('LOJACK+'),jdecode(''), jdecode('%2F110312.html'), 'false',[],'',''],
	['PAGE','501',jdecode('+MOTO+secret'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','67901',jdecode('Imprensa'),jdecode(''), jdecode('%2F67901.html'), 'false',[],'',''],
	['PAGE','68301',jdecode('blog'),jdecode(''), jdecode('%2F68301.html'), 'true',[],'',''],
	['PAGE','89401',jdecode('CONTRATA%C3%87%C3%83O'),jdecode(''), jdecode('%2F89401.html'), 'true',[],'','']];
var siteelementCount=5;
theSitetree.topTemplateName='Blast';
theSitetree.paletteFamily='87C82A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33266';
theSitetree.graphicsetId='14145';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
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: 			'Blast',
				paletteFamily: 	'87C82A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33266',
				graphicsetId: 	'14145',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'089D04',
				b_color: 		'84D66E',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '110312',
internalId:  '',
customField: '20110423-183803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20120206-091938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67901',
internalId:  '',
customField: '20100823-192730'
};
webappMappings['7050']=webappMappings['7050-3408']={
webappId:    '7050',
documentId:  '68301',
internalId:  '3408',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68301',
internalId:  '',
customField: '20100823-192809'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '110312',
internalId:  '',
customField: 'language:pt;country:BR;'
};
webappMappings['7008']=webappMappings['7008-15294']={
webappId:    '7008',
documentId:  '89401',
internalId:  '15294',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89401',
internalId:  '',
customField: '20110605-150014'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '501',
internalId:  '',
customField: 'language:pt;country:BR;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '67901',
internalId:  '',
customField: 'language:pt;country:BR;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '68301',
internalId:  '',
customField: 'language:pt;country:BR;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '89401',
internalId:  '',
customField: 'language:pt;country:BR;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INFPJR';
var companyName   = 'MOTO%2C+MOTOS%2C+RASTREADOR';
var htmlTitle	  = 'moto+%3B+MOTOS+ca%C3%A7ador+implacavel+localizador+secret';
var metaKeywords  = 'MOTO*%2CMOTOS*moto%3B+motos+LOCALIZADOR+INVISIVEL%3B+LOCA%C3%87%C3%83O+DE+MOTO%2C+MOTOS+ALUGADAS+ALUGAR+MOTO%3B+RASTREADOR%2Crastreador%2Crastreador+de+moto%2CRastreador%2CLOCALIZADOR%2CSATNET%2CITURAN%2CALARMES%2C+LOCALIZADOR+PARA+MOTO%2C+MOTO+LOCALIZADA+POR+RASTREADOR%2C+MOTO+LOCALIZADA+POR+RASTREADOR%2C+EMPRESAS+QUE+MONITORAM+MOTO.+RASTREADOR+VIA+SATELITE+PARA+MOTO%2C+RASTREADOR+PARA+MOTO+E+OUTROS+VE%C3%8DCULOS.+LOCALIZA%C3%87%C3%83O+DE+VE%C3%8DCULOS+PELA+INTERNET.+SEGURO+PARA+MOTO.+SEGURO+PORTO+SEGURO.graber+rastreamento%2Cgraber+rastreador%2Crastreador+graber+moto%2Cgraber+rastreador+de+ve%C3%ADculos%2Crastreadores+e+bloqueadores%2Crastreamento%2C+sacar%2C+sascarrastreamento+segsat+rastreamento+nskytrack+rastreamento+para+moto%2C+para+moto+PARA+MOTO%2C+MELHOR+RASTREADOR+CHIP+DE+RASTREAMENTO+LOJACK+RASTREADOR+ACESS%C3%93RIOS+PARA+MOTO%2C+VENDO+MOTO%2C+PARA+MOTO+CLUBE%2C+track-find.com';
var metaContents  = 'CA%C3%87ADOR+IMPLACAVEL+LOCALIZADOR+DE+MOTO%3B+MOTO.+MOTORCICLETA+%3BLOCALALIZADOR+INVIZIVEL+PARA+MOTOS+125+CC+ACIMA++COM+BATERIA+DE+LITIUN+DE+LONGA+DURA%C3%87%C3%83O+%2C+%C3%89+OTIMO+LOCALIZA+AT%C3%89+MOTOS+ESCONDIDAS+EM+GARAGENS+-+RASTREADORmotos%2CRASTREADOR%2CLOCALIZADOR%2C+EFICIENTE.+LOCALIZA+EM+LUGARES+COBERTOS+E+FECHADOS%2C+EM+TODO+BRASIL%2C+OU+SOMENTE+EM+S%C3%83O+PAULO+SISTEMA+RF.+A+TECNOLOGIA+DE+RADIO+FRENQUENCIA+ENVIADAS+POR+ANTENAS+%C3%89+A+SOLU%C3%87A%C3%95+MAIS+INTERESSANTE+PARA+MOTOS%2C+POIS+ALEM+DE+O+EQUIPAMENTO+CONSEGUIR+ENVIAR+E+RECEBER+SINAL+DE+LUGARES+FECHADOS+E+COBERTOS%2C+TAMBEM+N%C3%83O+DEPENDEM+DO+GPS+QUE+NORMALMENTE+TEM+QUE+SER+MAIS+ESPOSTO+NA+MOTO+PARA+RECPTAR+O+SINAL.TAMBEM+TEMOS+PORTO+SEGURO+PARA+MOTO.+CORRETOR+ON+LINE.+';
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();
};

