/* [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 theSitetree=[ 
	['PAGE','6401',jdecode('About+BTMS'),jdecode(''),'/6401.html','true',[],''],
	['PAGE','42623',jdecode('For+Business'),jdecode(''),'/42623.html','true',[],''],
	['PAGE','42644',jdecode('For+Home'),jdecode(''),'/42644.html','true',[],''],
	['PAGE','10512',jdecode('Products'),jdecode(''),'/10512.html','true',[],''],
	['PAGE','36123',jdecode('Shopping'),jdecode(''),'/36123.html','true',[],''],
	['PAGE','28623',jdecode('Search'),jdecode(''),'/28623.html','true',[],''],
	['PAGE','8112',jdecode('Blog'),jdecode(''),'/8112.html','true',[],''],
	['PAGE','39623',jdecode('Weather'),jdecode(''),'/39623.html','true',[],''],
	['PAGE','6864',jdecode('Contact+Us'),jdecode(''),'/6864.html','true',[],''],
	['PAGE','28644',jdecode('Guestbook'),jdecode(''),'/28644.html','true',[],''],
	['PAGE','36923',jdecode('Surveillance+Shop'),jdecode(''),'/36923.html','false',[],''],
	['PAGE','59323',jdecode('Downloads'),jdecode(''),'/59323.html','false',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Transluszent';
theSitetree.paletteFamily='6699CC';
theSitetree.keyvisualId='9241';
theSitetree.keyvisualName='kv3.swf';
theSitetree.fontsetId='17360';
theSitetree.graphicsetId='12764';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Transluszent',
				paletteFamily: 	'6699CC',
				keyvisualId: 	'9241',
				keyvisualName: 	'kv3.swf',
				fontsetId: 		'17360',
				graphicsetId: 	'12764',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20100123-152449'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7050']=webappMappings['7050-8182']={
webappId:    '7050',
documentId:  '8112',
internalId:  '8182',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-14383']={
webappId:    '7008',
documentId:  '6864',
internalId:  '14383',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6864',
internalId:  '',
customField: '20091117-221127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8112',
internalId:  '',
customField: '20091117-220938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10512',
internalId:  '',
customField: '20090528-211904'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '28623',
internalId:  'search',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-28644aendu0inesra']={
webappId:    '1002',
documentId:  '28644',
internalId:  '28644aendu0inesra',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28623',
internalId:  '',
customField: '20090528-000850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28644',
internalId:  '',
customField: '20090528-211937'
};
webappMappings['7008']=webappMappings['7008-15411']={
webappId:    '7008',
documentId:  '6864',
internalId:  '15411',
customField: 'language:en;country:US;'
};
webappMappings['4001']=webappMappings['4001-17703247']={
webappId:    '4001',
documentId:  '36123',
internalId:  '17703247',
customField: 'language:en;country:US;'
};
webappMappings['4001']=webappMappings['4001-17702545']={
webappId:    '4001',
documentId:  '36123',
internalId:  '17702545',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36123',
internalId:  '',
customField: '20091229-234910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36923',
internalId:  '',
customField: '20090509-152936'
};
webappMappings['1501']=webappMappings['1501-15882887']={
webappId:    '1501',
documentId:  '6401',
internalId:  '15882887',
customField: '1501'
};
webappMappings['7080']=webappMappings['7080-506']={
webappId:    '7080',
documentId:  '39623',
internalId:  '506',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39623',
internalId:  '',
customField: '20091117-221052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42623',
internalId:  '',
customField: '20091117-220627'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42644',
internalId:  '',
customField: '20090528-202044'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59323',
internalId:  '',
customField: '20100123-152159'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INESRA';
var companyName   = 'BTMS+Technology+Systems+';
var htmlTitle	  = 'BTMS+Technology+Systems+-+Memphis+Video+Surveillance+Installers';
var metaKeywords  = 'memphis+surveillance+installers%2C+security+systems+sellers%2C+video+surveillance+equipment%2C+security+cameras%2C+digital+video+recorders%2C+computer+repair%2C+Memphis%2C+mid-south+company%2C+commercial+property+protection%2C+tennessee+surveillance+company%2C+arkansas+surveillance+company%2C+mississippi+surveillance+system+company';
var metaContents  = 'BTMS+Technology+Systems-Memphis+commercial+video+surveillance+and+computer+system+sales%2C+installation+and+repair+company+servicing+Alabama%2C+Arkansas%2C+Mississippi%2C+Tennessee.+';
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();
};
