/* [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','2601',jdecode('Home'),jdecode(''), jdecode('%2F2601.html'), 'true',[],'',''],
	['PAGE','2652',jdecode('About+Us'),jdecode(''), jdecode('%2F2652.html'), 'true',[],'',''],
	['PAGE','11801',jdecode('Our+Products'),jdecode(''), jdecode('%2F11801%2Findex.html'), 'true',[ 
		['PAGE','2673',jdecode('Greenhouse'),jdecode(''), jdecode('%2F11801%2F2673.html'), 'true',[],'',''],
		['PAGE','8201',jdecode('Pork'),jdecode(''), jdecode('%2F11801%2F8201.html'), 'true',[],'',''],
		['PAGE','8222',jdecode('Poultry+'),jdecode(''), jdecode('%2F11801%2F8222.html'), 'true',[],'','']
	],'',''],
	['PAGE','31701',jdecode('Photo+Gallery'),jdecode(''), jdecode('%2F31701.html'), 'true',[],'',''],
	['PAGE','12501',jdecode('Greenhouse+Events'),jdecode(''), jdecode('%2F12501.html'), 'true',[],'',''],
	['PAGE','11822',jdecode('Our+Farm'),jdecode(''), jdecode('%2F11822.html'), 'false',[],'',''],
	['PAGE','5401',jdecode('Our+Services'),jdecode(''), jdecode('%2F5401.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Get+Directions'),jdecode(''), jdecode('%2F5301.html'), 'true',[],'',''],
	['PAGE','2715',jdecode('Customer+Registration'),jdecode(''), jdecode('%2F2715.html'), 'true',[],'',''],
	['PAGE','28701',jdecode('Hours+and+Days+open'),jdecode(''), jdecode('%2F28701.html'), 'true',[],'',''],
	['PAGE','15101',jdecode('Our+Location'),jdecode(''), jdecode('%2F15101.html'), 'false',[],'',''],
	['PAGE','27701',jdecode('Blog'),jdecode(''), jdecode('%2F27701.html'), 'true',[],'',''],
	['PAGE','30101',jdecode('our+Livestock'),jdecode(''), jdecode('%2F30101.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Hands';
theSitetree.paletteFamily='C4C468';
theSitetree.keyvisualId='7395';
theSitetree.keyvisualName='kv_7395.jpg';
theSitetree.fontsetId='16502';
theSitetree.graphicsetId='12165';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'netfirms',
  product: 'WSCSYSSSSLY0XYNE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Hands',
				paletteFamily: 	'C4C468',
				keyvisualId: 	'7395',
				keyvisualName: 	'kv_7395.jpg',
				fontsetId: 		'16502',
				graphicsetId: 	'12165',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-2715anfi20in21ba']={
webappId:    '1002',
documentId:  '2715',
internalId:  '2715anfi20in21ba',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2601',
internalId:  '',
customField: '20120113-105934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2673',
internalId:  '',
customField: '20120113-113207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100215-054013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2715',
internalId:  '',
customField: '20100216-050333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2652',
internalId:  '',
customField: '20120113-130422'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '5301',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20100215-015147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8201',
internalId:  '',
customField: '20120113-140135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8222',
internalId:  '',
customField: '20120113-113424'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '15101',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20110310-121207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11801',
internalId:  '',
customField: '20120108-090526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11822',
internalId:  '',
customField: '20100214-100820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15101',
internalId:  '',
customField: '20100215-042204'
};
webappMappings['7050']=webappMappings['7050-298']={
webappId:    '7050',
documentId:  '27701',
internalId:  '298',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-3821']={
webappId:    '7008',
documentId:  '12501',
internalId:  '3821',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20120108-095105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27701',
internalId:  '',
customField: '20110515-124618'
};
webappMappings['4001']=webappMappings['4001-18240726']={
webappId:    '4001',
documentId:  '30101',
internalId:  '18240726',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30101',
internalId:  '',
customField: '20120108-142516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20120108-095336'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'ANFI20IN21BA';
var companyName   = 'Little+Foot+Farm+and+Greenhouse';
var htmlTitle	  = 'Little+Foot+Farm+and+Greenhouse';
var metaKeywords  = 'greenhouse+Afton+Minnesota+Berkshire+Pork+Gloucestershire+Old+Spot+GOS+hog+pork+Organic+Minnesota+Grown+Free+Range+Karen+Weiss+Sally+Doherty+100%25+Berkshire++hog+heritage+chicken+heritage+pork+garden+breeder+breed+purebred+GOSA+GOS+America';
var metaContents  = 'Little+Foot+Farm+and+Greenhouse+is+in+Afton+Minnesota.+There+are+three+main+enterprises+in+operation%3A+retail+greenhouse+business+%28bedding+plants%2C+annuals%2C+perennials%2C+vegetables%29%2C+locally+grown+pork+%28purebred+Berkshire+Hogs++and+Gloucestershire+Old+Spot+hogs%29%2C+and+farm+fresh+eggs+from+our+heritage+breed+chickens.+';
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();
};

