/* [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','1801',jdecode('Home'),jdecode(''),'/1801.html','true',[],''],
	['PAGE','1852',jdecode('Table+of+Contents'),jdecode(''),'/1852.html','true',[],''],
	['PAGE','1873',jdecode('About+the+Author'),jdecode(''),'/1873.html','true',[],''],
	['PAGE','2201',jdecode('Endorsements%2FReviews'),jdecode(''),'/2201.html','true',[],''],
	['PAGE','1915',jdecode('Order+Now%21'),jdecode(''),'/1915.html','true',[],''],
	['PAGE','1936',jdecode('Legal%2FIndustry+Expert+Services'),jdecode(''),'/1936.html','true',[],''],
	['PAGE','1957',jdecode('Speaking+and+Lectures'),jdecode(''),'/1957.html','true',[],''],
	['PAGE','1978',jdecode('Media+%2F+Press+Room'),jdecode(''),'/1978/index.html','true',[ 
		['PAGE','13101',jdecode('Book+Cover+%28jpg%29'),jdecode(''),'/1978/13101.html','false',[],''],
		['PAGE','13122',jdecode('Jeff+Sarkozi%2C+M.D.+-+Hi+Res'),jdecode(''),'/1978/13122.html','false',[],'']
	],''],
	['PAGE','1999',jdecode('Comment+of+the+Week'),jdecode(''),'/1999.html','true',[],''],
	['PAGE','2020',jdecode('Question+of+the+Week'),jdecode(''),'/2020.html','true',[],''],
	['PAGE','3401',jdecode('Other+Resources'),jdecode(''),'/3401.html','true',[],''],
	['PAGE','2041',jdecode('Permissions+and+Licensing'),jdecode(''),'/2041.html','true',[],''],
	['PAGE','2401',jdecode('Customer+Service'),jdecode(''),'/2401.html','true',[],''],
	['PAGE','2422',jdecode('Contact+Us'),jdecode(''),'/2422.html','true',[],'']];
var siteelementCount=16;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='385CA9';
theSitetree.keyvisualId='7220';
theSitetree.keyvisualName='kv_7220.jpg';
theSitetree.fontsetId='16409';
theSitetree.graphicsetId='12134';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Capri',
				paletteFamily: 	'385CA9',
				keyvisualId: 	'7220',
				keyvisualName: 	'kv_7220.jpg',
				fontsetId: 		'16409',
				graphicsetId: 	'12134',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20090425-142900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20090425-143010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20090527-145100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20090331-184522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20090425-143206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20090714-181554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20090425-143506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1957',
internalId:  '',
customField: '20090922-152619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1978',
internalId:  '',
customField: '20090425-144528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1999',
internalId:  '',
customField: '20090425-144658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2020',
internalId:  '',
customField: '20090425-144829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2041',
internalId:  '',
customField: '20090511-191608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20090714-181652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2422',
internalId:  '',
customField: '20090714-181754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20090425-144948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13122',
internalId:  '',
customField: '20090425-151902'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INVD1N';
var companyName   = 'The+Missing+Pieces+of+the+Fibromyalgia+Puzzle';
var htmlTitle	  = 'The+Missing+Pieces+of+the+Fibromyalgia+Puzzle+-+Fibromyalgia+%2F+Pain+%2F+Polypain+%2F+Book+%2F+Cause+%2F+Treatment';
var metaKeywords  = 'The+Missing+Pieces+of+the+Fibromyalgia+Puzzle%2Cbook%2Cmissing%2C+pieces%2Cfibromyalgia%2Cpuzzle%2Cpatient%2Chealthcare%2Cpolypain%2Cchronic%2Cwidespread%2Cmusculoskeletal%2Cpain%2Carthritis%2Cchronic+pain%2Cwidespread%2Cfallacy+of+pain+from+nowhere%2Cfailure%2Cdiagnosis%2Ccause%2Ctreatment%2Cmusculoskeletal%2Ccause+of+pain%2Cmodulate%2Ctreat%2Ctenderness%2Cdisability%2Csleep%2Cweight%2Cpsychological%2C+psychosocial%2Csexual%2Csex%2Ctraditional%2Ctherapy%2Ccomplementary%2CJeff+Sarkozi%2CJeff+Sarkozi+MD%2CSarkozi%2Crheumatologist%2Cexpert%2Crevolutionary%2Cbreakthrough%2CJeff+Sarkozi+MD+FRCPC%2CJeff+Sarkozi+MD+FRCPC+FACR%2Cexpert%2Clegal%2Cmedical%2Cphysician%2Cmedicolegal%2Cwellness%2Cspeak%2Cspeaker%2Clecture%2Ctrial%2Crheumatology%2CRheumatologist%2CRheumatic%2Coccupational%2Cindustrial%2Cenvironmental%2Cfatigue%2Crheumatoid%2Costeoarthritis%2Cneck%2Cback%2Clupus%2Cscleroderma%2CRaynauds%2Cspondylitis%2C+myositis%2Creflex+dystrophy%2Ctrauma%2Cpost-traumatic%2Cpost%2C+traumatic%2Cconnective+tissue+disease%2C+connective%2Ctissue%2Cmalpractice';
var metaContents  = 'The+Missing+Pieces+of+the+Fibromyalgia+Puzzle+is+the+book+that+changes+everything+for+patients%2C+healthcare+providers%2C+and+everyone+with+an+interest+in+truly+understanding+fibromyalgia+and+chronic+widespread+pain.+The+Missing+Pieces+of+the+Fibromyalgia+Puzzle+is+the+most+ground-breaking+and+transformational+book+ever+written+on+fibromyalgia+and+chronic+widespread+musculoskeletal+pain.+It+does+what+no+other+book+or+publication+has+ever+been+capable+of+doing.+Through+original%2C+cutting+edge+clinical+research+results+and+evidence-based+analysis%2C+it+actually+identifies+the+cause+of+pain+in+fibromyalgia%2C+the+mechanism+by+which+it+evolves%2C+how+it+is+modulated%2C+and+how+to+effectively+treat+it.';
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();
};
