/* [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','7001',jdecode('Home'),jdecode(''),'/7001.html','true',[],'',''],
	['PAGE','7101',jdecode('About+us'),jdecode(''),'/7101/index.html','true',[ 
		['PAGE','7122',jdecode('Our+team'),jdecode(''),'/7101/7122.html','true',[],'',''],
		['PAGE','7143',jdecode('How+to+find+us'),jdecode(''),'/7101/7143.html','true',[],'','']
	],'',''],
	['PAGE','7164',jdecode('Service'),jdecode(''),'/7164.html','true',[],'',''],
	['PAGE','7185',jdecode('Contact'),jdecode(''),'/7185.html','true',[],'',''],
	['PAGE','7206',jdecode('C-t-C++Carports'),jdecode(''),'/7206.html','true',[],'',''],
	['PAGE','8401',jdecode('Parts+%26+Accessories'),jdecode(''),'/8401.html','true',[],'',''],
	['PAGE','9801',jdecode('Photo+Gallery'),jdecode(''),'/9801.html','true',[],'',''],
	['PAGE','18101',jdecode('Gift+Ideas'),jdecode(''),'/18101.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Column';
theSitetree.paletteFamily='45724E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10400';
theSitetree.graphicsetId='10617';
theSitetree.contentColor='121447';
theSitetree.contentBGColor='F8FBF9';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Column',
				paletteFamily: 	'45724E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10400',
				graphicsetId: 	'10617',
				contentColor: 	'121447',
				contentBGColor: 'F8FBF9',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'45724E',
				e_color: 		'25542E',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20101103-105550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20101102-123712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7122',
internalId:  '',
customField: '20101103-112132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7206',
internalId:  '',
customField: '20101028-160810'
};
webappMappings['7060']=webappMappings['7060-c0177ccfced488da07d37b9edf31ef34']={
webappId:    '7060',
documentId:  '9801',
internalId:  'c0177ccfced488da07d37b9edf31ef34',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7143',
internalId:  '',
customField: '20101103-112153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7164',
internalId:  '',
customField: '20101028-155458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9801',
internalId:  '',
customField: '20101103-111117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20101021-150225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7185',
internalId:  '',
customField: '20101021-153602'
};
webappMappings['7008']=webappMappings['7008-9881']={
webappId:    '7008',
documentId:  '7185',
internalId:  '9881',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18101',
internalId:  '',
customField: '20101206-141827'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZDQT';
var companyName   = 'Merrick+RV+Sales+%26+Service';
var htmlTitle	  = 'Merrick+RV';
var metaKeywords  = 'Merrick+rv%2C+Blackfoot+RV%2C+Blackfoot%2C+RV+parts%2C+RV+service%2C+used+RV+parts%2C+merrick+rv+blackfoot%2C+merrickrv.com';
var metaContents  = 'Welcome+to+Merrick+RV+in+Blackfoot%2C+Idaho.+Learn+more+about+us+at+our+new+website.';
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();
};

