/* [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','9601',jdecode('Home'),jdecode(''),'/9601.html','true',[],''],
	['PAGE','21022',jdecode('Boer+Goats'),jdecode(''),'/21022/index.html','true',[ 
		['PAGE','22701',jdecode('Boer+Goats+For+Sale'),jdecode(''),'/21022/22701.html','true',[],''],
		['PAGE','22901',jdecode('New+Kids'),jdecode(''),'/21022/22901.html','true',[],''],
		['PAGE','32201',jdecode('Boer+Goat+Links'),jdecode(''),'/21022/32201.html','true',[],'']
	],''],
	['PAGE','21001',jdecode('Grass-Fed+Beef'),jdecode(''),'/21001.html','true',[],''],
	['PAGE','21043',jdecode('Pastured+Poultry'),jdecode(''),'/21043.html','true',[],''],
	['PAGE','16901',jdecode('Contact+Us'),jdecode(''),'/16901.html','true',[],''],
	['PAGE','17001',jdecode('Please+sign+our+Guestbook'),jdecode(''),'/17001.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Intense';
theSitetree.paletteFamily='66956C';
theSitetree.keyvisualId='3496';
theSitetree.keyvisualName='kv_3496.jpg';
theSitetree.fontsetId='10439';
theSitetree.graphicsetId='10800';
theSitetree.contentColor='3F3F3F';
theSitetree.contentBGColor='B3D0B7';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Intense',
				paletteFamily: 	'66956C',
				keyvisualId: 	'3496',
				keyvisualName: 	'kv_3496.jpg',
				fontsetId: 		'10439',
				graphicsetId: 	'10800',
				contentColor: 	'3F3F3F',
				contentBGColor: 'B3D0B7',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'AD401A',
				e_color: 		'727171',
				f_color: 		'3F3F3F',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20091222-211237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22701',
internalId:  '',
customField: '20091231-030947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21043',
internalId:  '',
customField: '20091227-043514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17001',
internalId:  '',
customField: '20080818-200038'
};
webappMappings['7008']=webappMappings['7008-7543']={
webappId:    '7008',
documentId:  '16901',
internalId:  '7543',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21022',
internalId:  '',
customField: '20091231-031231'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9601',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-17001aendu0in2hol']={
webappId:    '1002',
documentId:  '17001',
internalId:  '17001aendu0in2hol',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32201',
internalId:  '',
customField: '20091229-170309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21001',
internalId:  '',
customField: '20091012-202251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16901',
internalId:  '',
customField: '20080818-200222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20091227-042941'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN2HOL';
var companyName   = 'KindleHope+Farm';
var htmlTitle	  = 'Welcome+to+Kindlehope+Farm';
var metaKeywords  = 'small+farm%2C+grass+fed+beef%2C+grass-fed+beef%2C+goat+meat%2C+chevon%2C+breeding+goats%2C+pasture+raised+poultry%2C+pasture-raised+poultry%2C+pastured+chicken%2C+chicken%2C+for+sale%2C+turkeys%2C+pasture+raised+turkeys%2C+humane+animal+treatment%2C+Washington%2C+Washington+state%2C+Chehalis%2C+WA%2C+Kindlehope%2C+Kindlehope+Farm%2C+fresh+eggs%2C+farm+fresh%2C+Boer+goat%2C+Hereford+cattle%2C+meat+chickens%2C+broilers%2C+fryers%2C+holiday+turkey%2C+meat+for+sale';
var metaContents  = 'Small+farm+specializing+in+grass+fed+beef+for+sale%2C+goats+for+sale+breeding+and+chevon%2C+and+pasture+raised+poultry.';
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();
};
