/* [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','6101',jdecode('Home'),jdecode(''),'/6101.html','true',[],'',''],
	['PAGE','6194',jdecode('Menu'),jdecode(''),'/6194/index.html','true',[ 
		['PAGE','6152',jdecode('Cold+Sandwiches'),jdecode(''),'/6194/6152.html','true',[],'',''],
		['PAGE','6257',jdecode('Hot+Sandwiches'),jdecode(''),'/6194/6257.html','true',[],'',''],
		['PAGE','24301',jdecode('Salads+%26+Soup'),jdecode(''),'/6194/24301.html','true',[],'',''],
		['PAGE','24343',jdecode('Beverages'),jdecode(''),'/6194/24343.html','true',[],'',''],
		['PAGE','7543',jdecode('Sides+Items'),jdecode(''),'/6194/7543.html','true',[],'',''],
		['PAGE','6278',jdecode('Specials'),jdecode(''),'/6194/6278.html','true',[],'','']
	],'',''],
	['PAGE','24322',jdecode('Order+Online'),jdecode(''),'/24322.html','true',[],'',''],
	['PAGE','24501',jdecode('Location'),jdecode(''),'/24501.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Time';
theSitetree.paletteFamily='272740';
theSitetree.keyvisualId='2291';
theSitetree.keyvisualName='beauty.jpg';
theSitetree.fontsetId='268';
theSitetree.graphicsetId='336';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Time',
				paletteFamily: 	'272740',
				keyvisualId: 	'2291',
				keyvisualName: 	'beauty.jpg',
				fontsetId: 		'268',
				graphicsetId: 	'336',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'272740',
				b_color: 		'6D6DA7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20101209-163452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6194',
internalId:  '',
customField: '20101209-163601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6257',
internalId:  '',
customField: '20101208-153556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6152',
internalId:  '',
customField: '20101208-153512'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24343',
internalId:  '',
customField: '20101209-161059'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '24501',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7543',
internalId:  '',
customField: '20101209-163813'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20101208-154324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24501',
internalId:  '',
customField: '20101209-160416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24322',
internalId:  '',
customField: '20101208-164124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6278',
internalId:  '',
customField: '20101208-162315'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH030IN2R1Y';
var companyName   = 'Jerseys+Original+Subs';
var htmlTitle	  = 'Jerseys+Original+Subs';
var metaKeywords  = 'Jerseys%2C+Jersey+Subs%2C+Jersey%E2%80%99s+Subs%2C+Jerseys+Original+Subs%2C+Jersey+Style+Subs%2C+Jersey+Sub%2C+Sub%2C+Subs%2C+Submarine%2C+Sub+Sandwiches%2C+Jersey+Original+Subs+Locations%2C+Jerseys+Original+Subs+Locations%2C+hot+pastrami%2C+hoagie%2C+Po+boy%2C+Poor+Boy%2C+PoorBoy%2C+Italian+Subs%2C+salad+bar';
var metaContents  = 'Jersey+Original+Subs+makes+fresh+sliced%2C+authentic+East+Coast+Style+Sub+Sandwiches+on+fresh+bread+baked+in+our+oven+each+day.+Subs+are+prepared+your+way+with+red+onions%2C+lettuce%2C+tomatoes%2C+dill+pickles%2C+pepperoncinis%2C+oil%2C+vinegar%2C+salt%2C+black+pepper+and+oregano.+Two+locations+on+the+Monterey+Peninsula+to+best+serve+you.';
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();
};

