/* [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','6201',jdecode('Home'),jdecode(''), jdecode('%2F6201.html'), 'true',[],'',''],
	['PAGE','9401',jdecode('Products'),jdecode(''), jdecode('%2F9401%2Findex.html'), 'true',[ 
		['PAGE','9422',jdecode('Windows'),jdecode(''), jdecode('%2F9401%2F9422.html'), 'true',[],'',''],
		['PAGE','6252',jdecode('Doors'),jdecode(''), jdecode('%2F9401%2F6252.html'), 'true',[],'',''],
		['PAGE','13901',jdecode('Decking'),jdecode(''), jdecode('%2F9401%2F13901.html'), 'true',[],'',''],
		['PAGE','16001',jdecode('Railing'),jdecode(''), jdecode('%2F9401%2F16001.html'), 'true',[],'',''],
		['PAGE','15701',jdecode('Roofing'),jdecode(''), jdecode('%2F9401%2F15701.html'), 'true',[],'',''],
		['PAGE','15722',jdecode('Siding'),jdecode(''), jdecode('%2F9401%2F15722.html'), 'true',[],'',''],
		['PAGE','15743',jdecode('Engineered+Wood'),jdecode(''), jdecode('%2F9401%2F15743.html'), 'true',[],'',''],
		['PAGE','15764',jdecode('Benjamin+Moore+Paint'),jdecode(''), jdecode('%2F9401%2F15764.html'), 'true',[],'','']
	],'',''],
	['PAGE','7001',jdecode('Quotes'),jdecode(''), jdecode('%2F7001.html'), 'true',[],'',''],
	['PAGE','6336',jdecode('About+us'),jdecode(''), jdecode('%2F6336%2Findex.html'), 'true',[ 
		['PAGE','6357',jdecode('Our+team'),jdecode(''), jdecode('%2F6336%2F6357.html'), 'true',[],'',''],
		['PAGE','6378',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F6336%2F6378.html'), 'true',[],'','']
	],'',''],
	['PAGE','23901',jdecode('Find+a+Contractor'),jdecode(''), jdecode('%2F23901%2Findex.html'), 'true',[ 
		['PAGE','24101',jdecode('Residential+Construction'),jdecode(''), jdecode('%2F23901%2F24101.html'), 'true',[],'',''],
		['PAGE','24122',jdecode('Commercial+Construction'),jdecode(''), jdecode('%2F23901%2F24122.html'), 'true',[],'',''],
		['PAGE','24143',jdecode('Remodeler'),jdecode(''), jdecode('%2F23901%2F24143.html'), 'true',[],'',''],
		['PAGE','24164',jdecode('Roofing+Contractor'),jdecode(''), jdecode('%2F23901%2F24164.html'), 'true',[],'',''],
		['PAGE','24185',jdecode('Siding+Contractor'),jdecode(''), jdecode('%2F23901%2F24185.html'), 'true',[],'',''],
		['PAGE','24206',jdecode('Drywall+Contractor'),jdecode(''), jdecode('%2F23901%2F24206.html'), 'true',[],'',''],
		['PAGE','24227',jdecode('Finish+Carpenter'),jdecode(''), jdecode('%2F23901%2F24227.html'), 'true',[],'',''],
		['PAGE','24248',jdecode('Framer'),jdecode(''), jdecode('%2F23901%2F24248.html'), 'true',[],'',''],
		['PAGE','24269',jdecode('Decks'),jdecode(''), jdecode('%2F23901%2F24269.html'), 'true',[],'',''],
		['PAGE','24290',jdecode('Concrete+%26+Excavation'),jdecode(''), jdecode('%2F23901%2F24290.html'), 'true',[],'',''],
		['PAGE','24311',jdecode('Design+%26+Drafting'),jdecode(''), jdecode('%2F23901%2F24311.html'), 'true',[],'','']
	],'','']];
var siteelementCount=26;
theSitetree.topTemplateName='Card';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='427';
theSitetree.graphicsetId='480';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'readyhosting',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Card',
				paletteFamily: 	'990000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'427',
				graphicsetId: 	'480',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20110228-180159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6252',
internalId:  '',
customField: '20110107-190504'
};
webappMappings['7008']=webappMappings['7008-15131']={
webappId:    '7008',
documentId:  '7001',
internalId:  '15131',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20090401-234837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20110107-185010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9422',
internalId:  '',
customField: '20110107-190620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20100209-173059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6336',
internalId:  '',
customField: '20110107-190656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6357',
internalId:  '',
customField: '20110107-191214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6378',
internalId:  '',
customField: '20090422-201540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16001',
internalId:  '',
customField: '20101230-123733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20101230-122351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15722',
internalId:  '',
customField: '20110209-180347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15743',
internalId:  '',
customField: '20091203-160654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15764',
internalId:  '',
customField: '20091120-174023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23901',
internalId:  '',
customField: '20100209-173341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24101',
internalId:  '',
customField: '20110228-173618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24122',
internalId:  '',
customField: '20110228-175854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24311',
internalId:  '',
customField: '20101229-131402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24143',
internalId:  '',
customField: '20110228-175140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24227',
internalId:  '',
customField: '20101229-135252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24248',
internalId:  '',
customField: '20110228-180133'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24269',
internalId:  '',
customField: '20100222-122853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24185',
internalId:  '',
customField: '20101229-140739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24164',
internalId:  '',
customField: '20101229-192509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24290',
internalId:  '',
customField: '20101229-124838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24206',
internalId:  '',
customField: '20101229-135327'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN34HG';
var companyName   = 'MASSA+HOME+CENTER';
var htmlTitle	  = 'Massa+Home+Center';
var metaKeywords  = 'Hamilton%2CMontana%2CBitterroot%2CLumberyard%2CLumber%2CWood%2CContractor%2CRoofing%2CDecking%2CConstruction%2C+Massa%2CYard%2CWindows%2CDoors%2CShingles%2C';
var metaContents  = 'Massa+Home+Center+has+been+serving+the+Bitterroot+Valley%27s+building+material+needs+since+1979.';
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();
};

