/* [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 theSitetree=[ 
	['PAGE','1901',jdecode('Home'),jdecode(''),'/1901.html','true',[],''],
	['PAGE','1952',jdecode('A+Bit+of+Bio'),jdecode(''),'/1952.html','true',[],''],
	['PAGE','1973',jdecode('Da+Blog'),jdecode(''),'/1973.html','true',[],''],
	['PAGE','1994',jdecode('Story+Craft'),jdecode(''),'/1994.html','true',[],''],
	['PAGE','2015',jdecode('Links'),jdecode(''),'/2015.html','true',[],''],
	['PAGE','2036',jdecode('Bibliographies'),jdecode(''),'/2036.html','true',[],''],
	['PAGE','2078',jdecode('Guestbook'),jdecode(''),'/2078.html','true',[],''],
	['PAGE','2099',jdecode('Miscellaneous'),jdecode(''),'/2099.html','true',[],''],
	['PAGE','7801',jdecode('Join+'),jdecode(''),'/7801.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Bigcity_Space';
theSitetree.paletteFamily='591414';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='21075';
theSitetree.graphicsetId='13165';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='591414';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Bigcity_Space',
				paletteFamily: 	'591414',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'21075',
				graphicsetId: 	'13165',
				contentColor: 	'FFFFFF',
				contentBGColor: '591414',
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				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['7050']=webappMappings['7050-14122']={
webappId:    '7050',
documentId:  '1973',
internalId:  '14122',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-2078aendu0inv2nm']={
webappId:    '1002',
documentId:  '2078',
internalId:  '2078aendu0inv2nm',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20100602-192714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1952',
internalId:  '',
customField: '20091229-003638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1994',
internalId:  '',
customField: '20100604-230023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1973',
internalId:  '',
customField: '20091228-173911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2015',
internalId:  '',
customField: '20100429-191018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2036',
internalId:  '',
customField: '20100407-174213'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2078',
internalId:  '',
customField: '20100101-151313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2099',
internalId:  '',
customField: '20100101-203542'
};
webappMappings['1501']=webappMappings['1501-26029252']={
webappId:    '1501',
documentId:  '1901',
internalId:  '26029252',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100101-203557'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INV2NM';
var companyName   = 'Life+to+Write';
var htmlTitle	  = 'Life+to+Write';
var metaKeywords  = 'Bob+Sojka%2C+Writing+tips%2C+Writing+Blog%2C+Writing+Discussions%2C+Publishing%2C+Writer%2C+Writers%2C+Story%2C+Stories%2C+Book%2C+Books%2C+Author%2C+Authors%2C+fiction%2C+speculative+fiction%2C+science+fiction%2C+horror%2C+fantasy%2C+magic+realism%2C+literature%2C+creative+writing%2C+workshop';
var metaContents  = 'This+site+covers+the+thoughts+and+aspirations+of+a+new+writer%2C+Bob+Sojka%2C+with+discussions+of+a+broad+range+of+topics+related+to+his+own+development+as+a+writer+and+current+topics+of+interest+in+the+writing+world.++While+much+of+the+emphasis+is+on+genre+fiction%2C+especially+speculative+fiction%2C+science+fiction+and+the+like%2C+much+is+also+devoted+to+recognized+literature+and+mainstream+commercial+writing.';
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();
};
