/* [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','10301',jdecode('Home'),jdecode(''),'/10301.html','true',[],'',''],
	['PAGE','10373',jdecode('Services'),jdecode(''),'/10373.html','true',[],'',''],
	['PAGE','10394',jdecode('News'),jdecode(''),'/10394.html','true',[],'',''],
	['PAGE','10415',jdecode('The+Girls'),jdecode(''),'/10415.html','true',[],'',''],
	['PAGE','10436',jdecode('The+Boys'),jdecode(''),'/10436.html','true',[],'',''],
	['PAGE','10457',jdecode('Journal'),jdecode(''),'/10457.html','true',[],'',''],
	['PAGE','10478',jdecode('Contact'),jdecode(''),'/10478.html','true',[],'',''],
	['PAGE','13701',jdecode('For+Sale'),jdecode(''),'/13701.html','false',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Applicant';
theSitetree.paletteFamily='7890D7';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26575';
theSitetree.graphicsetId='13383';
theSitetree.contentColor='4C4C4C';
theSitetree.contentBGColor='becefd';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Applicant',
				paletteFamily: 	'7890D7',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26575',
				graphicsetId: 	'13383',
				contentColor: 	'4C4C4C',
				contentBGColor: 'becefd',
				a_color: 		'7890D7',
				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['7050']=webappMappings['7050-17897']={
webappId:    '7050',
documentId:  '10457',
internalId:  '17897',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20100821-105703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10373',
internalId:  '',
customField: '20100816-175306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10394',
internalId:  '',
customField: '20100821-111826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10415',
internalId:  '',
customField: '20100821-110908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10436',
internalId:  '',
customField: '20100821-110157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10457',
internalId:  '',
customField: '20100821-111128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10478',
internalId:  '',
customField: '20100821-111642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13701',
internalId:  '',
customField: '20100818-212253'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10301',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10373',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10394',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10415',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10436',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10457',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10478',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '13701',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INZCP7';
var companyName   = 'Eagle+Creek+Farm';
var htmlTitle	  = 'Eagle+Creek+Farm';
var metaKeywords  = 'Eagle+Creek+Farm%2C+Temple%2C+NH%2C+New+Hampshire%2C+horse%2C+school%2C+equine%2C+horses%2C+riding%2C+horse+training+lessons%2C+riding+lessons+';
var metaContents  = 'Eagle+Creek+Farm+is+located+in+Temple%2C+NH.+We+specialize+in+training+horse+enthusiasts+to+ride+in+a+safe+and+stress-free+environment.+We+offer+riding+instruction+for+any+age+level%2C+beginner+to+advanced.+Our+instructors+are+experienced+and+eager+to+teach.';
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();
};

