/* [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','4478',jdecode('INICIO'),jdecode(''),'/4478.html','true',[],'',''],
	['PAGE','4562',jdecode('%C2%BFQUIENES+SOMOS%3F'),jdecode(''),'/4562.html','true',[],'',''],
	['PAGE','4589',jdecode('LISTA+DE+PRECIOS'),jdecode(''),'/4589.html','true',[],'',''],
	['PAGE','35701',jdecode('FOTOS+DE+ACCESORIOS'),jdecode(''),'/35701.html','true',[],'',''],
	['PAGE','41301',jdecode('RECOMENDACIONES+ESPECIALES'),jdecode(''),'/41301.html','true',[],'',''],
	['PAGE','27601',jdecode('EVENTOS+2010'),jdecode(''),'/27601.html','true',[],'',''],
	['PAGE','27622',jdecode('NOTICIAS+'),jdecode(''),'/27622.html','true',[],'',''],
	['PAGE','4616',jdecode('CONTACTANOS'),jdecode(''),'/4616.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='650000';
theSitetree.keyvisualId='1344';
theSitetree.keyvisualName='sektflasche.jpg';
theSitetree.fontsetId='232';
theSitetree.graphicsetId='296';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Startup',
				paletteFamily: 	'650000',
				keyvisualId: 	'1344',
				keyvisualName: 	'sektflasche.jpg',
				fontsetId: 		'232',
				graphicsetId: 	'296',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'650000',
				b_color: 		'666666',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-f7ad3c4ee2f2f518a23e42671c1ad93b']={
webappId:    '7060',
documentId:  '35701',
internalId:  'f7ad3c4ee2f2f518a23e42671c1ad93b',
customField: 'language:es;country:ES;'
};
webappMappings['1501']=webappMappings['1501-163878']={
webappId:    '1501',
documentId:  '4478',
internalId:  '163878',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4478',
internalId:  '',
customField: '20100525-221115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4562',
internalId:  '',
customField: '20090218-200627'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4589',
internalId:  '',
customField: '20100223-164403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4616',
internalId:  '',
customField: '20090219-110818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27601',
internalId:  '',
customField: '20100707-142421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27622',
internalId:  '',
customField: '20100518-203509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35701',
internalId:  '',
customField: '20090414-145211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41301',
internalId:  '',
customField: '20100514-162942'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INXE8B';
var companyName   = 'VINO+%26+TABACO';
var htmlTitle	  = '%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3AVINO+%26+TABACO%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A%3A';
var metaKeywords  = 'VINO+%26++TABACO%C2%94ACCESORIOS+PARA+%C2%93VINO+Y+TABACO%C2%94.';
var metaContents  = 'Tenemos+todo+para+que+no+falte+nada+en+tu+cava+o+bar%2C+todo+lo+que+necesita+un+verdadero+sibarita.+%C2%93VINO+%26+TABACO%C2%94++ACCESORIOS+PARA+VINO++Y+TABACO%C2%94.';
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();
};
