/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],''],
	['PAGE','7401',jdecode('About+Us'),jdecode(''),'/7401.html','true',[],''],
	['PAGE','7422',jdecode('Our+Garlic'),jdecode(''),'/7422.html','true',[],''],
	['PAGE','7443',jdecode('Try+Our+Garlic'),jdecode(''),'/7443.html','true',[],''],
	['PAGE','12401',jdecode('Growing+Garlic'),jdecode(''),'/12401/index.html','true',[ 
		['PAGE','16101',jdecode('Seed%2C+Soil+%26+Fertilizer'),jdecode(''),'/12401/16101.html','true',[],''],
		['PAGE','17001',jdecode('Planting+and+Growing'),jdecode(''),'/12401/17001.html','true',[],''],
		['PAGE','17801',jdecode('Harvest+%26+Storing'),jdecode(''),'/12401/17801.html','true',[],'']
	],''],
	['PAGE','11201',jdecode('Recipes'),jdecode(''),'/11201.html','true',[],''],
	['PAGE','22601',jdecode('Gratitude'),jdecode(''),'/22601.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Cuy';
theSitetree.paletteFamily='F7FDFD';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='385';
theSitetree.graphicsetId='438';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F7FDFD';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Cuy',
				paletteFamily: 	'F7FDFD',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'385',
				graphicsetId: 	'438',
				contentColor: 	'000000',
				contentBGColor: 'F7FDFD',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'F7FDFD',
				b_color: 		'E4E5C0',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-73']={
webappId:    '7008',
documentId:  '7401',
internalId:  '73',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100716-010013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20100314-165635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7422',
internalId:  '',
customField: '20100314-165706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7443',
internalId:  '',
customField: '20100314-165721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20100314-165736'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20100314-165751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17001',
internalId:  '',
customField: '20100314-165818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20100314-165834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20100103-075423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20100314-165854'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH020IN20PE';
var companyName   = 'Yes...We+Grow+Garlic....in+Wisconsin...and+it%27s+really+great+too%21++++++++++++++++++++++++++++++++++++';
var htmlTitle	  = 'We+grow+great+garlic+in+Wisconsin';
var metaKeywords  = 'verify-v1+TcjE4XeJIS9xNPunCz8B9odEUorT3DcH2ajf%2BPoYmNY%3D+%2Fgarlic%2C+Wisconsin%2C+growing+garlic%2C+seed+garlic%2C+eating+garlic%2C+garlic+varieties%2C+growing+garlic+in+Wisconsin%2C+growing+garlic+in+northern+climate%2C+garlic+farm%2C+garlic+source%2C+Madison%2C+fresh+produce%2C+great+garlic%2C+garlic+recipes%2C+garlic+scape+recipes%2C+scape+recipes%2C+we+grow+garlic%2C+how+to+grow+garlic%2C+Silver+White%2C+Asian+Tempest%2C+Martins+Heirloom%2C+Spanish+Roja%2C+Purple+Glazer%2C+Music+garlic%2C+Slovenian+garlic%2C+Carpathian+garlic%2C+Leningrad+garlic%2C+Russian+Red%2C+Siberian+garlic%2C+Simonetti%2C+German+Porcelain%2C+Schumacher+garlic%2C+Romanian+Red%2C+Vostani%2C+Pennsylvania+Dutch+garlic%2C+German+Red+garlic%2C+Georgian+Crystal%2C+Chesnok+Red%2C+Rosewood+garlic%2C+Pink+Music%2C+Legacy+garlic%2C+Transylvanian+garlic%2C+Italian+Late%2C+Tzan%2C+Red+Toch%2C+Red+Janice%2C+Chinese+Purple%2C+Inchellium%2C+all+about+garlic%2C+Madison%2C+WI%2C+Madison+WI%2C+Dane+Co%2C+Columbia+Co%2C+Madison+garlic%2C+Deforest%2C+Deforest+WI%2C+Deforest+garlic%2C+locally+grown+garlic%2C+home+grown+garlic%2C+garlic+grower+in+Wisconsin%2C+garlic+grower+in+Madison%2C+garlic+grower%2C+Wisconsin+produce%2C+Wisconsin+fresh+produce%2C+garlic+farm%2C+garlic+farming%2C+growing+garlic%2C+garlic+producer%2C+fresh+garlic%2C+garlic+scapes%2C+scapes%2C+how+to+grow+garlic+in+Wisconsin%2C+Wisconsin+garlic%2C+growing+garlic+in+cold+climate%2C+buy+garlic%2C+eat+garlic%2C+sell+garlic%2C+grow+garlic+bulbs%2C+we+grow+garlic+varieties%2C+grow+garlic+cloves%2C+grow+garlic+seed%2C+garlic+harvest';
var metaContents  = 'Information+on+our+Wisconsin+grown+garlic+and+the+varieties+we+grow+as+well+as+tips+for+growing+garlic+in+a+cold+northern+climate.++Listing+of+garlic+that+we+have+available.';
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();
};
