/* [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','701',jdecode('Home'),jdecode(''),'/701.html','true',[],''],
	['PAGE','752',jdecode('Catering'),jdecode(''),'/752.html','true',[],''],
	['PAGE','2006',jdecode('Guestbook'),jdecode(''),'/2006/index.html','true',[ 
		['PAGE','2001',jdecode('Read+Guestbook'),jdecode(''),'/2006/2001.html','true',[],'']
	],''],
	['PAGE','3501',jdecode('About+us'),jdecode(''),'/3501.html','true',[],''],
	['PAGE','3543',jdecode('Products'),jdecode(''),'/3543/index.html','true',[ 
		['PAGE','3585',jdecode('Bakery+Items'),jdecode(''),'/3543/3585.html','true',[],'']
	],''],
	['PAGE','3627',jdecode('Offers'),jdecode(''),'/3627.html','true',[],''],
	['PAGE','3669',jdecode('Contact'),jdecode(''),'/3669/index.html','true',[ 
		['PAGE','3690',jdecode('Adresses'),jdecode(''),'/3669/3690.html','true',[],''],
		['PAGE','3711',jdecode('How+to+find+us'),jdecode(''),'/3669/3711.html','true',[],'']
	],''],
	['PAGE','10869',jdecode('Cakes+galore%21'),jdecode(''),'/10869.html','true',[],''],
	['PAGE','49101',jdecode('Carved%2F3D+cakes'),jdecode(''),'/49101.html','true',[],''],
	['PAGE','50201',jdecode('Tiered+cakes'),jdecode(''),'/50201.html','true',[],''],
	['PAGE','11193',jdecode('Wedding+cake+pics'),jdecode(''),'/11193.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Cinema';
theSitetree.paletteFamily='B00E18';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16612';
theSitetree.graphicsetId='12208';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='B00E18';
var theTemplate={
				name: 			'Cinema',
				paletteFamily: 	'B00E18',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16612',
				graphicsetId: 	'12208',
				contentColor: 	'000000',
				contentBGColor: 'B00E18',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'C03E46',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3543',
internalId:  '',
customField: '20100406-081534'
};
webappMappings['1002']=webappMappings['1002-2006AHW050INXSBU']={
webappId:    '1002',
documentId:  '2006',
internalId:  '2006AHW050INXSBU',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100406-081027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50201',
internalId:  '',
customField: '20100417-114613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3585',
internalId:  '',
customField: '20100417-105137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49101',
internalId:  '',
customField: '20100417-111714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '752',
internalId:  '',
customField: '20100406-081144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10869',
internalId:  '',
customField: '20100417-112610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11193',
internalId:  '',
customField: '20090820-143950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2006',
internalId:  '',
customField: '20070127-232903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20070127-232903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20100329-073522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3627',
internalId:  '',
customField: '20090917-203706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3669',
internalId:  '',
customField: '20100406-081751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3690',
internalId:  '',
customField: '20090115-141720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3711',
internalId:  '',
customField: '20090116-134933'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INXSBU';
var companyName   = 'Old+Town+Bakery%2C+Cafe+%26+Sweets';
var htmlTitle	  = 'Old+Town+Bakery%2C+Cafe++Sweets----offering+bakery+items%2C+sweets++candies+and+other+yummy+treats.+Your+one+stop+candy+and+bakery+shop%21wedding+cakes+all+occasioncakes+bouquets+favors+chocolate+lunch+sandwiches+soup+healthy';
var metaKeywords  = 'wedding+cakes%2C+wedding+favors%2Ccandy%2Csweets%2Ctreats%2Ccookies%2Cbaked+goods%2Cgoodies%2Cbouquets%2Ccakes%2Ccupcakes%2Cparties%2Cfudge%2Ccafe%2Cbread%2Cgifts%2Cdelivery%2C+shipping%2Ccatering%2Ctea%2C+coffee%2Ccocoa%2Ccookie+cakes%2C+ice+cream+cakes%2Clunch%2C+sandwiches%2C';
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();
};
