/* [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('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','5101',jdecode('Para+Mayores'),jdecode(''),'/5101.html','true',[],'',''],
	['PAGE','8601',jdecode('Para+Beb%C3%A9s+y+Ni%C3%B1os+Peque%C3%B1os'),jdecode(''),'/8601.html','true',[],'',''],
	['PAGE','5122',jdecode('Precios+y+Como+Comprar'),jdecode(''),'/5122.html','true',[],'',''],
	['PAGE','8622',jdecode('Contacto'),jdecode(''),'/8622.html','true',[],'',''],
	['PAGE','8901',jdecode('Aviso+legal'),jdecode(''),'/8901.html','true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Konzept';
theSitetree.paletteFamily='0D8D28';
theSitetree.keyvisualId='567';
theSitetree.keyvisualName='garten.jpg';
theSitetree.fontsetId='119';
theSitetree.graphicsetId='137';
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: 			'Konzept',
				paletteFamily: 	'0D8D28',
				keyvisualId: 	'567',
				keyvisualName: 	'garten.jpg',
				fontsetId: 		'119',
				graphicsetId: 	'137',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'0D8D28',
				b_color: 		'60CC90',
				c_color: 		'000000',
				d_color: 		'0A377B',
				e_color: 		'C5B39F',
				f_color: 		'4BAF77',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090526-220113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20100118-234009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20090526-215755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8601',
internalId:  '',
customField: '20090521-100140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8622',
internalId:  '',
customField: '20090520-221932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20090520-222146'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INLKZM';
var companyName   = 'SabanadeSeguridad.com';
var htmlTitle	  = 'www.sabanadeseguridad.com';
var metaKeywords  = 's%C3%A1bana+de+seguridad%2C+sabana+de+seguridad+para+mayores%2C+geriatricos%2C+sabana+de+proteccion+para+adultos%2C+alzheimer%2C+residencia+de+mayores%2Cmayores%2C+alzheimer%2C+geriatricos%2C+residencia+de+la+tercera+edad%2C+residencia+de+mayores%2C+sabana+de+protecci%C3%B3n+para+geriatria%2C+sabana+de+protecci%C3%B3n%2C+s%C3%A1bana+de+protecci%C3%B3n';
var metaContents  = 'sabana+de+seguridad+para+mayores%3B+sabana+de+seguridad+para+bebes%3B+sabana+fantasma%3B+s%C3%A1bana+de+seguridad+para+mayores%3B+s%C3%A1bana+de+seguridad+para+beb%C3%A9s%3B+sabana+seguridad%2C+adultos%2C+mayores%2C+alzheimer%2C+geriatricos%2C+residencia+de+la+tercera+edad%2C+residencia+de+mayores%2C+sabana+de+protecci%C3%B3n+para+geriatria%2C+sabana+de+protecci%C3%B3n%2C+s%C3%A1bana+de+protecci%C3%B3n';
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();
};

