/* [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','76',jdecode('Home'),jdecode(''), jdecode('%2F76.html'), 'true',[],'',''],
	['PAGE','5401',jdecode('CAPE+COD+Items'),jdecode(''), jdecode('%2F5401.html'), 'true',[],'',''],
	['PAGE','28533',jdecode('Appliances'),jdecode(''), jdecode('%2F28533.html'), 'true',[],'',''],
	['PAGE','5422',jdecode('Bakeware'),jdecode(''), jdecode('%2F5422.html'), 'true',[],'',''],
	['PAGE','28512',jdecode('Cookware'),jdecode(''), jdecode('%2F28512.html'), 'true',[],'',''],
	['PAGE','28701',jdecode('Cutlery'),jdecode(''), jdecode('%2F28701.html'), 'true',[],'',''],
	['PAGE','28617',jdecode('Dinnerware'),jdecode(''), jdecode('%2F28617.html'), 'true',[],'',''],
	['PAGE','28659',jdecode('Food-Beverages'),jdecode(''), jdecode('%2F28659.html'), 'true',[],'',''],
	['PAGE','28722',jdecode('Food-Condiments'),jdecode(''), jdecode('%2F28722.html'), 'true',[],'',''],
	['PAGE','28680',jdecode('Food-Preserves'),jdecode(''), jdecode('%2F28680.html'), 'true',[],'',''],
	['PAGE','7101',jdecode('Gadgets+'),jdecode(''), jdecode('%2F7101.html'), 'true',[],'',''],
	['PAGE','28596',jdecode('Glassware'),jdecode(''), jdecode('%2F28596.html'), 'true',[],'',''],
	['PAGE','28575',jdecode('Linens+for+Table'),jdecode(''), jdecode('%2F28575.html'), 'true',[],'',''],
	['PAGE','28554',jdecode('Linens+for+Kitchen'),jdecode(''), jdecode('%2F28554.html'), 'true',[],'',''],
	['PAGE','28638',jdecode('Pottery'),jdecode(''), jdecode('%2F28638.html'), 'true',[],'',''],
	['PAGE','106',jdecode('About+us'),jdecode(''), jdecode('%2F106.html'), 'true',[],'',''],
	['PAGE','115',jdecode('Contact'),jdecode(''), jdecode('%2F115.html'), 'true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C5A858';
theSitetree.keyvisualId='6853';
theSitetree.keyvisualName='kv_6853.jpg';
theSitetree.fontsetId='11211';
theSitetree.graphicsetId='12034';
theSitetree.contentColor='64511A';
theSitetree.contentBGColor='DABB67';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC241'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'C5A858',
				keyvisualId: 	'6853',
				keyvisualName: 	'kv_6853.jpg',
				fontsetId: 		'11211',
				graphicsetId: 	'12034',
				contentColor: 	'64511A',
				contentBGColor: 'DABB67',
				a_color: 		'DABB67',
				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:  '76',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20090115-133209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '76',
internalId:  '',
customField: '20100430-094743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28512',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106',
internalId:  '',
customField: '20080129-180754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115',
internalId:  '',
customField: '20080123-182019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5422',
internalId:  '',
customField: '20090114-144955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20090115-124849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28533',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28554',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28575',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28596',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28617',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28638',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28659',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28680',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20090616-090916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28722',
internalId:  '',
customField: '20090616-090916'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INV9PP';
var companyName   = 'The+Cook+Shop+%7E+Brewster%2C+Cape+Cod';
var htmlTitle	  = 'The+Cook+Shop+Brewster+Cape+Cod';
var metaKeywords  = 'cookshop%2C+cook+shop%2C+cookware%2C+gourmet%2C+gourmet+food%2C+tabletop%2C+tableware%2C+kitchen%2C+cookinh%2C+kitchenware%2C+capecod%2C+cape+cod%2C+flatware%2C+dining%2C+utensils%2C+gadgets%2C+soda+stream%2C+cookbooks%2C+brewster%2C+cookbook%2C+coffee%2C+tea%2C+condiments%2C+olive+oil%2C+balsamic%2C+aprons%2C+linens%2C+tablelinens%2C+asian+food%2C+pastry%2C+caviar%2C+clamram%2C+clam+ram%2C+denby%2C+le+creuset%2C+rosle%2C+bourgeat%2C+peugeot%2C+wusthof%2C+henckels%2C+lamson%2C+pg+tips%2C+lower+cape%2C+route+6a%2C+spode%2C+copper';
var metaContents  = 'Gourmet+and+Tabletop+Shop+at+Lemon+Tree+Village+in+Brewster%2C+Cape+Cod.++Family+run+since+1978.++Where+to+buy+all+your+kitchen+and+dining+needs+on+Cape+Cod.';
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();
};

