/* [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','3701',jdecode('Home'),jdecode(''),'/3701.html','true',[],'',''],
	['PAGE','42218',jdecode('Current+Sales'),jdecode(''),'/42218.html','true',[],'',''],
	['PAGE','4722',jdecode('About+us'),jdecode(''),'/4722/index.html','true',[ 
		['PAGE','4743',jdecode('Our+team'),jdecode(''),'/4722/4743.html','true',[],'',''],
		['PAGE','4764',jdecode('How+to+find+us'),jdecode(''),'/4722/4764.html','true',[],'',''],
		['PAGE','10601',jdecode('Photo+Gallery'),jdecode(''),'/4722/10601.html','true',[],'','']
	],'',''],
	['PAGE','42239',jdecode('Book+Suggestions'),jdecode(''),'/42239/index.html','true',[ 
		['PAGE','8501',jdecode('STAFF+FAVORITES'),jdecode(''),'/42239/8501.html','true',[],'',''],
		['PAGE','8522',jdecode('Our+Customers+Favorites'),jdecode(''),'/42239/8522.html','true',[],'','']
	],'',''],
	['PAGE','17407',jdecode('Credit+Policy'),jdecode(''),'/17407/index.html','true',[ 
		['PAGE','47918',jdecode('Condition+Policy'),jdecode(''),'/17407/47918.html','true',[],'','']
	],'',''],
	['PAGE','25318',jdecode('AfterHours'),jdecode(''),'/25318/index.html','true',[ 
		['PAGE','4806',jdecode('Book+Clubs'),jdecode(''),'/25318/4806.html','true',[],'',''],
		['PAGE','25339',jdecode('Events'),jdecode(''),'/25318/25339.html','true',[],'','']
	],'',''],
	['PAGE','4785',jdecode('Contact'),jdecode(''),'/4785.html','true',[],'',''],
	['PAGE','4701',jdecode('Guestbook'),jdecode(''),'/4701.html','true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Communication';
theSitetree.paletteFamily='F6CF9C';
theSitetree.keyvisualId='332';
theSitetree.keyvisualName='books.jpg';
theSitetree.fontsetId='31';
theSitetree.graphicsetId='34';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F5E9CD';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Communication',
				paletteFamily: 	'F6CF9C',
				keyvisualId: 	'332',
				keyvisualName: 	'books.jpg',
				fontsetId: 		'31',
				graphicsetId: 	'34',
				contentColor: 	'000000',
				contentBGColor: 'F5E9CD',
				a_color: 		'F6CF9C',
				b_color: 		'9A190E',
				c_color: 		'000000',
				d_color: 		'CC6600',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3701',
internalId:  '',
customField: '20100726-150325'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25318',
internalId:  '',
customField: '20100525-170003'
};
webappMappings['1002']=webappMappings['1002-4701avfl30inharg']={
webappId:    '1002',
documentId:  '4701',
internalId:  '4701avfl30inharg',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20100218-103201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4722',
internalId:  '',
customField: '20100218-113400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4743',
internalId:  '',
customField: '20100702-165658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4785',
internalId:  '',
customField: '20100525-170506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4806',
internalId:  '',
customField: '20100525-170322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4764',
internalId:  '',
customField: '20100218-110633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8522',
internalId:  '',
customField: '20100629-174906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8501',
internalId:  '',
customField: '20100519-121751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20100224-151401'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17407',
internalId:  '',
customField: '20100410-155758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25339',
internalId:  '',
customField: '20100525-170404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42218',
internalId:  '',
customField: '20100629-175010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42239',
internalId:  '',
customField: '20100218-113755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47918',
internalId:  '',
customField: '20100402-131921'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHARG';
var companyName   = 'AfterWords+Bookstore';
var htmlTitle	  = 'AfterWords+Bookstore+Used+books+Edwardsville';
var metaKeywords  = '';
var metaContents  = '';
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();
};
