/* [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%2Findex.html'), 'true',[ 
		['PAGE','557',jdecode('Ask+the+Expert'),jdecode(''), jdecode('%2F401%2F557.html'), 'true',[],'',''],
		['PAGE','81901',jdecode('Testimonials'),jdecode(''), jdecode('%2F401%2F81901.html'), 'true',[],'',''],
		['PAGE','69301',jdecode('Associations'),jdecode(''), jdecode('%2F401%2F69301.html'), 'true',[],'',''],
		['PAGE','536',jdecode('Useful+Links'),jdecode(''), jdecode('%2F401%2F536.html'), 'true',[],'','']
	],'',''],
	['PAGE','452',jdecode('Quality'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','473',jdecode('Environmental'),jdecode(''), jdecode('%2F473.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Health+%26+Safety'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','75601',jdecode('Training'),jdecode(''), jdecode('%2F75601.html'), 'true',[],'',''],
	['PAGE','620',jdecode('Contact+Us'),jdecode(''), jdecode('%2F620.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Explore';
theSitetree.paletteFamily='248D03';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10633';
theSitetree.graphicsetId='10768';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Explore',
				paletteFamily: 	'248D03',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10633',
				graphicsetId: 	'10768',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110617-163241'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20110617-133953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20110617-134212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20110617-135109'
};
webappMappings['7008']=webappMappings['7008-1795']={
webappId:    '7008',
documentId:  '75601',
internalId:  '1795',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20110617-134404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20110617-140135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20110617-135312'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69301',
internalId:  '',
customField: '20110617-135532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75601',
internalId:  '',
customField: '20110617-134543'
};
webappMappings['7008']=webappMappings['7008-233']={
webappId:    '7008',
documentId:  '620',
internalId:  '233',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '401',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81901',
internalId:  '',
customField: '20110617-135424'
};
webappMappings['7008']=webappMappings['7008-4557']={
webappId:    '7008',
documentId:  '557',
internalId:  '4557',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '557',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '81901',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '69301',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '536',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '452',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '473',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '515',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '75601',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '620',
internalId:  '',
customField: 'language:en;country:GB;'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2QBY';
var companyName   = '....more+than+compliance';
var htmlTitle	  = '';
var metaKeywords  = 'FSC%2C+PEFC%2C+Chain+of+Custody%2C+Solutions-IMS%2C+Safety%2C+Portable+Appliance+Testing%2C+PAT+Testing%2C+Construction+Safety%2C+Health+and+Safety%2C+Health+and+Safety+Management%2C+Quality%2C+Quality+Management%2C+Environmental%2C+CDM+Coordinator%2C+PAT+testing%2C+training%2C+training+provision%2C+IOSH+training%2C+IOSH+working+safely%2C+Fire+risk+assessment%2C+Environmental+Management%2C+noise+assessment%2C+Management+Systems%2C+Consultants%2C+Consultancy%2C+Waste+Management%2C+Certification%2C+ISO%2C+Green+Dragon%2C+QMark%2C+Audits%2C+Data+Analysis%2C+Business+Bridgend%2C+Six+Sigma%2C+FMEA%2C+Process+Controls%2C+SPC%2C+System+Documentation%2C+Quality+Assurance%2C+Business+Support%2C+business+project+management%2C+business+management+consultants+uk%2C+business+management+consulting%2C+customer+satisfaction+theory%2C+quality+management+expert%2C+quality+management+consultants%2C+customer+satisfaction+training%2C+business+energy+efficiency%2C+environmental+management+services%2C+outsourced+environmental+management%2C+environmental+management+advisors%2C+environmental+management+uk%2C+business+efficiency+solutions%2C+workplace+risk+assessment%2C+risk+management+for+business%2C+financial+risk+assessment%2C+risk+assessment+uk%2C+machinery+risk+assessment%2C+control+and+process+solutions%2C+uk+process+control+systems%2C+process+control+engineering%2C+product+or+system+evaluation%2C+company+safety+policy%2C+company+security+policy%2C+gap+analysis+strategy+development%2C+system+auditing+expertise%2C+gap+analysis+tools%2C++www.solutions-ims.co.uk%2C+CDM%2C+Q+Mark%2C+NHSS4%2C+SIA%2C+SIA-ACS%2C+FSC%2C+TS16949%2C+HACCP%2C+food+safety%2C+kitemark%2C+Asbestos%2C+Asbestos+Register%2C+Asbestos+Survey';
var metaContents  = 'A+Bridgend+based+health%2C+safety%2C+quality+and+environmental+management+support+service%2C+specialising+in+building+and+maintaining+professional+and+affordable+systems.+A+One+Stop+Shop+for+all+of+your+quality%2C+environmental+and+health+and+safety+requirements%2C+developing+your+business+to+be+the+benchmark+for+others+within+your+field.+';
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();
};

