/* [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','10401',jdecode('Home'),jdecode(''),'/10401.html','true',[],'',''],
	['PAGE','10473',jdecode('About+us'),jdecode(''),'/10473.html','true',[],'',''],
	['PAGE','10452',jdecode('Products'),jdecode(''),'/10452/index.html','true',[ 
		['PAGE','11401',jdecode('Quill%C2%AE'),jdecode(''),'/10452/11401.html','true',[],'',''],
		['PAGE','11501',jdecode('Valve%2FInjection+Purge'),jdecode(''),'/10452/11501.html','true',[],'',''],
		['PAGE','11522',jdecode('Radiator'),jdecode(''),'/10452/11522.html','true',[],'',''],
		['PAGE','11601',jdecode('Supertech'),jdecode(''),'/10452/11601.html','true',[],'',''],
		['PAGE','27901',jdecode('Static+Engine+Flush+Kit'),jdecode(''),'/10452/27901.html','true',[],'',''],
		['PAGE','29501',jdecode('Tablets+%26+Crumb'),jdecode(''),'/10452/29501.html','true',[],'','']
	],'',''],
	['PAGE','31501',jdecode('Sales'),jdecode(''),'/31501.html','true',[],'',''],
	['PAGE','34301',jdecode('Private+Label'),jdecode(''),'/34301.html','true',[],'',''],
	['PAGE','10494',jdecode('News+%26+Events'),jdecode(''),'/10494.html','true',[],'',''],
	['PAGE','32301',jdecode('Mission+Statement'),jdecode(''),'/32301.html','true',[],'',''],
	['PAGE','10515',jdecode('Contact'),jdecode(''),'/10515.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='333333';
theSitetree.keyvisualId='1270';
theSitetree.keyvisualName='cd_stapel.jpg';
theSitetree.fontsetId='190';
theSitetree.graphicsetId='226';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Profile',
				paletteFamily: 	'333333',
				keyvisualId: 	'1270',
				keyvisualName: 	'cd_stapel.jpg',
				fontsetId: 		'190',
				graphicsetId: 	'226',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'333333',
				b_color: 		'999999',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10401',
internalId:  '',
customField: '20100902-043819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10452',
internalId:  '',
customField: '20100902-040611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10473',
internalId:  '',
customField: '20100902-040138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10515',
internalId:  '',
customField: '20100831-212101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10494',
internalId:  '',
customField: '20110308-120622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11401',
internalId:  '',
customField: '20100906-212426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11522',
internalId:  '',
customField: '20100831-211621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11501',
internalId:  '',
customField: '20100906-212550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20100902-042136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27901',
internalId:  '',
customField: '20100902-042757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29501',
internalId:  '',
customField: '20100831-212615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31501',
internalId:  '',
customField: '20100902-043208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32301',
internalId:  '',
customField: '20100831-172946'
};
webappMappings['1501']=webappMappings['1501-33206000']={
webappId:    '1501',
documentId:  '10401',
internalId:  '33206000',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34301',
internalId:  '',
customField: '20100831-174315'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INZ1S3';
var companyName   = 'Chemplex+-+Tradition+%26+Innovation';
var htmlTitle	  = 'Chemplex+Automotive+Group%2C+Inc.';
var metaKeywords  = 'diesel%2C+fuel+stabilizer%2C+windshield+cleaner%2C+radiator%2C+Quill%2C+purge%2C+supertech%2C+engine+flush%2C+fuel+system+cleaner%2C+octane';
var metaContents  = 'Designed+for+a+Greener+Environment';
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();
};

