/* [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','4601',jdecode('Home'),jdecode(''),'/4601.html','true',[],'',''],
	['PAGE','4652',jdecode('About+us'),jdecode(''),'/4652.html','true',[],'',''],
	['PAGE','4782',jdecode('Client'),jdecode(''),'/4782.html','true',[],'',''],
	['PAGE','4756',jdecode('Candidate'),jdecode(''),'/4756.html','true',[],'',''],
	['PAGE','4730',jdecode('Contact+us'),jdecode(''),'/4730.html','true',[],'','']];
var siteelementCount=5;
theSitetree.topTemplateName='Impulse';
theSitetree.paletteFamily='84AACA';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10413';
theSitetree.graphicsetId='10679';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='84AACA';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Impulse',
				paletteFamily: 	'84AACA',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10413',
				graphicsetId: 	'10679',
				contentColor: 	'FFFFFF',
				contentBGColor: '84AACA',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'517695',
				e_color: 		'4A6C8B',
				f_color: 		'2F6999',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1745']={
webappId:    '7008',
documentId:  '4730',
internalId:  '1745',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4601',
internalId:  '',
customField: '20100714-140334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4652',
internalId:  '',
customField: '20100714-140518'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4782',
internalId:  '',
customField: '20080613-122350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4730',
internalId:  '',
customField: '20100714-152846'
};
webappMappings['1501']=webappMappings['1501-6337189']={
webappId:    '1501',
documentId:  '4601',
internalId:  '6337189',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4756',
internalId:  '',
customField: '20080612-140612'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2L3Q';
var companyName   = 'Animus+Personnel+';
var htmlTitle	  = 'Specialists+in+Recruitment+for+Health+Care%2C+Construction%2C+Civil+and+Building+Services+industries';
var metaKeywords  = 'Telecommunications%2C+IT%2C+Business%2C+Sales%2C++Recruitment+Consultancy%2CIT+%2CIT+recruitment%2C+management+jobs%2Ccomputer+jobs%2Ctechnology+jobs%2Ccontracts%2C+banking+jobs%2Cpublic+sector+jobs%2Csecurity+cleared+jobs%2C+financial+services+jobs%2C+mortgages%2C+boats%2CSecurity+Cleared+Jobs%2C+Security+Clearance%2C+Security+Vetting%2C+Government+Jobs%2C+Defence+Jobs%2C+IT+Jobs%2C+Career%2C+Vacancies%2C+MOD%2C+Ministry+of+Defence%2C+Military%2C+NATO%2C+Employment%2C+Nuclear%2C+Aviation%2C+Aerospace%2C+Cleared+Jobs%2C+Defense+Jobs%2C+Health+Care%2C+Civil+Engineering%2C+Building+Services%2C+Engineer%2C+Electrical%2C+Mechanical%2C+RGN%2C+RMN%2C+Care+Workers';
var metaContents  = 'An+independent+recruitment+consultancy+focused+on+delivering+first+class+service+to+its+clients+and+candidates';
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();
};
