/* [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','1411',jdecode('Visitas+guiadas'),jdecode(''), jdecode('%2F1411.html'), 'true',[],'',''],
	['PAGE','4001',jdecode('D%C3%B3nde+alojarse'),jdecode(''), jdecode('%2F4001.html'), 'true',[],'',''],
	['PAGE','7201',jdecode('Enamorados+de+Asturias'),jdecode(''), jdecode('%2F7201.html'), 'true',[],'',''],
	['PAGE','15301',jdecode('Fotos'),jdecode(''), jdecode('%2F15301.html'), 'true',[],'',''],
	['PAGE','48601',jdecode('Blog'),jdecode(''), jdecode('%2F48601.html'), 'true',[],'',''],
	['PAGE','18401',jdecode('Opiniones'),jdecode(''), jdecode('%2F18401.html'), 'true',[],'',''],
	['PAGE','1506',jdecode('Contacto'),jdecode(''), jdecode('%2F1506.html'), 'true',[],'',''],
	['PAGE','52501',jdecode('Aviso+legal'),jdecode(''), jdecode('%2F52501.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Corpus';
theSitetree.paletteFamily='A19A7E';
theSitetree.keyvisualId='8965';
theSitetree.keyvisualName='kv_8965.jpg';
theSitetree.fontsetId='17256';
theSitetree.graphicsetId='12681';
theSitetree.contentColor='7F723C';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'piensa',
  product: 'WSCSYSSSSLYTC2IR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Corpus',
				paletteFamily: 	'A19A7E',
				keyvisualId: 	'8965',
				keyvisualName: 	'kv_8965.jpg',
				fontsetId: 		'17256',
				graphicsetId: 	'12681',
				contentColor: 	'7F723C',
				contentBGColor: 'FFFFFF',
				a_color: 		'bdaf77',
				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:  '15301',
internalId:  '',
customField: '20100819-172723'
};
webappMappings['7002']=webappMappings['7002-4556']={
webappId:    '7002',
documentId:  '18401',
internalId:  '4556',
customField: 'language:es;country:ES;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1411',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-3369']={
webappId:    '7008',
documentId:  '1506',
internalId:  '3369',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1411',
internalId:  '',
customField: '20110902-082950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20110526-170116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20090801-144005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20110523-161625'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1506',
internalId:  '',
customField: '20100801-162559'
};
webappMappings['1501']=webappMappings['1501-9477438']={
webappId:    '1501',
documentId:  '1411',
internalId:  '9477438',
customField: '1501'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '52501',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1506',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '18401',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48601',
internalId:  '',
customField: '20100318-202734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52501',
internalId:  '',
customField: '20100516-123335'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1411',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4001',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7201',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15301',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '48601',
internalId:  '',
customField: 'language:es;country:ES;'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INVVCB';
var companyName   = 'GU%C3%ADAS+tour+ASTURIAS...sus+gu%C3%ADas+en+Cudillero';
var htmlTitle	  = 'guias+turisticos+asturias';
var metaKeywords  = 'Visitas+guiadas+Cudillero%2C+guias+turisticos+Asturias%2C+visita+guiada+Asturias%2C+guias+turisticos+Cudillero';
var metaContents  = 'Visitas+guiadas+en+Cudillero%2C+gu%C3%ADas+tur%C3%ADsticos+en+Cudillero+y+Comarca+Vaqueira+-Asturias-+para+grupos+e+individuales.';
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();
};

