/* [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','14901',jdecode('HOME'),jdecode(''), jdecode('%2F14901.html'), 'true',[],'',''],
	['PAGE','14973',jdecode('WORMS+'),jdecode(''), jdecode('%2F14973%2Findex.html'), 'true',[ 
		['PAGE','15015',jdecode('RED+HOT+CRAWLERS'),jdecode(''), jdecode('%2F14973%2F15015.html'), 'true',[],'','']
	],'',''],
	['PAGE','57601',jdecode('COMPOST+AND+CASTINGS'),jdecode(''), jdecode('%2F57601%2Findex.html'), 'true',[ 
		['PAGE','14994',jdecode('SOIL+BUILDER'),jdecode(''), jdecode('%2F57601%2F14994.html'), 'true',[],'',''],
		['PAGE','34601',jdecode('COMPOST%2FREFUSE'),jdecode(''), jdecode('%2F57601%2F34601.html'), 'true',[],'',''],
		['PAGE','42801',jdecode('HOME+COMPOSTING+KITS'),jdecode(''), jdecode('%2F57601%2F42801.html'), 'true',[],'','']
	],'',''],
	['PAGE','47201',jdecode('COLD+COMPRESS+SOAP'),jdecode(''), jdecode('%2F47201.html'), 'false',[],'',''],
	['PAGE','57101',jdecode('LANDSCAPING'),jdecode(''), jdecode('%2F57101.html'), 'true',[],'',''],
	['PAGE','48101',jdecode('POULTRY'),jdecode(''), jdecode('%2F48101.html'), 'true',[],'',''],
	['PAGE','41601',jdecode('EVENTS'),jdecode(''), jdecode('%2F41601.html'), 'true',[],'',''],
	['PAGE','34201',jdecode('SPECIALS'),jdecode(''), jdecode('%2F34201.html'), 'false',[],'',''],
	['PAGE','36401',jdecode('EXTREME+MAKEOVER'),jdecode(''), jdecode('%2F36401.html'), 'false',[],'',''],
	['PAGE','35901',jdecode('BRAG+BOARD'),jdecode(''), jdecode('%2F35901.html'), 'false',[],'',''],
	['PAGE','39901',jdecode('WORM+COCOONS'),jdecode(''), jdecode('%2F39901.html'), 'false',[],'',''],
	['PAGE','15057',jdecode('PURCHASE'),jdecode(''), jdecode('%2F15057.html'), 'true',[],'',''],
	['PAGE','40822',jdecode('OTHER+LINKS'),jdecode(''), jdecode('%2F40822.html'), 'true',[],'',''],
	['PAGE','40801',jdecode('GUESTBOOK'),jdecode(''), jdecode('%2F40801.html'), 'true',[],'',''],
	['PAGE','15036',jdecode('CUSTOMER+SERVICE'),jdecode(''), jdecode('%2F15036.html'), 'true',[],'',''],
	['PAGE','14952',jdecode('ABOUT+US'),jdecode(''), jdecode('%2F14952.html'), 'false',[],'',''],
	['PAGE','15078',jdecode('CONTACT'),jdecode(''), jdecode('%2F15078.html'), 'true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Trade';
theSitetree.paletteFamily='4D8DBD';
theSitetree.keyvisualId='12119';
theSitetree.keyvisualName='kv_12119.jpg';
theSitetree.fontsetId='33299';
theSitetree.graphicsetId='14174';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRNU'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Trade',
				paletteFamily: 	'4D8DBD',
				keyvisualId: 	'12119',
				keyvisualName: 	'kv_12119.jpg',
				fontsetId: 		'33299',
				graphicsetId: 	'14174',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				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:  '57101',
internalId:  '',
customField: '20120120-121201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20120120-121912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14952',
internalId:  '',
customField: '20090702-113948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15078',
internalId:  '',
customField: '20120120-121608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15036',
internalId:  '',
customField: '20100326-162150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15057',
internalId:  '',
customField: '20120120-121438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14973',
internalId:  '',
customField: '20120128-150432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15015',
internalId:  '',
customField: '20110130-120703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14994',
internalId:  '',
customField: '20120111-090334'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '14901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34201',
internalId:  '',
customField: '20091106-210311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20120111-091637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35901',
internalId:  '',
customField: '20120111-091030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36401',
internalId:  '',
customField: '20110130-122711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39901',
internalId:  '',
customField: '20091026-191420'
};
webappMappings['1002']=webappMappings['1002-40801aendu0in32mb']={
webappId:    '1002',
documentId:  '40801',
internalId:  '40801aendu0in32mb',
customField: 'icq=false'
};
webappMappings['7050']=webappMappings['7050-13121']={
webappId:    '7050',
documentId:  '40822',
internalId:  '13121',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40801',
internalId:  '',
customField: '20091029-193308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40822',
internalId:  '',
customField: '20091029-202406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41601',
internalId:  '',
customField: '20120201-171156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42801',
internalId:  '',
customField: '20120128-152617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47201',
internalId:  '',
customField: '20110320-153342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48101',
internalId:  '',
customField: '20120128-152747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57601',
internalId:  '',
customField: '20120128-151338'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN32MB';
var companyName   = 'WHITETAIL+ORGANICS+++++++++++++Meeting+your+fishing+and+growing+needs%21%21%21';
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();
};

