/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','74822',jdecode('We+now+Rent+vehicles%21%21%21'),jdecode(''),'/74822.html','true',[],'',''],
	['PAGE','452',jdecode('About+us'),jdecode(''),'/452.html','true',[],'',''],
	['PAGE','75190',jdecode('Meet+Our+Staff'),jdecode(''),'/75190.html','true',[],'',''],
	['PAGE','74092',jdecode('What%26%23x27%3Bs+Happening+%3F'),jdecode(''),'/74092.html','true',[],'',''],
	['PAGE','473',jdecode('Inventory'),jdecode(''),'/473/index.html','true',[ 
		['PAGE','74224',jdecode('Specials'),jdecode(''),'/473/74224.html','true',[],'','']
	],'',''],
	['PAGE','578',jdecode('Contact'),jdecode(''),'/578.html','true',[],'',''],
	['PAGE','12301',jdecode('Map'),jdecode(''),'/12301.html','true',[],'',''],
	['PAGE','12401',jdecode('Driving+directions'),jdecode(''),'/12401.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='A3CAFE';
theSitetree.keyvisualId='780';
theSitetree.keyvisualName='uhr.jpg';
theSitetree.fontsetId='142';
theSitetree.graphicsetId='161';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Metal',
				paletteFamily: 	'A3CAFE',
				keyvisualId: 	'780',
				keyvisualName: 	'uhr.jpg',
				fontsetId: 		'142',
				graphicsetId: 	'161',
				contentColor: 	'DDDDDD',
				contentBGColor: '000000',
				a_color: 		'A3CAFE',
				b_color: 		'87A7D2',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-360']={
webappId:    '7008',
documentId:  '578',
internalId:  '360',
customField: 'language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-1481553']={
webappId:    '1501',
documentId:  '401',
internalId:  '1481553',
customField: '1501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '12301',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '12401',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC24G']={
webappId:    '5003',
documentId:  '401',
internalId:  'tid:1;pid:WSCSYSSSSLYTC24G',
customField: 'en:US:'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100211-161444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090801-153154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100211-161916'
};
webappMappings['7060']=webappMappings['7060-6770b0c136e97dc9f09fcd33d860d77f']={
webappId:    '7060',
documentId:  '74092',
internalId:  '6770b0c136e97dc9f09fcd33d860d77f',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75190',
internalId:  '',
customField: '20100326-223218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20070420-220735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12301',
internalId:  '',
customField: '20070428-220451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20070428-220521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74092',
internalId:  '',
customField: '20090519-194105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74224',
internalId:  '',
customField: '20090918-182107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74822',
internalId:  '',
customField: '20100211-161648'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN30Q9';
var companyName   = 'Midwest+Auto+Sales%2C+Inc';
var htmlTitle	  = 'Midwest+Auto';
var metaKeywords  = 'ottumwa%2C+iowa%2C+midwest%2C+midwest+auto%2C+sales%2C+used+vehicles%2C+cars%2C+trucks%2C+motorcycles%2C+tractors%2C+equipment%2C+buy+here%2Fpay+here%2C+in+house+financing%2C+late+model%2C+classics%2C+buy+here%2C+pay+here%2C+Ed+Black%2C+Lisa+Black%2C+financing%2C+dodge%2C+chevy%2C+Ford%2C+';
var metaContents  = 'A+great+place+to+buy+your+next+vehicle+at+fair+and+competitive+prices.+Knowledgeable+and+friendly+staff+to+help+you+with+your+vehicle+buying+needs.+Buy+here%2Fpay+here.+0%25+financing%2C+0%25+interest';
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();
};
