/* [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(''), jdecode('%2F52.html'), 'true',[],'',''],
	['PAGE','73',jdecode('Meet+the+Team'),jdecode(''), jdecode('%2F73.html'), 'true',[],'',''],
	['PAGE','100',jdecode('Products'),jdecode(''), jdecode('%2F100%2Findex.html'), 'true',[ 
		['PAGE','136',jdecode('QuickBooks'),jdecode(''), jdecode('%2F100%2F136.html'), 'true',[],'',''],
		['PAGE','1543',jdecode('Quicken'),jdecode(''), jdecode('%2F100%2F1543.html'), 'true',[],'','']
	],'',''],
	['PAGE','1632',jdecode('Interesting+links'),jdecode(''), jdecode('%2F1632.html'), 'true',[],'',''],
	['PAGE','145',jdecode('Contact'),jdecode(''), jdecode('%2F145.html'), 'true',[],'',''],
	['PAGE','1186',jdecode('Guestbook'),jdecode(''), jdecode('%2F1186%2Findex.html'), 'true',[ 
		['PAGE','1185',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F1186%2F1185.html'), 'false',[],'','']
	],'',''],
	['PAGE','1204',jdecode('Directions'),jdecode(''), jdecode('%2F1204.html'), 'true',[],'',''],
	['PAGE','1216',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F1216.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Art';
theSitetree.paletteFamily='660000';
theSitetree.keyvisualId='1784';
theSitetree.keyvisualName='edv_systemhaus.jpg';
theSitetree.fontsetId='283';
theSitetree.graphicsetId='352';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='660000';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTCPXC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Art',
				paletteFamily: 	'660000',
				keyvisualId: 	'1784',
				keyvisualName: 	'edv_systemhaus.jpg',
				fontsetId: 		'283',
				graphicsetId: 	'352',
				contentColor: 	'DDDDDD',
				contentBGColor: '660000',
				a_color: 		'660000',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '52',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73',
internalId:  '',
customField: '20110525-121251'
};
webappMappings['1002']=webappMappings['1002-1186AHW050IN3LQV']={
webappId:    '1002',
documentId:  '1186',
internalId:  '1186AHW050IN3LQV',
customField: 'icq=false'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '1204',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '1216',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52',
internalId:  '',
customField: '20110525-104256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100',
internalId:  '',
customField: '20100517-120349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '136',
internalId:  '',
customField: '20100517-120455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1543',
internalId:  '',
customField: '20090626-100257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1632',
internalId:  '',
customField: '20110525-121840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '145',
internalId:  '',
customField: '20110525-122155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1186',
internalId:  '',
customField: '20070104-011105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1185',
internalId:  '',
customField: '20070104-011105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1204',
internalId:  '',
customField: '20101123-115011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1216',
internalId:  '',
customField: '20070104-011332'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3LQV';
var companyName   = 'Advantage+Tax+Service+Plus%2C+Inc.';
var htmlTitle	  = 'Advantage+Tax+Service+Plus%2C+Inc.';
var metaKeywords  = 'tax+monticello%2C+tax+prep+monticello%2C+accounting+monticello%2C+bookkeeping+monticello%2C+refunds%2C+refund+loans%2C+quickbooks+monticello%2C+proadvisormonticello%2C+enrolled+agent%2C+tax+professional+monticello%2C+IRS%2C+internal+revenue+service%2C+minnesota%2C+wisconsin%2C+iowa%2C+tax+service%2C+tax+services%2C+busniess+tax+service+monticello%2C+electronic+filing+monticello%2C+efiling.+tax+return+monticello%2C+tax+returns%2C+business+planning+monticello%2C+bookkeeping%2C+monticello%2C+buffalo%2C+big+lake%2C+becker%2C+st.+cloud%2C+saint+cloud%2C+albertville%2C+otsego%2C+elk+river%2C+st.+michael%2C+saint+michael%2C+maple+lake%2C+wright%2C+sherburne%2C+benson%2C+stearns';
var metaContents  = 'Advantage+Tax+Service%2C+your+tax+experts+in+Central+Minnesota';
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();
};

