/* [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','1610',jdecode('Fraga+do+Eume+2012'),jdecode(''), jdecode('%2F1610.html'), 'true',[],'',''],
	['PAGE','1631',jdecode('Informaci%C3%B3n+personal'),jdecode(''), jdecode('%2F1631.html'), 'true',[],'',''],
	['PAGE','1652',jdecode('Fotos'),jdecode(''), jdecode('%2F1652.html'), 'true',[],'',''],
	['PAGE','1673',jdecode('Mi+blog'),jdecode(''), jdecode('%2F1673.html'), 'false',[],'',''],
	['PAGE','1684',jdecode('Libro+de+invitados'),jdecode(''), jdecode('%2F1684.html'), 'false',[],'',''],
	['PAGE','1705',jdecode('Contacto'),jdecode(''), jdecode('%2F1705.html'), 'true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Citadel';
theSitetree.paletteFamily='414E8C';
theSitetree.keyvisualId='8145';
theSitetree.keyvisualName='kv_8145.jpg';
theSitetree.fontsetId='17011';
theSitetree.graphicsetId='12397';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='414E8C';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'piensa',
  product: 'WSCSYSSSSLY0XKNE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Citadel',
				paletteFamily: 	'414E8C',
				keyvisualId: 	'8145',
				keyvisualName: 	'kv_8145.jpg',
				fontsetId: 		'17011',
				graphicsetId: 	'12397',
				contentColor: 	'FFFFFF',
				contentBGColor: '414E8C',
				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['7060']=webappMappings['7060-d30bd96b1c1cb68aa3d0ff7910e9bc24']={
webappId:    '7060',
documentId:  '1652',
internalId:  'd30bd96b1c1cb68aa3d0ff7910e9bc24',
customField: 'language:es;country:ES;'
};
webappMappings['7050']=webappMappings['7050-5750']={
webappId:    '7050',
documentId:  '1673',
internalId:  '5750',
customField: 'language:es;country:ES;'
};
webappMappings['7002']=webappMappings['7002-6209']={
webappId:    '7002',
documentId:  '1684',
internalId:  '6209',
customField: 'language:es;country:ES;'
};
webappMappings['7008']=webappMappings['7008-6551']={
webappId:    '7008',
documentId:  '1705',
internalId:  '6551',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1610',
internalId:  '',
customField: '20120124-140443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1631',
internalId:  '',
customField: '20100129-174116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1652',
internalId:  '',
customField: '20100129-172157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1673',
internalId:  '',
customField: '20100129-150041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1684',
internalId:  '',
customField: '20100129-150041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1705',
internalId:  '',
customField: '20100129-174249'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1610',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AAS340INLZ8Z';
var companyName   = '%C2%A1CAMPING+FRAGADEUME+de+vacaciones%21';
var htmlTitle	  = '%C2%A1CAMPING+FRAGADEUME+de+vacaciones%21';
var metaKeywords  = '';
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();
};

