/* [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','701',jdecode('Home'),jdecode(''),'/701.html','true',[],'',''],
	['PAGE','773',jdecode('Books+and+DVD'),jdecode(''),'/773/index.html','true',[ 
		['PAGE','15701',jdecode('The+Handbook'),jdecode(''),'/773/15701.html','true',[],'',''],
		['PAGE','15901',jdecode('Winning+Strategies'),jdecode(''),'/773/15901.html','true',[],'',''],
		['PAGE','17301',jdecode('7+Charting+Tools'),jdecode(''),'/773/17301.html','true',[],'',''],
		['PAGE','17327',jdecode('DVD'),jdecode(''),'/773/17327.html','true',[],'','']
	],'',''],
	['PAGE','5701',jdecode('Training'),jdecode(''),'/5701/index.html','true',[ 
		['PAGE','5743',jdecode('Seminar+Content'),jdecode(''),'/5701/5743.html','true',[],'',''],
		['PAGE','815',jdecode('Seminar+-+Register+Interest'),jdecode(''),'/5701/815.html','true',[],'',''],
		['PAGE','12801',jdecode('Seminar+-+Booking+Form'),jdecode(''),'/5701/12801.html','true',[],'','']
	],'',''],
	['PAGE','836',jdecode('Contact'),jdecode(''),'/836.html','true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Japanese';
theSitetree.paletteFamily='384B5A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='11136';
theSitetree.graphicsetId='11937';
theSitetree.contentColor='1C2934';
theSitetree.contentBGColor='BDC1B4';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Japanese',
				paletteFamily: 	'384B5A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'11136',
				graphicsetId: 	'11937',
				contentColor: 	'1C2934',
				contentBGColor: 'BDC1B4',
				a_color: 		'384B5A',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100728-173658'
};
webappMappings['7008']=webappMappings['7008-445']={
webappId:    '7008',
documentId:  '815',
internalId:  '445',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '773',
internalId:  '',
customField: '20091018-174051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '815',
internalId:  '',
customField: '20100520-100227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '836',
internalId:  '',
customField: '20070904-220305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20100830-140944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12801',
internalId:  '',
customField: '20100830-141018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5743',
internalId:  '',
customField: '20100324-100053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17301',
internalId:  '',
customField: '20091018-173914'
};
webappMappings['7008']=webappMappings['7008-2260']={
webappId:    '7008',
documentId:  '12801',
internalId:  '2260',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15901',
internalId:  '',
customField: '20090310-123218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20090310-122207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17327',
internalId:  '',
customField: '20091018-174026'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXFZT';
var companyName   = 'Sparkdales+Limited';
var htmlTitle	  = '';
var metaKeywords  = 'spread+betting+companies%2Cspread+betting+tips%2Cspread+betting+arbitrage%2Cspread+betting+explained%2Cspread+betting+day+trading%2Cspread+betting+trading%2Cfree+advice+on+spread+betting%2Cfinancial+spread+betting+advice%2Cspread+betting+advice%2Cuk+spread+betting+company%2Cspread+betting+techniques%2Cinternet+spread+betting%2Cspread+betting+and+trading%2Cuk+financial+spread+betting+%2Conline+books+on+spread+betting%2Cthe+financial+spread+betting+handbook%2Cspread+betting+training+%2Cspread+betting+seminars%2Cspread+betting+course%2Cspread+betting+trading%2Cfinancial+spread+betting+guide%2Cspread+betting+strategy%2Cwhat+is+spread+betting%2Cetrade+financial+spread+betting%2C+www.sparkdales.co.uk';
var metaContents  = '';
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();
};
