/* [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','5201',jdecode('Home'),jdecode(''), jdecode('%2F5201.html'), 'true',[],'',''],
	['PAGE','8348',jdecode('About+us'),jdecode(''), jdecode('%2F8348.html'), 'true',[],'',''],
	['PAGE','47201',jdecode('Awesome+Sauce'),jdecode(''), jdecode('%2F47201.html'), 'true',[],'',''],
	['PAGE','49101',jdecode('Products'),jdecode(''), jdecode('%2F49101.html'), 'true',[],'',''],
	['PAGE','8801',jdecode('Catering'),jdecode(''), jdecode('%2F8801.html'), 'true',[],'',''],
	['PAGE','36701',jdecode('Mexican+Menu'),jdecode(''), jdecode('%2F36701.html'), 'false',[],'',''],
	['PAGE','36722',jdecode('Italian+Menu'),jdecode(''), jdecode('%2F36722.html'), 'false',[],'',''],
	['PAGE','36743',jdecode('Asian+Menu'),jdecode(''), jdecode('%2F36743.html'), 'false',[],'',''],
	['PAGE','36764',jdecode('BBQ+Menu'),jdecode(''), jdecode('%2F36764.html'), 'false',[],'',''],
	['PAGE','8822',jdecode('Food+Vending'),jdecode(''), jdecode('%2F8822.html'), 'true',[],'',''],
	['PAGE','9901',jdecode('Events'),jdecode(''), jdecode('%2F9901.html'), 'true',[],'',''],
	['PAGE','10122',jdecode('Media+Album'),jdecode(''), jdecode('%2F10122.html'), 'true',[],'',''],
	['PAGE','9701',jdecode('Customer+Reviews'),jdecode(''), jdecode('%2F9701.html'), 'true',[],'',''],
	['PAGE','9601',jdecode('Chewy%26%23x27%3Bs+Blog'),jdecode(''), jdecode('%2F9601.html'), 'true',[],'',''],
	['PAGE','10101',jdecode('Contact+Us'),jdecode(''), jdecode('%2F10101.html'), 'true',[],'',''],
	['PAGE','9622',jdecode('Guestbook'),jdecode(''), jdecode('%2F9622.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Americanlife';
theSitetree.paletteFamily='A71E1E';
theSitetree.keyvisualId='4243';
theSitetree.keyvisualName='kv_4243.jpg';
theSitetree.fontsetId='10673';
theSitetree.graphicsetId='11194';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='C53131';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hostway_generic',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Americanlife',
				paletteFamily: 	'A71E1E',
				keyvisualId: 	'4243',
				keyvisualName: 	'kv_4243.jpg',
				fontsetId: 		'10673',
				graphicsetId: 	'11194',
				contentColor: 	'FFFFFF',
				contentBGColor: 'C53131',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20110529-142555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36701',
internalId:  '',
customField: '20110622-162853'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36722',
internalId:  '',
customField: '20110622-163700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8348',
internalId:  '',
customField: '20110529-142619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8822',
internalId:  '',
customField: '20110529-142739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20110529-142716'
};
webappMappings['7050']=webappMappings['7050-2009']={
webappId:    '7050',
documentId:  '9601',
internalId:  '2009',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-9622ahw050inzkec']={
webappId:    '1002',
documentId:  '9622',
internalId:  '9622ahw050inzkec',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20110529-142856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9622',
internalId:  '',
customField: '20110529-142939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20110529-142834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20110627-142723'
};
webappMappings['7008']=webappMappings['7008-6154']={
webappId:    '7008',
documentId:  '10101',
internalId:  '6154',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-864a654a20985796a36c6a1950d3bc1a']={
webappId:    '7060',
documentId:  '10122',
internalId:  '864a654a20985796a36c6a1950d3bc1a',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20110529-142919'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10122',
internalId:  '',
customField: '20110529-142812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36743',
internalId:  '',
customField: '20110622-163726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36764',
internalId:  '',
customField: '20110622-163750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47201',
internalId:  '',
customField: '20110622-162455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49101',
internalId:  '',
customField: '20110522-163422'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INZKEC';
var companyName   = 'Chewy%27s+Kitchen';
var htmlTitle	  = 'Catering+Vancouver%2C+Washington+-+Caterers+Vancouver+WA+-+Chewy%27s+Kitchen+Catering+service+Vancouver+WA.+98685-+Mexican+Food%2C+Italian+Food%2C+BBQ%2C+Asian+Food.';
var metaKeywords  = 'Affordable+Catering+Vancouver+Washington%2C+Caterers%2C+caterer%2C+Service%2C+Mexican+Food%2C+Italian+Food%2C+BBQ%2C+Asian+Food.+Vancouver%2C+WA.+98685.';
var metaContents  = 'Affordable+Catering+Vancouver%2C+Washington+-+Caterers+Vancouver+WA+-+Catering+service+-+Mexican+Food%2C+Italian+Food%2C+BBQ%2C+Asian+Food.+Vancouver%2C+WA.+98685.';
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();
};

