/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','452',jdecode('News'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','38101',jdecode('Horses'),jdecode(''), jdecode('%2F38101%2Findex.html'), 'true',[ 
		['PAGE','494',jdecode('Broodmares+%26+Youngstock'),jdecode(''), jdecode('%2F38101%2F494.html'), 'true',[],'',''],
		['PAGE','536',jdecode('Racehorses'),jdecode(''), jdecode('%2F38101%2F536.html'), 'true',[],'',''],
		['PAGE','557',jdecode('Endurance+horses'),jdecode(''), jdecode('%2F38101%2F557.html'), 'true',[],'',''],
		['PAGE','23501',jdecode('Witchcombe+Showman'),jdecode(''), jdecode('%2F38101%2F23501.html'), 'true',[],'',''],
		['PAGE','32401',jdecode('Shetland+Ponies'),jdecode(''), jdecode('%2F38101%2F32401.html'), 'true',[],'',''],
		['PAGE','35601',jdecode('Redburn+Little+Sir+Echo+%28Our+Mini+Shetland+Stallion%29'),jdecode(''), jdecode('%2F38101%2F35601.html'), 'true',[],'',''],
		['PAGE','515',jdecode('RIP+Midnite+dream'),jdecode(''), jdecode('%2F38101%2F515.html'), 'true',[],'',''],
		['PAGE','620',jdecode('Horses+for+sale'),jdecode(''), jdecode('%2F38101%2F620.html'), 'true',[],'','']
	],'',''],
	['PAGE','38127',jdecode('Our+Dogs'),jdecode(''), jdecode('%2F38127%2Findex.html'), 'true',[ 
		['PAGE','29901',jdecode('Puppies+for+Sale'),jdecode(''), jdecode('%2F38127%2F29901.html'), 'true',[],'',''],
		['PAGE','35627',jdecode('Tanboree+Golden+Cruz+%28Poodle+Stud%29'),jdecode(''), jdecode('%2F38127%2F35627.html'), 'true',[],'',''],
		['PAGE','38153',jdecode('Cruz%26%23x27%3Bs+puppies'),jdecode(''), jdecode('%2F38127%2F38153.html'), 'true',[],'',''],
		['PAGE','35653',jdecode('Our+breeding+bitches'),jdecode(''), jdecode('%2F38127%2F35653.html'), 'true',[],'','']
	],'',''],
	['PAGE','11601',jdecode('Links'),jdecode(''), jdecode('%2F11601.html'), 'true',[],'',''],
	['PAGE','38179',jdecode('Contact+Details'),jdecode(''), jdecode('%2F38179.html'), 'true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Qben';
theSitetree.paletteFamily='AA7138';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='17183';
theSitetree.graphicsetId='12656';
theSitetree.contentColor='2E2E2E';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDH'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Qben',
				paletteFamily: 	'AA7138',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'17183',
				graphicsetId: 	'12656',
				contentColor: 	'2E2E2E',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'A7E333',
				e_color: 		'D28C7F',
				f_color: 		'A7E333',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110811-182027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20111031-214706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20081220-163856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20100613-183838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20090130-190526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20100613-184322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20100613-190425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29901',
internalId:  '',
customField: '20111123-151956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20111123-151635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20110811-182832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32401',
internalId:  '',
customField: '20100613-192607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35601',
internalId:  '',
customField: '20110811-183519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35627',
internalId:  '',
customField: '20100613-181917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35653',
internalId:  '',
customField: '20110811-182551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38179',
internalId:  '',
customField: '20100317-232035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38101',
internalId:  '',
customField: '20100317-232133'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38127',
internalId:  '',
customField: '20111031-215711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38153',
internalId:  '',
customField: '20100814-062118'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXSBR';
var companyName   = 'HILLSIDE+ARABIANS';
var htmlTitle	  = 'www.arabianracehorses.co.uk';
var metaKeywords  = 'Arab+Racehorses%2C++Arab+Stallion%2C++Endurance%2C+++Midnite+dream%2C++Carol+Legg%2C++Arab+Racing%2C++Mystic+Dream%2C+French+Lieutenant%2C+ARO+RACING%2C+ENDURANCE+GB';
var metaContents  = 'Arab+stud%2C+standing+Stallion+at+Stud%2C+competing+at+Endurance+and+Arab+Racing';
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();
};

