/* [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','373',jdecode('Hotel+cat'),jdecode(''),'/373.html','true',[],'',''],
	['PAGE','301',jdecode('Hotel++cast'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','352',jdecode('Tarifes+-+Tarifas'),jdecode(''),'/352.html','true',[],'',''],
	['PAGE','8764',jdecode('Spa+%C2%B7+Wellness'),jdecode(''),'/8764.html','true',[],'',''],
	['PAGE','8743',jdecode('Pizzeria+La+Timba'),jdecode(''),'/8743.html','true',[],'',''],
	['PAGE','8701',jdecode('Activitats+-+Actividades'),jdecode(''),'/8701.html','true',[],'',''],
	['PAGE','8806',jdecode('Congressos+-+Empresas'),jdecode(''),'/8806.html','true',[],'',''],
	['PAGE','8785',jdecode('Entorn+-+Entorno'),jdecode(''),'/8785.html','true',[],'',''],
	['PAGE','24901',jdecode('Promocions+-+Ofertas'),jdecode(''),'/24901.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Konzept';
theSitetree.paletteFamily='6C05A7';
theSitetree.keyvisualId='566';
theSitetree.keyvisualName='reisen.jpg';
theSitetree.fontsetId='119';
theSitetree.graphicsetId='139';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Konzept',
				paletteFamily: 	'6C05A7',
				keyvisualId: 	'566',
				keyvisualName: 	'reisen.jpg',
				fontsetId: 		'119',
				graphicsetId: 	'139',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'6C05A7',
				b_color: 		'C8D0ED',
				c_color: 		'000000',
				d_color: 		'15094B',
				e_color: 		'C5B39F',
				f_color: 		'900B4D',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '373',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20080607-161328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20090919-223827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20080607-161527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20080706-124346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8764',
internalId:  '',
customField: '20090423-175612'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8785',
internalId:  '',
customField: '20080524-102114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8806',
internalId:  '',
customField: '20080524-151623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8743',
internalId:  '',
customField: '20080816-095159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24901',
internalId:  '',
customField: '20100417-124836'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20IN34GG';
var companyName   = 'Hotel-Spa+Cap+de+Creus***+%C2%B7+El+Port+de+la+Selva';
var htmlTitle	  = 'Hotel+Cap+de+Creus***++El+Port+de+la+Selva+%C2%B7+Costa+Brava';
var metaKeywords  = 'hotel+Port+de+la+Selva%2C+El+Port+de+la+Selva%2C+Hotel+en+el+Port+de+la+Selva%2C+Hotel+en+el+Cap+de+Creus%2C+Hotel+Costa+Brava+nord%2C+Hotel+and+SPA%2C+Hotel-SPA+Cap+de+Creus%2C+Aparthotel+Cap+de+Creus%2C+Hotel+con+Jacuzzi%2C+Hotel+primera+linea+de+mar%2C+Pizzeria+la+timba.+Escapada+port+de+la+selva.+hoteles+port+de+la+selva.+escapada+cap+de+creus.+escapada+stop+stress%2C+Hebergement+Port+de+la+Selva';
var metaContents  = 'El+Hotel-Spa+Cap+de+Creus***+situado+en+El+Port+de+la+Selva+dispone+de+20+modernas+habitaciones+con+unas+magn%C3%ADficas+vistas+que+le+permiten+disfrutar+de+uno+de+los+paisajes+m%C3%A1s+bellos+de+la+Costa+Brava.+Dispone+tambi%C3%A9n+de+una+Pizzeria+con+vistas+al+mar+y+un+SPA+%C2%B7+Wellness.';
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();
};
