/* [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','6801',jdecode('Home'),jdecode(''), jdecode('%2F6801.html'), 'true',[],'',''],
	['PAGE','55023',jdecode('About+Us'),jdecode(''), jdecode('%2F55023.html'), 'true',[],'',''],
	['PAGE','8922',jdecode('2012+Kidding+Sched.'),jdecode(''), jdecode('%2F8922.html'), 'true',[],'',''],
	['PAGE','73023',jdecode('For+Sale'),jdecode(''), jdecode('%2F73023.html'), 'true',[],'',''],
	['PAGE','73723',jdecode('Kid+Gallery'),jdecode(''), jdecode('%2F73723%2Findex.html'), 'true',[ 
		['PAGE','73044',jdecode('2011+Kids'),jdecode(''), jdecode('%2F73723%2F73044.html'), 'true',[],'','']
	],'',''],
	['PAGE','8901',jdecode('Does'),jdecode(''), jdecode('%2F8901%2Findex.html'), 'true',[ 
		['PAGE','51523',jdecode('Senior+Does'),jdecode(''), jdecode('%2F8901%2F51523.html'), 'true',[],'',''],
		['PAGE','51544',jdecode('First+Fresheners'),jdecode(''), jdecode('%2F8901%2F51544.html'), 'true',[],'',''],
		['PAGE','51565',jdecode('Junior+Does'),jdecode(''), jdecode('%2F8901%2F51565.html'), 'true',[],'','']
	],'',''],
	['PAGE','36125',jdecode('Bucks'),jdecode(''), jdecode('%2F36125.html'), 'true',[],'',''],
	['PAGE','46123',jdecode('Great+Pyrs+-+LGD'),jdecode(''), jdecode('%2F46123.html'), 'true',[],'',''],
	['PAGE','8943',jdecode('Other+Farm+Friends'),jdecode(''), jdecode('%2F8943%2Findex.html'), 'true',[ 
		['PAGE','23257',jdecode('Pet+Wethers'),jdecode(''), jdecode('%2F8943%2F23257.html'), 'true',[],'',''],
		['PAGE','38623',jdecode('Mini+Donkeys'),jdecode(''), jdecode('%2F8943%2F38623.html'), 'true',[],'',''],
		['PAGE','40923',jdecode('Chickens'),jdecode(''), jdecode('%2F8943%2F40923.html'), 'true',[],'','']
	],'',''],
	['PAGE','25255',jdecode('Photo+Gallery'),jdecode(''), jdecode('%2F25255%2Findex.html'), 'true',[ 
		['PAGE','46144',jdecode('The+Barn+2010'),jdecode(''), jdecode('%2F25255%2F46144.html'), 'true',[],'',''],
		['PAGE','21543',jdecode('Other+Farm+Photos'),jdecode(''), jdecode('%2F25255%2F21543.html'), 'true',[],'','']
	],'',''],
	['PAGE','20115',jdecode('Favorite+Links'),jdecode(''), jdecode('%2F20115.html'), 'true',[],'',''],
	['PAGE','21743',jdecode('Helpful+Terms'),jdecode(''), jdecode('%2F21743.html'), 'true',[],'',''],
	['PAGE','27725',jdecode('Guestbook'),jdecode(''), jdecode('%2F27725.html'), 'true',[],'',''],
	['PAGE','31525',jdecode('Lady'),jdecode(''), jdecode('%2F31525.html'), 'false',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='BB9C60';
theSitetree.keyvisualId='2224';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='364';
theSitetree.graphicsetId='417';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='BB9C60';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'fatcow',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Enjoy',
				paletteFamily: 	'BB9C60',
				keyvisualId: 	'2224',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'364',
				graphicsetId: 	'417',
				contentColor: 	'000000',
				contentBGColor: 'BB9C60',
				a_color: 		'BB9C60',
				b_color: 		'FFFFFF',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20120111-050355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20110114-043446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8943',
internalId:  '',
customField: '20100123-070114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51565',
internalId:  '',
customField: '20111116-051034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8922',
internalId:  '',
customField: '20120111-052722'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20115',
internalId:  '',
customField: '20110609-200952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21543',
internalId:  '',
customField: '20100120-065235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21743',
internalId:  '',
customField: '20100126-185337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23257',
internalId:  '',
customField: '20110110-054132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25255',
internalId:  '',
customField: '20100610-062643'
};
webappMappings['1002']=webappMappings['1002-27725aendu0invgne']={
webappId:    '1002',
documentId:  '27725',
internalId:  '27725aendu0invgne',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27725',
internalId:  '',
customField: '20100122-091428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31525',
internalId:  '',
customField: '20100130-183901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36125',
internalId:  '',
customField: '20110513-052007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38623',
internalId:  '',
customField: '20101117-055022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40923',
internalId:  '',
customField: '20101027-051642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46123',
internalId:  '',
customField: '20110120-052302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46144',
internalId:  '',
customField: '20111025-051931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51523',
internalId:  '',
customField: '20111116-050852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51544',
internalId:  '',
customField: '20111231-135915'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55023',
internalId:  '',
customField: '20110204-051830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73023',
internalId:  '',
customField: '20111231-141511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73044',
internalId:  '',
customField: '20120111-051920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73723',
internalId:  '',
customField: '20120111-050837'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INVGNE';
var companyName   = 'Shailey+Hill+Farm';
var htmlTitle	  = '';
var metaKeywords  = 'nigerian%2C+dwarf%2C+goats%2C+New+Hampshire%2C+New+England%2C+kids';
var metaContents  = 'Shailey+Hill+Farm%2C+breeding+Nigerian+dwarf+goats+for+pet%2C+show+and+dairy.';
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();
};

