/* [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','401',jdecode('Piano+Tuning+HOME'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','45101',jdecode('ABOUT+LPT+and+PIANOS'),jdecode(''),'/45101.html','true',[],'',''],
	['PAGE','4901',jdecode('CONTACT'),jdecode(''),'/4901.html','true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Padma';
theSitetree.paletteFamily='999999';
theSitetree.keyvisualId='1021';
theSitetree.keyvisualName='seerose.jpg';
theSitetree.fontsetId='178';
theSitetree.graphicsetId='212';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='666666';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Padma',
				paletteFamily: 	'999999',
				keyvisualId: 	'1021',
				keyvisualName: 	'seerose.jpg',
				fontsetId: 		'178',
				graphicsetId: 	'212',
				contentColor: 	'DDDDDD',
				contentBGColor: '666666',
				a_color: 		'999999',
				b_color: 		'000000',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20091220-193422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45101',
internalId:  '',
customField: '20091220-193747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20090925-101333'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN010INL8E2';
var companyName   = 'LOMBARDO+PIANO+TECHNOLOGY++%28860%29+670-4638';
var htmlTitle	  = 'Piano+Tuning+in+Connecticut%3A+LOMBARDO+PIANO+TUNING+-+Your+Piano+Tuner+for+Central+CT+and+Beyond';
var metaKeywords  = 'piano+tuners%2C+piano+tuning%2C+piano+tuner%2C+connecticut%2C+CT%2C+Wethersfield%2C+++Connecticut+piano+tuners%2C+piano+repair%2C+piano+service%2C+connecticut+piano+tuning%2C+connecticut+area+tuners%2C+piano+tuners+in+connecticut%2C+concert+tuning%2C+harpsichord+tuning%2C+piano+technician%2C+piano+technicians%2C+Historic+Temperaments';
var metaContents  = 'Piano+Tuning+for+Connecticut+Homes%2C+Schools%2C+Churches+and+Concert+Halls.+Known+throughout+Central+CT+as+its+Trusted%2C+Professional+Piano+Tuner.+Concert+Piano+Tuning%2C++Piano+Tuning+and+Repair+for+Grand+Pianos%2C+Upright+Pianos%2C+and+Harpsichords+including+Harpsichord+Tuning+using+Well+Temperaments+and+other+Historic+Tuning+Temperaments.+';
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();
};
