/* [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','494',jdecode('Specialty+Pillow+Choices%3A'),jdecode(''),'/494/index.html','true',[ 
		['PAGE','515',jdecode('The+Chiari+Pillow'),jdecode(''),'/494/515.html','true',[],''],
		['PAGE','12401',jdecode('Chiari+Kid+Pillows'),jdecode(''),'/494/12401.html','true',[],''],
		['PAGE','12901',jdecode('Menopause+Pillows'),jdecode(''),'/494/12901.html','true',[],''],
		['PAGE','12922',jdecode('Fibromyalgia+Pillows'),jdecode(''),'/494/12922.html','true',[],''],
		['PAGE','20301',jdecode('Pain+in+the+Neck+Pillow+'),jdecode(''),'/494/20301.html','true',[],''],
		['PAGE','20322',jdecode('Pain+in+the+Neck-Modified'),jdecode(''),'/494/20322.html','true',[],''],
		['PAGE','20343',jdecode('Sunrise+Pillow'),jdecode(''),'/494/20343.html','true',[],''],
		['PAGE','20385',jdecode('All+Natural+Wool+Pillow'),jdecode(''),'/494/20385.html','true',[],'']
	],''],
	['PAGE','26001',jdecode('Pillow+Donation+Program%3A'),jdecode(''),'/26001.html','true',[],''],
	['PAGE','23601',jdecode('How+the+Chiari+Pillow+Helps%3A'),jdecode(''),'/23601.html','true',[],''],
	['PAGE','452',jdecode('Other+Helpful+Products%3A'),jdecode(''),'/452.html','true',[],''],
	['PAGE','5506',jdecode('Guestbook'),jdecode(''),'/5506/index.html','true',[ 
		['PAGE','5501',jdecode('Read+Guestbook'),jdecode(''),'/5506/5501.html','false',[],'']
	],''],
	['PAGE','473',jdecode('The+Team'),jdecode(''),'/473.html','true',[],''],
	['PAGE','620',jdecode('Contact'),jdecode(''),'/620/index.html','true',[ 
		['PAGE','12964',jdecode('Addresses'),jdecode(''),'/620/12964.html','true',[],'']
	],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1754';
theSitetree.keyvisualName='krankenhaus.jpg';
theSitetree.fontsetId='291';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1754',
				keyvisualName: 	'krankenhaus.jpg',
				fontsetId: 		'291',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20090512-121556'
};
webappMappings['1002']=webappMappings['1002-5506AHW050INX37K']={
webappId:    '1002',
documentId:  '5506',
internalId:  '5506AHW050INX37K',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090512-121316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20080531-025103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20080531-025039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20080531-025008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12922',
internalId:  '',
customField: '20080531-024940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20301',
internalId:  '',
customField: '20080531-024913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20322',
internalId:  '',
customField: '20080531-024835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20343',
internalId:  '',
customField: '20080531-024730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20385',
internalId:  '',
customField: '20080226-063434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20080930-102248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23601',
internalId:  '',
customField: '20090512-122304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20080410-134204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5506',
internalId:  '',
customField: '20071123-022452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20071123-022452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20090512-122631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20090218-124105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12964',
internalId:  '',
customField: '20090512-122703'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX37K';
var companyName   = 'MedPillow.com';
var htmlTitle	  = 'Medical+Specialty+Pillows';
var metaKeywords  = 'Medical%2C+Pillows%2C+Medical+Pillows%2C+Chiari%2C+Chiari+Pillow%2C+Chiari+Pillows%2C+Zipperhead+Chiari+Pillows%2C+Fibromyalgia%2C+Insomnia%2C+Sleep+Disorder%2C+Insomniac%2C+Neck%2C+Neck+Pillow%2C+Chiropractor%2C+Neck+Pain%2C+Menopause%2C+Menopause+Pillow%2C+Perimenopause%2C+Perimenopause+Pillow%2C+Menopausal%2C+Chip+Vierow%2C+Ann+Hood%2C+WACMA%2C+Arnold+Chiari+Malformation%2C+Decompression+Brain+Surgery%2C+Chip+Special%2C+Pain+in+the+Neck+Pillow%2C+Pain+in+the+Neck+Modified+Pillow%2C+Chiari+Kid%2C+Chiari+Kid+Pillows%2C+Better+Sleep%2C+Heavenly+Soft+Pillow%2C+Softest+Pillow%2C+Soft+Pillow';
var metaContents  = 'Medical+Pillows++Chiari+Pillows++Zipperhead+Chiari+Pillows';
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();
};
