/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','394',jdecode('Buy+now'),jdecode(''),'/394.html','true',[],'',''],
	['PAGE','43801',jdecode('Clues'),jdecode(''),'/43801.html','true',[],'',''],
	['PAGE','5701',jdecode('Reviews'),jdecode(''),'/5701.html','true',[],'',''],
	['PAGE','7101',jdecode('Inside+The+Oracle'),jdecode(''),'/7101/index.html','true',[ 
		['PAGE','21801',jdecode('Book+Description'),jdecode(''),'/7101/21801.html','true',[],'','']
	],'',''],
	['PAGE','21822',jdecode('Poems'),jdecode(''),'/21822/index.html','true',[ 
		['PAGE','22701',jdecode('Master+Riddle'),jdecode(''),'/21822/22701.html','true',[],'',''],
		['PAGE','22722',jdecode('Solar+System'),jdecode(''),'/21822/22722.html','true',[],'',''],
		['PAGE','23001',jdecode('Moon'),jdecode(''),'/21822/23001.html','true',[],'',''],
		['PAGE','23022',jdecode('Big+Bang'),jdecode(''),'/21822/23022.html','true',[],'',''],
		['PAGE','23043',jdecode('Precession'),jdecode(''),'/21822/23043.html','true',[],'',''],
		['PAGE','23401',jdecode('Greeks'),jdecode(''),'/21822/23401.html','true',[],'',''],
		['PAGE','23422',jdecode('Russia'),jdecode(''),'/21822/23422.html','true',[],'',''],
		['PAGE','23443',jdecode('Rome'),jdecode(''),'/21822/23443.html','true',[],'',''],
		['PAGE','23464',jdecode('Crucifixion'),jdecode(''),'/21822/23464.html','true',[],'',''],
		['PAGE','23485',jdecode('Great+Plague'),jdecode(''),'/21822/23485.html','true',[],'',''],
		['PAGE','23506',jdecode('Columbus'),jdecode(''),'/21822/23506.html','true',[],'',''],
		['PAGE','23527',jdecode('Time'),jdecode(''),'/21822/23527.html','true',[],'','']
	],'',''],
	['PAGE','41201',jdecode('Sponsors'),jdecode(''),'/41201.html','true',[],'',''],
	['PAGE','415',jdecode('Links'),jdecode(''),'/415.html','true',[],'',''],
	['PAGE','436',jdecode('Submissions'),jdecode(''),'/436.html','true',[],'',''],
	['PAGE','457',jdecode('Contact'),jdecode(''),'/457.html','true',[],'',''],
	['PAGE','61401',jdecode('The+Final+Six'),jdecode(''),'/61401.html','false',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='A3CAFE';
theSitetree.keyvisualId='780';
theSitetree.keyvisualName='uhr.jpg';
theSitetree.fontsetId='144';
theSitetree.graphicsetId='161';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Metal',
				paletteFamily: 	'A3CAFE',
				keyvisualId: 	'780',
				keyvisualName: 	'uhr.jpg',
				fontsetId: 		'144',
				graphicsetId: 	'161',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'A3CAFE',
				b_color: 		'87A7D2',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100510-091812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20090427-153611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '394',
internalId:  '',
customField: '20090817-223653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '436',
internalId:  '',
customField: '20070822-162930'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22701',
internalId:  '',
customField: '20070828-212322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '415',
internalId:  '',
customField: '20070825-180636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '457',
internalId:  '',
customField: '20070823-224845'
};
webappMappings['7060']=webappMappings['7060-0b4b946b5ddc449a4886e47a77d04179']={
webappId:    '7060',
documentId:  '7101',
internalId:  '0b4b946b5ddc449a4886e47a77d04179',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20070828-214627'
};
webappMappings['7008']=webappMappings['7008-472']={
webappId:    '7008',
documentId:  '457',
internalId:  '472',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22722',
internalId:  '',
customField: '20070828-212422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21801',
internalId:  '',
customField: '20070828-213605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21822',
internalId:  '',
customField: '20070828-214559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23001',
internalId:  '',
customField: '20070828-212447'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23022',
internalId:  '',
customField: '20070828-212507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23043',
internalId:  '',
customField: '20070828-212531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20070828-212555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23422',
internalId:  '',
customField: '20070828-212632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23443',
internalId:  '',
customField: '20070828-212705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23464',
internalId:  '',
customField: '20070828-212732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23485',
internalId:  '',
customField: '20070828-212754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23506',
internalId:  '',
customField: '20070828-212818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23527',
internalId:  '',
customField: '20070828-212900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41201',
internalId:  '',
customField: '20070829-143806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43801',
internalId:  '',
customField: '20100510-092209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61401',
internalId:  '',
customField: '20090417-190335'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN25A9';
var companyName   = 'The+Oracle+-+Lost+in+Time';
var htmlTitle	  = 'The+Oracle+-+Lost+in+Time';
var metaKeywords  = 'books%2C+childrens+books%2C+book%2C+treasure%2C+treasure+hunt%2C+cash+prize%2C+buried+treasure%2C+hidden+treasure%2C+armachair+treasure+hunt%2C+cash%2C+prize%2C+gift%2C+ideal+gift';
var metaContents  = 'Beautifully+illustated+childrens+treasure+hunt+book+with+a+%C2%A35000+minimum+cash+prize.++Hours+of+fun+and+a+lifetime+of+pleasure.';
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();
};
