/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','26901',jdecode('New+Store+'),jdecode(''),'/26901.html','true',[],''],
	['PAGE','39201',jdecode('Chef+Matt+Products'),jdecode(''),'/39201.html','true',[],''],
	['PAGE','46557',jdecode('Recipe+Forum'),jdecode(''),'/46557.html','true',[],''],
	['PAGE','24422',jdecode('Links+to+Friends'),jdecode(''),'/24422.html','true',[],''],
	['PAGE','746',jdecode('Contact+Us'),jdecode(''),'/746.html','true',[],''],
	['PAGE','37801',jdecode('About+Chef+Matt'),jdecode(''),'/37801.html','true',[],''],
	['PAGE','683',jdecode('Awards+%26+Reviews'),jdecode(''),'/683.html','true',[],''],
	['PAGE','16806',jdecode('Guestbook'),jdecode(''),'/16806/index.html','true',[ 
		['PAGE','16801',jdecode('Read+Guestbook'),jdecode(''),'/16806/16801.html','false',[],'']
	],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Zoe';
theSitetree.paletteFamily='B06021';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='412';
theSitetree.graphicsetId='457';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Zoe',
				paletteFamily: 	'B06021',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'412',
				graphicsetId: 	'457',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'B76301',
				e_color: 		'794202',
				f_color: 		'F5E204',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1003']=webappMappings['1003-aendu0in2cuz117c390a9fd']={
webappId:    '1003',
documentId:  '46557',
internalId:  'aendu0in2cuz117c390a9fd',
customField: 'en:US'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-3177521']={
webappId:    '1501',
documentId:  '401',
internalId:  '3177521',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37801',
internalId:  '',
customField: '20081022-224618'
};
webappMappings['1002']=webappMappings['1002-16806aendu0in2cuz']={
webappId:    '1002',
documentId:  '16806',
internalId:  '16806aendu0in2cuz',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-2655']={
webappId:    '7008',
documentId:  '746',
internalId:  '2655',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20091007-144704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20081025-162759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '746',
internalId:  '',
customField: '20080212-003713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39201',
internalId:  '',
customField: '20081128-213422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '683',
internalId:  '',
customField: '20081122-133833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16806',
internalId:  '',
customField: '20081016-125911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16801',
internalId:  '',
customField: '20080128-224852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46557',
internalId:  '',
customField: '20081109-120412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24422',
internalId:  '',
customField: '20081204-124314'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2CUZ';
var companyName   = 'Chef+Matt%27s+BBQ+Sauces+and+Online+Store';
var htmlTitle	  = 'Chef+Matts+BBQ+Sauces';
var metaKeywords  = 'Scovie+award%2C+winner%2C+Hot+BBQ%2CFiery+Foods%2C+Albuquerque%2CArizona%2CChef+Matt%2CHabanero%2CSauce%2CHoney%2CFlavor%2CFresh%2CBeer%2C%2CTexas+Hold+em+All+In+No+Limit+Hot+Sauce%2CGourmet+BBQ+Sauces%2C+%2CTucson%2C%2C';
var metaContents  = 'Chef+Matts+BBQ+Sauces+located+in+Tucson+Arizona+specializing+in+Honey+Habanero+BBQ+Sauces+and+Hot+Sauces.+Promotional+Products+to+leave+a+lasting+impression+on+your+clients+for+far+longer+than+any+business+card.Creator+of+the+Original+Texas+Hold+em+All+In+No+Limit+Hot+Sauce.+Originator+of+the+Thank+You+BBQ+sauce.Scovie+Award+winner+for+HOT+BBQ+Sauce.';
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();
};
