/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','1852',jdecode('About+Us'),jdecode(''), jdecode('%2F1852.html'), 'true',[],'',''],
	['PAGE','1873',jdecode('Services'),jdecode(''), jdecode('%2F1873%2Findex.html'), 'true',[ 
		['PAGE','1894',jdecode('Repairs'),jdecode(''), jdecode('%2F1873%2F1894.html'), 'true',[],'',''],
		['PAGE','1915',jdecode('Mobile+Service'),jdecode(''), jdecode('%2F1873%2F1915.html'), 'true',[],'','']
	],'',''],
	['PAGE','1957',jdecode('Parts'),jdecode(''), jdecode('%2F1957%2Findex.html'), 'true',[ 
		['PAGE','1999',jdecode('Parts+Request'),jdecode(''), jdecode('%2F1957%2F1999.html'), 'true',[],'',''],
		['ITEM','4701',jdecode('Online+Parts+Store'),jdecode(''), jdecode('https%3A%2F%2Fwww.ntpdistribution.com%2FVia%2Findex.jsp%3FRefAgent%3DR0016580'), 'true',[],'','_blank']
	],'',''],
	['PAGE','1936',jdecode('Storage'),jdecode(''), jdecode('%2F1936.html'), 'true',[],'',''],
	['PAGE','2020',jdecode('Contact+Us'),jdecode(''), jdecode('%2F2020.html'), 'true',[ 
		['ITEM','11201',jdecode('How+To+Find+Us'),jdecode(''), jdecode('http%3A%2F%2Fmaps.google.com%2Fmaps%3Ff%3Dq%26source%3Ds_q%26hl%3Den%26geocode%3D%26q%3DSouth%2BCoast%2BRV%2BService%2BCenter%2C%2BChula%2BVista%2C%2BCA%26sll%3D37.0625%2C-95.677068%26sspn%3D29.854268%2C56.162109%26ie%3DUTF8%26hq%3DSouth%2BCoast%2BRV%2BService%2BCenter%2C%26hnear%3DChula%2BVista%2C%2BCA%26ll%3D32.635616%2C-117.08456%26spn%3D0.058257%2C0.109692%26t%3Dh%26z%3D13%26iwloc%3DA'), 'true',[],'','_blank']
	],'',''],
	['PAGE','8701',jdecode('Photo+Gallery'),jdecode(''), jdecode('%2F8701.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Chaste';
theSitetree.paletteFamily='DFBB74';
theSitetree.keyvisualId='11554';
theSitetree.keyvisualName='kv_11554.jpg';
theSitetree.fontsetId='33239';
theSitetree.graphicsetId='13965';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp13-cbeyon',
  product: 'WSCSYSSSSLYTC2ZA'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Chaste',
				paletteFamily: 	'DFBB74',
				keyvisualId: 	'11554',
				keyvisualName: 	'kv_11554.jpg',
				fontsetId: 		'33239',
				graphicsetId: 	'13965',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'DFBB74',
				b_color: 		'846A36',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-16494']={
webappId:    '7008',
documentId:  '1999',
internalId:  '16494',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20110824-140525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20100426-182341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20100428-145726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20100426-172948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20100426-182900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20100426-183535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1957',
internalId:  '',
customField: '20100426-173306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1999',
internalId:  '',
customField: '20100423-193937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2020',
internalId:  '',
customField: '20110725-183513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20100426-170347'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['7080']=webappMappings['7080-800']={
webappId:    '7080',
documentId:  '1852',
internalId:  '800',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-cb8dad4f114cc2c137759d4088966077']={
webappId:    '7060',
documentId:  '8701',
internalId:  'cb8dad4f114cc2c137759d4088966077',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7C6RA';
var companyName   = 'South+Coast+RV+Service+Center';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};

