/* [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('++++++++++MIS+LIBROS'),jdecode(''),'/1511.html','true',[],'',''],
	['PAGE','1532',jdecode('Toda+la+informaci%C3%B3n'),jdecode(''),'/1532.html','true',[],'',''],
	['PAGE','1606',jdecode('Me+puedes+escribir+a...'),jdecode(''),'/1606.html','true',[],'',''],
	['PAGE','17043',jdecode('Enlaces+interesantes'),jdecode(''),'/17043.html','true',[],'',''],
	['PAGE','21606',jdecode('Libro+de+visitas'),jdecode(''),'/21606/index.html','true',[ 
		['PAGE','21601',jdecode('Leer+el+libro+de+Visitas'),jdecode(''),'/21606/21601.html','false',[],'','']
	],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Stripes';
theSitetree.paletteFamily='003333';
theSitetree.keyvisualId='1642';
theSitetree.keyvisualName='kanu_see.jpg';
theSitetree.fontsetId='244';
theSitetree.graphicsetId='310';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FCFCFB';
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: 			'Stripes',
				paletteFamily: 	'003333',
				keyvisualId: 	'1642',
				keyvisualName: 	'kanu_see.jpg',
				fontsetId: 		'244',
				graphicsetId: 	'310',
				contentColor: 	'A00000',
				contentBGColor: 'FCFCFB',
				a_color: 		'003333',
				b_color: 		'DEDECA',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17043',
internalId:  '',
customField: '20101110-124205'
};
webappMappings['1002']=webappMappings['1002-21606aars20invlzy']={
webappId:    '1002',
documentId:  '21606',
internalId:  '21606aars20invlzy',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-3508']={
webappId:    '7008',
documentId:  '1606',
internalId:  '3508',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1511',
internalId:  '',
customField: '20100614-125147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1532',
internalId:  '',
customField: '20100220-113930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1606',
internalId:  '',
customField: '20091118-082255'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1511',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '1511',
internalId:  '1501',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21606',
internalId:  '',
customField: '20091014-112128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21601',
internalId:  '',
customField: '20091014-112128'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INVLZY';
var companyName   = 'La+Guerra+del+%22golfo%22+esta+en+linea%21%21%21';
var htmlTitle	  = 'La+Guerra+del+golfo';
var metaKeywords  = 'guerra%2C+golfo%2C+actualidad%2C+pol%C3%ADtica%2C+famosos%2C+far%C3%A1ndula%2C+intr%C3%A9pido%2C+osado%2C+divertido%2C+espa%C3%B1a%2C+mallorca%2C+canarias%2C+mujeres%2C+droga%2C+submundos%2C+noticias%2C+castrodorrey';
var metaContents  = 'Esta+es+una+historia+basada+en+hechos+reales.+Es+la+vida+de+un+personaje%2C+adaptada+a+un+protagonista+ficticio.';
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();
};

