/* [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','501',jdecode('Welcome'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','10101',jdecode('Introduction'),jdecode(''), jdecode('%2F10101.html'), 'true',[],'',''],
	['PAGE','9785',jdecode('Contact'),jdecode(''), jdecode('%2F9785%2Findex.html'), 'true',[ 
		['PAGE','46101',jdecode('Contact+%28follow+up+page%29'),jdecode(''), jdecode('%2F9785%2F46101.html'), 'false',[],'','']
	],'',''],
	['PAGE','10122',jdecode('Press'),jdecode(''), jdecode('%2F10122.html'), 'true',[],'',''],
	['PAGE','11001',jdecode('Services'),jdecode(''), jdecode('%2F11001.html'), 'true',[],'',''],
	['PAGE','20301',jdecode('Web+links'),jdecode(''), jdecode('%2F20301.html'), 'true',[],'',''],
	['PAGE','105682',jdecode('News%2FBlog'),jdecode(''), jdecode('%2F105682.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Business';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='2487';
theSitetree.keyvisualName='seminar.jpg';
theSitetree.fontsetId='418';
theSitetree.graphicsetId='463';
theSitetree.contentColor='020E66';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Business',
				paletteFamily: 	'003366',
				keyvisualId: 	'2487',
				keyvisualName: 	'seminar.jpg',
				fontsetId: 		'418',
				graphicsetId: 	'463',
				contentColor: 	'020E66',
				contentBGColor: 'FFFFFF',
				a_color: 		'003366',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-9503921']={
webappId:    '1501',
documentId:  '501',
internalId:  '9503921',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20111227-084819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10122',
internalId:  '',
customField: '20120130-164846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9785',
internalId:  '',
customField: '20110704-083538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20091208-192033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20110129-083411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46101',
internalId:  '',
customField: '20070822-031048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20301',
internalId:  '',
customField: '20110129-083246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105682',
internalId:  '',
customField: '20110705-221956'
};
webappMappings['7050']=webappMappings['7050-1640']={
webappId:    '7050',
documentId:  '105682',
internalId:  '1640',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-7792']={
webappId:    '7008',
documentId:  '9785',
internalId:  '7792',
customField: 'language:en;country:US;'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXX2D';
var companyName   = 'Eric+A.+Kinsherf%2C+CPA';
var htmlTitle	  = 'Eric+A.+Kinsherf%2C+CPA-+Accounting%2C+Auditing%2C+Consulting+and+Tax+Preparation';
var metaKeywords  = 'municipal+auditing%2C+accounting+services%2C+cape+cod+accountants%2C+south+shore+accountants%2C+cape+cod+cpa%2C+consulting+services%2C+accountant%2C+certified+public+accountant%2C+muncipal+consulting%2C+municipal+auditor%2C+accounting%2C+accountants%2C+tax+preparation%2C+tax+preparers%2C+tax+prep+in+bourne+ma%2C+accountant+in+bourne%2C+tax+preparer+on+cape+cod%2C+cape+cod+tax+prep%2C+malloy+lynch+bienvenue%2C+interim+town+accountant%2C+interim+treasurer%2C+tax+preparers+in+wareham%2C+ma%2C+tax+preparers+in+bourne+ma%2C+income+tax+';
var metaContents  = 'For+those+needing+a+tax+preparer+or+accountant+on+Cape+Cod+or+the+South+Shore%2C+Eric+A.+Kinsherf%2C+CPA+provides+accounting%2C+income+tax+preparation%2C+and+small+business+consulting+services.++Eric+specializes+in+municipal+auditing+and+consulting.++';
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();
};

