/* [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','7001',jdecode('Recycled+Books'),jdecode(''),'/7001.html','true',[],''],
	['PAGE','10634',jdecode('All+About+Recycled'),jdecode(''),'/10634.html','true',[],''],
	['PAGE','7073',jdecode('Buying+and+Selling'),jdecode(''),'/7073.html','true',[],''],
	['PAGE','7052',jdecode('Store+Tour'),jdecode(''),'/7052.html','true',[],''],
	['PAGE','10655',jdecode('Location%2C+location...'),jdecode(''),'/10655.html','true',[],''],
	['PAGE','10676',jdecode('Directions'),jdecode(''),'/10676.html','true',[],''],
	['PAGE','7094',jdecode('E-mail+Request+Form'),jdecode(''),'/7094.html','true',[],''],
	['PAGE','15850',jdecode('Merchandise'),jdecode(''),'/15850.html','true',[],''],
	['PAGE','10697',jdecode('There%26%23x27%3Bs+always+more...'),jdecode(''),'/10697.html','true',[],''],
	['PAGE','10718',jdecode('Contact+Us'),jdecode(''),'/10718.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Deejay';
theSitetree.paletteFamily='A062E0';
theSitetree.keyvisualId='4640';
theSitetree.keyvisualName='kv_4640.jpg';
theSitetree.fontsetId='10840';
theSitetree.graphicsetId='11307';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Deejay',
				paletteFamily: 	'A062E0',
				keyvisualId: 	'4640',
				keyvisualName: 	'kv_4640.jpg',
				fontsetId: 		'10840',
				graphicsetId: 	'11307',
				contentColor: 	'666666',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FF6732',
				e_color: 		'FF6732',
				f_color: 		'FF6732',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20090515-165833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7094',
internalId:  '',
customField: '20090515-170822'
};
webappMappings['7060']=webappMappings['7060-6183399e8210c55fb6f2b332fbbd9161']={
webappId:    '7060',
documentId:  '7052',
internalId:  '6183399e8210c55fb6f2b332fbbd9161',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '10655',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '10676',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['7008']=webappMappings['7008-3264']={
webappId:    '7008',
documentId:  '7094',
internalId:  '3264',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10634',
internalId:  '',
customField: '20090515-170124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7052',
internalId:  '',
customField: '20090515-170730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10676',
internalId:  '',
customField: '20090515-153726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10655',
internalId:  '',
customField: '20090515-153702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7073',
internalId:  '',
customField: '20090515-170552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10697',
internalId:  '',
customField: '20090515-153826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10718',
internalId:  '',
customField: '20090515-170939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15850',
internalId:  '',
customField: '20090515-170904'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7001',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INLMDD';
var companyName   = 'Recycled+Books+Records+CDs';
var htmlTitle	  = '';
var metaKeywords  = 'Recycled+Books%2C+bookstores%2C+Denton%2C+Texas%2C+record+stores%2C+sell+books%2C+used+bookstore';
var metaContents  = 'Recycled+Books+Records+and+CDs%3A+Serving+Denton%2C+Texas%2C+and+the+world+since+1983.+Recycled+Books+is+a+17%2C000+square+foot+used+bookstore+located+in+downtown+Denton%2C+Texas+in+a+large%2C+historic%2C+purple+building.+Going+on+twenty-six+years+of+business%2C+Recycled+is+proud+of+its+profound+stock+of+books%2C+music%2C+and+movies%2C+as+well+as+a+good-sized+collection+of+rare+and+collectible+items.+Located+at+200+N.+Locust+in+Denton%2C+Texas%2C+our+toll-free+number+is+866-651-5688.';
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();
};
