/* [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','4701',jdecode('Home'),jdecode(''),'/4701.html','true',[],'',''],
	['PAGE','4752',jdecode('Products+%26+Service'),jdecode(''),'/4752/index.html','true',[ 
		['PAGE','5701',jdecode('Equipment+Supply'),jdecode(''),'/4752/5701.html','true',[],'',''],
		['PAGE','5727',jdecode('Financing'),jdecode(''),'/4752/5727.html','true',[],'',''],
		['PAGE','7601',jdecode('Why+Lease'),jdecode(''),'/4752/7601.html','true',[],'','']
	],'',''],
	['PAGE','4778',jdecode('Contact'),jdecode(''),'/4778.html','true',[],'',''],
	['PAGE','4804',jdecode('About+us'),jdecode(''),'/4804.html','true',[],'',''],
	['PAGE','4830',jdecode('Jobs'),jdecode(''),'/4830.html','true',[],'',''],
	['PAGE','4856',jdecode('Partner+Page'),jdecode(''),'/4856.html','true',[],'',''],
	['PAGE','4882',jdecode('News'),jdecode(''),'/4882.html','true',[],'',''],
	['PAGE','8501',jdecode('Terms+%26+Conditions'),jdecode(''),'/8501/index.html','true',[ 
		['PAGE','8527',jdecode('AUP'),jdecode(''),'/8501/8527.html','true',[],'',''],
		['PAGE','9101',jdecode('Privacy+Statements'),jdecode(''),'/8501/9101.html','true',[],'',''],
		['PAGE','9127',jdecode('Legal+Notices'),jdecode(''),'/8501/9127.html','true',[],'','']
	],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Moonflight';
theSitetree.paletteFamily='5B7A93';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='445';
theSitetree.graphicsetId='499';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Moonflight',
				paletteFamily: 	'5B7A93',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'445',
				graphicsetId: 	'499',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'2C5574',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20090914-124511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4752',
internalId:  '',
customField: '20090914-131831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20090914-132830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5727',
internalId:  '',
customField: '20090914-135046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4778',
internalId:  '',
customField: '20090914-125528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4804',
internalId:  '',
customField: '20090914-130228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4830',
internalId:  '',
customField: '20090914-141406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4856',
internalId:  '',
customField: '20090914-141301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4882',
internalId:  '',
customField: '20090914-113021'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4701',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4752',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5701',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5727',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4778',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4804',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4830',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4856',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4882',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-5610']={
webappId:    '7008',
documentId:  '4778',
internalId:  '5610',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8501',
internalId:  '',
customField: '20100309-125132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20090914-140733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8527',
internalId:  '',
customField: '20100309-145858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20100309-150030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9127',
internalId:  '',
customField: '20100309-150153'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3WJN';
var companyName   = 'GPS+Systems+%26+Leasing+Ltd';
var htmlTitle	  = 'GPS+Systems+%26+Leasing+Ltd%2C+one+of+the+UK%27s+leading+providers+of+Systems+and+Finance';
var metaKeywords  = 'IT+equipment%2C+Buy+equipment%2C+Telecoms+equipment%2C+buy+catering+equipment.+equipment%2C+financingequipment%2C+leasing%2C+tax+deductable%2C+garage+equipment';
var metaContents  = 'GPS+Systems++Leasing+is+one+of+the+leading+companies+in+equipment+purchasing+and+financing';
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();
};

