/* [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','1801',jdecode('Home'),jdecode(''),'/1801.html','true',[],'',''],
	['PAGE','2041',jdecode('Wine+Club'),jdecode(''),'/2041.html','true',[],'',''],
	['PAGE','50923',jdecode('Wine+Club+Wine+Archives'),jdecode(''),'/50923.html','true',[],'',''],
	['PAGE','29801',jdecode('Menu'),jdecode(''),'/29801.html','true',[],'',''],
	['PAGE','2062',jdecode('Calendar+of+Events'),jdecode(''),'/2062.html','true',[],'',''],
	['PAGE','11006',jdecode('Sign+our+Guestbook'),jdecode(''),'/11006.html','true',[],'',''],
	['PAGE','1978',jdecode('Meet+us%21'),jdecode(''),'/1978/index.html','true',[ 
		['PAGE','1999',jdecode('Addresses'),jdecode(''),'/1978/1999.html','true',[],'',''],
		['PAGE','2020',jdecode('How+to+find+us'),jdecode(''),'/1978/2020.html','true',[],'','']
	],'',''],
	['PAGE','42484',jdecode('Map'),jdecode(''),'/42484.html','true',[],'',''],
	['PAGE','1852',jdecode('Products'),jdecode(''),'/1852/index.html','true',[ 
		['PAGE','23501',jdecode('European+Pottery'),jdecode(''),'/1852/23501.html','true',[],'',''],
		['PAGE','1873',jdecode('Northwest+wines'),jdecode(''),'/1852/1873.html','true',[],'',''],
		['PAGE','26301',jdecode('California+wines'),jdecode(''),'/1852/26301.html','true',[],'',''],
		['PAGE','1894',jdecode('Italian+wines'),jdecode(''),'/1852/1894.html','true',[],'',''],
		['PAGE','1915',jdecode('Wines+from+around+the+world'),jdecode(''),'/1852/1915.html','true',[],'',''],
		['PAGE','28001',jdecode('Italian+Regional+foods'),jdecode(''),'/1852/28001.html','true',[],'',''],
		['PAGE','23522',jdecode('Gifts+and+Gadgets'),jdecode(''),'/1852/23522.html','true',[],'','']
	],'',''],
	['PAGE','1936',jdecode('About+us'),jdecode(''),'/1936.html','true',[],'',''],
	['PAGE','44128',jdecode('We+can+ship+your+wines'),jdecode(''),'/44128/index.html','true',[ 
		['PAGE','50823',jdecode('Wine+Club+Archives'),jdecode(''),'/44128/50823.html','true',[],'','']
	],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Round';
theSitetree.paletteFamily='CC3333';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='440';
theSitetree.graphicsetId='495';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='e47272';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Round',
				paletteFamily: 	'CC3333',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'440',
				graphicsetId: 	'495',
				contentColor: 	'FFFFFF',
				contentBGColor: 'e47272',
				a_color: 		'e47272',
				b_color: 		'CC3333',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '42484',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2041',
internalId:  '',
customField: '20100504-110246'
};
webappMappings['1002']=webappMappings['1002-11006AHW050INX3MO']={
webappId:    '1002',
documentId:  '11006',
internalId:  '11006AHW050INX3MO',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20100724-123147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20100722-115958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1978',
internalId:  '',
customField: '20100722-120718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1999',
internalId:  '',
customField: '20100622-182901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2020',
internalId:  '',
customField: '20071210-125209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42484',
internalId:  '',
customField: '20091122-192834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20091121-125508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20080203-135836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20081211-102416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26301',
internalId:  '',
customField: '20080626-114442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20080626-114558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20080626-114820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28001',
internalId:  '',
customField: '20081208-155851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23522',
internalId:  '',
customField: '20090103-125539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2062',
internalId:  '',
customField: '20100723-170027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20071125-163022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50823',
internalId:  '',
customField: '20100315-120024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11006',
internalId:  '',
customField: '20071021-133312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50923',
internalId:  '',
customField: '20100712-164046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44128',
internalId:  '',
customField: '20090809-180500'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3MO';
var companyName   = 'Wine+101+%7E+The+Gathering+Place';
var htmlTitle	  = 'wine101-thegatheringplace.com';
var metaKeywords  = 'wine+++wine+101+++wine+shop+++Mukilteo+restaurant+lunch+music+free+internet+wine+tasting+outside+dining+deck+patio+close+to+Seattle';
var metaContents  = 'wine+wine+101++wine+shop+++mukilteo+restaurant+lunch+music+free+internet+wine+tasting+Seattlewine+flights+gifts++outside+seating';
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();
};
