/* [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','501',jdecode('Music+Store'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','901',jdecode('Guitars%2C+Basses%2C+%26+Drums'),jdecode(''), jdecode('%2F901.html'), 'true',[],'',''],
	['PAGE','922',jdecode('Accessories%2C+Lessons%2C+Etc.'),jdecode(''), jdecode('%2F922.html'), 'true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Architekt';
theSitetree.paletteFamily='C8C0A4';
theSitetree.keyvisualId='1697';
theSitetree.keyvisualName='chart.jpg';
theSitetree.fontsetId='281';
theSitetree.graphicsetId='347';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='C8C0A4';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'comcast',
  product: 'WSCSYSSSSLYTC24M'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Architekt',
				paletteFamily: 	'C8C0A4',
				keyvisualId: 	'1697',
				keyvisualName: 	'chart.jpg',
				fontsetId: 		'281',
				graphicsetId: 	'347',
				contentColor: 	'000000',
				contentBGColor: 'C8C0A4',
				a_color: 		'C8C0A4',
				b_color: 		'5C5438',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20110926-143732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '901',
internalId:  '',
customField: '20110810-124550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '922',
internalId:  '',
customField: '20110926-144039'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INX2QZ';
var companyName   = 'Trapp+Sound+and+Music';
var htmlTitle	  = 'TRAPP+SOUND+AND+MUSIC++Lebanon%2C+IN+46052';
var metaKeywords  = 'guitars%2C+amplifiers%2C+basses%2C+drums%2Cbanjos%2C+mandolins%2C+straps%2C+picks%2C+cables%2C+music+store%2C+guitar+store%2C+musicians%2C+accessories%2C+music+books%2C+strings%2C++sticks%2C++capos%2C+tuners%2C+concert+T+shirts%2C+Alvarez%2C+Fender%2CEpiphone%2C+Ibanez%2C+Schecter%2C+esp+ltd%2C+new+and+used+%2C+acoustic+and+electric%2C+guitar+lessons%2C+bass+lessons%2C+drum+lessons+%2C++Frankfort%2C+Thorntown%2C+Colfax%2C+Crawfordsville%2C+Zionsville%2C+Kirkland%2C+Sheridan%2C+Westfield%2C+Brownsburg%2C+Indianapolis%2C+Lafayette%2C+Boone+county%2C+Lebanon+Indiana+46052+ebay%2C+paypal%2C+craigslist%2C+visa%2C+mastercard%2C+financing+available';
var metaContents  = 'Trapp+Sound+and+Music+Lebanon+IN%2C+46052.+owned+and+operated+by+Darrin+Trapp+%28aka+all+around+sound%29+we+offer+lessons+for+guitar+%2Cbass+%2Cdrums+and%0D%0Apiano%2C+guitars%2C+amplifiers%2C+basses%2C+drums%2Cbanjos%2C+mandolins%2C+straps%2C+picks%2C+cables%2C+music+store%2C+guitar+store%2C+musicians%2C+accessories%2C+music+books%2C+strings%2C++sticks%2C++capos%2C+tuners%2C+concert+T+shirts%2C+Alvarez%2C+Fender%2CEpiphone%2C+Ibanez%2C+Schecter%2C+esp+ltd%2C+new+and+used.+111+west+north+st.+765-482-7558';
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();
};

