/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','5043',jdecode('Domestic+and+Teens'),jdecode(''),'/5043.html','true',[],'',''],
	['PAGE','5001',jdecode('Corporate'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','17801',jdecode('Criminal+%26+CSI'),jdecode(''),'/17801.html','true',[],'',''],
	['PAGE','7601',jdecode('Child+Custody+%26+Abuse'),jdecode(''),'/7601.html','true',[],'',''],
	['PAGE','5064',jdecode('Construction+Site+Theft'),jdecode(''),'/5064.html','true',[],'',''],
	['PAGE','5022',jdecode('Insurance'),jdecode(''),'/5022.html','true',[],'',''],
	['PAGE','5085',jdecode('Testimonials'),jdecode(''),'/5085.html','true',[],'',''],
	['PAGE','5106',jdecode('My+Rates'),jdecode(''),'/5106.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Logg';
theSitetree.paletteFamily='96652B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='422';
theSitetree.graphicsetId='471';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='96652B';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Logg',
				paletteFamily: 	'96652B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'422',
				graphicsetId: 	'471',
				contentColor: 	'FFFFFF',
				contentBGColor: '96652B',
				a_color: 		'96652B',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20100323-064216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5106',
internalId:  '',
customField: '20100228-215055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5043',
internalId:  '',
customField: '20090518-192807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20080221-091519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20100126-204648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20081027-171339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5064',
internalId:  '',
customField: '20080903-083930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5022',
internalId:  '',
customField: '20100528-072333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5085',
internalId:  '',
customField: '20080221-093325'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INLKDQ';
var companyName   = 'with+API++discover+the+power+of+truth...';
var htmlTitle	  = '';
var metaKeywords  = 'PrivateInvestigatorCary%2CNC%2CPrivateInvestigatorRaleigh%2CNC%2CPrivateInvestigatorChapelHill%2CNC%2CPrivateInvestigatorNC%2CPrivateInvestigatorCary%2CNC27511%2CPrivateInvestigatorWakeCountyNC27513%2C27608%2C27560%2C27514%2C27519%2C27614%2C27617%2C27615%2C27617%2C27612%2C27511%2C27613%2C27605%2C27503%2C27516%2C27539%2C27502%2C27510%2C27609%2C27606%2C27540%2CDomesticInvestigations%2CCheating%2CPrivateDetectiveCary%2CNC%2CPrivateDetectiveRaleigh%2CNC%2CPrivateDetective%2CDomesticSurveillance%2CChildCustody%2Cpropertyrecovery%2Cchildabuseinvestigations%2Cchildabuse%2Ccorporateinvestigations%2Cbackgrounds%2Cbackgroundchecks%2Cpolicematters%2Cpolicedefense%2Cnursinghomeabuse%2Cgpstracking%2Ccellphone%2Cassetssearch%2Cbugsweep%2Cwiretapdetection%2Clocatefelon%2Clocates%2Cprocessservice%2Cspecialprocessservice.';
var metaContents  = 'My+name+is+James+Petrie.+My+firm+provides+FREE+GPS+TRACKING%2C+Private+Investigators+in+Cary%2C+Raleigh%2C+Chapel+Hill%2C+and+area+of+NC.+We+investigate+Domestic+Matters%2C+Child+Custody+Issues%2C+Teen+Investigations%2C+Police+Shootings%2C+Property+Recovery%2C+Benefits+Fraud%2C+and+Corporate+Fraud.+';
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();
};
