/* [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','5901',jdecode('HOME'),jdecode(''),'/5901.html','true',[],'',''],
	['PAGE','59829',jdecode('HEAR+MUSIC+NEW+CD'),jdecode(''),'/59829.html','true',[],'',''],
	['PAGE','5952',jdecode('BIOGRAPHY'),jdecode(''),'/5952.html','true',[],'',''],
	['PAGE','33615',jdecode('CONCERT+CALENDAR'),jdecode(''),'/33615.html','true',[],'',''],
	['PAGE','18315',jdecode('RESERVATIONS'),jdecode(''),'/18315.html','true',[],'',''],
	['PAGE','69229',jdecode('LESSONS'),jdecode(''),'/69229.html','true',[],'',''],
	['PAGE','18136',jdecode('See+Studio'),jdecode(''),'/18136.html','true',[],'',''],
	['PAGE','7401',jdecode('CONTACT'),jdecode(''),'/7401.html','true',[],'',''],
	['PAGE','5994',jdecode('Photo+album'),jdecode(''),'/5994.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='2155';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='355';
theSitetree.graphicsetId='408';
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: 			'Medium',
				paletteFamily: 	'000000',
				keyvisualId: 	'2155',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'355',
				graphicsetId: 	'408',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-92e1dc8529565331a6f53786886be7c0']={
webappId:    '7060',
documentId:  '5994',
internalId:  '92e1dc8529565331a6f53786886be7c0',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20100827-002150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5952',
internalId:  '',
customField: '20100821-010144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5994',
internalId:  '',
customField: '20080802-160737'
};
webappMappings['7008']=webappMappings['7008-3445']={
webappId:    '7008',
documentId:  '7401',
internalId:  '3445',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20090826-003020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18315',
internalId:  '',
customField: '20100614-132332'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18136',
internalId:  '',
customField: '20100807-191413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33615',
internalId:  '',
customField: '20100902-224159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69229',
internalId:  '',
customField: '20100905-061504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59829',
internalId:  '',
customField: '20100827-002256'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2TII';
var companyName   = 'Maureen+Girard';
var htmlTitle	  = '88+Keys+Piano+Studio+and+Performance+Space';
var metaKeywords  = 'piano%2C+piano+studio%2C+langley%2C+washington%2C+88+keys';
var metaContents  = 'A+Piano+Studio+and+Performance+Space+located+in+langley%2C+WA.';
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();
};
