/* [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','5301',jdecode('Home'),jdecode(''),'/5301.html','true',[],'',''],
	['PAGE','9101',jdecode('Appointments'),jdecode(''),'/9101.html','true',[],'',''],
	['PAGE','71923',jdecode('Location'),jdecode(''),'/71923.html','true',[],'',''],
	['PAGE','75234',jdecode('DETAILING'),jdecode(''),'/75234.html','true',[],'',''],
	['PAGE','47065',jdecode('Window+Tinting'),jdecode(''),'/47065.html','true',[],'',''],
	['PAGE','73234',jdecode('*+Radars+*'),jdecode(''),'/73234.html','true',[],'',''],
	['PAGE','8101',jdecode('Tail+Lights'),jdecode(''),'/8101.html','true',[],'',''],
	['PAGE','8122',jdecode('HeadLights'),jdecode(''),'/8122.html','true',[],'',''],
	['PAGE','10201',jdecode('Painting'),jdecode(''),'/10201.html','true',[],'',''],
	['PAGE','67923',jdecode('Angel+Eyes'),jdecode(''),'/67923.html','true',[],'',''],
	['PAGE','8185',jdecode('Painted+Rims'),jdecode(''),'/8185.html','true',[],'',''],
	['PAGE','40712',jdecode('HID%26%23x27%3Bs'),jdecode(''),'/40712.html','true',[],'',''],
	['PAGE','26343',jdecode('*PRICE%24*'),jdecode(''),'/26343.html','true',[],'',''],
	['PAGE','50465',jdecode('Remote+Starts'),jdecode(''),'/50465.html','true',[],'',''],
	['PAGE','5352',jdecode('About+us'),jdecode(''),'/5352.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='FC2323';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10381';
theSitetree.graphicsetId='10561';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'FC2323',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10381',
				graphicsetId: 	'10561',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47065',
internalId:  '',
customField: '20100822-181032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100823-135633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5352',
internalId:  '',
customField: '20090717-191604'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '71923',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20091025-160822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8122',
internalId:  '',
customField: '20090812-163619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8185',
internalId:  '',
customField: '20100510-165738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20100822-180037'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20091019-141457'
};
webappMappings['1501']=webappMappings['1501-5183481']={
webappId:    '1501',
documentId:  '5301',
internalId:  '5183481',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67923',
internalId:  '',
customField: '20100510-173555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40712',
internalId:  '',
customField: '20100510-170235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26343',
internalId:  '',
customField: '20100822-180805'
};
webappMappings['7008']=webappMappings['7008-4581']={
webappId:    '7008',
documentId:  '9101',
internalId:  '4581',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71923',
internalId:  '',
customField: '20100816-155232'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73234',
internalId:  '',
customField: '20100822-180634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75234',
internalId:  '',
customField: '20100823-135716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50465',
internalId:  '',
customField: '20091222-181908'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INLR6B';
var companyName   = 'Custom+Sprayz';
var htmlTitle	  = 'CustomSprayz.com';
var metaKeywords  = 'tints%2C+rims%2C+paint%2C+custom%2C+work%2C+window+tints%2C+auto+tint%2C+rim+paint%2C+audi+leds%2C+angel+eyes%2C+sub+boxes%2C+audio%2C+';
var metaContents  = 'Custom%2C+tints%2C+rims%2C+tail+light+tints%2C+head+light+tints%2C+decals%2C+spray+paint%2C+custom+paint+work%2C+custom+paint%2C+valve+cover%2C+window+tint%2C+auto+tint%2C+glass+tint%2C+audio%2C+rim+painting%2C+headlight+housing+paint%2C+angel+eyes%2C+audi+leds%2C+audi+style+leds%2C+sub+boxes%2C+reverse+camera%2C+head+units%2C+';
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();
};
