/* [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','501',jdecode('HOME'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','552',jdecode('+Motorcycles'),jdecode(''),'/552/index.html','true',[ 
		['PAGE','14901',jdecode('trax+125'),jdecode(''),'/552/14901.html','true',[],'',''],
		['PAGE','11701',jdecode('vx+125'),jdecode(''),'/552/11701.html','true',[],'',''],
		['PAGE','11722',jdecode('vx+250'),jdecode(''),'/552/11722.html','true',[],'','']
	],'',''],
	['PAGE','573',jdecode('Quads'),jdecode(''),'/573/index.html','true',[ 
		['PAGE','11743',jdecode('xy+250+stxe'),jdecode(''),'/573/11743.html','true',[],'',''],
		['PAGE','11764',jdecode('xy+300+ste'),jdecode(''),'/573/11764.html','true',[],'','']
	],'',''],
	['PAGE','594',jdecode('Used+bikes+%26+quads'),jdecode(''),'/594.html','true',[],'',''],
	['PAGE','615',jdecode('+Special+offers'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','636',jdecode('Rider+gear+%26+protection'),jdecode(''),'/636.html','true',[],'',''],
	['PAGE','657',jdecode('Spare+parts'),jdecode(''),'/657.html','true',[],'',''],
	['PAGE','678',jdecode('Accessories'),jdecode(''),'/678.html','true',[],'',''],
	['PAGE','804',jdecode('Entertainment+%26+news'),jdecode(''),'/804/index.html','true',[ 
		['PAGE','825',jdecode('Bike+video+action'),jdecode(''),'/804/825.html','true',[],'',''],
		['PAGE','17101',jdecode('Quad+video+action+1'),jdecode(''),'/804/17101.html','true',[],'',''],
		['PAGE','18401',jdecode('Quad+video+action+2'),jdecode(''),'/804/18401.html','true',[],'',''],
		['PAGE','18422',jdecode('Quad+video+action+3'),jdecode(''),'/804/18422.html','true',[],'',''],
		['PAGE','846',jdecode('Photo+gallery'),jdecode(''),'/804/846.html','true',[],'',''],
		['PAGE','867',jdecode('+News+%26+events'),jdecode(''),'/804/867.html','true',[],'','']
	],'',''],
	['PAGE','10401',jdecode('About+us'),jdecode(''),'/10401/index.html','true',[ 
		['PAGE','10464',jdecode('Contact+details'),jdecode(''),'/10401/10464.html','true',[],'',''],
		['PAGE','699',jdecode('Our+services'),jdecode(''),'/10401/699.html','true',[],'','']
	],'',''],
	['PAGE','16801',jdecode('Directions'),jdecode(''),'/16801.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Stone';
theSitetree.paletteFamily='776737';
theSitetree.keyvisualId='4396';
theSitetree.keyvisualName='kv_4396.jpg';
theSitetree.fontsetId='10804';
theSitetree.graphicsetId='11241';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='9C9B9B';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stone',
				paletteFamily: 	'776737',
				keyvisualId: 	'4396',
				keyvisualName: 	'kv_4396.jpg',
				fontsetId: 		'10804',
				graphicsetId: 	'11241',
				contentColor: 	'000000',
				contentBGColor: '9C9B9B',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100609-162059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '804',
internalId:  '',
customField: '20080215-112730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '825',
internalId:  '',
customField: '20080215-134746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20100609-135707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20110225-135951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20110225-135726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20080110-233243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20080110-233243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '657',
internalId:  '',
customField: '20090911-163137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20080110-233243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20080110-233243'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '16801',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20090911-164903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '846',
internalId:  '',
customField: '20100609-143312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '867',
internalId:  '',
customField: '20100609-143120'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10464',
internalId:  '',
customField: '20090321-212631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16801',
internalId:  '',
customField: '20080204-235913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17101',
internalId:  '',
customField: '20080215-113503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20080204-211001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20110225-140146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11722',
internalId:  '',
customField: '20090908-164947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11743',
internalId:  '',
customField: '20080215-150818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11764',
internalId:  '',
customField: '20080215-153110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20080215-134900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18422',
internalId:  '',
customField: '20080215-121724'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN27PF';
var companyName   = 'welcome+to+VIXEN+motorcycles+%26+quads';
var htmlTitle	  = 'VIXEN';
var metaKeywords  = 'MOTORCYCLE%2C+QUAD%2C+ENDURO%2C+DIRT+BIKE%2CVIXEN+QUAD%2C+VIXEN+MOTORCYCLE%2COFF+ROAD+RIDING%2C+GREEN+LANE+RIDING%2C+QUAD+RACING%2C+QUAD+RIDING%2C+SPARE+PARTS%2C+CHINESE+MOTORCYCLE+PARTS%2C+VIXEN+PARTS%2CQUAD+PARTS%2C+REPAIRS%2C+MOTORCYCLE+REPAIRS%2C+QUAD+REPAIRS%2C+MOTORCYCLE+ENGINE+REPAIRS';
var metaContents  = 'MOTORCYCLES%2C+QUADS%2C+VIXEN+MOTORCYCLES%2C+VIXEN+QUADS%2C+SERVICING%2C+REPAIRS%2C+SPARE+PARTS%2C+';
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();
};

