/* [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','147',jdecode('HOME'),jdecode(''),'/147.html','true',[],''],
	['PAGE','1978',jdecode('ROOMS+AND+PRICES'),jdecode(''),'/1978.html','true',[],''],
	['PAGE','21201',jdecode('OFFERS+%26+GROUPS'),jdecode(''),'/21201.html','true',[],''],
	['PAGE','1679',jdecode('EVENTS'),jdecode(''),'/1679.html','true',[],''],
	['PAGE','32101',jdecode('BIRDWATCHING'),jdecode(''),'/32101.html','true',[],''],
	['PAGE','38401',jdecode('CONTACT'),jdecode(''),'/38401.html','true',[],''],
	['PAGE','38715',jdecode('GUESTBOOK'),jdecode(''),'/38715/index.html','true',[ 
		['PAGE','38710',jdecode('Read+our+Guestbook'),jdecode(''),'/38715/38710.html','false',[],'']
	],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Crisscross';
theSitetree.paletteFamily='95B86B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11082';
theSitetree.graphicsetId='11810';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='95B86B';
var theTemplate={
				name: 			'Crisscross',
				paletteFamily: 	'95B86B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11082',
				graphicsetId: 	'11810',
				contentColor: 	'000000',
				contentBGColor: '95B86B',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'95B86B',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '147',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1978',
internalId:  '',
customField: '20080902-112153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '147',
internalId:  '',
customField: '20090601-103543'
};
webappMappings['1002']=webappMappings['1002-38715ahw050inxxkx']={
webappId:    '1002',
documentId:  '38715',
internalId:  '38715ahw050inxxkx',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-246']={
webappId:    '7008',
documentId:  '38401',
internalId:  '246',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21201',
internalId:  '',
customField: '20090601-103342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1679',
internalId:  '',
customField: '20090102-072143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20080926-100400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38401',
internalId:  '',
customField: '20090406-142845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38715',
internalId:  '',
customField: '20081108-093240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38710',
internalId:  '',
customField: '20080825-083611'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXXKX';
var companyName   = 'The+Tivoli+Guest+House';
var htmlTitle	  = '';
var metaKeywords  = 'HOLIDAY++CHEAP+++BUDGET+++ECONOMY+++ACCOMMODATION++ROOMS++BEDROOMS++CENTRAL+FARO++ALGARVE++CLEAN++SPECIAL+OFFERS++DISCOUNTS++Baratos+++OR%C3%87AMENTO+++ECONOMIA+++ALOJAMENTO++QUARTOS+++FARO+CENTRAL++ALGARVE++LIMPO++PROMO%C3%87%C3%95ES+++DESCONTOS++++';
var metaContents  = 'The+Tivoli+Guest+House+in+Faro%2C+Algarve%2C+Portugal+is+superbly+situated+opposite+a+pretty+Pra%C3%A7a%2C+we+are+only+a+10+minute+walk+from+the+Train+Station+and+a+7+minute+walk+from+the+Bus+Station.++We+are+the+closest+Guest+House+to+the+free+car+park+in+Faro.++Surrounded+by+cobbled+streets%2C+beautiful+architecture+and+only+5+minutes+walk+from+the+Old+City+surrounded+by+a+13th+Century+wall+and+the+Marina%2C+and+the+pedestrianised+shopping+area.+';
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();
};
