/* [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('About+us'),jdecode(''),'/552.html','true',[],'',''],
	['PAGE','615',jdecode('Hand+%26+Power+Tools'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','636',jdecode('Household+%26+Garden+Plastics'),jdecode(''),'/636.html','true',[],'',''],
	['PAGE','699',jdecode('Offers'),jdecode(''),'/699.html','true',[],'',''],
	['PAGE','657',jdecode('Vacuum+Bags+Online+Shop'),jdecode(''),'/657.html','true',[],'',''],
	['PAGE','678',jdecode('Contact'),jdecode(''),'/678/index.html','true',[ 
		['PAGE','720',jdecode('How+to+find+us'),jdecode(''),'/678/720.html','true',[],'','']
	],'',''],
	['PAGE','27101',jdecode('Nostalgic+Pictures+of+Lake'),jdecode(''),'/27101.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='5252B6';
theSitetree.keyvisualId='9810';
theSitetree.keyvisualName='kv_9810.jpg';
theSitetree.fontsetId='17626';
theSitetree.graphicsetId='13032';
theSitetree.contentColor='646464';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Valiant',
				paletteFamily: 	'5252B6',
				keyvisualId: 	'9810',
				keyvisualName: 	'kv_9810.jpg',
				fontsetId: 		'17626',
				graphicsetId: 	'13032',
				contentColor: 	'646464',
				contentBGColor: 'FFFFFF',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20101016-154634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20090509-131741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20081022-214331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20061104-125212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20080329-152704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '657',
internalId:  '',
customField: '20080329-122619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20080328-184029'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '720',
internalId:  '',
customField: '20061031-225558'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '501',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '552',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27101',
internalId:  '',
customField: '20101112-214610'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '615',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '636',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '699',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '657',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '678',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '720',
internalId:  '',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXSG5';
var companyName   = 'VACUUM+BAGS+ONLINE';
var htmlTitle	  = 'RITE-PRICE+ONLINE+SHOP';
var metaKeywords  = 'AEG%2C+Advance%2C+Alaska%2C+Aquavac%2C+Argos%2C+Asda%2C+Beaumark%2C+Black++Decker%2C+Bloomberg%2C+Bomann%2C+Bosch%2C+Bush%2C+Capi%2Cl+Carlton%2C+Cimex%2C+Clarke%2C+Cleanfix%2C+Columbus+Dixon%2C+Comet%2C+Contico+Dejon%2C+Currys%2C+Daewoo%2C+Delonghi%2C+Dirt+Devil%2C+Dreamclean%2C+Dynamix%2C+Dyson%2C+Electra%2C+Electrolux%2C+Electrix%2C+Escort%2C+Eta%2C+Euroclean%2C+Fakir%2C+Fam%2C+Floor+Maintenance%2C+General+Electric%2C+Ghibli%2C+Goblin%2C+Goldstar%2C+Goodmans%2C+Henkel%2C+Hitachi%2C+Hoover%2C+Hotpoint%2C+Ivac%2C+Jeyes%2C+JMB%2C+Karcher%2C+Kashima%2C+Kenwood%2C+Kerstar%2C+Kirby%2C+Krups%2C+LG%2C+Lindhaus%2C+M-Tec%2C+Makro%2C+Mastervac%2C+Melissa%2C+Miele%2C+Mercedes%2C+Morphy+Richards%2C+Moulinex%2C+Nilfisk%2C+Nilco%2C+Numatic%2C+Oreck+uk%2C+Pacific%2C+Panasonic%2C+Phillips%2C+Phoenix%2C+Polti%2C+Premiere%2C+Proaction%2C+QVC%2C+Reckitt+Ensign%2C+Reddyvac%2C+Regina%2C+Rowenta%2C+Samsung%2C+Sanyo%2C+Schneider%2C+Sebo%2C+Severin%2C+Sharp%2C+Siemens%2C+Spinney%2FRotel%2C+Soteco%2C+Swan%2C+Taski%2C+Team%2C+Tefal%2C+Tornado%2C+Trewax%2C+Truvox%2C+Ufesa%2C+Vax%2C+Victor%2C+Volta%2C+Vortice%2C+Vorwerk%2C+Wetrok%2C+Zelmer';
var metaContents  = 'Wide+Range+of+Bags+for+Most+Makes++Models%2C+New%2C+Old++Hard+to+Find%2C+Domestic++Commercial+meta+name%3Dverify-v1+content%3DjQ%2BZ89aNE13mOrrlYSinybDH%2BsrJtGhMPsrzUqaQsLw%3D+%2F+';
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();
};

