/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','5701',jdecode('About+Us'),jdecode(''),'/5701.html','true',[],''],
	['PAGE','5722',jdecode('Contact+Us'),jdecode(''),'/5722.html','true',[],''],
	['PAGE','15101',jdecode('Testimonials'),jdecode(''),'/15101.html','true',[],''],
	['PAGE','13101',jdecode('Wedding+Cakes'),jdecode(''),'/13101.html','true',[],''],
	['PAGE','14601',jdecode('Groom%26%23x27%3Bs+Cakes'),jdecode(''),'/14601.html','true',[],''],
	['PAGE','14843',jdecode('Birthday+Cakes'),jdecode(''),'/14843.html','true',[],''],
	['PAGE','14822',jdecode('Anniversary+Cakes'),jdecode(''),'/14822.html','true',[],''],
	['PAGE','15122',jdecode('Baby+Shower+Cakes'),jdecode(''),'/15122.html','true',[],''],
	['PAGE','15143',jdecode('Seasonal+Cakes'),jdecode(''),'/15143.html','true',[],''],
	['PAGE','15164',jdecode('Bridal+Shower+Cakes'),jdecode(''),'/15164.html','true',[],''],
	['PAGE','15185',jdecode('Miscellaneous+Cakes'),jdecode(''),'/15185.html','true',[],''],
	['PAGE','15206',jdecode('Cupcake+Cakes+%26+Cupcakes'),jdecode(''),'/15206.html','true',[],'']];
var siteelementCount=13;
theSitetree.topTemplateName='Round';
theSitetree.paletteFamily='CC3333';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='439';
theSitetree.graphicsetId='495';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='e47272';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Round',
				paletteFamily: 	'CC3333',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'439',
				graphicsetId: 	'495',
				contentColor: 	'000000',
				contentBGColor: 'e47272',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'e47272',
				b_color: 		'CC3333',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-20569']={
webappId:    '7008',
documentId:  '5722',
internalId:  '20569',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14843',
internalId:  '',
customField: '20091028-151654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100706-011136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20091029-145700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5722',
internalId:  '',
customField: '20091027-120603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14601',
internalId:  '',
customField: '20091028-141124'
};
webappMappings['7060']=webappMappings['7060-bf1d92a36470d2bd489b279b340dce80']={
webappId:    '7060',
documentId:  '13101',
internalId:  'bf1d92a36470d2bd489b279b340dce80',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20091028-043817'
};
webappMappings['7060']=webappMappings['7060-b3e9353ff865aad23893850b3d7a35f0']={
webappId:    '7060',
documentId:  '14601',
internalId:  'b3e9353ff865aad23893850b3d7a35f0',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-4edd9ce5a97ab69e29fc5658652bb8b2']={
webappId:    '7060',
documentId:  '14843',
internalId:  '4edd9ce5a97ab69e29fc5658652bb8b2',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14822',
internalId:  '',
customField: '20100621-104900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15122',
internalId:  '',
customField: '20091028-151756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15143',
internalId:  '',
customField: '20091028-153046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15164',
internalId:  '',
customField: '20091028-153116'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15185',
internalId:  '',
customField: '20091028-153138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15206',
internalId:  '',
customField: '20091028-153206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15101',
internalId:  '',
customField: '20100707-204211'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INV048';
var companyName   = 'Creative+Cakes';
var htmlTitle	  = '';
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();
};
