/* [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','4556',jdecode('Mono+Azul+Editora'),jdecode(''),'/4556.html','true',[],'',''],
	['PAGE','188298',jdecode('Distribuci%C3%B3n'),jdecode(''),'/188298.html','true',[],'',''],
	['PAGE','36429',jdecode('Compra+de+Libros'),jdecode(''),'/36429.html','true',[],'',''],
	['PAGE','188319',jdecode('Sala+de+Prensa'),jdecode(''),'/188319.html','true',[],'',''],
	['PAGE','200298',jdecode('Cat%C3%A1logo'),jdecode(''),'/200298/index.html','false',[ 
		['PAGE','200319',jdecode('Colecci%C3%B3n+VUELAPLUMA'),jdecode(''),'/200298/200319.html','true',[],'','']
	],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='D72B2B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10893';
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: 			'Alpha',
				paletteFamily: 	'D72B2B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10893',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D72B2B',
				e_color: 		'D72B2B',
				f_color: 		'D72B2B',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4556',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-8402']={
webappId:    '7008',
documentId:  '36429',
internalId:  '8402',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4556',
internalId:  '',
customField: '20100505-202843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '188298',
internalId:  '',
customField: '20100415-125700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36429',
internalId:  '',
customField: '20100324-122137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '200298',
internalId:  '',
customField: '20100324-114821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '200319',
internalId:  '',
customField: '20100324-114727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '188319',
internalId:  '',
customField: '20091023-113830'
};
webappMappings['1501']=webappMappings['1501-1862934']={
webappId:    '1501',
documentId:  '4556',
internalId:  '1862934',
customField: '1501'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'Aas010IN2EJP';
var companyName   = 'MONO+AZUL+Editora';
var htmlTitle	  = 'mono+azul';
var metaKeywords  = 'mono+azul+editora%2C+jesus+cotta%2C+habanecer%2C+luis+manuel+garcia%2C+melville%2C+v%EF%BF%BDrgenes+prudentes%2C+libros%2C+editorial+independiente%2C+comprar+libros%2C+hawthorne%2C+tere+medina%2C+jabier+h.+pizarroso%2C+javier+lucini%2C+isabel+oyarz%EF%BF%BDbal%2C+eliseo+altunaga%2C+fernando+birri%2C+isreal+potter%2C+americana%2C+el+sill%EF%BF%BDn+del+abuelo%2C+canto+de+gemido%2C+memoria+del+andar%EF%BF%BDn%2C+en+mi+hambre+mando+yo%2C+suplicando+ternura+a+los+gatos%2C+entrevistas+con+autores%2C+literatura+independiente%2C+literatura+latinoamericana%2C+literatura+norteamericana%2C+andaluc%EF%BF%BDa%2C+espa%EF%BF%BDa%2C+pais+vasco%2C+literatura%2C+cuentos%2C+viajes%2C+memorias%2C+guerra+civil%2C+memoria+hist%EF%BF%BDrica%2C+rep%EF%BF%BDblica%2C+exilio%2C+literatura+del+exilio%2C+victor+hugo+viscarra%2C+viscarra%2C+bolivia%2C+edmundo+desnoes%2C+memorias+del+subdesarrollo%2C+exilio%2C+sobre+mis+escombros%2C+tere+medina-navascu%EF%BF%BDs%2C+medina+navascu%EF%BF%BDs%2C+borracho+estaba+pero+me+acuerdo%2C+borracho%2C+poe+y+otros+cuervos%2C+edgar+allan+poe%2C+poetas+puritanos%2C+primeros+poetas+norteamericanos%2C+literatura+norteamericana%2Ccalidad%2C+independiente%2C+buenos+libros%2C+lecturas%2C+buena+literatura%2C+blog%2C+blog+lucini%2C+blog+cotta%2C+blog+tere%2C+blog+edmundo+desnoes%2C+recuperaci%EF%BF%BDn+de+la+memoria+hist%EF%BF%BDrica%2C+guerra+civil%2C+exiliados%2C+cuba%2C+literatura%2C+ensayo%2C+memorias%2C+izquierda%2C+independiente';
var metaContents  = 'editorial+independiente+de+miradas+distintas+en+lucha+contra+la+tristeza+del+ocio.';
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();
};
