/* [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','9301',jdecode('Home'),jdecode(''), jdecode('%2F9301.html'), 'true',[],'',''],
	['PAGE','28901',jdecode('Staff'),jdecode(''), jdecode('%2F28901%2Findex.html'), 'true',[ 
		['PAGE','28922',jdecode('Officers'),jdecode(''), jdecode('%2F28901%2F28922.html'), 'true',[],'',''],
		['PAGE','28943',jdecode('Employees'),jdecode(''), jdecode('%2F28901%2F28943.html'), 'true',[],'',''],
		['PAGE','28964',jdecode('Join'),jdecode(''), jdecode('%2F28901%2F28964.html'), 'true',[],'','']
	],'',''],
	['PAGE','28801',jdecode('Meeting+%2F+Training'),jdecode(''), jdecode('%2F28801.html'), 'true',[],'',''],
	['PAGE','13622',jdecode('Contact'),jdecode(''), jdecode('%2F13622.html'), 'true',[],'',''],
	['PAGE','40201',jdecode('HIPAA'),jdecode(''), jdecode('%2F40201.html'), 'true',[],'',''],
	['PAGE','28985',jdecode('Schedule'),jdecode(''), jdecode('%2F28985%2Findex.html'), 'true',[ 
		['PAGE','29006',jdecode('Day+Shift'),jdecode(''), jdecode('%2F28985%2F29006.html'), 'true',[],'',''],
		['PAGE','29027',jdecode('Night+Shift'),jdecode(''), jdecode('%2F28985%2F29027.html'), 'true',[],'','']
	],'',''],
	['PAGE','37901',jdecode('Public+Awareness'),jdecode(''), jdecode('%2F37901.html'), 'true',[],'',''],
	['PAGE','37922',jdecode('Photos'),jdecode(''), jdecode('%2F37922.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Welcome';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='9178';
theSitetree.keyvisualName='kv_9178.jpg';
theSitetree.fontsetId='10364';
theSitetree.graphicsetId='10524';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='AC0A16';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'gate',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Welcome',
				paletteFamily: 	'990000',
				keyvisualId: 	'9178',
				keyvisualName: 	'kv_9178.jpg',
				fontsetId: 		'10364',
				graphicsetId: 	'10524',
				contentColor: 	'FFFFFF',
				contentBGColor: 'AC0A16',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D6AAAA',
				e_color: 		'DC6C70',
				f_color: 		'68070E',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9301',
internalId:  '',
customField: '20120201-115226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13622',
internalId:  '',
customField: '20120117-135047'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28943',
internalId:  '',
customField: '20120117-211904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28801',
internalId:  '',
customField: '20120201-112821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28964',
internalId:  '',
customField: '20120117-145446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28922',
internalId:  '',
customField: '20120117-155453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28901',
internalId:  '',
customField: '20120117-205734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28985',
internalId:  '',
customField: '20120117-151743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29006',
internalId:  '',
customField: '20120118-113059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29027',
internalId:  '',
customField: '20120118-113504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37922',
internalId:  '',
customField: '20120201-133859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37901',
internalId:  '',
customField: '20120201-124041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40201',
internalId:  '',
customField: '20120202-083044'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INFBGE';
var companyName   = 'Berlin+Inter+Community+Ambulance+Assoc.';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};

