/* [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','401',jdecode('Blog'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','7222',jdecode('Nuestra+trayectoria'),jdecode(''),'/7222.html','true',[],'',''],
	['PAGE','14401',jdecode('nuestras+instalaciones'),jdecode(''),'/14401.html','true',[],'',''],
	['PAGE','23801',jdecode('Fotos+'),jdecode(''),'/23801.html','true',[],'',''],
	['PAGE','11006',jdecode('Libro+de+visitas'),jdecode(''),'/11006/index.html','true',[ 
		['PAGE','11001',jdecode('Leer+el+libro+de+Visitas'),jdecode(''),'/11006/11001.html','true',[],'','']
	],'',''],
	['PAGE','69301',jdecode('Contactar'),jdecode(''),'/69301.html','true',[],'',''],
	['PAGE','7348',jdecode('Aviso+legal'),jdecode(''),'/7348.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Architekt';
theSitetree.paletteFamily='90A262';
theSitetree.keyvisualId='2055';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='282';
theSitetree.graphicsetId='344';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='90A262';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Architekt',
				paletteFamily: 	'90A262',
				keyvisualId: 	'2055',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'282',
				graphicsetId: 	'344',
				contentColor: 	'000000',
				contentBGColor: '90A262',
				a_color: 		'90A262',
				b_color: 		'525D37',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100130-205403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7222',
internalId:  '',
customField: '20100130-204256'
};
webappMappings['1002']=webappMappings['1002-11006aars20inv5mt']={
webappId:    '1002',
documentId:  '11006',
internalId:  '11006aars20inv5mt',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-a897c4b1ebfe457183ea4cf2003a0677']={
webappId:    '7060',
documentId:  '23801',
internalId:  'a897c4b1ebfe457183ea4cf2003a0677',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69301',
internalId:  '',
customField: '20100130-210236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7348',
internalId:  '',
customField: '20081019-121154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20081018-153210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11006',
internalId:  '',
customField: '20081018-153210'
};
webappMappings['7060']=webappMappings['7060-62e922bf4509a8950873234af10176a9']={
webappId:    '7060',
documentId:  '14401',
internalId:  '62e922bf4509a8950873234af10176a9',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14401',
internalId:  '',
customField: '20081019-111722'
};
webappMappings['1501']=webappMappings['1501-5960412']={
webappId:    '1501',
documentId:  '401',
internalId:  '5960412',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23801',
internalId:  '',
customField: '20100130-200339'
};
webappMappings['7050']=webappMappings['7050-5773']={
webappId:    '7050',
documentId:  '401',
internalId:  '5773',
customField: 'language:es;country:ES;'
};
webappMappings['7008']=webappMappings['7008-6624']={
webappId:    '7008',
documentId:  '69301',
internalId:  '6624',
customField: 'language:es;country:ES;'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INV5MT';
var companyName   = 'Cacerias+y+Repoblaciones+%22El+Valle%22';
var htmlTitle	  = 'Venta+de+perdiz+roja%2Chuevos%2Cpollitos+y+coto+intensivo';
var metaKeywords  = 'venta+de+perdiz++roja+santiba%C3%B1ez+vidriales+granja+cinegetica+sueltas++repoblaciones+el+valle+vidriales%2C+zamora%2Ccoto+intensivo+de+caza%2C';
var metaContents  = 'Venta+de+perdiz+roja+para+sueltas+y+repoblaciones.+Cacerias+de+perdiz%2C+codorniz+y+faisan+todo+el+a%C3%B1o%2C+venta+de+pollitos+de+un+dia%2C+venta+de+huevos+para+incubar%2C+venta+de+machos+de+reclamo%2C+pajaros+para+el+reclamo%2C+calidad%2C+seriedad%2C+compromiso%2C';
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();
};

