/* [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','4822',jdecode('Home+Page'),jdecode(''), jdecode('%2F4822.html'), 'true',[],'',''],
	['PAGE','15601',jdecode('About+MMCS+Clinic'),jdecode(''), jdecode('%2F15601.html'), 'true',[],'',''],
	['PAGE','19222',jdecode('Career+Opportunities'),jdecode(''), jdecode('%2F19222.html'), 'true',[],'',''],
	['PAGE','51501',jdecode('Qualifying+Conditions'),jdecode(''), jdecode('%2F51501.html'), 'true',[],'',''],
	['PAGE','22401',jdecode('Setting+an+Appointment'),jdecode(''), jdecode('%2F22401%2Findex.html'), 'true',[ 
		['PAGE','53601',jdecode('Appointment+Prices'),jdecode(''), jdecode('%2F22401%2F53601.html'), 'true',[],'','']
	],'',''],
	['PAGE','23401',jdecode('Medical+Records+Form'),jdecode(''), jdecode('%2F23401%2Findex.html'), 'true',[ 
		['PAGE','19201',jdecode('Notice+of+Privacy+Practices'),jdecode(''), jdecode('%2F23401%2F19201.html'), 'true',[],'',''],
		['PAGE','20301',jdecode('HIPAA'),jdecode(''), jdecode('%2F23401%2F20301.html'), 'true',[],'','']
	],'',''],
	['PAGE','52401',jdecode('Answers+to+FAQ%26%23x27%3Bs'),jdecode(''), jdecode('%2F52401%2Findex.html'), 'true',[ 
		['PAGE','52601',jdecode('OMMP+Basic+Facts'),jdecode(''), jdecode('%2F52401%2F52601.html'), 'true',[],'','']
	],'',''],
	['PAGE','120710',jdecode('WEED'),jdecode(''), jdecode('%2F120710.html'), 'true',[],'',''],
	['PAGE','117110',jdecode('MedMar'),jdecode(''), jdecode('%2F117110.html'), 'true',[],'',''],
	['PAGE','19306',jdecode('Ways+to+Give'),jdecode(''), jdecode('%2F19306.html'), 'true',[],'',''],
	['PAGE','19601',jdecode('How+to+Find+Us'),jdecode(''), jdecode('%2F19601.html'), 'true',[],'',''],
	['PAGE','4801',jdecode('Contact+Us'),jdecode(''), jdecode('%2F4801.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Padma';
theSitetree.paletteFamily='999999';
theSitetree.keyvisualId='1062';
theSitetree.keyvisualName='aerzteteam.jpg';
theSitetree.fontsetId='178';
theSitetree.graphicsetId='212';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='666666';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC21T'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Padma',
				paletteFamily: 	'999999',
				keyvisualId: 	'1062',
				keyvisualName: 	'aerzteteam.jpg',
				fontsetId: 		'178',
				graphicsetId: 	'212',
				contentColor: 	'000000',
				contentBGColor: '666666',
				a_color: 		'999999',
				b_color: 		'000000',
				c_color: 		'000000',
				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:  '4822',
internalId:  '',
customField: '20110729-184320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20110130-183451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20110130-180433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20110130-182536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19601',
internalId:  '',
customField: '20110130-183413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20301',
internalId:  '',
customField: '20110130-182640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117110',
internalId:  '',
customField: '20110130-183204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19222',
internalId:  '',
customField: '20110130-180524'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '19601',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20110130-182442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19306',
internalId:  '',
customField: '20110130-183241'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22401',
internalId:  '',
customField: '20110729-183655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51501',
internalId:  '',
customField: '20110130-180739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52601',
internalId:  '',
customField: '20110130-183014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52401',
internalId:  '',
customField: '20110130-182839'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53601',
internalId:  '',
customField: '20110130-181108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '120710',
internalId:  '',
customField: '20110130-190406'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN330INZTJR';
var companyName   = 'Medical+Marijuana+Card+Services+Clinic+-+OPEN+7+DAYS';
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();
};

