/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','139847',jdecode('Video'),jdecode(''), jdecode('%2F139847.html'), 'true',[],'',''],
	['PAGE','23501',jdecode('About+Us%3A+Legal'),jdecode(''), jdecode('%2F23501.html'), 'true',[],'',''],
	['PAGE','17901',jdecode('About+Us%3A+Personal'),jdecode(''), jdecode('%2F17901.html'), 'true',[],'',''],
	['PAGE','141689',jdecode('References'),jdecode(''), jdecode('%2F141689.html'), 'true',[],'',''],
	['PAGE','452',jdecode('Practice+Areas'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','78901',jdecode('Wills+%26+Trusts'),jdecode(''), jdecode('%2F78901.html'), 'true',[],'',''],
	['PAGE','145544',jdecode('Law+Blog'),jdecode(''), jdecode('%2F145544.html'), 'true',[],'',''],
	['PAGE','59701',jdecode('Will+Special'),jdecode(''), jdecode('%2F59701.html'), 'true',[],'',''],
	['PAGE','126401',jdecode('Current+Advertisement'),jdecode(''), jdecode('%2F126401.html'), 'false',[],'',''],
	['PAGE','10222',jdecode('Contact+Us'),jdecode(''), jdecode('%2F10222.html'), 'true',[],'',''],
	['PAGE','55201',jdecode('Map+%26+Directions'),jdecode(''), jdecode('%2F55201.html'), 'true',[],'',''],
	['PAGE','143157',jdecode('Make+A+Payment+Now'),jdecode(''), jdecode('%2F143157.html'), 'true',[],'',''],
	['PAGE','139997',jdecode('.'),jdecode(''), jdecode('%2F139997.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Dots';
theSitetree.paletteFamily='E7E9D5';
theSitetree.keyvisualId='403';
theSitetree.keyvisualName='gericht.jpg';
theSitetree.fontsetId='43';
theSitetree.graphicsetId='49';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E7E9D5';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'valueweb',
  product: 'WSCSYSSSSLYTCR7V'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Dots',
				paletteFamily: 	'E7E9D5',
				keyvisualId: 	'403',
				keyvisualName: 	'gericht.jpg',
				fontsetId: 		'43',
				graphicsetId: 	'49',
				contentColor: 	'000000',
				contentBGColor: 'E7E9D5',
				a_color: 		'E7E9D5',
				b_color: 		'CCCCCC',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20111030-021541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20110527-221013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20111029-235632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17901',
internalId:  '',
customField: '20110527-221200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78901',
internalId:  '',
customField: '20110527-221234'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10222',
internalId:  '',
customField: '20110527-221314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55201',
internalId:  '',
customField: '20110712-154419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '141689',
internalId:  '',
customField: '20110630-215225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59701',
internalId:  '',
customField: '20110527-221533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126401',
internalId:  '',
customField: '20110527-221549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '139847',
internalId:  '',
customField: '20111030-114154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143157',
internalId:  '',
customField: '20110624-161703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '139997',
internalId:  '',
customField: '20111030-034824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '145544',
internalId:  '',
customField: '20111029-232538'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INXSPN';
var companyName   = 'Law+Office+of+Matt+Michaels';
var htmlTitle	  = 'Brighton+Lawyer%2C+Matt+Michaels%3A+Divorce%2C+DUI%2C+Family%2C+Criminal%2C+Will%2C+Brighton+MI%2C+Livingston+County%2C+Howell%2C+Estate+Plan%2C+Probate%2C+South+Lyon%2C+New+Hudson%2C+Milford%2C+Pinckney';
var metaKeywords  = 'Lawyer+Divorce+Attorney++Will++Trust++DUI+OWI+Estate+Traffic+Ticket++Livingston++Livingstn+Oakland++Washtenaw++Brighton+Brightn+Family+Law+Civil+Misdemeanor++Felony++Contract++Social+Security++Expungement++Landlord++Drunk++Driving++Property+Business+South+Lyon+Howell+Pinkney+New+Hudson+Milford+Hamburg+Michigan+Whitmore+Novi+Hartland+Probate+Custody+Support+Paternity+Expungment+Felony+Misdemeanor+Collections+Lien+PPO+Guardian+Conservator+Alimony+Nuptial+Landlord+Tort+Property+';
var metaContents  = 'Matt+Michaels%2C+an+attorney+who+cares+about+YOUR+interests.++%28810%29+545-4894+Stop+worrying+...+contact+us.++Divorce+lawyer%2C+DUI%2C+Wills+++Trust%2C+Probate%2C+Criminal%2C+Traffic%2C+Civil+Suits%2C+Contracts%2C+Family+Law%2C+General+Law.++Reasonable+rates.++Evening+and+Weekends.+';
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();
};

