/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','1901',jdecode('Products'),jdecode(''),'/1901/index.html','true',[ 
		['PAGE','1922',jdecode('Auto+Insurance'),jdecode(''),'/1901/1922.html','true',[],''],
		['PAGE','1943',jdecode('Property+Insurance'),jdecode(''),'/1901/1943.html','true',[],''],
		['PAGE','1964',jdecode('Business+Owners+Insurance'),jdecode(''),'/1901/1964.html','true',[],''],
		['PAGE','7801',jdecode('Health+Insurance'),jdecode(''),'/1901/7801.html','true',[],''],
		['PAGE','7822',jdecode('Life+Insurance'),jdecode(''),'/1901/7822.html','true',[],'']
	],''],
	['PAGE','7843',jdecode('About+us'),jdecode(''),'/7843.html','true',[],''],
	['PAGE','1985',jdecode('Contact+Us'),jdecode(''),'/1985.html','true',[],''],
	['PAGE','22301',jdecode('Companies'),jdecode(''),'/22301.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='003399';
theSitetree.keyvisualId='1235';
theSitetree.keyvisualName='handschlag.jpg';
theSitetree.fontsetId='190';
theSitetree.graphicsetId='228';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Profile',
				paletteFamily: 	'003399',
				keyvisualId: 	'1235',
				keyvisualName: 	'handschlag.jpg',
				fontsetId: 		'190',
				graphicsetId: 	'228',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003399',
				b_color: 		'000066',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20091118-151023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20091118-171713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1922',
internalId:  '',
customField: '20091118-153743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1943',
internalId:  '',
customField: '20091118-152851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1964',
internalId:  '',
customField: '20091118-153026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20090810-153826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7822',
internalId:  '',
customField: '20090810-154041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7843',
internalId:  '',
customField: '20091118-163638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1985',
internalId:  '',
customField: '20091118-164802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22301',
internalId:  '',
customField: '20091118-165241'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INLS7N';
var companyName   = 'Be+Sure...ProSure';
var htmlTitle	  = 'ProSure+Insurance-auto%2C+homeowners%2C+life%2C+health%2C+business+insurance%2C+Staunton+Va';
var metaKeywords  = 'insurance%2C+auto%2C+home%2C+life%2C+health%2C+individual+health%2C+group+health%2C+prosure%2C+prosure+insurance%2C+insurance+in+virginia%2C+insurance+in+va%2C+thom+jennings%2C+scott+shomo%2C+carolyn+fisher%2C+dennis+stepp%2C+jeff+jennings%2C+insurance%2C+auto+insurance%2C+group%2C+business%2C+work%2C+workers%2C+comp%2C+compensation%2C+agency%2C+independent%2C+automobile%2C+car%2C+homeowners%2C+renters%2C+tenant%2C+umbrella%2C+boat%2C+watercraft%2C+commercial%2C+property%2C+liability%2Cira%2C+pension%2C+floyd%2C+flood%2C+waynesboro%2C+staunton%2C+buena+vista%2C+rockbridge%2C+lexington%2C+harrisonburg%2C+augusta%2C+rockingham%2C+county%2C+virginia%2C+safeco%2C+auto-owners%2C+autoowners%2C+progressive%2Cdrive%2C+southern+health%2C+anthem%2C+augusta+mutual%2C+edmunds%2C+carfax';
var metaContents  = 'Insurance+company+in+Augusta+county+selling+auto%2C+home%2C+life%2C+health+and+business+insurance.+Licensed+in+the+state+of+Virginia.';
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();
};
