/* [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','7801',jdecode('Home'),jdecode(''),'/7801.html','true',[],''],
	['PAGE','7852',jdecode('Lessons'),jdecode(''),'/7852/index.html','true',[ 
		['PAGE','7873',jdecode('Lesson+Calendar'),jdecode(''),'/7852/7873.html','true',[],'']
	],''],
	['PAGE','7894',jdecode('Staff'),jdecode(''),'/7894/index.html','true',[ 
		['PAGE','16501',jdecode('Schooling+Horses'),jdecode(''),'/7894/16501.html','true',[],'']
	],''],
	['PAGE','7915',jdecode('Training'),jdecode(''),'/7915.html','true',[],''],
	['PAGE','7936',jdecode('Custom+Freestyle+Design'),jdecode(''),'/7936.html','true',[],''],
	['PAGE','7957',jdecode('Sales'),jdecode(''),'/7957.html','true',[],''],
	['PAGE','7978',jdecode('Events'),jdecode(''),'/7978.html','true',[],''],
	['PAGE','15401',jdecode('Davlin+Farms'),jdecode(''),'/15401.html','true',[],''],
	['PAGE','7999',jdecode('Links'),jdecode(''),'/7999.html','true',[],''],
	['PAGE','8020',jdecode('Gallery'),jdecode(''),'/8020.html','true',[],''],
	['PAGE','8041',jdecode('Blog'),jdecode(''),'/8041.html','true',[],''],
	['PAGE','8062',jdecode('Discussion+Forum'),jdecode(''),'/8062.html','true',[],''],
	['PAGE','15422',jdecode('Fun+Stuff'),jdecode(''),'/15422.html','true',[],''],
	['PAGE','8083',jdecode('Guest+Book'),jdecode(''),'/8083.html','true',[],''],
	['PAGE','8104',jdecode('Contact+Us'),jdecode(''),'/8104.html','true',[],'']];
var siteelementCount=17;
theSitetree.topTemplateName='Pain';
theSitetree.paletteFamily='4C4C4C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10721';
theSitetree.graphicsetId='10551';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4C4C4C';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Pain',
				paletteFamily: 	'4C4C4C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10721',
				graphicsetId: 	'10551',
				contentColor: 	'FFFFFF',
				contentBGColor: '4C4C4C',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-99a6c6e3861545c5549de5517f165733']={
webappId:    '7060',
documentId:  '8020',
internalId:  '99a6c6e3861545c5549de5517f165733',
customField: 'language:en;country:US;'
};
webappMappings['7050']=webappMappings['7050-4304']={
webappId:    '7050',
documentId:  '8041',
internalId:  '4304',
customField: 'language:en;country:US;'
};
webappMappings['1003']=webappMappings['1003-aendu0ineciw11b965da467']={
webappId:    '1003',
documentId:  '8062',
internalId:  'aendu0ineciw11b965da467',
customField: 'en:US'
};
webappMappings['1002']=webappMappings['1002-8083aendu0ineciw']={
webappId:    '1002',
documentId:  '8083',
internalId:  '8083aendu0ineciw',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-7072']={
webappId:    '7008',
documentId:  '8104',
internalId:  '7072',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100517-124322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7852',
internalId:  '',
customField: '20100517-124419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7873',
internalId:  '',
customField: '20100517-125436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7894',
internalId:  '',
customField: '20100423-201353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7915',
internalId:  '',
customField: '20080814-122343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7936',
internalId:  '',
customField: '20080814-122832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7957',
internalId:  '',
customField: '20100423-201005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7978',
internalId:  '',
customField: '20090706-134608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7999',
internalId:  '',
customField: '20080902-165943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8020',
internalId:  '',
customField: '20080814-123610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8062',
internalId:  '',
customField: '20080814-123849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8041',
internalId:  '',
customField: '20080818-172844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8083',
internalId:  '',
customField: '20080814-123931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8104',
internalId:  '',
customField: '20080806-005424'
};
webappMappings['1501']=webappMappings['1501-11459011']={
webappId:    '1501',
documentId:  '7801',
internalId:  '11459011',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15401',
internalId:  '',
customField: '20080814-131016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15422',
internalId:  '',
customField: '20080902-164406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16501',
internalId:  '',
customField: '20100423-201712'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INECIW';
var companyName   = 'CK+Performance+Horses';
var htmlTitle	  = 'CK+Performance+Horses';
var metaKeywords  = 'riding+lessons+instruction+manitoba+chantelle+slater+kryschuk+CK+Performance+Horses+English+Western+Jumping+Dressage+Horses';
var metaContents  = 'Instruction+in+Western%2FEnglish+%28including+jumping%29.+CHA+Certified+Level+3+instructor+%2C27%2B+years+experience.+Tailored+lesson+programs+to+satisfy+private+and+group+requirements.+Clinic+instruction+is+also+available.+Serving+Eastman+and+surrounding+areas%2C+will+travel.+Please+feel+free+to+call+anytime.';
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();
};
