/* [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','2001',jdecode('Home'),jdecode(''),'/2001.html','true',[],'',''],
	['PAGE','2052',jdecode('Contact'),jdecode(''),'/2052.html','true',[],'',''],
	['PAGE','2073',jdecode('Legal+areas'),jdecode(''),'/2073.html','true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Solid';
theSitetree.paletteFamily='A16464';
theSitetree.keyvisualId='4379';
theSitetree.keyvisualName='kv_4379.jpg';
theSitetree.fontsetId='10800';
theSitetree.graphicsetId='11236';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='A16464';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Solid',
				paletteFamily: 	'A16464',
				keyvisualId: 	'4379',
				keyvisualName: 	'kv_4379.jpg',
				fontsetId: 		'10800',
				graphicsetId: 	'11236',
				contentColor: 	'FFFFFF',
				contentBGColor: 'A16464',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100204-130201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2052',
internalId:  '',
customField: '20100204-130311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20090913-113655'
};
webappMappings['7008']=webappMappings['7008-3086']={
webappId:    '7008',
documentId:  '2052',
internalId:  '3086',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN330INF46P';
var companyName   = 'LAWNYC.COM+-+Meltzer+Law+Office';
var htmlTitle	  = '';
var metaKeywords  = 'Criminal%2CDWI%2CDomestic+Violence%2COrders+of+Protection%2CFamily+Law%2C+custody%2Cvisitation%2C+child+support%2CMatrimonial%2CCivil+Rights%2CAccidents+Attorney%2CNew+York+City%2CBrooklyn%2CQueens%2C+Manhattan%2CBronx%2CNYC%2CNassau%2CSuffolk.years+of+experience%2Cfield+of+law%2Cproperty+division%2CDUI%2Ccriminal+attorney%2Cdivorce+lawyer%2Cmediation%2Cmediator%2Carbitrator%2Cuncontested+divorce%2Ccontested+divorce%2Cparental+rights%2Cequal+parenting%2Ccivil+rights%2Cfalse+arrest%2Ctrip+and+fall%2Caccidents%2Caccidents%2Cinsurance%2C+insurance+law%2Cmalpractice%2Cmedical%2Cassault%2Cfight%2Cbattery%2Corder+of+protection%2Carrest%2Carrested%2Ccrime%2Cjail%2Ccontracts%2Cwills%2Creview%2Cestates%2Cfraud%2Cattorney+general%2C+corruption%2Cpolice%2Cjudge%2Cjudiciary%2Cfederal%2Cstate%2Csupreme%2Ccivil%2Ctraffic%2Clicense%2CVTL+1192%2CPenal+law%2C+PL+120%2C+narcotics%2Cdrugs%2Cmarihuana%2Crape%2Cvictim%2Cadvocate%2Cjury%2Ctrial%2Cnegligence%2Clegal+rights%2Cny+law%2Ctrial+lawyer%2Ctrial+attorney%2Cfelony%2Cmisdemeanor%2Cviolation%2Clegal+action%2Clawsuit%2Crights%2Cpassenger%2Cinjuries%2Clitigation%2Ccounsel%2Cfees%2Cequitable%2Cdistribution%2Cproperty+division';
var metaContents  = 'Criminal%2C+DWI%2C+Domestic+Violence%2C+Orders+of+Protection%2C+Family+Law%2C+Matrimonial%2C+Civil+Rights%2C+Accidents+Attorney%2C+New+York+City%2C+Brooklyn%2C+Queens%2C+Manhattan%2C+Bronx%2C+NYC%2C+Nassau%2C+Suffolk.+22+years+of+experience+in+the+field+of+law';
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();
};

