/* [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','4801',jdecode('Home'),jdecode(''),'/4801.html','true',[],'',''],
	['PAGE','30923',jdecode('Ask+The+Maestro'),jdecode(''),'/30923.html','true',[],'',''],
	['PAGE','12612',jdecode('Piano+Tuning+%26+Repair'),jdecode(''),'/12612.html','true',[],'',''],
	['PAGE','12712',jdecode('Piano+Rebuilding'),jdecode(''),'/12712.html','true',[],'',''],
	['PAGE','4852',jdecode('Music+Lessons'),jdecode(''),'/4852/index.html','true',[ 
		['PAGE','12633',jdecode('Music+Instructors'),jdecode(''),'/4852/12633.html','true',[],'','']
	],'',''],
	['PAGE','32223',jdecode('Church+Music+Info'),jdecode(''),'/32223.html','true',[],'',''],
	['PAGE','18812',jdecode('Special+Links'),jdecode(''),'/18812.html','true',[],'',''],
	['PAGE','4894',jdecode('About+Premier+Music'),jdecode(''),'/4894.html','true',[],'',''],
	['PAGE','31423',jdecode('Order+Form'),jdecode(''),'/31423.html','true',[],'',''],
	['PAGE','4915',jdecode('Contact+Premier+Music'),jdecode(''),'/4915/index.html','true',[ 
		['PAGE','13912',jdecode('Email+Premier+Music'),jdecode(''),'/4915/13912.html','true',[],'','']
	],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Music';
theSitetree.paletteFamily='C0BEFF';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10443';
theSitetree.graphicsetId='10820';
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: 			'Music',
				paletteFamily: 	'C0BEFF',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10443',
				graphicsetId: 	'10820',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'C0BEFF',
				e_color: 		'777676',
				f_color: 		'777676',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20090616-000242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4852',
internalId:  '',
customField: '20090307-135521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4894',
internalId:  '',
customField: '20090327-231304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4915',
internalId:  '',
customField: '20090616-000522'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1003']=webappMappings['1003-aendu0in2v4p11dd1120926']={
webappId:    '1003',
documentId:  '30923',
internalId:  'aendu0in2v4p11dd1120926',
customField: 'en:US'
};
webappMappings['1501']=webappMappings['1501-10381528']={
webappId:    '1501',
documentId:  '4801',
internalId:  '10381528',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12633',
internalId:  '',
customField: '20081115-211102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12612',
internalId:  '',
customField: '20081124-204512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12712',
internalId:  '',
customField: '20080913-111346'
};
webappMappings['7008']=webappMappings['7008-6402']={
webappId:    '7008',
documentId:  '13912',
internalId:  '6402',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13912',
internalId:  '',
customField: '20080918-100556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18812',
internalId:  '',
customField: '20081124-204438'
};
webappMappings['7008']=webappMappings['7008-8680']={
webappId:    '7008',
documentId:  '13912',
internalId:  '8680',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30923',
internalId:  '',
customField: '20100217-003120'
};
webappMappings['7008']=webappMappings['7008-8733']={
webappId:    '7008',
documentId:  '31423',
internalId:  '8733',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31423',
internalId:  '',
customField: '20080920-120845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32223',
internalId:  '',
customField: '20081230-144017'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2V4P';
var companyName   = 'Premier+Piano+Service';
var htmlTitle	  = 'Premier+Piano+Service';
var metaKeywords  = 'PremierMusicCenter.com%2C+Premier+Music+Center%2C+Premier+Piano+Service%2C+piano%2C+instrument+sales%2C+music+lessons%2C+piano+tuning%2C+piano+repairs%2C+Manassas%2C+instrument+rentals%2C+music+books%2C+Premier%2C+pianos%2C+new+pianos%2C+used+pianos%2C+lessons%2C+Prince+William%2C+Bristow%2C+music+instruction%2C+Rentals%2C+music%2C+';
var metaContents  = 'Premier+Music+Center%2C+Premier+Piano+Service%2C+Instrument+Rentals%2C+Music+Lessons%2C+New+Pianos%2C+Used+Pianos%2C+PremierMusicCenter.com%2C+Instrument+Sales%2C+Music+Instruction%2C+Pianos%2C+Rentals%2C+Music%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();
};
