/* [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','301',jdecode('Hanna+Auto+Mart'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','501',jdecode('Contact+Us'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','133223',jdecode('New+Owner'),jdecode(''),'/133223.html','true',[],'',''],
	['PAGE','522',jdecode('CARS'),jdecode(''),'/522/index.html','true',[ 
		['PAGE','15001',jdecode('TO+%24+2995'),jdecode(''),'/522/15001.html','true',[],'',''],
		['PAGE','543',jdecode('TO+%24+3995'),jdecode(''),'/522/543.html','true',[],'',''],
		['PAGE','564',jdecode('TO+%24+4995'),jdecode(''),'/522/564.html','true',[],'',''],
		['PAGE','585',jdecode('TO+%24+5995'),jdecode(''),'/522/585.html','true',[],'',''],
		['PAGE','10701',jdecode('TO+%24+9%2C995'),jdecode(''),'/522/10701.html','true',[],'','']
	],'',''],
	['PAGE','606',jdecode('TRUCKS'),jdecode(''),'/606/index.html','true',[ 
		['PAGE','627',jdecode('SMALL'),jdecode(''),'/606/627.html','true',[],'',''],
		['PAGE','648',jdecode('LARGE'),jdecode(''),'/606/648.html','true',[],'',''],
		['PAGE','669',jdecode('WORK'),jdecode(''),'/606/669.html','true',[],'','']
	],'',''],
	['PAGE','753',jdecode('SUV%26%23x27%3Bs'),jdecode(''),'/753.html','true',[],'',''],
	['PAGE','18722',jdecode('VANS'),jdecode(''),'/18722.html','true',[],'',''],
	['PAGE','30005',jdecode('SCOOTERS'),jdecode(''),'/30005.html','true',[],'',''],
	['PAGE','30552',jdecode('EdenPure'),jdecode(''),'/30552.html','true',[],'',''],
	['PAGE','774',jdecode('Warranty'),jdecode(''),'/774.html','true',[],'',''],
	['PAGE','93623',jdecode('Service'),jdecode(''),'/93623.html','true',[],'',''],
	['PAGE','6822',jdecode('How+to+find+us'),jdecode(''),'/6822.html','true',[],'',''],
	['PAGE','795',jdecode('About+us'),jdecode(''),'/795.html','true',[],'',''],
	['PAGE','5601',jdecode('Map'),jdecode(''),'/5601.html','true',[],'',''],
	['PAGE','879',jdecode('Request'),jdecode(''),'/879.html','true',[],'',''],
	['PAGE','36012',jdecode('HOURS'),jdecode(''),'/36012.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Coaster';
theSitetree.paletteFamily='818081';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10476';
theSitetree.graphicsetId='10971';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Coaster',
				paletteFamily: 	'818081',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10476',
				graphicsetId: 	'10971',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'858586',
				e_color: 		'858586',
				f_color: 		'858586',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-239']={
webappId:    '7008',
documentId:  '879',
internalId:  '239',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5601',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1501']=webappMappings['1501-42006']={
webappId:    '1501',
documentId:  '301',
internalId:  '42006',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100506-144658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100112-134652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30552',
internalId:  '',
customField: '20100113-100113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30005',
internalId:  '',
customField: '20100322-144923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '522',
internalId:  '',
customField: '20091126-220544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15001',
internalId:  '',
customField: '20100701-110559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '543',
internalId:  '',
customField: '20100701-094251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '564',
internalId:  '',
customField: '20100701-094803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '585',
internalId:  '',
customField: '20100701-095207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10701',
internalId:  '',
customField: '20100701-102836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '606',
internalId:  '',
customField: '20090303-111959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '627',
internalId:  '',
customField: '20100504-085542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '648',
internalId:  '',
customField: '20100504-085617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '669',
internalId:  '',
customField: '20100208-132729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '753',
internalId:  '',
customField: '20100701-110125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18722',
internalId:  '',
customField: '20100701-105539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '774',
internalId:  '',
customField: '20091126-234535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6822',
internalId:  '',
customField: '20080512-142839'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '795',
internalId:  '',
customField: '20091203-094439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5601',
internalId:  '',
customField: '20080512-153220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '879',
internalId:  '',
customField: '20091126-230400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36012',
internalId:  '',
customField: '20091126-231024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93623',
internalId:  '',
customField: '20091126-225251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '133223',
internalId:  '',
customField: '20100112-134433'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INXXK2';
var companyName   = 'HANNA+AUTO+MART+LLC';
var htmlTitle	  = 'Hanna+Auto+Mart+';
var metaKeywords  = 'Used+Cars%2C+Used+Autos%2C+Automobiles%2C+Used+Trucks';
var metaContents  = 'Used+Cars%2C+Used+Autos+Automobiles%2C+Used+trucks';
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();
};
