/* [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','52',jdecode('HOME'),jdecode(''),'/52.html','true',[],'',''],
	['PAGE','2230',jdecode('WHAT+WE+DO'),jdecode(''),'/2230/index.html','true',[ 
		['PAGE','2239',jdecode('Business+Insurance'),jdecode(''),'/2230/2239.html','true',[],'',''],
		['PAGE','2248',jdecode('Personal+Insurance'),jdecode(''),'/2230/2248.html','true',[],'',''],
		['PAGE','2417',jdecode('-Homeowners+Insurance'),jdecode(''),'/2230/2417.html','true',[],'',''],
		['PAGE','2426',jdecode('-Automobile+Insurance'),jdecode(''),'/2230/2426.html','true',[],'',''],
		['PAGE','2435',jdecode('-Valuable+Items'),jdecode(''),'/2230/2435.html','true',[],'',''],
		['PAGE','2444',jdecode('-Personal+Umbrella'),jdecode(''),'/2230/2444.html','true',[],'',''],
		['PAGE','2616',jdecode('-Life+Insurance'),jdecode(''),'/2230/2616.html','true',[],'',''],
		['PAGE','2625',jdecode('-Disability+Income'),jdecode(''),'/2230/2625.html','true',[],'','']
	],'',''],
	['PAGE','2863',jdecode('RATE+QUOTE+REQUEST'),jdecode(''),'/2863/index.html','true',[ 
		['PAGE','2922',jdecode('Insurance+Quotes+%28follow+up+page%29'),jdecode(''),'/2863/2922.html','false',[],'','']
	],'',''],
	['PAGE','2146',jdecode('CUSTOMER+SERVICE'),jdecode(''),'/2146.html','true',[],'',''],
	['PAGE','2137',jdecode('CLAIMS'),jdecode(''),'/2137.html','true',[],'',''],
	['PAGE','2155',jdecode('NEWS+%26+LINKS'),jdecode(''),'/2155.html','true',[],'',''],
	['PAGE','2164',jdecode('CONTACT+US'),jdecode(''),'/2164.html','true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Dots';
theSitetree.paletteFamily='CCCC99';
theSitetree.keyvisualId='407';
theSitetree.keyvisualName='handschlag1.jpg';
theSitetree.fontsetId='43';
theSitetree.graphicsetId='47';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='CCCC99';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Dots',
				paletteFamily: 	'CCCC99',
				keyvisualId: 	'407',
				keyvisualName: 	'handschlag1.jpg',
				fontsetId: 		'43',
				graphicsetId: 	'47',
				contentColor: 	'666666',
				contentBGColor: 'CCCC99',
				a_color: 		'CCCC99',
				b_color: 		'CCCCCC',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '52',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2230',
internalId:  '',
customField: '20070410-013014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52',
internalId:  '',
customField: '20070410-012916'
};
webappMappings['7008']=webappMappings['7008-9613']={
webappId:    '7008',
documentId:  '2863',
internalId:  '9613',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2239',
internalId:  '',
customField: '20070410-013113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2248',
internalId:  '',
customField: '20070410-013549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2417',
internalId:  '',
customField: '20070410-014051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2426',
internalId:  '',
customField: '20070410-024532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2435',
internalId:  '',
customField: '20070410-015343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2444',
internalId:  '',
customField: '20070410-015733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2616',
internalId:  '',
customField: '20070410-020732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2625',
internalId:  '',
customField: '20070410-021218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2863',
internalId:  '',
customField: '20070410-021331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2922',
internalId:  '',
customField: '20070407-022341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2146',
internalId:  '',
customField: '20080219-024033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2137',
internalId:  '',
customField: '20070410-021627'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2155',
internalId:  '',
customField: '20070406-192645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2164',
internalId:  '',
customField: '20070408-014510'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3YSF';
var companyName   = 'Brian+Wallach+Agency%2C+Inc.';
var htmlTitle	  = 'Brian+Wallach+Agency%2C+Inc.';
var metaKeywords  = '';
var metaContents  = '';
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();
};

