/* [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','5401',jdecode('Home'),jdecode(''),'/5401.html','true',[],''],
	['PAGE','37071',jdecode('Find+Me+A+Car%21'),jdecode(''),'/37071.html','true',[],''],
	['PAGE','5452',jdecode('Current+Inventory'),jdecode(''),'/5452/index.html','true',[ 
		['PAGE','40471',jdecode('01+Pontiac+Firebird'),jdecode(''),'/5452/40471.html','true',[],''],
		['PAGE','41113',jdecode('02+Ford+Explorer'),jdecode(''),'/5452/41113.html','true',[],''],
		['PAGE','51171',jdecode('03+Hyundai+Tiburon'),jdecode(''),'/5452/51171.html','true',[],''],
		['PAGE','41071',jdecode('04+Sebring+Convert.'),jdecode(''),'/5452/41071.html','false',[],''],
		['PAGE','41092',jdecode('00+Toyota+Corolla'),jdecode(''),'/5452/41092.html','false',[],''],
		['PAGE','35871',jdecode('98+Chevy+Cavalier'),jdecode(''),'/5452/35871.html','false',[],''],
		['PAGE','49171',jdecode('95+Nissan+Pathfinder'),jdecode(''),'/5452/49171.html','false',[],''],
		['PAGE','49192',jdecode('99+Honda+CR-V'),jdecode(''),'/5452/49192.html','false',[],''],
		['PAGE','40671',jdecode('97+Ford+Contour'),jdecode(''),'/5452/40671.html','false',[],''],
		['PAGE','47171',jdecode('05+Ranger+STX'),jdecode(''),'/5452/47171.html','false',[],'']
	],''],
	['PAGE','6101',jdecode('Sell+Us+Your+Car%21'),jdecode(''),'/6101.html','true',[],''],
	['PAGE','5536',jdecode('Contact+Us'),jdecode(''),'/5536.html','true',[],''],
	['PAGE','5557',jdecode('Map+%26+Directions'),jdecode(''),'/5557.html','true',[],''],
	['PAGE','32371',jdecode('Save+On+Gas'),jdecode(''),'/32371.html','true',[],'']];
var siteelementCount=17;
theSitetree.topTemplateName='Pain';
theSitetree.paletteFamily='4C4C4C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10379';
theSitetree.graphicsetId='10551';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4C4C4C';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Pain',
				paletteFamily: 	'4C4C4C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10379',
				graphicsetId: 	'10551',
				contentColor: 	'FFFFFF',
				contentBGColor: '4C4C4C',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20100428-031752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35871',
internalId:  '',
customField: '20100511-133729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5536',
internalId:  '',
customField: '20090820-132142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5452',
internalId:  '',
customField: '20100615-164822'
};
webappMappings['7008']=webappMappings['7008-22006']={
webappId:    '7008',
documentId:  '37071',
internalId:  '22006',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5557',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5557',
internalId:  '',
customField: '20100104-172653'
};
webappMappings['7008']=webappMappings['7008-19766']={
webappId:    '7008',
documentId:  '6101',
internalId:  '19766',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20091014-134127'
};
webappMappings['7008']=webappMappings['7008-19776']={
webappId:    '7008',
documentId:  '5536',
internalId:  '19776',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32371',
internalId:  '',
customField: '20090908-130938'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-21488441']={
webappId:    '1501',
documentId:  '5401',
internalId:  '21488441',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40471',
internalId:  '',
customField: '20100615-170327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37071',
internalId:  '',
customField: '20091124-170654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40671',
internalId:  '',
customField: '20091111-152057'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41092',
internalId:  '',
customField: '20100511-133708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41071',
internalId:  '',
customField: '20100511-133639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41113',
internalId:  '',
customField: '20100615-171708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47171',
internalId:  '',
customField: '20091218-190611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49171',
internalId:  '',
customField: '20100321-233729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49192',
internalId:  '',
customField: '20100413-160631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51171',
internalId:  '',
customField: '20100615-173025'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3HHB';
var companyName   = 'WE+BUY+CARS++++++%28559%29+492-9224';
var htmlTitle	  = 'WE+BUY+CARS+-+Jim+%26+Jim+buy+cars%2C+trucks%2C+vans%2C+and+SUVs+in+Fresno%2C+Clovis%2C+Madera%2C+Sanger%2C+Selma%2C+Reedley%2C+and+more.+WE+BUY+CARS';
var metaKeywords  = 'we+buy+cars%2C+jim+buys+cars%2C+fresno%2C+clovis%2C+ca%2C+used+cars%2C+sell+your+car%2C+sell+cars%2C+cars%2C+buy%2C+sell%2C+trade%2C+financing%2C+jimbuyscars.com%2C+www.jimbuyscars.com%2C+we%2C+buy%2C+we+buy%2C+jim%2C+jim++Jim';
var metaContents  = 'We+Buy+Cars+is+a+used+car+dealer+in+the+Fresno%2FClovis+CA+area.+Jim++Jim+buy+all+makes++models.+We+also+sell+our+best+cars+to+the+public+at+below+market+prices+and+list+them+for+sale+on+our+www.JimBuysCars.com+web+site.';
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();
};
