/* [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 theSitetree=[ 
	['PAGE','301',jdecode('Home'),jdecode(''),'/301.html','true',[],''],
	['PAGE','149529',jdecode('Mountain+Dog+festival'),jdecode(''),'/149529.html','true',[],''],
	['PAGE','148898',jdecode('New+hours+in+2010'),jdecode(''),'/148898.html','true',[],''],
	['PAGE','149084',jdecode('Closed+4%2F18+till+4%2F27'),jdecode(''),'/149084.html','true',[],''],
	['PAGE','147188',jdecode('About+us'),jdecode(''),'/147188.html','true',[],''],
	['PAGE','51501',jdecode('Our+e-mail+list'),jdecode(''),'/51501.html','true',[],''],
	['PAGE','352',jdecode('Opening+hours'),jdecode(''),'/352.html','true',[],''],
	['PAGE','373',jdecode('How+to+find+us'),jdecode(''),'/373.html','true',[],''],
	['PAGE','541',jdecode('Reservations'),jdecode(''),'/541.html','true',[],''],
	['PAGE','79312',jdecode('Testimonials'),jdecode(''),'/79312.html','true',[],''],
	['PAGE','394',jdecode('Menu'),jdecode(''),'/394/index.html','true',[ 
		['PAGE','14301',jdecode('Lunch'),jdecode(''),'/394/14301.html','true',[],''],
		['PAGE','14322',jdecode('Dinner+Entree'),jdecode(''),'/394/14322.html','true',[],''],
		['PAGE','14343',jdecode('Desserts'),jdecode(''),'/394/14343.html','true',[],'']
	],''],
	['PAGE','146740',jdecode('we+support+the+local+food+bank'),jdecode(''),'/146740.html','true',[],''],
	['PAGE','13501',jdecode('Entertainment'),jdecode(''),'/13501.html','true',[],''],
	['PAGE','148045',jdecode('Bands+pix'),jdecode(''),'/148045.html','true',[],''],
	['PAGE','147078',jdecode('Rewards+Network'),jdecode(''),'/147078.html','true',[],''],
	['PAGE','6906',jdecode('Guestbook'),jdecode(''),'/6906/index.html','true',[ 
		['PAGE','6901',jdecode('Read+Guestbook'),jdecode(''),'/6906/6901.html','false',[],'']
	],'']];
var siteelementCount=20;
theSitetree.topTemplateName='Layers';
theSitetree.paletteFamily='C89C55';
theSitetree.keyvisualId='612';
theSitetree.keyvisualName='prost.jpg';
theSitetree.fontsetId='130';
theSitetree.graphicsetId='144';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='EBF0F0';
var theTemplate={
				name: 			'Layers',
				paletteFamily: 	'C89C55',
				keyvisualId: 	'612',
				keyvisualName: 	'prost.jpg',
				fontsetId: 		'130',
				graphicsetId: 	'144',
				contentColor: 	'000000',
				contentBGColor: 'EBF0F0',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'CE4747',
				b_color: 		'C1E0DA',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13501',
internalId:  '',
customField: '20100221-225117'
};
webappMappings['1002']=webappMappings['1002-6906AHW050IN2PZD']={
webappId:    '1002',
documentId:  '6906',
internalId:  '6906AHW050IN2PZD',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100112-152758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20100104-004959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '541',
internalId:  '',
customField: '20090906-221329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51501',
internalId:  '',
customField: '20090103-162203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20091015-005040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79312',
internalId:  '',
customField: '20091018-223509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '394',
internalId:  '',
customField: '20100112-152002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14301',
internalId:  '',
customField: '20090921-225350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14322',
internalId:  '',
customField: '20091202-191954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14343',
internalId:  '',
customField: '20090921-225556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '149084',
internalId:  '',
customField: '20100128-202528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '148045',
internalId:  '',
customField: '20091213-203738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '146740',
internalId:  '',
customField: '20090607-154310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '148898',
internalId:  '',
customField: '20100221-225230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6906',
internalId:  '',
customField: '20070320-192710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20070320-192710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '147078',
internalId:  '',
customField: '20091202-190320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '147188',
internalId:  '',
customField: '20090928-215838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '149529',
internalId:  '',
customField: '20100302-135115'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050IN2PZD';
var companyName   = 'Flavours';
var htmlTitle	  = 'Flavours+Restaurant%2C+Dining+In+The+Berkshires%2C+Malaysian%2C+Asian%2C+American+Restaurant+Lenox%2C+MA';
var metaKeywords  = 'dining+in+the+Berkshires%2Crestaurants+in+the+Berkshires%2Cdining+in+Berkshire+County%2Crestaurants+in+Berkshire+County%2CLenox%2C+MA+restaurants%2Centertainment+in+the+berkshires%2CMalaysian+food%2CAsian+food%2CAmerican+food%2Cberkshire+restaurant%2Clenox%2C+ma+restaurant%2Centertainment%2Clive+bands%2Ckaraoke%2Cdj%2Cflavours+restaurant%2Cberkshire+dining%2Cthe+berkshires%2Cberkshire+county';
var metaContents  = 'Flavours+Restaurant+Malaysian+dining%2C+Asian+dining+and+American+dining+in+the+Berkshires.++Flavours+Restaurant+located+in+Lenox%2C+MA+dining+in+Berkshire+County%2C+serving+Asian%2C+Malaysian+and+American+food.++Plus+entertainment+in+the+Berkshires+including+live+bands%2C+karaoke+and+DJs.';
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();
};
