/* [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','4558',jdecode('Home'),jdecode(''),'/4558.html','true',[],'',''],
	['PAGE','4615',jdecode('Biography'),jdecode(''),'/4615.html','true',[],'',''],
	['PAGE','11741',jdecode('Books'),jdecode(''),'/11741/index.html','true',[ 
		['PAGE','9402',jdecode('Dying'),jdecode(''),'/11741/9402.html','true',[],'',''],
		['PAGE','4723',jdecode('Feast+or+Famine'),jdecode(''),'/11741/4723.html','true',[],'',''],
		['PAGE','4696',jdecode('Love+In+Aotearoa'),jdecode(''),'/11741/4696.html','true',[],'',''],
		['PAGE','11587',jdecode('Retire+Right'),jdecode(''),'/11741/11587.html','true',[],'',''],
		['PAGE','8002',jdecode('Shaggy+Dog...'),jdecode(''),'/11741/8002.html','true',[],'',''],
		['PAGE','4669',jdecode('Unbreakable+Spirit'),jdecode(''),'/11741/4669.html','true',[],'',''],
		['PAGE','4750',jdecode('Watching+Over+Me'),jdecode(''),'/11741/4750.html','true',[],'','']
	],'',''],
	['PAGE','11905',jdecode('Book+Reviews'),jdecode(''),'/11905.html','true',[],'',''],
	['PAGE','4777',jdecode('Contact'),jdecode(''),'/4777.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Time';
theSitetree.paletteFamily='272740';
theSitetree.keyvisualId='2302';
theSitetree.keyvisualName='korrespondenz.jpg';
theSitetree.fontsetId='268';
theSitetree.graphicsetId='336';
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: 			'Time',
				paletteFamily: 	'272740',
				keyvisualId: 	'2302',
				keyvisualName: 	'korrespondenz.jpg',
				fontsetId: 		'268',
				graphicsetId: 	'336',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'272740',
				b_color: 		'6D6DA7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4558',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4558',
internalId:  '',
customField: '20090424-200125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4777',
internalId:  '',
customField: '20090404-170504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4615',
internalId:  '',
customField: '20090822-230734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11741',
internalId:  '',
customField: '20070923-145421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9402',
internalId:  '',
customField: '20070405-210716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4723',
internalId:  '',
customField: '20070405-212253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4696',
internalId:  '',
customField: '20081107-190649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11587',
internalId:  '',
customField: '20070619-194624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8002',
internalId:  '',
customField: '20070608-164052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4669',
internalId:  '',
customField: '20070923-152816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4750',
internalId:  '',
customField: '20081107-192359'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11905',
internalId:  '',
customField: '20100313-181837'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2G3N';
var companyName   = 'Karen+McMillan+-+author+and+freelance+writer';
var htmlTitle	  = 'Karen+McMillan+-+author+and+freelance+writer';
var metaKeywords  = 'Karen+McMillan%2C+Karen+M%2C+author%2C+writer%2C+freelance+writer%2C+non-fiction%2C+fiction%2C+Unbreakable+Spirit%2C+Love+in+Aotearoa%2C+Love+Bytes%2C+Feast+or+Famine%2C+Ashton+Wylie+Charitable+Trust%2C+Watching+Over+Me%2C+NZ%2C+New+Zealand%2C+New+Zealand+writer%2C+New+Zealand+author%2C+New+Zealand+freelance+writer%2C+Karen+McMillan+biography%2C+Karen+McMillans+books%2C++cancer+book%2C+Karen+McMillan+contact%2C+inspirational%2C+stories%2C+inspirational+stories%2C+courage%2C+cancer%2C+survival%2C+terminal+illness%2C+hospice%2C+NZ+cancer%2C+North+Shore+Hospice%2C++NZ+hospices%2C+NZ+love%2C+CanTeen%2C+Childrens+cancer%2C+love%2C+relationships%2C+family%2C+friendship%2C+friend%2C+humanity%2C+NZ+relationships%2C+NZ+love+stories%2C+love+stories%2C+UK+love%2C+romance%2C+NZ+romance%2C+love+book%2C+relationship+book%2C+passion%2C+NZ+passion%2C+weddings%2C+honeymoons%2C++eating+disorders%2C+NZ+eating+disorders%2C+treatments%2C+survivor+stories%2C+diets%2C+dieting%2C+weight+loss%2C+anorexia%2C+bulimia%2C+binge+eating%2C+over+eating%2C+under+eating%2C+NZ+guide+to+eating+disorders%2C+low+self-esteem%2C+western+ideals+of+beauty%2C+beauty%2C+slim%2C+thin%2C+thinness%2C+boney%2C+fat%2C+obesity%2C+obese%2C+looking+good%2C+pressure+to+look+good%2C+fear+of+being+fat%2C+body+size%2C+models%2C+magazines%2C+models+presented+in+magazines%2C+teenagers%2C+anorexia+nervosa%2C+binge+eating+disorder%2C+compulsive+eating%2C+eating+disorder+book%2C+angels%2C+loss+and+love%2C+loss%2C+novel%2C+novels%2C+inspirational+book.+Dying%3A+A+New+Zealand+Guide+to+the+Journey%3B+Shaggy+Dog+and+Fishy+Cat+Tales%2C+animals%2C+pets%2C+humour+books%2C+Calico+Publishing%2C+Powerfresh.';
var metaContents  = 'Karen+McMillan+is+a+freelance+writer+and+author+of+both+fiction+and+non-fiction+books.+Her+books+include+Unbreakable+Spirit%3B+Love+In+Aotearoa+%28published+as+Love+Bytes+in+the+UK%29%3B+Feast+or+Famine+and+the+novel+Watching+Over+Me.+She+has+adapted+a+book+about+dying+for+the+New+Zealand+market+-+Dying%3A+A+New+Zealand+Guide+to+the+Journey.+She+has+also+written+Shaggy+Dog+and+Fishy+Cat+Tales.+Karen+McMillan+lives+in+New+Zealand.';
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();
};
