/* [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','34601',jdecode('New+Website+Redirect'),jdecode(''),'/34601.html','true',[],'',''],
	['PAGE','33',jdecode('A+Kingdom+Usurped'),jdecode(''),'/33/index.html','true',[ 
		['PAGE','13897',jdecode('Copyright+Notice'),jdecode(''),'/33/13897.html','true',[],'','']
	],'',''],
	['PAGE','398',jdecode('About+The+Story'),jdecode(''),'/398/index.html','true',[ 
		['PAGE','407',jdecode('The+World+of+Glorn'),jdecode(''),'/398/407.html','true',[],'',''],
		['PAGE','416',jdecode('About+the+Author'),jdecode(''),'/398/416.html','true',[],'','']
	],'',''],
	['PAGE','434',jdecode('Game+Modules'),jdecode(''),'/434/index.html','true',[ 
		['PAGE','452',jdecode('The+Sight'),jdecode(''),'/434/452.html','true',[],'',''],
		['PAGE','461',jdecode('The+Miracle+Worker%2C+Act+I'),jdecode(''),'/434/461.html','true',[],'',''],
		['PAGE','30401',jdecode('The+Miracle+Worker%2C+Act+II'),jdecode(''),'/434/30401.html','true',[],'',''],
		['PAGE','14591',jdecode('The+Alliance'),jdecode(''),'/434/14591.html','true',[],'',''],
		['PAGE','443',jdecode('Cast+of+Characters'),jdecode(''),'/434/443.html','true',[],'',''],
		['PAGE','28701',jdecode('Romantic+Animations'),jdecode(''),'/434/28701.html','true',[],'','']
	],'',''],
	['PAGE','470',jdecode('The+Novels'),jdecode(''),'/470.html','true',[],'',''],
	['PAGE','11245',jdecode('Guestbook'),jdecode(''),'/11245/index.html','true',[ 
		['PAGE','11244',jdecode('Read+Guestbook'),jdecode(''),'/11245/11244.html','false',[],'','']
	],'',''],
	['PAGE','13682',jdecode('Modules+Forum'),jdecode(''),'/13682.html','true',[],'',''],
	['PAGE','13526',jdecode('The+Sanctum+%28Blog%29'),jdecode(''),'/13526.html','true',[],'',''],
	['PAGE','14872',jdecode('Sanctum+1+-+Screenshots'),jdecode(''),'/14872.html','true',[],'',''],
	['PAGE','14970',jdecode('Sanctum+2+-+Screenshots'),jdecode(''),'/14970.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Finance';
theSitetree.paletteFamily='F3EBF5';
theSitetree.keyvisualId='2731';
theSitetree.keyvisualName='buecher.jpg';
theSitetree.fontsetId='10412';
theSitetree.graphicsetId='10673';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Finance',
				paletteFamily: 	'F3EBF5',
				keyvisualId: 	'2731',
				keyvisualName: 	'buecher.jpg',
				fontsetId: 		'10412',
				graphicsetId: 	'10673',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'F3EBF5',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-11245AHW050IN39JE']={
webappId:    '1002',
documentId:  '11245',
internalId:  '11245AHW050IN39JE',
customField: 'icq=false'
};
webappMappings['1003']=webappMappings['1003-ahw050in39je11b36e154d1']={
webappId:    '1003',
documentId:  '13682',
internalId:  'ahw050in39je11b36e154d1',
customField: 'en:US:'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '34601',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-5b03e8aa3672b5d10e56561c8385306a']={
webappId:    '7060',
documentId:  '14872',
internalId:  '5b03e8aa3672b5d10e56561c8385306a',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-057c62bb602abeed5234177e034889b8']={
webappId:    '7060',
documentId:  '14970',
internalId:  '057c62bb602abeed5234177e034889b8',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33',
internalId:  '',
customField: '20070429-115318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '398',
internalId:  '',
customField: '20100325-204556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '416',
internalId:  '',
customField: '20091224-091942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '434',
internalId:  '',
customField: '20101220-183637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13897',
internalId:  '',
customField: '20070310-173859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '407',
internalId:  '',
customField: '20070310-174016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20080212-204842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '461',
internalId:  '',
customField: '20100308-063139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14591',
internalId:  '',
customField: '20100413-145923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '443',
internalId:  '',
customField: '20100325-203646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '470',
internalId:  '',
customField: '20081214-112924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11245',
internalId:  '',
customField: '20070310-174255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11244',
internalId:  '',
customField: '20070306-035226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13682',
internalId:  '',
customField: '20070310-174134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13526',
internalId:  '',
customField: '20070310-174201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14872',
internalId:  '',
customField: '20070921-033200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14970',
internalId:  '',
customField: '20070921-033245'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20100118-122036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30401',
internalId:  '',
customField: '20101220-183656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20110326-175142'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN39JE';
var companyName   = 'Sanctum+of+the+Archmage';
var htmlTitle	  = 'Sanctum+of+the+Archmage';
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();
};

