/* [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','32',jdecode('Home'),jdecode(''),'/32.html','true',[],'',''],
	['PAGE','62',jdecode('Products+%26+Services'),jdecode(''),'/62/index.html','true',[ 
		['PAGE','7768',jdecode('Air+Conditioning'),jdecode(''),'/62/7768.html','true',[],'',''],
		['PAGE','7777',jdecode('Heating'),jdecode(''),'/62/7777.html','true',[],'',''],
		['PAGE','7786',jdecode('Indoor+Air+Quality'),jdecode(''),'/62/7786.html','true',[],'',''],
		['PAGE','7795',jdecode('Generators'),jdecode(''),'/62/7795.html','true',[],'',''],
		['PAGE','7804',jdecode('Commercial'),jdecode(''),'/62/7804.html','true',[],'',''],
		['PAGE','12958',jdecode('Tankless+Water+Heaters'),jdecode(''),'/62/12958.html','true',[],'',''],
		['PAGE','7813',jdecode('Other+Services'),jdecode(''),'/62/7813.html','true',[],'','']
	],'',''],
	['PAGE','6073',jdecode('Special+Offers'),jdecode(''),'/6073.html','true',[],'',''],
	['PAGE','7831',jdecode('Home+Comfort+Tips'),jdecode(''),'/7831/index.html','true',[ 
		['PAGE','7886',jdecode('High+Efficiency+Heating'),jdecode(''),'/7831/7886.html','true',[],'',''],
		['PAGE','7895',jdecode('Two-Stage+Heating'),jdecode(''),'/7831/7895.html','true',[],'',''],
		['PAGE','7904',jdecode('Variable+Speed+Heating'),jdecode(''),'/7831/7904.html','true',[],'',''],
		['PAGE','10295',jdecode('Programmable+Thermostats'),jdecode(''),'/7831/10295.html','true',[],'',''],
		['PAGE','7913',jdecode('Energy+Savings'),jdecode(''),'/7831/7913.html','true',[],'','']
	],'',''],
	['PAGE','10989',jdecode('Customer+Testimonials'),jdecode(''),'/10989.html','true',[],'',''],
	['PAGE','80',jdecode('Contact+Us'),jdecode(''),'/80/index.html','true',[ 
		['PAGE','5849',jdecode('Contact+%28follow+up+page%29'),jdecode(''),'/80/5849.html','false',[],'','']
	],'',''],
	['PAGE','12490',jdecode('Map'),jdecode(''),'/12490.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Dots';
theSitetree.paletteFamily='E7E9D5';
theSitetree.keyvisualId='427';
theSitetree.keyvisualName='detail.jpg';
theSitetree.fontsetId='43';
theSitetree.graphicsetId='49';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E7E9D5';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Dots',
				paletteFamily: 	'E7E9D5',
				keyvisualId: 	'427',
				keyvisualName: 	'detail.jpg',
				fontsetId: 		'43',
				graphicsetId: 	'49',
				contentColor: 	'000000',
				contentBGColor: 'E7E9D5',
				a_color: 		'E7E9D5',
				b_color: 		'CCCCCC',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '12490',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20100528-234804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20090310-132931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7768',
internalId:  '',
customField: '20100529-001952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6073',
internalId:  '',
customField: '20100528-235446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80',
internalId:  '',
customField: '20060612-201759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7831',
internalId:  '',
customField: '20090310-133229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7886',
internalId:  '',
customField: '20090310-133249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7777',
internalId:  '',
customField: '20100529-002229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7786',
internalId:  '',
customField: '20090310-133045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7795',
internalId:  '',
customField: '20090310-133108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7804',
internalId:  '',
customField: '20090310-133131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12958',
internalId:  '',
customField: '20080531-191050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7813',
internalId:  '',
customField: '20090310-133157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7895',
internalId:  '',
customField: '20060627-122554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7904',
internalId:  '',
customField: '20090310-133322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10295',
internalId:  '',
customField: '20090310-133356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7913',
internalId:  '',
customField: '20060627-122623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10989',
internalId:  '',
customField: '20080531-172051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5849',
internalId:  '',
customField: '20070413-194925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12490',
internalId:  '',
customField: '20070724-123310'
};
webappMappings['7008']=webappMappings['7008-8332']={
webappId:    '7008',
documentId:  '80',
internalId:  '8332',
customField: 'language:en;country:US;'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3OWG';
var companyName   = 'Adema+Heating+%26+Air+Conditioning';
var htmlTitle	  = 'Adema+Heating+%26+Air+Conditioning+-+Family+Owned+%26+Operated+Since+1873';
var metaKeywords  = 'adema%2C+heating%2C+air+conditioning%2C+furnace%2C+cooling%2C+humidifier%2C+air+cleaner%2C+boiler%2C+heat%2C+service%2C+sales%2C+installation%2C+commercial%2C+residential%2C+buffalo%2C+ny%2C+wny%2C+western+new+york%2C+hvac%2C+amherst%2C+east+amherst%2C+williamville%2C+clarence%2C+kenmore%2C+tonawanda%2C+cheektowaga%2C+lockport%2C+orchard+park%2C+lackawana%2C+east+aurora%2C+hamburg%2C+heat%2C+heater%2C+cool';
var metaContents  = 'Adema+Heating++Air+Conditioning%2C+Established+in+1873%2C+has+been+serving+the+heating%2C+ventilation%2C+and+air+conditioning+%28HVAC%29+needs+of+Buffalo+and+Western+New+York+%28WNY%29+for+over+130+years.+';
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();
};
