/* [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','5701',jdecode('Home'),jdecode(''), jdecode('%2F5701.html'), 'true',[],'',''],
	['PAGE','10501',jdecode('About+Us'),jdecode(''), jdecode('%2F10501.html'), 'true',[],'',''],
	['PAGE','10522',jdecode('Bistro+Menus'),jdecode(''), jdecode('%2F10522%2Findex.html'), 'true',[ 
		['PAGE','10543',jdecode('Lunch'),jdecode(''), jdecode('%2F10522%2F10543.html'), 'true',[],'',''],
		['PAGE','14501',jdecode('Dinner'),jdecode(''), jdecode('%2F10522%2F14501.html'), 'true',[],'',''],
		['PAGE','10585',jdecode('Dessert'),jdecode(''), jdecode('%2F10522%2F10585.html'), 'true',[],'',''],
		['PAGE','10606',jdecode('Wine'),jdecode(''), jdecode('%2F10522%2F10606.html'), 'true',[],'','']
	],'',''],
	['PAGE','10627',jdecode('Catering'),jdecode(''), jdecode('%2F10627%2Findex.html'), 'true',[ 
		['PAGE','48033',jdecode('Hors+d%26%23x27%3B+Oeuvres'),jdecode(''), jdecode('%2F10627%2F48033.html'), 'true',[],'',''],
		['PAGE','48012',jdecode('Sample+Dinner+Menus'),jdecode(''), jdecode('%2F10627%2F48012.html'), 'true',[],'',''],
		['PAGE','48054',jdecode('Sample+Wedding+Menus'),jdecode(''), jdecode('%2F10627%2F48054.html'), 'true',[],'',''],
		['PAGE','49112',jdecode('Napa+Valley+Picnic'),jdecode(''), jdecode('%2F10627%2F49112.html'), 'true',[],'',''],
		['PAGE','10669',jdecode('Venues'),jdecode(''), jdecode('%2F10627%2F10669.html'), 'true',[],'','']
	],'',''],
	['PAGE','10690',jdecode('Current+Events'),jdecode(''), jdecode('%2F10690.html'), 'true',[],'',''],
	['PAGE','10711',jdecode('Contact+Us'),jdecode(''), jdecode('%2F10711.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='CECEA9';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10432';
theSitetree.graphicsetId='10772';
theSitetree.contentColor='692643';
theSitetree.contentBGColor='F3F9FC';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'valueweb',
  product: 'WSCSYSSSSLYTCR7V'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Borders',
				paletteFamily: 	'CECEA9',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10432',
				graphicsetId: 	'10772',
				contentColor: 	'692643',
				contentBGColor: 'F3F9FC',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20111219-164731'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10501',
internalId:  '',
customField: '20090716-201327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10522',
internalId:  '',
customField: '20110405-155125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10543',
internalId:  '',
customField: '20111219-172903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48033',
internalId:  '',
customField: '20120118-151144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10585',
internalId:  '',
customField: '20111219-173616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10606',
internalId:  '',
customField: '20091104-141018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10627',
internalId:  '',
customField: '20120118-144025'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48012',
internalId:  '',
customField: '20120202-121545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10669',
internalId:  '',
customField: '20110622-115429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10690',
internalId:  '',
customField: '20111219-173814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10711',
internalId:  '',
customField: '20101214-183711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20111219-172801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48054',
internalId:  '',
customField: '20120202-131804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49112',
internalId:  '',
customField: '20110624-141401'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INECJF';
var companyName   = 'all+seasons+';
var htmlTitle	  = 'All+Seasons+Bistro';
var metaKeywords  = 'napa+valley%2C+napa+valley+restaurants%2C+calistoga%2C+calistoga+restaurants%2C+california+cuisine%2C+wine+retail%2C+wine+shop%2C+catering%2C+napa+valley+catering%2C+gourmet%2C+gourmet+restaurants%2C+calistoga+catering%2C+napa+valley+weddings%2C+wedding+planning%2C+wedding+planner%2C+wine+country+wedding%2C+wine+country+restaurants%2C+wine+country+gourmet%2C+special+events%2C+wine+pairing%2C+napa+valley+special+events%2C+food+and+wine+pairing%2C+calistoga+special+events';
var metaContents  = 'napa+valley%2C+napa+valley+restaurants%2C+calistoga%2C+calistoga+restaurants%2C+california+cuisine%2C+wine+retail%2C+wine+shop%2C+catering%2C+napa+valley+catering%2C+gourmet%2C+gourmet+restaurants%2C+calistoga+catering%2C+napa+valley+weddings%2C+wedding+planning%2C+wedding+planner%2C+wine+country+wedding%2C+wine+country+restaurants%2C+wine+country+gourmet%2C+special+events%2C+wine+pairing%2C+napa+valley+special+events%2C+food+and+wine+pairing%2C+calistoga+special+events';
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();
};

