/* [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','24301',jdecode('Home'),jdecode(''),'/24301.html','true',[],''],
	['PAGE','33601',jdecode('Writing+Services'),jdecode(''),'/33601/index.html','true',[ 
		['PAGE','24322',jdecode('Creative+Writing'),jdecode(''),'/33601/24322.html','true',[],''],
		['PAGE','24343',jdecode('Marketing%2FCopywriting'),jdecode(''),'/33601/24343.html','true',[],''],
		['PAGE','24364',jdecode('Technical+Writing'),jdecode(''),'/33601/24364.html','true',[],'']
	],''],
	['PAGE','5652',jdecode('Our+Writing+Team'),jdecode(''),'/5652/index.html','true',[ 
		['PAGE','24101',jdecode('Sue+Ronson'),jdecode(''),'/5652/24101.html','true',[],''],
		['PAGE','24122',jdecode('Chris+Port'),jdecode(''),'/5652/24122.html','true',[],''],
		['PAGE','24143',jdecode('Alex+Gabriel'),jdecode(''),'/5652/24143.html','true',[],'']
	],''],
	['PAGE','5673',jdecode('Contact+Us'),jdecode(''),'/5673.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='1427';
theSitetree.keyvisualName='tastatur.jpg';
theSitetree.fontsetId='236';
theSitetree.graphicsetId='278';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Startup',
				paletteFamily: 	'990000',
				keyvisualId: 	'1427',
				keyvisualName: 	'tastatur.jpg',
				fontsetId: 		'236',
				graphicsetId: 	'278',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'990000',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-617']={
webappId:    '7008',
documentId:  '5673',
internalId:  '617',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24301',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5652',
internalId:  '',
customField: '20090519-213729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5673',
internalId:  '',
customField: '20090519-213825'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '33601',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33601',
internalId:  '',
customField: '20090519-213551'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5652',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5673',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20090519-213451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24322',
internalId:  '',
customField: '20090515-164746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24101',
internalId:  '',
customField: '20090515-164849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24122',
internalId:  '',
customField: '20090519-212824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24143',
internalId:  '',
customField: '20090515-165142'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24343',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24322',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24343',
internalId:  '',
customField: '20090511-235419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24364',
internalId:  '',
customField: '20090512-000256'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24364',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24101',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24122',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '24143',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'cm4all.netfirms.com';
var accountId     = 'ANFI10INXV1N';
var companyName   = '';
var htmlTitle	  = 'Creative+and+Technical+Writing+Services+-+Ronson+Writing+Company+Inc';
var metaKeywords  = 'technical+writing%2C+creative+writing%2C+professional+writing%2C+writing%2C+Vancouver%2C+Ronson%2C+Ronson+Writing+Company%2C+The+Ronson+Writing+Company+Inc%2C+copywriting%2C+websites%2C+brochures%2C+newsletters%2C+scripts%2C+books%2C+travel+writing%2C+memoirs%2C+business+plans%2C+reports%2C+resumes%2C+technical+writing%2C+editing';
var metaContents  = 'A+team+of+creative+and+technical+writers+based+out+of+Vancouver%2C+BC+Canada+with+55+years+of+combined+experience.++We+cover+it+all%3A+copywriting%2C+websites%2C+brochures%2C+newsletters%2C+scripts%2C+books%2C+travel+writing%2C+memoirs%2C+business+plans%2C+reports%2C+resumes%2C+technical+writing%2C+editing+and+more...';
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();
};

