/* [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 theSitetree=[ 
	['PAGE','42',jdecode('Home'),jdecode(''),'/42.html','true',[],''],
	['PAGE','33701',jdecode('About+us'),jdecode(''),'/33701.html','true',[],''],
	['PAGE','90',jdecode('Food+Service+Products'),jdecode(''),'/90/index.html','true',[ 
		['PAGE','1254',jdecode('Cannoli%26%23x27%3Bs'),jdecode(''),'/90/1254.html','true',[],''],
		['PAGE','1263',jdecode('Tiramisu'),jdecode(''),'/90/1263.html','true',[],''],
		['PAGE','1272',jdecode('Sfogliatelle'),jdecode(''),'/90/1272.html','true',[],''],
		['PAGE','1461',jdecode('Cheesecakes'),jdecode(''),'/90/1461.html','true',[],''],
		['PAGE','1470',jdecode('Layer+Cakes'),jdecode(''),'/90/1470.html','true',[],'']
	],''],
	['PAGE','1479',jdecode('Retail+Products'),jdecode(''),'/1479/index.html','true',[ 
		['PAGE','9401',jdecode('Cannoli+Kits'),jdecode(''),'/1479/9401.html','true',[],''],
		['PAGE','9422',jdecode('Tiramisu'),jdecode(''),'/1479/9422.html','true',[],''],
		['PAGE','9443',jdecode('Whoopie+Pies'),jdecode(''),'/1479/9443.html','true',[],''],
		['PAGE','9464',jdecode('Cupcakes'),jdecode(''),'/1479/9464.html','true',[],''],
		['PAGE','11001',jdecode('Layer+Cakes'),jdecode(''),'/1479/11001.html','true',[],''],
		['PAGE','11022',jdecode('Cheesecakes'),jdecode(''),'/1479/11022.html','true',[],''],
		['PAGE','32201',jdecode('Sfogliatelle'),jdecode(''),'/1479/32201.html','true',[],'']
	],''],
	['PAGE','36201',jdecode('How+To+Order'),jdecode(''),'/36201.html','true',[],''],
	['PAGE','1358',jdecode('Our+Guarantee'),jdecode(''),'/1358.html','true',[],''],
	['PAGE','1134',jdecode('Directions'),jdecode(''),'/1134.html','true',[],''],
	['PAGE','63',jdecode('Contact'),jdecode(''),'/63.html','true',[],''],
	['PAGE','1594',jdecode('Guestbook'),jdecode(''),'/1594/index.html','true',[ 
		['PAGE','1593',jdecode('Read+Guestbook'),jdecode(''),'/1594/1593.html','false',[],'']
	],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Architekt';
theSitetree.paletteFamily='C8C0A4';
theSitetree.keyvisualId='2055';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='281';
theSitetree.graphicsetId='347';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='C8C0A4';
var theTemplate={
				name: 			'Architekt',
				paletteFamily: 	'C8C0A4',
				keyvisualId: 	'2055',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'281',
				graphicsetId: 	'347',
				contentColor: 	'000000',
				contentBGColor: 'C8C0A4',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'C8C0A4',
				b_color: 		'5C5438',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '42',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '1134',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33701',
internalId:  '',
customField: '20080915-232834'
};
webappMappings['1002']=webappMappings['1002-1594AHW050IN3BEC']={
webappId:    '1002',
documentId:  '1594',
internalId:  '1594AHW050IN3BEC',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20081002-155423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90',
internalId:  '',
customField: '20080819-144533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1254',
internalId:  '',
customField: '20080819-132206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1263',
internalId:  '',
customField: '20080819-131252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1272',
internalId:  '',
customField: '20080819-152812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1461',
internalId:  '',
customField: '20080819-131329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1470',
internalId:  '',
customField: '20080819-131429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1479',
internalId:  '',
customField: '20080819-144512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20080819-131640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9422',
internalId:  '',
customField: '20080819-131729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9443',
internalId:  '',
customField: '20080806-145407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9464',
internalId:  '',
customField: '20080806-145654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20080819-131840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11022',
internalId:  '',
customField: '20080819-132019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32201',
internalId:  '',
customField: '20080819-152840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1358',
internalId:  '',
customField: '20070213-171024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1134',
internalId:  '',
customField: '20070213-164558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63',
internalId:  '',
customField: '20080906-122523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1594',
internalId:  '',
customField: '20070213-174235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1593',
internalId:  '',
customField: '20070213-173634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36201',
internalId:  '',
customField: '20090609-113747'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3BEC';
var companyName   = 'THE+CANNOLI+FACTORY';
var htmlTitle	  = 'THE+CANNOLI+FACTORY';
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();
};
