/* [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','10601',jdecode('Home'),jdecode(''),'/10601.html','true',[],'',''],
	['PAGE','19901',jdecode('Bio'),jdecode(''),'/19901.html','true',[],'',''],
	['PAGE','19922',jdecode('Writing'),jdecode(''),'/19922/index.html','true',[ 
		['PAGE','58801',jdecode('Bibliography'),jdecode(''),'/19922/58801.html','true',[],'',''],
		['PAGE','58822',jdecode('Screenplays'),jdecode(''),'/19922/58822.html','true',[],'',''],
		['PAGE','58843',jdecode('Novels'),jdecode(''),'/19922/58843.html','true',[],'',''],
		['PAGE','58864',jdecode('Short+Fiction'),jdecode(''),'/19922/58864.html','true',[],'',''],
		['PAGE','58885',jdecode('Reviews'),jdecode(''),'/19922/58885.html','true',[],'','']
	],'',''],
	['PAGE','60101',jdecode('Acting'),jdecode(''),'/60101.html','true',[],'',''],
	['PAGE','62101',jdecode('Racing'),jdecode(''),'/62101.html','true',[],'',''],
	['PAGE','60122',jdecode('Interviews%2FReviews'),jdecode(''),'/60122.html','true',[],'',''],
	['PAGE','60143',jdecode('Pictures'),jdecode(''),'/60143.html','true',[],'',''],
	['PAGE','60164',jdecode('Contact'),jdecode(''),'/60164.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Abstract';
theSitetree.paletteFamily='FFF0D4';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10386';
theSitetree.graphicsetId='10582';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFF0D4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Abstract',
				paletteFamily: 	'FFF0D4',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10386',
				graphicsetId: 	'10582',
				contentColor: 	'000000',
				contentBGColor: 'FFF0D4',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20101023-171952'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19901',
internalId:  '',
customField: '20101027-222738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19922',
internalId:  '',
customField: '20101026-215130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58801',
internalId:  '',
customField: '20101027-214525'
};
webappMappings['7060']=webappMappings['7060-8e3051f86adb9e6cfc5aea8d756ebe04']={
webappId:    '7060',
documentId:  '60143',
internalId:  '8e3051f86adb9e6cfc5aea8d756ebe04',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-9919']={
webappId:    '7008',
documentId:  '60164',
internalId:  '9919',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58822',
internalId:  '',
customField: '20101026-194049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58843',
internalId:  '',
customField: '20101026-194049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58864',
internalId:  '',
customField: '20101026-194049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58885',
internalId:  '',
customField: '20101026-194049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60101',
internalId:  '',
customField: '20101027-222135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60122',
internalId:  '',
customField: '20101026-220603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60143',
internalId:  '',
customField: '20101027-214927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60164',
internalId:  '',
customField: '20101027-214724'
};
webappMappings['7060']=webappMappings['7060-78974d0b1d6d74503aed828638920ca5']={
webappId:    '7060',
documentId:  '60101',
internalId:  '78974d0b1d6d74503aed828638920ca5',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62101',
internalId:  '',
customField: '20101029-201814'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INZSRG';
var companyName   = 'STEVEN+SAWICKI';
var htmlTitle	  = 'Steven+Sawicki';
var metaKeywords  = 'steven+sawicki%2C+writer%2C+science+fiction%2C+scifi%2C+syfy%2C+horror%2C+fantasy%2C+high+fantasy%2C+review%2C+criticism%2C+opinion%2C+sfrevu%2C+damnaliens%2C+invisible+friends%2C+book+review%2C+books%2C+literature%2C+short+stories%2C+fiction%2C+mystery';
var metaContents  = 'Homepage+of+writer+Steven+Sawcki';
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();
};

