/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','452',jdecode('About+us'),jdecode(''),'/452.html','true',[],'',''],
	['PAGE','473',jdecode('News'),jdecode(''),'/473.html','true',[],'',''],
	['PAGE','6801',jdecode('Product+Information'),jdecode(''),'/6801.html','true',[],'',''],
	['PAGE','515',jdecode('New+Releases'),jdecode(''),'/515.html','true',[],'',''],
	['PAGE','41012',jdecode('Manga+Art+Prints'),jdecode(''),'/41012.html','true',[],'',''],
	['PAGE','41038',jdecode('Anime%2FManga+Figures'),jdecode(''),'/41038.html','true',[],'',''],
	['PAGE','41064',jdecode('Anime%2FManga+Artbooks'),jdecode(''),'/41064.html','true',[],'',''],
	['PAGE','536',jdecode('Events'),jdecode(''),'/536.html','true',[],'',''],
	['PAGE','22112',jdecode('Recommendations'),jdecode(''),'/22112.html','true',[],'',''],
	['PAGE','27412',jdecode('Special+Offers'),jdecode(''),'/27412.html','true',[],'',''],
	['PAGE','34112',jdecode('Secondhand+Manga+'),jdecode(''),'/34112.html','true',[],'',''],
	['PAGE','57512',jdecode('Mail+Order'),jdecode(''),'/57512.html','true',[],'',''],
	['PAGE','55512',jdecode('Artist+Forum'),jdecode(''),'/55512.html','true',[],'',''],
	['PAGE','55538',jdecode('Facebook'),jdecode(''),'/55538.html','true',[],'',''],
	['PAGE','5706',jdecode('Guestbook'),jdecode(''),'/5706/index.html','true',[ 
		['PAGE','5701',jdecode('Read+Guestbook'),jdecode(''),'/5706/5701.html','false',[],'','']
	],'',''],
	['PAGE','20901',jdecode('Jobs'),jdecode(''),'/20901.html','true',[],'',''],
	['PAGE','557',jdecode('Contact+Us'),jdecode(''),'/557.html','true',[],'',''],
	['PAGE','578',jdecode('Links'),jdecode(''),'/578.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Surround';
theSitetree.paletteFamily='C12C21';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10514';
theSitetree.graphicsetId='11132';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='C12C21';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Surround',
				paletteFamily: 	'C12C21',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10514',
				graphicsetId: 	'11132',
				contentColor: 	'000000',
				contentBGColor: 'C12C21',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FEA7A1',
				e_color: 		'FEA7A1',
				f_color: 		'FEA7A1',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20091228-170938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100829-164632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100829-155947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20100829-154458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20100818-190217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20100430-222757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20100811-161017'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5706',
internalId:  '',
customField: '20071121-205507'
};
webappMappings['1002']=webappMappings['1002-5706anbt10in2qcf']={
webappId:    '1002',
documentId:  '5706',
internalId:  '5706anbt10in2qcf',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20901',
internalId:  '',
customField: '20080827-203223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20071117-130353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20100527-221220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41038',
internalId:  '',
customField: '20100829-154708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34112',
internalId:  '',
customField: '20100711-180745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27412',
internalId:  '',
customField: '20100811-160920'
};
webappMappings['7050']=webappMappings['7050-1400']={
webappId:    '7050',
documentId:  '22112',
internalId:  '1400',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22112',
internalId:  '',
customField: '20081118-210408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41012',
internalId:  '',
customField: '20100811-160458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41064',
internalId:  '',
customField: '20100818-190124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55512',
internalId:  '',
customField: '20100722-201826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55538',
internalId:  '',
customField: '20100722-201531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57512',
internalId:  '',
customField: '20100829-164842'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2QCF';
var companyName   = 'Red+Garden+Manga';
var htmlTitle	  = 'redgardenmanga';
var metaKeywords  = '';
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();
};
