/* [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','5301',jdecode('Home'),jdecode(''), jdecode('%2F5301.html'), 'true',[],'',''],
	['PAGE','43001',jdecode('Our+Members'),jdecode(''), jdecode('%2F43001%2Findex.html'), 'true',[ 
		['PAGE','67801',jdecode('Board+of+Governors'),jdecode(''), jdecode('%2F43001%2F67801.html'), 'true',[],'',''],
		['PAGE','5394',jdecode('Active+Members'),jdecode(''), jdecode('%2F43001%2F5394.html'), 'true',[],'',''],
		['PAGE','67822',jdecode('Resident+Members'),jdecode(''), jdecode('%2F43001%2F67822.html'), 'true',[],'',''],
		['PAGE','67843',jdecode('Retired+Members'),jdecode(''), jdecode('%2F43001%2F67843.html'), 'true',[],'','']
	],'',''],
	['PAGE','75001',jdecode('Communications'),jdecode(''), jdecode('%2F75001%2Findex.html'), 'true',[ 
		['PAGE','76101',jdecode('The+Directory'),jdecode(''), jdecode('%2F75001%2F76101.html'), 'true',[],'',''],
		['PAGE','75022',jdecode('The+Bulletin'),jdecode(''), jdecode('%2F75001%2F75022.html'), 'true',[],'',''],
		['PAGE','73701',jdecode('News+Break'),jdecode(''), jdecode('%2F75001%2F73701.html'), 'true',[],'','']
	],'',''],
	['PAGE','5457',jdecode('Join'),jdecode(''), jdecode('%2F5457.html'), 'true',[],'',''],
	['PAGE','71101',jdecode('Contact+Us'),jdecode(''), jdecode('%2F71101.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='FFD375';
theSitetree.keyvisualId='1989';
theSitetree.keyvisualName='stetoskop.jpg';
theSitetree.fontsetId='328';
theSitetree.graphicsetId='385';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stylus',
				paletteFamily: 	'FFD375',
				keyvisualId: 	'1989',
				keyvisualName: 	'stetoskop.jpg',
				fontsetId: 		'328',
				graphicsetId: 	'385',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFD375',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20090326-094955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5394',
internalId:  '',
customField: '20110811-194744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67801',
internalId:  '',
customField: '20110106-125902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5457',
internalId:  '',
customField: '20101008-155400'
};
webappMappings['7008']=webappMappings['7008-12370']={
webappId:    '7008',
documentId:  '71101',
internalId:  '12370',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43001',
internalId:  '',
customField: '20110727-184429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67822',
internalId:  '',
customField: '20101008-161717'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67843',
internalId:  '',
customField: '20110420-193037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73701',
internalId:  '',
customField: '20111221-162526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75001',
internalId:  '',
customField: '20090324-152928'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75022',
internalId:  '',
customField: '20111128-175247'
};
webappMappings['7008']=webappMappings['7008-12369']={
webappId:    '7008',
documentId:  '5457',
internalId:  '12369',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71101',
internalId:  '',
customField: '20090111-175507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '76101',
internalId:  '',
customField: '20101008-155124'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN2IZ9';
var companyName   = 'Merced-Mariposa+County+Medical+Society';
var htmlTitle	  = '';
var metaKeywords  = 'Merced%2C+Mariposa%2C+County%2C+Merced-Mariposa%2C+Medical%2C+Society%2C+Medical+Society%2C+Merced-Mariposa+County+Medical+Society%2C+Physicians%2C+Doctors%2C+Doctor+Look-up%2C+Doctor+Information%2C+Physician+Information%2C+Physician+Look-up%2C+Physician+Resources%2C+Doctor+Resources%2C+Healthcare';
var metaContents  = 'Merced-Mariposa+County+Medical+Society+-+A+professional+organization+of+physicians+-+2848+Park+Avenue%2C+Suite+C%2C+Merced%2C+CA++95348';
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();
};

