/* [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','11',jdecode('Home'),jdecode(''), jdecode('%2F11.html'), 'true',[],'',''],
	['PAGE','50',jdecode('Pousada'),jdecode(''), jdecode('%2F50.html'), 'true',[],'',''],
	['PAGE','41',jdecode('Casa+da+Sede'),jdecode(''), jdecode('%2F41.html'), 'true',[],'',''],
	['PAGE','13512',jdecode('Galeria+de+Fotos'),jdecode(''), jdecode('%2F13512.html'), 'true',[],'',''],
	['PAGE','68',jdecode('Como+chegar'),jdecode(''), jdecode('%2F68.html'), 'true',[],'',''],
	['PAGE','95',jdecode('Contato'),jdecode(''), jdecode('%2F95.html'), 'true',[],'',''],
	['PAGE','2400',jdecode('Festa+do+Pe%C3%A3o'),jdecode(''), jdecode('%2F2400.html'), 'false',[],'',''],
	['PAGE','53712',jdecode('Motorcycles+2010'),jdecode(''), jdecode('%2F53712.html'), 'false',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Seasons_summer';
theSitetree.paletteFamily='FFFFFF';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='21100';
theSitetree.graphicsetId='13193';
theSitetree.contentColor='2E2E2E';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pt',
  country: 'BR'
};
var prodDef={
  wl_name: 'brazilprod',
  product: 'WSCVWLSSSLYTC2IW'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Seasons_summer',
				paletteFamily: 	'FFFFFF',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'21100',
				graphicsetId: 	'13193',
				contentColor: 	'2E2E2E',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '11',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-2657']={
webappId:    '7008',
documentId:  '95',
internalId:  '2657',
customField: 'language:pt;country:BR;'
};
webappMappings['7060']=webappMappings['7060-1336f867d40e365cf5370839e5c03cfa']={
webappId:    '7060',
documentId:  '13512',
internalId:  '1336f867d40e365cf5370839e5c03cfa',
customField: 'language:pt;country:BR;'
};
webappMappings['7008']=webappMappings['7008-6768']={
webappId:    '7008',
documentId:  '53712',
internalId:  '6768',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11',
internalId:  '',
customField: '20110912-091928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2400',
internalId:  '',
customField: '20110721-081544'
};
webappMappings['7008']=webappMappings['7008-6764']={
webappId:    '7008',
documentId:  '2400',
internalId:  '6764',
customField: 'language:pt;country:BR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50',
internalId:  '',
customField: '20111020-121524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41',
internalId:  '',
customField: '20110513-132101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13512',
internalId:  '',
customField: '20100503-203216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68',
internalId:  '',
customField: '20101101-065848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53712',
internalId:  '',
customField: '20100430-152432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95',
internalId:  '',
customField: '20110909-090713'
};
webappMappings['1501']=webappMappings['1501-5505517']={
webappId:    '1501',
documentId:  '11',
internalId:  '5505517',
customField: '1501'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2BGA';
var companyName   = 'Rancho+Pau+Imp%C3%A9';
var htmlTitle	  = 'Rancho+Pau+Imp%C3%A9+-+Barretos+%2FSP';
var metaKeywords  = 'barretos%2C+festa+do+pe%C3%A3o%2C+independentes%2C+rodeio%2C+aluguel%2C+casas%2C+festas%2C+sal%C3%A3o%2C+recep%C3%A7%C3%A3o%2C+casamento%2C+agosto%2C+2007%2C+jerom%C3%A3o%2C+gerom%C3%A3o%2C+hospedagem%2C+camping%2C+turismo%2C+casa%2C+quarto%2C+apartamento%2C+flat%2C+hotel%2C+hoteis%2C+pau+em+p%C3%A9%2C+pauimpe%2C+pau+emp%C3%A9';
var metaContents  = 'Portal+do+Rancho+Pau+Imp%C3%A9%2C+tudo+sobre+o+melhor+lugar+para+fazer+sua+festa+e+tamb%C3%A9m+para+ficar+durante+a+Festa+do+Pe%C3%A3o+de+Boiadeiro+de+Barretos%21';
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();
};

