/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],''],
	['PAGE','2201',jdecode('About+us'),jdecode(''),'/2201/index.html','true',[ 
		['PAGE','2222',jdecode('Our+History'),jdecode(''),'/2201/2222.html','true',[],'']
	],''],
	['PAGE','56101',jdecode('CRMC+Mission+and+Core+Values'),jdecode(''),'/56101.html','true',[],''],
	['PAGE','2315',jdecode('Testimonials'),jdecode(''),'/2315.html','true',[],''],
	['PAGE','7601',jdecode('Why+CRMC'),jdecode(''),'/7601.html','true',[],''],
	['PAGE','2483',jdecode('When+CRMC'),jdecode(''),'/2483.html','true',[],''],
	['PAGE','2336',jdecode('Our+Services+and+Capabilities'),jdecode(''),'/2336/index.html','true',[ 
		['PAGE','2378',jdecode('For+Design+Professionals'),jdecode(''),'/2336/2378.html','true',[],''],
		['PAGE','19801',jdecode('For+Construction+Professionals'),jdecode(''),'/2336/19801.html','true',[],''],
		['PAGE','19822',jdecode('For+Environmental+Consultants'),jdecode(''),'/2336/19822.html','true',[],''],
		['PAGE','2399',jdecode('For+Insurance+Companies'),jdecode(''),'/2336/2399.html','true',[],''],
		['PAGE','2357',jdecode('For+Insurance+Professionals'),jdecode(''),'/2336/2357.html','true',[],''],
		['PAGE','2420',jdecode('For+Project+Owners+'),jdecode(''),'/2336/2420.html','true',[],''],
		['PAGE','65801',jdecode('For+Law+Firms'),jdecode(''),'/2336/65801.html','true',[],'']
	],''],
	['PAGE','55501',jdecode('Our+Fees'),jdecode(''),'/55501.html','true',[],''],
	['PAGE','18601',jdecode('Tip+of+the+Month'),jdecode(''),'/18601.html','true',[],''],
	['PAGE','7622',jdecode('Risk+Management+News'),jdecode(''),'/7622.html','true',[],''],
	['PAGE','2462',jdecode('Newsletters+and+Publications'),jdecode(''),'/2462.html','true',[],''],
	['PAGE','2504',jdecode('Links'),jdecode(''),'/2504.html','true',[],''],
	['PAGE','2441',jdecode('Contact+Us'),jdecode(''),'/2441.html','true',[],'']];
var siteelementCount=21;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='50';
theSitetree.graphicsetId='57';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Easy',
				paletteFamily: 	'003366',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'50',
				graphicsetId: 	'57',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003366',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC245']={
webappId:    '5003',
documentId:  '301',
internalId:  'tid:1;pid:WSCSYSSSSLYTC245',
customField: 'en:US:'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-10']={
webappId:    '7008',
documentId:  '2441',
internalId:  '10',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20090105-092538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2483',
internalId:  '',
customField: '20081208-225256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20090117-001440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2462',
internalId:  '',
customField: '20081208-230102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2336',
internalId:  '',
customField: '20081208-225335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2420',
internalId:  '',
customField: '20081208-225805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65801',
internalId:  '',
customField: '20081208-225901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56101',
internalId:  '',
customField: '20081208-225037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2378',
internalId:  '',
customField: '20081208-225426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20081208-225159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7622',
internalId:  '',
customField: '20081208-230022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2504',
internalId:  '',
customField: '20081208-230158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20081208-224920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2222',
internalId:  '',
customField: '20081208-225006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2315',
internalId:  '',
customField: '20081208-225138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19801',
internalId:  '',
customField: '20081208-225457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19822',
internalId:  '',
customField: '20081208-225550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2399',
internalId:  '',
customField: '20081208-225620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2357',
internalId:  '',
customField: '20081208-225735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55501',
internalId:  '',
customField: '20081208-225921'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2441',
internalId:  '',
customField: '20081208-230704'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INVA89';
var companyName   = 'Construction+Risk+Management+Consultants+LLC';
var htmlTitle	  = 'Construction+Risk+Management+Consultants+LLC';
var metaKeywords  = 'Professional+Liability%2C++Professional+Liability+Risk+Management%2C++Construction+Risk+Management%2C++Risk+Management';
var metaContents  = 'Professional+Liability+Risk+Management+for+the+Construction+Industry.++The+premier+source+of+professional+liability+risk+management+services+to+the+construction+industry.';
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();
};
