/* [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','1511',jdecode('INICIO'),jdecode(''), jdecode('%2F1511.html'), 'true',[],'',''],
	['PAGE','28212',jdecode('%C2%BFQUIENES+SOMOS%3F'),jdecode(''), jdecode('%2F28212.html'), 'true',[],'',''],
	['PAGE','20433',jdecode('M%C3%9ASICA+'),jdecode(''), jdecode('%2F20433.html'), 'true',[],'',''],
	['PAGE','38912',jdecode('FOTOGRAF%C3%8DAS'),jdecode(''), jdecode('%2F38912.html'), 'true',[],'',''],
	['PAGE','27933',jdecode('CONCIERTOS'),jdecode(''), jdecode('%2F27933.html'), 'true',[],'',''],
	['PAGE','1590',jdecode('LIBRO+DE+VISITAS'),jdecode(''), jdecode('%2F1590.html'), 'true',[],'',''],
	['PAGE','1611',jdecode('CONTACTO'),jdecode(''), jdecode('%2F1611.html'), 'true',[],'',''],
	['ITEM','20454',jdecode('MY+SPACE+CERANDEO'),jdecode(''), jdecode('http%3A%2F%2Fwww.myspace.com%2Fcerandeo'), 'true',[],'','_blank'],
	['PAGE','53112',jdecode('ENLACES'),jdecode(''), jdecode('%2F53112.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Quadrat';
theSitetree.paletteFamily='E1A03A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10449';
theSitetree.graphicsetId='10840';
theSitetree.contentColor='000000';
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: 			'Quadrat',
				paletteFamily: 	'E1A03A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10449',
				graphicsetId: 	'10840',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E1A03A',
				e_color: 		'807E7E',
				f_color: 		'434242',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20433',
internalId:  '',
customField: '20100323-200437'
};
webappMappings['7002']=webappMappings['7002-1081']={
webappId:    '7002',
documentId:  '1590',
internalId:  '1081',
customField: 'language:es;country:ES;'
};
webappMappings['7008']=webappMappings['7008-1095']={
webappId:    '7008',
documentId:  '1611',
internalId:  '1095',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1511',
internalId:  '',
customField: '20110627-180332'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53112',
internalId:  '',
customField: '20100420-201729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28212',
internalId:  '',
customField: '20100723-114819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1590',
internalId:  '',
customField: '20081113-200526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1611',
internalId:  '',
customField: '20081113-201723'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1511',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-6316353']={
webappId:    '1501',
documentId:  '1511',
internalId:  '6316353',
customField: '1501'
};
webappMappings['7060']=webappMappings['7060-ba12f9b17749664c50cacb91cf23f721']={
webappId:    '7060',
documentId:  '20433',
internalId:  'ba12f9b17749664c50cacb91cf23f721',
customField: 'language:es;country:ES;'
};
webappMappings['7060']=webappMappings['7060-4330f4f51bf2bae212874ae5c3f99f81']={
webappId:    '7060',
documentId:  '38912',
internalId:  '4330f4f51bf2bae212874ae5c3f99f81',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38912',
internalId:  '',
customField: '20100322-213619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27933',
internalId:  '',
customField: '20100310-141244'
};
webappMappings['7050']=webappMappings['7050-1008']={
webappId:    '7050',
documentId:  '27933',
internalId:  '1008',
customField: 'language:es;country:ES;'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INVDYN';
var companyName   = 'CERANDEO+evoluci%C3%B3n';
var htmlTitle	  = 'CERANDEO+FOLK+-+M%C3%9ASICA+DE+EVOLUCI%C3%93N';
var metaKeywords  = 'FOLK+EXTREME%C3%91OS+C%C3%81CERES+M%C3%9ASICA+EXTREMADURA+ACTUACIONES+CONCIERTOS+DISCO+CD+GRUPO+PROMUSICA+REDOBLE+ACETRE+NI%C3%91OS+DE+LOS+OJOS+ROJOS+NOR+AMEX+ACADEMIA+MC+OPOSICIONES+MUNDO+FOLCLORE+FOLKLORE+TAMBORIL+FLAUTA+AYUNTAMIENTO+DE+CACERES+JUNTA+DE+EXTREMADURA+CONSEJERIA+DE+CULTURA+DIPUTACION+CERANDEO';
var metaContents  = 'GRUPO+EXTREME%C3%91O+DE+M%C3%9ASICA+FOLK+DE+EVOLUCI%C3%93N%2C+TEMAS+PROPIOS+Y+TRADICIONALES+CON+CRITERIOS+DE+EXPRESI%C3%93N+CONTEMPOR%C3%81NEOS.+FLAUTA+Y+TAMBORIL';
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();
};

