/* [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','6301',jdecode('Home'),jdecode(''),'/6301.html','true',[],''],
	['PAGE','13101',jdecode('About+Us'),jdecode(''),'/13101/index.html','true',[ 
		['PAGE','13122',jdecode('Breeding+Philosophy'),jdecode(''),'/13101/13122.html','true',[],''],
		['PAGE','13143',jdecode('Training+Methods'),jdecode(''),'/13101/13143.html','true',[],''],
		['PAGE','13164',jdecode('More+About+Lisa'),jdecode(''),'/13101/13164.html','true',[],''],
		['PAGE','31601',jdecode('More+About+Jack'),jdecode(''),'/13101/31601.html','true',[],'']
	],''],
	['PAGE','29801',jdecode('FOR+SALE+%22Sweet+Escape%22'),jdecode(''),'/29801.html','true',[],''],
	['PAGE','6394',jdecode('The+Pride+of+Gloster'),jdecode(''),'/6394.html','true',[],''],
	['PAGE','24701',jdecode('Gloster+Offspring'),jdecode(''),'/24701/index.html','true',[ 
		['PAGE','34501',jdecode('2010+Foals'),jdecode(''),'/24701/34501.html','true',[],''],
		['PAGE','15701',jdecode('2009+Foals'),jdecode(''),'/24701/15701.html','true',[],''],
		['PAGE','24722',jdecode('2005+Tully+Cross+Calieb+RID'),jdecode(''),'/24701/24722.html','true',[],''],
		['PAGE','24743',jdecode('2006+Dublin+Dan+RID'),jdecode(''),'/24701/24743.html','true',[],''],
		['PAGE','24764',jdecode('2008+FS+Clover+IDSH'),jdecode(''),'/24701/24764.html','true',[],''],
		['PAGE','6415',jdecode('07-08+Offspring'),jdecode(''),'/24701/6415.html','true',[],''],
		['PAGE','24806',jdecode('2003+Prescotts+Magnolia+RID'),jdecode(''),'/24701/24806.html','true',[],''],
		['PAGE','30822',jdecode('2003+%22Last+Legion%22++ISDH+'),jdecode(''),'/24701/30822.html','true',[],''],
		['PAGE','6436',jdecode('Breeding'),jdecode(''),'/24701/6436.html','true',[],''],
		['PAGE','6457',jdecode('More+Pictures'),jdecode(''),'/24701/6457.html','true',[],''],
		['PAGE','30801',jdecode('FOR+SALE+09+%22Shenanigan%22'),jdecode(''),'/24701/30801.html','true',[],'']
	],''],
	['PAGE','27401',jdecode('Sensual+Lena'),jdecode(''),'/27401.html','true',[],''],
	['PAGE','13185',jdecode('Irish+Horse+History'),jdecode(''),'/13185.html','true',[],''],
	['PAGE','7201',jdecode('Facility+and+Equine+Consulting'),jdecode(''),'/7201.html','true',[],'']];
var siteelementCount=23;
theSitetree.topTemplateName='Ornaments';
theSitetree.paletteFamily='3E8832';
theSitetree.keyvisualId='3894';
theSitetree.keyvisualName='kv_3894.jpg';
theSitetree.fontsetId='10493';
theSitetree.graphicsetId='11077';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Ornaments',
				paletteFamily: 	'3E8832',
				keyvisualId: 	'3894',
				keyvisualName: 	'kv_3894.jpg',
				fontsetId: 		'10493',
				graphicsetId: 	'11077',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'887248',
				e_color: 		'887248',
				f_color: 		'887248',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20100321-122749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6394',
internalId:  '',
customField: '20091231-144700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6415',
internalId:  '',
customField: '20091027-210301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6457',
internalId:  '',
customField: '20090405-205024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31601',
internalId:  '',
customField: '20091231-142542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6436',
internalId:  '',
customField: '20090405-170907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20090406-114213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20091231-141005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13122',
internalId:  '',
customField: '20090406-231017'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13143',
internalId:  '',
customField: '20090406-231114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13164',
internalId:  '',
customField: '20091231-141256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13185',
internalId:  '',
customField: '20090406-230600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24764',
internalId:  '',
customField: '20091027-202502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24722',
internalId:  '',
customField: '20091027-205922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24743',
internalId:  '',
customField: '20091027-202502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24701',
internalId:  '',
customField: '20091027-202955'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20090411-195749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24806',
internalId:  '',
customField: '20091027-202502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27401',
internalId:  '',
customField: '20091101-185708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20100126-184602'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30822',
internalId:  '',
customField: '20091129-135813'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30801',
internalId:  '',
customField: '20091129-144411'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3JGK';
var companyName   = 'Diamond+J+Ranch+Home+of+%22The+Pride+of+Gloster%22';
var htmlTitle	  = 'The+Pride+of+Gloster+RID';
var metaKeywords  = 'irish+draught+irish+sport+horse+warmblood+stallions+clover+hill+dressage+hunters+sport+ponies+kid+friendly+irish+stallion+eventing+lisa+parent+orkney+horses+for+sale+stud+the+pride+of+gloster+finncastle+farms+micheal+poulin';
var metaContents  = 'The+Pride+of+Gloster+is+the+only+RID+son+of+Clover+Hill+RID+standing+in+NA%21+';
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();
};
