/* [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','2201',jdecode('HOME'),jdecode(''), jdecode('%2F2201.html'), 'true',[],'',''],
	['PAGE','2252',jdecode('PHILOSOPHY'),jdecode(''), jdecode('%2F2252.html'), 'true',[],'',''],
	['PAGE','2301',jdecode('PRODUCTS'),jdecode(''), jdecode('%2F2301%2Findex.html'), 'true',[ 
		['PAGE','13215',jdecode('Detail+Magnifier'),jdecode(''), jdecode('%2F2301%2F13215.html'), 'true',[],'',''],
		['PAGE','13236',jdecode('AC+Filter'),jdecode(''), jdecode('%2F2301%2F13236.html'), 'true',[],'',''],
		['PAGE','21215',jdecode('Component+Footer'),jdecode(''), jdecode('%2F2301%2F21215.html'), 'true',[],'','']
	],'',''],
	['PAGE','2322',jdecode('DIY'),jdecode(''), jdecode('%2F2322.html'), 'true',[],'',''],
	['PAGE','3901',jdecode('LINKS'),jdecode(''), jdecode('%2F3901.html'), 'true',[],'',''],
	['PAGE','2343',jdecode('REVIEWS'),jdecode(''), jdecode('%2F2343.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='FBB044';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32050';
theSitetree.graphicsetId='13869';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'powweb',
  product: 'WSCSYSSSSLY0XRNC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Grace',
				paletteFamily: 	'FBB044',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32050',
				graphicsetId: 	'13869',
				contentColor: 	'484848',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20110528-171843'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2252',
internalId:  '',
customField: '20090531-120134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2301',
internalId:  '',
customField: '20111104-171658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2322',
internalId:  '',
customField: '20110623-202146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2343',
internalId:  '',
customField: '20111104-172001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13215',
internalId:  '',
customField: '20111105-093901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20111104-171922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21215',
internalId:  '',
customField: '20111104-171824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13236',
internalId:  '',
customField: '20111104-171751'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN3JU2';
var companyName   = 'ET%27s++EconoTweaks+-+Great+Audio+Tweaks+and+DIY+Recipes+';
var htmlTitle	  = 'EconoTweaks+-Economic+minded+high+quality+products+to+improve+your+sound%21';
var metaKeywords  = 'Detail+Magnifiers%2C+Detail+Magnifier%2C+detail+magnifiers%2C+detail+magnifier%2C+conrad+johnson%2C+ayre%2C+marantz%2C+mcintosh%2C+jm+labs%2C+focal%2C+nad%2C+psb%2C+shunyata%2C+richard+gray%2C+tice%2C+ps+audio%2C+power%2C+clean%2C+filter%2C+rfi%2C+rf%2C+emi%2C+noise%2C+grunge%2C+detail%2C+micro+detail%2C+image%2C+sound+stage%2C+soundstage%2C+vinyl%2C+CD%2C+SACD%2C+sampling+rate%2C+upsample%2CDAC%2C+phono%2C+turntable%2C+project%2C+basis%2C+vpi%2C+clearaudio%2C+teres%2C+tara+labs%2Ceconotweaks%2C+synergistic+research%2C+jena+labs%2C+kimber%2C+kimber+kable%2C+wattgate%2C+oyaide%2C+hubbell%2C+audio+grade%2C+audiophile%2C+audiophiles%2C+audio+asylum%2C+audiogon%2C+products%2C+for+sale%2C+improve%2C+DIY%2Cart+audio%2C+cary%2Cmagnepan%2C+quad%2C+tube%2C+tubes%2C+soft%2C+warm%2C+digital%2C+analog%2C+interconnect%2C+speaker+cable%2C+speaker%2C+cable%2C+outlet%2C+AC%2CDC%2C+capacitor%2C+resistor%2Chigh+quality%2C+RCA%2C+XLR%2C+BNC%2C+Spade%2C+spade+lug%2C+banana%2C+banana+plug%2C+gold%2C+silver%2CWBT%2C+silver+solder%2C+3%2F16%2C1%2F4%2C5%2F16%2C+wholesale%2C+retail%2C+best+price%2C+best+prices%2C+lowest+price%2C+made+in+u.s.a.%2C+room+treatment%2C+acoustic+panels%2C+isolation%2C+vibration%2C+deflex%2C+herbies%2C+damper%2C+points%2C+cones%2C+speaker+stands%2C+gallo%2C+grado%2C+sumiko%2C+rega%2C+rb-300%2C+tonearm%2C+arm%2C+balance%2C+60+cycle+hum%2C+ground%2C+ground+loop%2C+ground+loops%2C+manley%2C+manley+labs%2C+acoustic+sounds%2C+acoustic%2C+solid+state%2C+SS%2C+denon%2C+classe%2C+parasound%2C+yba%2C+accuphase%2C+threshold%2C+mccormack%2C+carver%2C+cambridge%2C+plinius%2Ckrell%2C+sme%2C+sota%2C+musical+fidelity%2C+tweak%2C+improve%2C+vh+audio%2C+shakti%2C+maple%2C+vibration%2C+resonance%2C+nordost%2C+titanium%2C+annealed%2C+wire%2Ccrimp%2C+solder%2C+silver+solder%2C+visa%2C+mastercard%2C+discover%2C+american+express%2C+paypal%2C+check%2C+money+order%2C+feedback.+detail+magnifier%2C+alan+maher+designs%2C+walker+high+definition+links%2C+tweaks%2C+tweaking%2C+tweeks%2C+piezo+electric%2C+crystals%2C+amethyst%2C+quartz%2C+tourmaline';
var metaContents  = 'ETs+EconoTweaks%3A+great+products+to+improve+the+sound+of+your+music+system%21+Whether+mid+-+fi+%2C+hi-fi+or+ultra+hi-fi+and+anywhere+in+between.+Our+Detail+Magnifiers+and+other+products+make+the+music+better+or+your+money+back%21+See+our+DIY+pages+too%21';
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();
};

