/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','22701',jdecode('Ghostwriting'),jdecode(''),'/22701.html','true',[],''],
	['PAGE','10701',jdecode('Writing+Services'),jdecode(''),'/10701.html','true',[],''],
	['PAGE','473',jdecode('R%C3%A9sum%C3%A9+Services'),jdecode(''),'/473.html','true',[],''],
	['PAGE','452',jdecode('Editing+services'),jdecode(''),'/452.html','true',[],''],
	['PAGE','12722',jdecode('Consultation+'),jdecode(''),'/12722.html','true',[],''],
	['PAGE','12701',jdecode('Our+Prices'),jdecode(''),'/12701.html','true',[],''],
	['PAGE','14401',jdecode('FAQs'),jdecode(''),'/14401.html','true',[],''],
	['PAGE','16401',jdecode('Common+Errors'),jdecode(''),'/16401.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Classic';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='286';
theSitetree.keyvisualName='tastatur.jpg';
theSitetree.fontsetId='30';
theSitetree.graphicsetId='24';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333399';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Classic',
				paletteFamily: 	'000000',
				keyvisualId: 	'286',
				keyvisualName: 	'tastatur.jpg',
				fontsetId: 		'30',
				graphicsetId: 	'24',
				contentColor: 	'FFFFFF',
				contentBGColor: '333399',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'333399',
				c_color: 		'000000',
				d_color: 		'6699CC',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1501']=webappMappings['1501-10330904']={
webappId:    '1501',
documentId:  '401',
internalId:  '10330904',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-189']={
webappId:    '7008',
documentId:  '401',
internalId:  '189',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090924-125655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090627-190718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20090802-150803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12701',
internalId:  '',
customField: '20090802-151429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10701',
internalId:  '',
customField: '20090924-131525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14401',
internalId:  '',
customField: '20090627-190815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16401',
internalId:  '',
customField: '20090924-121643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12722',
internalId:  '',
customField: '20090627-190734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22701',
internalId:  '',
customField: '20090924-130842'
};
var canonHostname = 'cm4all.aplus.net';
var accountId     = 'AAPLU0INLE76';
var companyName   = 'The+Write+Company%2C+Inc.';
var htmlTitle	  = 'The+Write+Company%2C+for+all+your+professional+writing+needs.';
var metaKeywords  = 'technical+writing%2C+resume+writing%2C+career+counseling%2C+editing%2C+copyediting%2C+proofreading%2C+professional+writing%2C+Technical+writing%2C+copyediting%2C+proofreading%2C+career+counseling%2C+resume+writing%2C+academic+editing%2C+grant+writing%2C+consultation%2C+dissertation+editing%2C+edit%2C+editing%2C+write%2C+writing%2C+cover+letter%2C+resume%2C+curriculum+vita%2C+CV%2C+thesis%2C+dissertation%2C+grammar%2C+sentence+structure%2C+sentence%2C+subject-verb+agreement%2C+present+tense%2C+past+tense%2C+writing+services%2C+editing+services%2C+career+development%2C+coaching%2C+consulting%2C+write%2C+edit%2C+ghostwriting%2C+corporate+editing';
var metaContents  = 'technical+writing%2C+resume+writing%2C+career+counseling%2C+editing%2C+copyediting%2C+proofreading%2C+professional+writing%2C+Technical+writing%2C+copyediting%2C+proofreading%2C+career+counseling%2C+resume+writing%2C+academic+editing%2C+grant+writing%2C+consultation%2C+dissertation+editing%2C+edit%2C+editing%2C+write%2C+writing%2C+cover+letter%2C+resume%2C+curriculum+vita%2C+CV%2C+thesis%2C+dissertation%2C+grammar%2C+sentence+structure%2C+sentence%2C+subject-verb+agreement%2C+present+tense%2C+past+tense%2C+writing+services%2C+editing+services%2C+career+development%2C+coaching%2C+consulting%2C+write%2C+edit';
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();
};

