/* [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','9101',jdecode('Inicial'),jdecode(''),'/9101.html','true',[],'',''],
	['PAGE','9152',jdecode('Quem+somos'),jdecode(''),'/9152.html','true',[],'',''],
	['PAGE','9173',jdecode('Servi%C3%A7os'),jdecode(''),'/9173/index.html','true',[ 
		['PAGE','9194',jdecode('Engenharia+Social'),jdecode(''),'/9173/9194.html','true',[],'',''],
		['PAGE','9215',jdecode('Intelig%C3%AAncia+Competitiva'),jdecode(''),'/9173/9215.html','true',[],'',''],
		['PAGE','9236',jdecode('Pesquisa+de+Mercado'),jdecode(''),'/9173/9236.html','true',[],'',''],
		['PAGE','9257',jdecode('Pesquisa+Eleitoral'),jdecode(''),'/9173/9257.html','true',[],'',''],
		['PAGE','9278',jdecode('Pesquisa+de+Opini%C3%A3o'),jdecode(''),'/9173/9278.html','true',[],'',''],
		['PAGE','9299',jdecode('An%C3%A1lise+Institucional'),jdecode(''),'/9173/9299.html','true',[],'',''],
		['PAGE','9320',jdecode('Sociologia+Anal%C3%ADtica'),jdecode(''),'/9173/9320.html','true',[],'',''],
		['PAGE','9341',jdecode('An%C3%A1lise+do+Discurso'),jdecode(''),'/9173/9341.html','true',[],'',''],
		['PAGE','9362',jdecode('Geomarketing'),jdecode(''),'/9173/9362.html','true',[],'','']
	],'',''],
	['PAGE','9383',jdecode('Contato'),jdecode(''),'/9383.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Vienna';
theSitetree.paletteFamily='CBE1FC';
theSitetree.keyvisualId='11889';
theSitetree.keyvisualName='kv_11889.jpg';
theSitetree.fontsetId='33180';
theSitetree.graphicsetId='14091';
theSitetree.contentColor='223144';
theSitetree.contentBGColor='d6e7fe';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Vienna',
				paletteFamily: 	'CBE1FC',
				keyvisualId: 	'11889',
				keyvisualName: 	'kv_11889.jpg',
				fontsetId: 		'33180',
				graphicsetId: 	'14091',
				contentColor: 	'223144',
				contentBGColor: 'd6e7fe',
				a_color: 		'D6E7FE',
				b_color: 		'000000',
				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:  '9101',
internalId:  '',
customField: '20091010-235908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9152',
internalId:  '',
customField: '20091011-000352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9173',
internalId:  '',
customField: '20091011-002110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9194',
internalId:  '',
customField: '20091011-003027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9215',
internalId:  '',
customField: '20091011-003100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9236',
internalId:  '',
customField: '20091011-003140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9257',
internalId:  '',
customField: '20091011-003210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9278',
internalId:  '',
customField: '20091011-003301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9299',
internalId:  '',
customField: '20091011-003331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9320',
internalId:  '',
customField: '20091011-003400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9341',
internalId:  '',
customField: '20091011-003431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9362',
internalId:  '',
customField: '20091011-003458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9383',
internalId:  '',
customField: '20100413-115307'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INH308';
var companyName   = 'Instituto+de+Pesquisa+em+Ci%C3%AAncias+Sociais';
var htmlTitle	  = 'IPCS+-+Instituto+de+Pesquisa+em+Ci%C3%AAncias+Sociais';
var metaKeywords  = 'instituto+pesquisa+mercado+pol%C3%ADtica+sociologia+consultoria+estrat%C3%A9gia+informa%C3%A7%C3%A3o+decis%C3%A3o+efic%C3%A1cia+sucesso';
var metaContents  = '';
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();
};
