/* [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','5201',jdecode('Home'),jdecode(''),'/5201.html','true',[],'',''],
	['PAGE','5273',jdecode('Special+Promotions+%21'),jdecode(''),'/5273/index.html','true',[ 
		['PAGE','5294',jdecode('Hardwired+Home+%2F+Business+Systems'),jdecode(''),'/5273/5294.html','true',[],'',''],
		['PAGE','5336',jdecode('Wireless+Home+%2F+Business+Systems'),jdecode(''),'/5273/5336.html','true',[],'',''],
		['PAGE','5315',jdecode('Camera+Systems'),jdecode(''),'/5273/5315.html','true',[],'',''],
		['PAGE','5357',jdecode('Fire+Alarm+Systems'),jdecode(''),'/5273/5357.html','true',[],'',''],
		['PAGE','5378',jdecode('Access+Control+Systems'),jdecode(''),'/5273/5378.html','true',[],'',''],
		['PAGE','5399',jdecode('Medical+Alert+Systems'),jdecode(''),'/5273/5399.html','true',[],'',''],
		['PAGE','5420',jdecode('Wireless+Systems'),jdecode(''),'/5273/5420.html','true',[],'',''],
		['PAGE','5441',jdecode('Biometric+sensors'),jdecode(''),'/5273/5441.html','true',[],'',''],
		['PAGE','5462',jdecode('Solar+Powered+Systems'),jdecode(''),'/5273/5462.html','true',[],'',''],
		['PAGE','5483',jdecode('Mobile+Phone+Viewing'),jdecode(''),'/5273/5483.html','true',[],'',''],
		['PAGE','5504',jdecode('Remote+control+of+your+system'),jdecode(''),'/5273/5504.html','true',[],'','']
	],'',''],
	['PAGE','5525',jdecode('Service'),jdecode(''),'/5525/index.html','true',[ 
		['PAGE','5546',jdecode('Monitoring'),jdecode(''),'/5525/5546.html','true',[],'',''],
		['PAGE','5567',jdecode('Consulting'),jdecode(''),'/5525/5567.html','true',[],'',''],
		['PAGE','5588',jdecode('Planning'),jdecode(''),'/5525/5588.html','true',[],'',''],
		['PAGE','5609',jdecode('Maintenance'),jdecode(''),'/5525/5609.html','true',[],'','']
	],'',''],
	['PAGE','5630',jdecode('Tips+and+tricks'),jdecode(''),'/5630.html','true',[],'',''],
	['PAGE','5252',jdecode('How+to+find+us'),jdecode(''),'/5252.html','true',[],'',''],
	['PAGE','5672',jdecode('About+us'),jdecode(''),'/5672/index.html','true',[ 
		['PAGE','5693',jdecode('Our+team'),jdecode(''),'/5672/5693.html','false',[],'','']
	],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Amaze';
theSitetree.paletteFamily='0A2447';
theSitetree.keyvisualId='2416';
theSitetree.keyvisualName='digital.jpg';
theSitetree.fontsetId='397';
theSitetree.graphicsetId='444';
theSitetree.contentColor='AAFF00';
theSitetree.contentBGColor='0A2447';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Amaze',
				paletteFamily: 	'0A2447',
				keyvisualId: 	'2416',
				keyvisualName: 	'digital.jpg',
				fontsetId: 		'397',
				graphicsetId: 	'444',
				contentColor: 	'AAFF00',
				contentBGColor: '0A2447',
				a_color: 		'0A2447',
				b_color: 		'081B35',
				c_color: 		'3268E2',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20091215-150048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5252',
internalId:  '',
customField: '20091008-171304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5273',
internalId:  '',
customField: '20091116-224326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5672',
internalId:  '',
customField: '20091215-141136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5693',
internalId:  '',
customField: '20091008-170824'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5201',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-6036107']={
webappId:    '1501',
documentId:  '5201',
internalId:  '6036107',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5294',
internalId:  '',
customField: '20091116-214659'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5315',
internalId:  '',
customField: '20091116-222558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5336',
internalId:  '',
customField: '20091116-222857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5357',
internalId:  '',
customField: '20091215-141653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5378',
internalId:  '',
customField: '20091215-142142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5399',
internalId:  '',
customField: '20091008-170824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5420',
internalId:  '',
customField: '20091215-143555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5441',
internalId:  '',
customField: '20091215-143903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5462',
internalId:  '',
customField: '20091215-144236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5483',
internalId:  '',
customField: '20091215-144449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5504',
internalId:  '',
customField: '20091215-144807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5525',
internalId:  '',
customField: '20091215-135542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5546',
internalId:  '',
customField: '20091215-135040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5567',
internalId:  '',
customField: '20091215-133246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5588',
internalId:  '',
customField: '20091215-133900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5609',
internalId:  '',
customField: '20091215-134350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5630',
internalId:  '',
customField: '20091215-140229'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INL38L';
var companyName   = 'SIERRA+SECURITY';
var htmlTitle	  = 'Sierra+Security+home';
var metaKeywords  = 'St.+George%2C+Utah%2C+Security+systems%2C+Fire+alarms%2C+Burglar+alarms%2C+Cameras%2C+CCTV%2C+Video%2C+Alarms%2C+protection%2C+siren%2C+police%2C+smoke+detector%2C+motion+detector%2C+wireless%2C+keypad%2C+cell+phone%2C+PDA%2C+medical%2C+PERS%2C+elderly+care%2C+supervision%2C+safety';
var metaContents  = 'Security+systems+service+and+installations+CCTV+camera+systems+service+and+installations+Fire+Alarm+systems+service+and+installations+Access+control+systems+service+and+installations';
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();
};

