/* [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('Home'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','4901',jdecode('Contact'),jdecode(''), jdecode('%2F4901.html'), 'true',[],'',''],
	['PAGE','4922',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F4922.html'), 'true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Inspiration';
theSitetree.paletteFamily='819B9B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='100';
theSitetree.graphicsetId='127';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='819B9B';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC21A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Inspiration',
				paletteFamily: 	'819B9B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'100',
				graphicsetId: 	'127',
				contentColor: 	'FFFFFF',
				contentBGColor: '819B9B',
				a_color: 		'819B9B',
				b_color: 		'C8C899',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20110221-115751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20100817-104334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4922',
internalId:  '',
customField: '20100817-095538'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN010IN3D4F';
var companyName   = 'Torchia+Law+Firm+PA';
var htmlTitle	  = 'Law+Office+of+Christopher+Torchia+PA+-+Real+Estate+and+Business+Litigation+and+Services';
var metaKeywords  = 'florida%2C+longwood%2C+maitland%2C+apopka%2C+winter+springs%2C+winter+park%2C+orienta+gardens%2C+longdale%2C+sanlando+springs%2C+college+park%2C+wekiva%2C+fern+park%2C+orlando%2C+altamonte+springs%2C+altamonte%2C+altamont%2C+debary%2C+metro+west%2C+seminole+county%2C+seminole%2C+orange+county%2C+orange%2C+lake+county%2C+attorney%2C+lawyer%2C+legal+services%2C+law+office%2C+advice%2C+esquire%2C+real+estate%2C+land+trust%2C+contract%2C+litigation%2C+probate%2C+guardianship%2C+business%2C+wills%2C+last+will+and+testament%2C+trusts%2C+trust%2C+living+trust%2C+revocable+trust%2C+health+care+surrogate%2C+living+will%2C+corporate+formation%2C+corporations%2C+c-corp%2C+s-corp%2C+limited+liability+company%2C+llc%2C+partnership%2C+joint+venture%2C+court%2C+landlord%2C+tenant%2C+eviction%2C+plaintiff%2C+defendant%2C+foreclosure%2C+breach%2C+breach+of+contract%2C+fraud%2C+durable+power+of+attorney%2C+power+of+attorney%2C+advance+health+care+directive%2C+debt%2C+debt+collection%2C+rent%2C+lease%2C+real+estate+closing%2C+closing%2C+business+sale%2C+security+deposit%2C+collect%2C+short+sale%2C+deed-in-lieu%2C+mortgage%2C+modification%2C+deficiency%2C+judgment%2C+breach+of+contract%2C+breach';
var metaContents  = 'Call+our+law+office+%5B407-869-1004%5D+for+business+and+real+estate+litigation%2C+real+estate+transactions%2C+business+contracts%2C+foreclosures%2C+probate%2C+Wills%2C+trusts%2C+estate+planning%2C+and+business+services.+Our+office+is+in+Maitland+near+the+RDV+Sportsplex.++We+serve+Seminole+County+%28Longwood%2C+Altamonte+Springs%2C+Winter+Springs%2C+Maitland%2C+Fern+Park%2C+Sanlando+Springs%2C+Wekiva%2C+Orienta+Gardens%2C+Longdale%29+and+Orange+County+%28Apopka%2C+College+Park%2C+Winter+Park%2C+Orlando%2C+Windermere%29+.';
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();
};

