/* [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','301',jdecode('TOP'),jdecode(''), jdecode('%2F301.html'), 'true',[],'',''],
	['PAGE','457',jdecode('MENU'),jdecode(''), jdecode('%2F457.html'), 'true',[],'',''],
	['PAGE','76726',jdecode('NEWS'),jdecode(''), jdecode('%2F76726.html'), 'true',[],'',''],
	['PAGE','394',jdecode('CONTACT'),jdecode(''), jdecode('%2F394.html'), 'true',[],'',''],
	['PAGE','499',jdecode('C2U+CLUB'),jdecode(''), jdecode('%2F499.html'), 'true',[],'',''],
	['PAGE','13401',jdecode('SUSHI+SCHOOL'),jdecode(''), jdecode('%2F13401.html'), 'true',[],'',''],
	['PAGE','6101',jdecode('CHEFS+TO+YOU'),jdecode(''), jdecode('%2F6101.html'), 'true',[],'',''],
	['PAGE','115326',jdecode('KOSHER+SUSHI'),jdecode(''), jdecode('%2F115326.html'), 'true',[],'',''],
	['PAGE','478',jdecode('GIFT+CERTIFICATE'),jdecode(''), jdecode('%2F478.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Holz';
theSitetree.paletteFamily='FF7112';
theSitetree.keyvisualId='8820';
theSitetree.keyvisualName='KV_06.swf';
theSitetree.fontsetId='-1';
theSitetree.graphicsetId='12654';
theSitetree.contentColor='CCCCCC';
theSitetree.contentBGColor='262626';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRNC'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Holz',
				paletteFamily: 	'FF7112',
				keyvisualId: 	'8820',
				keyvisualName: 	'KV_06.swf',
				fontsetId: 		'-1',
				graphicsetId: 	'12654',
				contentColor: 	'CCCCCC',
				contentBGColor: '262626',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FF6600',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'',
				contentFontSize:'-1',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '394',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-4148773']={
webappId:    '1501',
documentId:  '301',
internalId:  '4148773',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-30877']={
webappId:    '7008',
documentId:  '499',
internalId:  '30877',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-98']={
webappId:    '7008',
documentId:  '6101',
internalId:  '98',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20111125-082123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '394',
internalId:  '',
customField: '20111120-195553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '478',
internalId:  '',
customField: '20110321-193837'
};
webappMappings['7008']=webappMappings['7008-25681']={
webappId:    '7008',
documentId:  '115326',
internalId:  '25681',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20111230-092610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13401',
internalId:  '',
customField: '20120125-232221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '499',
internalId:  '',
customField: '20111123-152924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '457',
internalId:  '',
customField: '20120129-113435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '76726',
internalId:  '',
customField: '20091210-182708'
};
webappMappings['7050']=webappMappings['7050-13860']={
webappId:    '7050',
documentId:  '76726',
internalId:  '13860',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115326',
internalId:  '',
customField: '20111230-091141'
};
webappMappings['7008']=webappMappings['7008-25697']={
webappId:    '7008',
documentId:  '13401',
internalId:  '25697',
customField: 'language:en;country:US;'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2CLH';
var companyName   = 'Sea+To+You+Sushi+%26+Asian+Foods';
var htmlTitle	  = 'Sea+To+You+Sushi+%26+Asian+Foods';
var metaKeywords  = 'sushi%2Cplatter%2Cgrade%2Cfish%2Cingredients%2Csalad%2Cbar%2Cgrocery%2Ckosher%2Csea%2Cfood%2Casian%2Cfoods%2Ctemaki%2Cudon%2Cnoodle%2Ckorean%2Cbbq%2Ccatering%2Cschool%2Ckendall%2Cbrookline';
var metaContents  = 'Weve+been+serving+sushi+products+and+services+since+1982.+As+we+relocated+our+facility+to+Brookline+in+the+fall+of+2009%2C+we+are+expanding+our+retail+hours+and+start+serving+from+freshest+sushi+ingredients+to+all+kinds+of+Asian+foods+prepared+at+our+kitchen.';
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();
};

