/* [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','601',jdecode('Home'),jdecode(''),'/601/index.html','true',[ 
		['PAGE','45601',jdecode('About+us'),jdecode(''),'/601/45601.html','true',[],'',''],
		['PAGE','5201',jdecode('Local+Board+'),jdecode(''),'/601/5201.html','true',[],'',''],
		['PAGE','12201',jdecode('Our+Team'),jdecode(''),'/601/12201.html','true',[],'','']
	],'',''],
	['PAGE','39501',jdecode('Feed+and+Farm'),jdecode(''),'/39501/index.html','true',[ 
		['PAGE','33501',jdecode('Legends+Horse+feed'),jdecode(''),'/39501/33501.html','true',[],'',''],
		['PAGE','35801',jdecode('Triple+Crown+Horse+feed'),jdecode(''),'/39501/35801.html','true',[],'',''],
		['PAGE','41601',jdecode('Reliance+horse+feed'),jdecode(''),'/39501/41601.html','true',[],'',''],
		['PAGE','39522',jdecode('Organic'),jdecode(''),'/39501/39522.html','true',[],'',''],
		['PAGE','39801',jdecode('Beef'),jdecode(''),'/39501/39801.html','true',[],'',''],
		['PAGE','46701',jdecode('Deer+feed'),jdecode(''),'/39501/46701.html','true',[],'',''],
		['PAGE','62301',jdecode('LLama+and+Alpaca+feeds'),jdecode(''),'/39501/62301.html','true',[],'',''],
		['PAGE','40101',jdecode('Mineral'),jdecode(''),'/39501/40101.html','true',[],'',''],
		['PAGE','66201',jdecode('Electric+fence'),jdecode(''),'/39501/66201.html','true',[],'',''],
		['PAGE','71201',jdecode('Horse+pastures'),jdecode(''),'/39501/71201.html','true',[],'',''],
		['PAGE','78166',jdecode('Poultry'),jdecode(''),'/39501/78166.html','true',[],'',''],
		['PAGE','78614',jdecode('Pet+food'),jdecode(''),'/39501/78614.html','true',[],'','']
	],'',''],
	['PAGE','45622',jdecode('Lawn+and+garden'),jdecode(''),'/45622/index.html','true',[ 
		['PAGE','68001',jdecode('Specials'),jdecode(''),'/45622/68001.html','true',[],'',''],
		['PAGE','55201',jdecode('Wild+Bird'),jdecode(''),'/45622/55201.html','true',[],'',''],
		['PAGE','58601',jdecode('Power+Equipment'),jdecode(''),'/45622/58601.html','true',[],'','']
	],'',''],
	['PAGE','71801',jdecode('Pet+'),jdecode(''),'/71801/index.html','true',[ 
		['PAGE','71822',jdecode('Cats'),jdecode(''),'/71801/71822.html','true',[],'',''],
		['PAGE','71843',jdecode('Dogs'),jdecode(''),'/71801/71843.html','true',[],'',''],
		['PAGE','71864',jdecode('Other+pets'),jdecode(''),'/71801/71864.html','true',[],'','']
	],'','']];
var siteelementCount=25;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10344';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5e5e5e';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10344',
				graphicsetId: 	'10448',
				contentColor: 	'FFFFFF',
				contentBGColor: '5e5e5e',
				a_color: 		'5E5E5E',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20100304-151638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20100401-162028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100401-161925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12201',
internalId:  '',
customField: '20100709-094053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39501',
internalId:  '',
customField: '20090614-135810'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33501',
internalId:  '',
customField: '20071011-091821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35801',
internalId:  '',
customField: '20070606-174405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41601',
internalId:  '',
customField: '20100304-153633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39522',
internalId:  '',
customField: '20070306-164655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39801',
internalId:  '',
customField: '20070312-123417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46701',
internalId:  '',
customField: '20100304-154220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62301',
internalId:  '',
customField: '20070607-105125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40101',
internalId:  '',
customField: '20090218-093405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66201',
internalId:  '',
customField: '20070731-142212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71201',
internalId:  '',
customField: '20071011-181041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78166',
internalId:  '',
customField: '20080705-140926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45622',
internalId:  '',
customField: '20100401-162222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68001',
internalId:  '',
customField: '20100709-094309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55201',
internalId:  '',
customField: '20100422-130103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58601',
internalId:  '',
customField: '20100401-170028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71801',
internalId:  '',
customField: '20100401-161429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71822',
internalId:  '',
customField: '20080719-142357'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71843',
internalId:  '',
customField: '20080719-145414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71864',
internalId:  '',
customField: '20080822-164353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78614',
internalId:  '',
customField: '20090103-122230'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXEAI';
var companyName   = 'Southern+States+Front+Royal+Coop';
var htmlTitle	  = 'Southern+States+Front+Royal+Coop';
var metaKeywords  = 'beef%2Chorse%2Cpet%2Ccat%2Cdog%2Crabbit%2Cfeed%2Cfood%2Clawn%2Cgarden%2Cfarm%2Cpasture%2Chay%2Cfertilizer%2Cchemicals%2Ccarhart%2Cclothing%2Ccaged+birds%2Cchickens%2Cturkeys%2Corganic%2Cseed%2Cvegetable%2Ccollars%2Cag+spraying%2Cliquid+nitrogen%2Cfencing%2Cfence+boards%2Coak%2Cpost+presure+treated%2Ccattle+handling+equipment%2Ccattle%2C+beef%2Cdairy%2Cberne%2Csouthern+states+front+%2C+gallagher+fence+controllers%2C+royal%2Ccoop%2Crat%2Cmice%2Cincest+pest%2Cbugs%2Cmowers%2Ccooperative%2Csouthern+states%2Cbeet+pulp';
var metaContents  = 'Pet+food%2CLegends%2Chorse+feed%2Cbeef+feed%2Ccat+food%2C+dog+food%2C+lawn+and+garden%2C+mowers%2C+chainsaws%2C+beet+pulp%2Corganic+feed';
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();
};
