/* [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','9501',jdecode('Home'),jdecode(''),'/9501.html','true',[],'',''],
	['PAGE','9552',jdecode('Cold+Dishes'),jdecode(''),'/9552.html','true',[],'',''],
	['PAGE','9573',jdecode('Warm+Dishes'),jdecode(''),'/9573.html','true',[],'',''],
	['PAGE','5522',jdecode('Kruton%26%23x27%3Bs+Pictures'),jdecode(''),'/5522.html','true',[],'',''],
	['PAGE','26801',jdecode('We+do+Cakes%21+...+for+all+occations'),jdecode(''),'/26801.html','true',[],'',''],
	['PAGE','9615',jdecode('References'),jdecode(''),'/9615.html','true',[],'',''],
	['PAGE','9657',jdecode('About+us'),jdecode(''),'/9657/index.html','true',[ 
		['PAGE','9678',jdecode('Our+team'),jdecode(''),'/9657/9678.html','true',[],'','']
	],'',''],
	['PAGE','9636',jdecode('Contact'),jdecode(''),'/9636.html','true',[],'',''],
	['PAGE','9699',jdecode('How+to+find+us'),jdecode(''),'/9699.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Cook';
theSitetree.paletteFamily='684A34';
theSitetree.keyvisualId='11577';
theSitetree.keyvisualName='kv_11577.jpg';
theSitetree.fontsetId='32888';
theSitetree.graphicsetId='13970';
theSitetree.contentColor='713b32';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Cook',
				paletteFamily: 	'684A34',
				keyvisualId: 	'11577',
				keyvisualName: 	'kv_11577.jpg',
				fontsetId: 		'32888',
				graphicsetId: 	'13970',
				contentColor: 	'713b32',
				contentBGColor: 'FFFFFF',
				a_color: 		'FDF1D6',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-14270561']={
webappId:    '1501',
documentId:  '9501',
internalId:  '14270561',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9501',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-0dd0e35f2c5e085636e0eb8073c37985']={
webappId:    '7060',
documentId:  '5522',
internalId:  '0dd0e35f2c5e085636e0eb8073c37985',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5522',
internalId:  '',
customField: '20090910-095106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20100720-171326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9552',
internalId:  '',
customField: '20100817-111346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9573',
internalId:  '',
customField: '20100817-113014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26801',
internalId:  '',
customField: '20100820-215606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9615',
internalId:  '',
customField: '20100608-125603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9636',
internalId:  '',
customField: '20100325-233642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9657',
internalId:  '',
customField: '20100817-110248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9678',
internalId:  '',
customField: '20090913-180314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9699',
internalId:  '',
customField: '20100325-233733'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHESL';
var companyName   = 'Kruton%27s+Catering%2C+Inc';
var htmlTitle	  = 'Kruton%27s+Catering+479.756.5433';
var metaKeywords  = '';
var metaContents  = '';
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();
};
