/* [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','32',jdecode('HOME'),jdecode(''),'/32.html','true',[],'',''],
	['PAGE','28161',jdecode('BARTON+SKYWAY'),jdecode(''),'/28161.html','true',[],'',''],
	['PAGE','432',jdecode('LUNCH+DAVENPORT'),jdecode(''),'/432.html','true',[],'',''],
	['PAGE','29189',jdecode('LUNCH+SPECIALS'),jdecode(''),'/29189.html','true',[],'',''],
	['PAGE','2402',jdecode('APPETIZER+MENU'),jdecode(''),'/2402.html','true',[],'',''],
	['PAGE','25591',jdecode('WINE+LIST'),jdecode(''),'/25591.html','true',[],'',''],
	['PAGE','11713',jdecode('DINNER+MENU'),jdecode(''),'/11713.html','true',[],'',''],
	['PAGE','15513',jdecode('DINNER+SPECIALS'),jdecode(''),'/15513.html','true',[],'',''],
	['PAGE','450',jdecode('CATERING'),jdecode(''),'/450.html','true',[],'',''],
	['PAGE','2327',jdecode('FINGER+FOODS'),jdecode(''),'/2327.html','true',[],'',''],
	['PAGE','486',jdecode('HOURS%2FINFO'),jdecode(''),'/486.html','true',[],'',''],
	['PAGE','29210',jdecode('DAVENPORT+MAP'),jdecode(''),'/29210.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Produce';
theSitetree.paletteFamily='FFA717';
theSitetree.keyvisualId='5746';
theSitetree.keyvisualName='kv_5746.jpg';
theSitetree.fontsetId='11058';
theSitetree.graphicsetId='11827';
theSitetree.contentColor='2F671B';
theSitetree.contentBGColor='9EE386';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Produce',
				paletteFamily: 	'FFA717',
				keyvisualId: 	'5746',
				keyvisualName: 	'kv_5746.jpg',
				fontsetId: 		'11058',
				graphicsetId: 	'11827',
				contentColor: 	'2F671B',
				contentBGColor: '9EE386',
				a_color: 		'FFA717',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '29210',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20100720-162046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '432',
internalId:  '',
customField: '20100511-142357'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2402',
internalId:  '',
customField: '20100213-172516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '450',
internalId:  '',
customField: '20100526-104009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2327',
internalId:  '',
customField: '20100202-154912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28161',
internalId:  '',
customField: '20100528-090618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '486',
internalId:  '',
customField: '20100713-154702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25591',
internalId:  '',
customField: '20100209-175410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11713',
internalId:  '',
customField: '20100206-190648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15513',
internalId:  '',
customField: '20100609-181002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29189',
internalId:  '',
customField: '20100713-154938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29210',
internalId:  '',
customField: '20100720-163537'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3SRP';
var companyName   = 'THISTLE+CAFE';
var htmlTitle	  = 'thistlecafe.com';
var metaKeywords  = 'Lunch+Caterings+Office+Deliveries+Austin+weddings++rehearsal+dinners++corporate+caterings+divorce+parties';
var metaContents  = 'Austin+Catering+weddings+receptions+Austin++special+events++corporate+events++Christmas+parties++holiday+parties++private+rooms+rehearsal+dinner+places';
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();
};
