/* [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','1674',jdecode('HOME'),jdecode(''), jdecode('%2F1674.html'), 'true',[],'',''],
	['PAGE','126270',jdecode('F.T.++RESULTS'),jdecode(''), jdecode('%2F126270.html'), 'true',[],'',''],
	['PAGE','185370',jdecode('FIELD+TRIALS+2011%2F12'),jdecode(''), jdecode('%2F185370.html'), 'false',[],'',''],
	['PAGE','1716',jdecode('FIELD+TRIAL+SECRETARYS'),jdecode(''), jdecode('%2F1716.html'), 'true',[],'',''],
	['PAGE','1748',jdecode('TRAINING+DAYS'),jdecode(''), jdecode('%2F1748.html'), 'true',[],'',''],
	['PAGE','238170',jdecode('Spring+pointing+tests'),jdecode(''), jdecode('%2F238170.html'), 'true',[],'',''],
	['PAGE','235170',jdecode('GUNDOG+WORKING+TESTS'),jdecode(''), jdecode('%2F235170.html'), 'true',[],'',''],
	['PAGE','233070',jdecode('SEMINARS'),jdecode(''), jdecode('%2F233070.html'), 'true',[],'',''],
	['PAGE','189670',jdecode('G+H+D+A'),jdecode(''), jdecode('%2F189670.html'), 'true',[],'',''],
	['PAGE','143770',jdecode('LINKS+'),jdecode(''), jdecode('%2F143770.html'), 'true',[],'',''],
	['PAGE','1769',jdecode('Contact'),jdecode(''), jdecode('%2F1769.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Favor';
theSitetree.paletteFamily='D2BD84';
theSitetree.keyvisualId='7345';
theSitetree.keyvisualName='kv_7345.jpg';
theSitetree.fontsetId='16467';
theSitetree.graphicsetId='12160';
theSitetree.contentColor='323232';
theSitetree.contentBGColor='F1EEDB';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk_ce',
  product: 'WSCSYSSSSLY0XKQS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Favor',
				paletteFamily: 	'D2BD84',
				keyvisualId: 	'7345',
				keyvisualName: 	'kv_7345.jpg',
				fontsetId: 		'16467',
				graphicsetId: 	'12160',
				contentColor: 	'323232',
				contentBGColor: 'F1EEDB',
				a_color: 		'000000',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-7937300a66fdfd348d25053d6f0e6b04']={
webappId:    '7060',
documentId:  '1716',
internalId:  '7937300a66fdfd348d25053d6f0e6b04',
customField: 'language:en;country:GB;'
};
webappMappings['7002']=webappMappings['7002-946']={
webappId:    '7002',
documentId:  '1748',
internalId:  '946',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-2401']={
webappId:    '7008',
documentId:  '1769',
internalId:  '2401',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1674',
internalId:  '',
customField: '20120203-143658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '185370',
internalId:  '',
customField: '20120107-192348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1716',
internalId:  '',
customField: '20111103-182546'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1674',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1748',
internalId:  '',
customField: '20120127-175131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1769',
internalId:  '',
customField: '20100821-093342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '238170',
internalId:  '',
customField: '20120127-175056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '235170',
internalId:  '',
customField: '20120118-181101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126270',
internalId:  '',
customField: '20120203-145212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143770',
internalId:  '',
customField: '20110305-145850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189670',
internalId:  '',
customField: '20110906-151930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '233070',
internalId:  '',
customField: '20111123-185427'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE4WO';
var companyName   = 'HUNT+POINT+AND+RETRIEVE+FIELD+TRIAL+INFORMATION';
var htmlTitle	  = 'HPRFTINFO+';
var metaKeywords  = 'hpr+ft+sec+.HPR++field+trials+Results+';
var metaContents  = 'all++field+trial+dates+and+results%2Fcompititions+for%0D%0A+HUNT+POINT+AND+RETREIVE+breeds';
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();
};

