/* [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','98',jdecode('Home'),jdecode(''), jdecode('%2F98%2Findex.html'), 'true',[ 
		['PAGE','1491',jdecode('About+us'),jdecode(''), jdecode('%2F98%2F1491.html'), 'true',[],'','']
	],'',''],
	['PAGE','1428',jdecode('Mustangs'),jdecode(''), jdecode('%2F1428%2Findex.html'), 'true',[ 
		['PAGE','1905',jdecode('BEFORE+%26+AFTER'),jdecode(''), jdecode('%2F1428%2F1905.html'), 'true',[],'','']
	],'',''],
	['PAGE','5701',jdecode('Nitro%26%23x27%3Bs+Story'),jdecode(''), jdecode('%2F5701%2Findex.html'), 'true',[ 
		['PAGE','17401',jdecode('More+Nitro'),jdecode(''), jdecode('%2F5701%2F17401.html'), 'true',[],'','']
	],'',''],
	['PAGE','7801',jdecode('How+you+can+help'),jdecode(''), jdecode('%2F7801.html'), 'true',[],'',''],
	['PAGE','16101',jdecode('Contact+us+%26+Links'),jdecode(''), jdecode('%2F16101.html'), 'true',[],'',''],
	['PAGE','438',jdecode('Guestbook'),jdecode(''), jdecode('%2F438%2Findex.html'), 'true',[ 
		['PAGE','29301',jdecode('ENVIRONMENTAL+REALITY'),jdecode(''), jdecode('%2F438%2F29301.html'), 'true',[],'','']
	],'',''],
	['PAGE','437',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F437.html'), 'false',[],'',''],
	['PAGE','63101',jdecode('Use+Our+Credit+Card'),jdecode(''), jdecode('%2F63101.html'), 'true',[],'',''],
	['PAGE','67301',jdecode('Latest+news'),jdecode(''), jdecode('%2F67301.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Linear';
theSitetree.paletteFamily='993300';
theSitetree.keyvisualId='2186';
theSitetree.keyvisualName='art.jpg';
theSitetree.fontsetId='361';
theSitetree.graphicsetId='412';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333300';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'optimum',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Linear',
				paletteFamily: 	'993300',
				keyvisualId: 	'2186',
				keyvisualName: 	'art.jpg',
				fontsetId: 		'361',
				graphicsetId: 	'412',
				contentColor: 	'FFFFFF',
				contentBGColor: '333300',
				a_color: 		'003333',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'99CC66',
				e_color: 		'CCFF66',
				f_color: 		'669966',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1428',
internalId:  '',
customField: '20100103-144951'
};
webappMappings['1002']=webappMappings['1002-438AHW050INX2KZ']={
webappId:    '1002',
documentId:  '438',
internalId:  '438AHW050INX2KZ',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '98',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20081213-193920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1491',
internalId:  '',
customField: '20090301-164024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63101',
internalId:  '',
customField: '20090728-062712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67301',
internalId:  '',
customField: '20100205-174206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98',
internalId:  '',
customField: '20090201-184800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1905',
internalId:  '',
customField: '20080626-202207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20110114-191049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20100414-164825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '438',
internalId:  '',
customField: '20060508-230812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '437',
internalId:  '',
customField: '20060508-230812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20090122-215013'
};
webappMappings['7050']=webappMappings['7050-284']={
webappId:    '7050',
documentId:  '29301',
internalId:  '284',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29301',
internalId:  '',
customField: '20081208-222401'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INX2KZ';
var companyName   = 'HORSESAVERS';
var htmlTitle	  = 'HORSESAVERS';
var metaKeywords  = 'horse+rescue%2C+environment%2C+';
var metaContents  = 'horse+rescue';
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();
};

