/* [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','7401',jdecode('Home'),jdecode(''),'/7401.html','true',[],'',''],
	['PAGE','7452',jdecode('About+us'),jdecode(''),'/7452.html','true',[],'',''],
	['PAGE','7515',jdecode('Horses'),jdecode(''),'/7515/index.html','true',[ 
		['PAGE','36301',jdecode('Becketts+Ladys+Man'),jdecode(''),'/7515/36301.html','true',[],'',''],
		['PAGE','45901',jdecode('A+Beau+Kane+Too'),jdecode(''),'/7515/45901.html','true',[],'',''],
		['PAGE','42401',jdecode('Sorcerer'),jdecode(''),'/7515/42401.html','true',[],'',''],
		['PAGE','42422',jdecode('Daisy+Dukes'),jdecode(''),'/7515/42422.html','true',[],'',''],
		['PAGE','36601',jdecode('Indigo'),jdecode(''),'/7515/36601.html','true',[],'',''],
		['PAGE','39943',jdecode('Blue+N+Fancy'),jdecode(''),'/7515/39943.html','true',[],'',''],
		['PAGE','18401',jdecode('Elegant+Treasure+'),jdecode(''),'/7515/18401.html','true',[],'',''],
		['PAGE','8543',jdecode('Malachit'),jdecode(''),'/7515/8543.html','true',[],'',''],
		['PAGE','39901',jdecode('SOLD+-+Shiloh'),jdecode(''),'/7515/39901.html','true',[],'',''],
		['PAGE','39922',jdecode('SOLD+-+Belle'),jdecode(''),'/7515/39922.html','true',[],'',''],
		['PAGE','22501',jdecode('SOLD+-+Relative+Time'),jdecode(''),'/7515/22501.html','true',[],'',''],
		['PAGE','27001',jdecode('SOLD+-+Collected+Canter'),jdecode(''),'/7515/27001.html','true',[],'',''],
		['PAGE','37101',jdecode('SOLD+-+One+Fancy+Zip'),jdecode(''),'/7515/37101.html','true',[],'',''],
		['PAGE','36001',jdecode('SOLD+-+Bo+Jangles++'),jdecode(''),'/7515/36001.html','true',[],'','']
	],'',''],
	['PAGE','7557',jdecode('Facilities'),jdecode(''),'/7557.html','true',[],'',''],
	['PAGE','12301',jdecode('Boarding'),jdecode(''),'/12301.html','true',[],'',''],
	['PAGE','12101',jdecode('Training'),jdecode(''),'/12101.html','true',[],'',''],
	['PAGE','7536',jdecode('Contact'),jdecode(''),'/7536.html','true',[],'',''],
	['PAGE','32501',jdecode('Farm+News'),jdecode(''),'/32501.html','true',[],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2E5D32';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10399';
theSitetree.graphicsetId='10612';
theSitetree.contentColor='BFA45F';
theSitetree.contentBGColor='2E5D32';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Draft',
				paletteFamily: 	'2E5D32',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10399',
				graphicsetId: 	'10612',
				contentColor: 	'BFA45F',
				contentBGColor: '2E5D32',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'92BD96',
				e_color: 		'BFA45F',
				f_color: 		'BFA45F',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20091011-153552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7515',
internalId:  '',
customField: '20100901-153010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7536',
internalId:  '',
customField: '20100412-074209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7557',
internalId:  '',
customField: '20100106-080318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7452',
internalId:  '',
customField: '20091013-073956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36301',
internalId:  '',
customField: '20100828-115448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39901',
internalId:  '',
customField: '20100802-145434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36001',
internalId:  '',
customField: '20100515-080027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20100901-153725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8543',
internalId:  '',
customField: '20100901-153324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20091011-153529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12301',
internalId:  '',
customField: '20100106-082705'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22501',
internalId:  '',
customField: '20091031-160807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27001',
internalId:  '',
customField: '20100224-181045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39922',
internalId:  '',
customField: '20100729-155415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32501',
internalId:  '',
customField: '20091224-150056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42401',
internalId:  '',
customField: '20100803-122902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36601',
internalId:  '',
customField: '20100726-161326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37101',
internalId:  '',
customField: '20100515-073410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39943',
internalId:  '',
customField: '20100802-145502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42422',
internalId:  '',
customField: '20100802-145421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45901',
internalId:  '',
customField: '20100828-114403'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INLESM';
var companyName   = 'Touch+of+Class+Farm';
var htmlTitle	  = '';
var metaKeywords  = 'horses+for+sale%2Cdressage%2Cquarterhorse%2Cboarding%2Chorses%2C+trail+horse%2C';
var metaContents  = 'Touch+of+Class+Farm+offers+horses+for+sale+and+dressage+training+with+USDF+judge+Barbara+Ebner.';
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();
};
