/* [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(''),'/index.html','true',[],''],
	['PAGE','1852',jdecode('Used+cars'),jdecode(''),'/inventory.php','true',[],''],
	['PAGE','1894',jdecode('Financing'),jdecode(''),'/1894.html','true',[],''],
	['PAGE','5001',jdecode('Credit+Repair'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','1915',jdecode('Contact'),jdecode(''),'/1915.html','true',[],''],
	['PAGE','2501',jdecode('Auto+Brokers'),jdecode(''),'/2501.html','true',[],''],
	['PAGE','2522',jdecode('Consignment'),jdecode(''),'/2522.html','true',[],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Meta';
theSitetree.paletteFamily='72A7D3';
theSitetree.keyvisualId='11103';
theSitetree.keyvisualName='kv_11103.jpg';
theSitetree.fontsetId='31995';
theSitetree.graphicsetId='13826';
theSitetree.contentColor='020202';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Meta',
				paletteFamily: 	'72A7D3',
				keyvisualId: 	'11103',
				keyvisualName: 	'kv_11103.jpg',
				fontsetId: 		'31995',
				graphicsetId: 	'13826',
				contentColor: 	'020202',
				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: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20080803-211737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2522',
internalId:  '',
customField: '20080705-234934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20080705-225649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20080705-234822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20080708-005716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20080706-002919'
};
webappMappings['7008']=webappMappings['7008-5894']={
webappId:    '7008',
documentId:  '2501',
internalId:  '5894',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-5895']={
webappId:    '7008',
documentId:  '1894',
internalId:  '5895',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-10440966']={
webappId:    '1501',
documentId:  '1801',
internalId:  '10440966',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20080706-165728'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2VEZ';
var companyName   = 'Good+Used+Cars++++++++2722+Simpson+Ave.++Aberdeen%2C+Washington+360-532-6526';
var htmlTitle	  = 'Aberdeen+Good+Used+Cars+';
var metaKeywords  = 'Armando+Juarez%2C+Ernie+Bushong%2C+Rhonda+Fink%2C+Aberdeen%2C+Washington%2C+car%2C+truck%2C+suv%2C+auto%2C+broker%2C+financing%2C+in+house+financing%2C+bad+credit%2C+ford%2C+chevy%2C+honda%2C+toyota%2C+kia%2C+lincoln%2C+mercury%2C+scion%2C+bmw%2C+pontiac%2C+buick%2C+lexus%2C+mercedes%2C+hyundai%2C+nissan%2C+dodge%2C+jeep%2C+chrysler%2C+hummer%2C+mitsubishi%2C+saturn%2C+roush%2C+saleen%2C+foose%2C+volvo%2C+acura%2C+bad+credit%2C+credit+repair%2C+credit%2C+consignment%2C+purchasing%2C+automobile%2C+f150%2C+civic%2C+tacoma%2C+4runner%2C+silverado';
var metaContents  = 'Rhonda%2C+Armando%2C+and+Ernie+of+Good+Used+Cars+of+Aberdeen+Washington+are+here+to+help+you+with+your+vehicle+needs.++We+do+in+house+financing%2C+auto+brokering%2C+credit+repair%2C+consignment+and+much+more.++Thank+you+Grays+Harbor+for+all+your+support%21%21';
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();
};
