/* [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 theSitetree=[ 
	['PAGE','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','5052',jdecode('Services'),jdecode(''),'/5052/index.html','true',[ 
		['PAGE','8601',jdecode('for+Home+Owners'),jdecode(''),'/5052/8601.html','true',[],''],
		['PAGE','8622',jdecode('for+Real+Estate+Agents'),jdecode(''),'/5052/8622.html','true',[],''],
		['PAGE','8643',jdecode('for+Home+Builders'),jdecode(''),'/5052/8643.html','true',[],''],
		['PAGE','8664',jdecode('for+HVAC+Contractors'),jdecode(''),'/5052/8664.html','true',[],'']
	],''],
	['PAGE','5073',jdecode('About+us'),jdecode(''),'/5073.html','true',[],''],
	['PAGE','5094',jdecode('Tips+and+tricks'),jdecode(''),'/5094.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Workflow';
theSitetree.paletteFamily='DAD8BC';
theSitetree.keyvisualId='7834';
theSitetree.keyvisualName='kv_7834.jpg';
theSitetree.fontsetId='16843';
theSitetree.graphicsetId='12289';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Workflow',
				paletteFamily: 	'DAD8BC',
				keyvisualId: 	'7834',
				keyvisualName: 	'kv_7834.jpg',
				fontsetId: 		'16843',
				graphicsetId: 	'12289',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'B8B68B',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'B8B68B',
				e_color: 		'979696',
				f_color: 		'707070',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20090602-172519'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20090602-170707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20090602-141805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20090602-141805'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5052',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5073',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '5094',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8601',
internalId:  '',
customField: '20090604-175800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8622',
internalId:  '',
customField: '20090604-175800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8643',
internalId:  '',
customField: '20090604-175800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8664',
internalId:  '',
customField: '20090604-175800'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN3IEQ';
var companyName   = 'Southern+Illinois+Residential+Energy';
var htmlTitle	  = 'Southern+Illinois+Residential+Energy+-++HERS+Ratings%2C+Energy+Audits%2C+Energy+Consulting';
var metaKeywords  = 'blower+door%2C+building+energy+efficiency%2C+commerial+energy+efficiency%2C+commerrcial+energy+management%2C+electric+audit%2C+electric+energy+audit%2C+electric+energy+auditing%2C+electric+energy+efficiency%2C+electrical+energy+audit%2C+electrical+energy+audting%2C+electrical+energy+audits%2C+electrical+energy+efficiency%2C+energy+bills%2C+energy+doctor%2C+energy+efficiency%2C+energy+efficiency+audit%2C+energy+efficiency+auditing%2C+energy+efficiency+audits%2C+energy+efficiency+heating%2C+energy+efficiency+improvements%2C+energy+efficiency+information%2C+energy+efficiency+rating%2C+energy+efficiency+ratings%2C+energy+efficiency+savings%2C+energy+efficiency+services%2C+energy+managementenergy+management+services%2C+energy+management+solutions%2C+gas+energy+efficiency%2C+hight+energy+efficiency%2C+home+insulation%2C+house+insulation%2C+household+electricity+usage%2C+illinois+electricity+save%2C+improve+energy+efficiency%2C+improving+energy+efficiency%2C+increased+energy+efficiency%2C+lower+electric+bills%2C+lower+energy+bills%2C+lower+my+energy+billes%2C+lower+your+energy+bills%2C+natural+gas+electricity+rates%2C+natural+gas+energy+efficiencyy%2C+renewable+energy+business%2C+residential+alternative+energy+sources%2C+residential+energy+efficiency%2C+save+electricity%2C+save+on+electricity%2C+saving+electricity%2C+to+lower+energy+bills%2C+blower+door+test%2C+electric+bill%2C+electricity+conservation%2C+electricity+savings%2C+home+energy+audits%2C+electricity+bills%2C+home+energy+ratings%2C+house+doctor%2C+green+building%2C+insulation';
var metaContents  = 'Southern+Illinois+Residential+Energy+is+an+energy+consulting+business+based+in+Carbondale%2C+IL.+We+specialize+in+providing+our+customers+with+fair%2C+independent+energy+consulting+through+energy+audits+and+HERS+Ratings.+S.I.R.E.+%28Southern+Illinois+Residential+Energy%29+is+a+consulting+company+only.+We+will+never+make+a+profit+on+any+of+our+Energy+Efficiency+recommendations%2C+so+you+can+be+rest+assured+that+our+improvement+recommendations+are+sincere+and+objective.+Southern+Illinois+Residential+Energy+is+certified+through+RESNET+%28www.natresnet.org%29+and+our+provider+is+the+Illinois+Association+of+Energy+Raters+%28www.ilenergyraters.org%29.+Southern+Illinois+Residential+Energy+is+an+ENERGY+STAR+partner.+We+provide+services+to+home+owners%2C+real+estate+agents%2C+General+Contractors%2C+and+Land+Lords+who+wish+to+reduce+their+monthly+utility+bills.+This+business+is+located+in+Carbondale%2C+IL+and+services+a+wide+range+of+area%2C+including%3A+north+to+Effingham%2C+IL%3B+west+to+Cape+Girardeau%2C+MO%3B+South+to+Metropolis%2C+IL+and+Paducah%2C+KY%3B+and+east+to+Evansville%2C+IN.';
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();
};

